I finally decided to try making a test dimension, I ended up making mountain one, and it looks really epic . I might start adding more stuff to it, then maybe it can become a full mod.
How can i make that monsters spawn daylight in my dimension?
If your dimension consists of a custom biome, you could also just add them to the spawn list of that biome. If you mean you want to make night-spawning monsters spawn in daylight, I suppose you could try to add them to the spawnableCreatureList as opposed to the spawnableMonsterList.
can you use the jungle biome in your dimension because i was searching for the name and has no name like forest or hills just something like field_x4412x5135 blalbla .
How to use it ?
Currently the normal jungle biome would be BiomeGenBase.field_48416_w, and the hilly jungle would be BiomeGenBase.field_48417_x. They will probably be renamed at some point by MCP.
I think I might add the ability to override RenderGlobal completely per dimension, which would clear out all those random rendering-related hooks while also giving modders a massive amount of flexibility. I'll add it in the next update (before 1.3) if it tests well and if I don't find any serious issues with doing this.
can you still change the skycolor ? with the latest version
Thanks !
VirtualArts
Yes, unless it's bugged out for some reason. It would be better and easier to change the sky color in your biome's file, though. The sky color hook in WorldProviderBase was added just in case someone wanted to override the sky color of an overworld biome in a custom dimension.
- Added an extremely easy way to register a modified (differently-colored) Nether portal texture.
- Added support for custom portal overlays; now your portal texture (or actually any block's texture) can be displayed when the player is about to teleport instead of the Nether portal's texture.
- Added a hook that is called every time an item is used or a block is placed, to allow modders access to these events (for portal activation and such) by implementing the IItemUse interface.
Looks like there is no point to me developing QuinAPI anymore, since you've added all it's features into this API.
Added the link. What do you mean by darker? You can change the celestial angle so that it's always night or dusk, or you could change the light calculations in generateLightBrightnessTable to make it inherently dark. Both of those methods would go in your WorldProvider.
i think its a problem with modloader register block method, blocks were increased to 4096 and modloader still has some 256 stuff in the method, can u try make ur own register block, could work, ill try and send sources to u via pm
Regarding the terrain-gen-with-a-custom-block-causes-crash bug: It is not caused by ModLoader; it is a bug within the game. It actually has nothing to do with custom blocks, but blocks whose IDs exceed the number 128 (and virtually all the IDs up to that point are taken). I tried turning all the bytes in ChunkProviderGenerate into ints in an attempt to solve this, but, while the game didn't crash, no terrain generated either. I'm still working on it, though.
I tried all but i stuck at the Lightnessbrighttable can someone help me with this?
EDIT : How can i add more than 1 biome ?
For the lighting, just play around with the numbers until you find something right. For the biomes, you need to make a new WorldChunkManager if you already haven't and then make several custom GenLayer classes. Looking at the existing code for it would probably help the most.
I get this error java.lang.NullPointerException at net.minecraft.src.MC_GenLayerBiome.getInts(MC_GenLayerBiome.java:48)
Here is line 48:
ai1[j + i * par3] = allowedBiomes[nextInt(allowedBiomes.length)].biomeID;
What the heck is wrong?
Also How to you change the sky color? It flickers when I change it
Apparently one of the biomes you've listed is null somehow; I would need to see more to figure it out. I recommend changing the sky color in your biome's file, not your WorldProvider, since it's simpler that way. I only included the sky color hook on the small chance it was needed in a way that the biome sky color couldn't fulfill.
I have fixed the block bug in ExtendedBlockStorage.java; now let's see if I can fix it in a ChunkProvider. (It was indeed a bug in the game itself.)
For the lighting, just play around with the numbers until you find something right. For the biomes, you need to make a new WorldChunkManager if you already haven't and then make several custom GenLayer classes. Looking at the existing code for it would probably help the most.
Apparently one of the biomes you've listed is null somehow; I would need to see more to figure it out. I recommend changing the sky color in your biome's file, not your WorldProvider, since it's simpler that way. I only included the sky color hook on the small chance it was needed in a way that the biome sky color couldn't fulfill.
Really? You did?
yeah u fixed it, now forge gonna look at ur sources!a nullpointerexception doesnt mean that u used a null, its something else causing the problem and is very hard to figure out where exactly
You have to make your dimension's equivalent of the base GenLayer and several other GenLayers, then replace or eliminate some of the arguments where necessary. You can't just have a single GenLayer for biomes; you need a base (which you would reference in your WorldChunkManager) and possibly several others.
public boolean getCanSpawnHere()
{
if (worldObj.getWorldInfo().getDimension() == whateverYourDimensionsNumbeIs)
{
return true;
}
}
in your entity file
I'm glad you decided to make a dimension.
If your dimension consists of a custom biome, you could also just add them to the spawn list of that biome. If you mean you want to make night-spawning monsters spawn in daylight, I suppose you could try to add them to the spawnableCreatureList as opposed to the spawnableMonsterList.
Currently the normal jungle biome would be BiomeGenBase.field_48416_w, and the hilly jungle would be BiomeGenBase.field_48417_x. They will probably be renamed at some point by MCP.
Yes, unless it's bugged out for some reason. It would be better and easier to change the sky color in your biome's file, though. The sky color hook in WorldProviderBase was added just in case someone wanted to override the sky color of an overworld biome in a custom dimension.
Looks like there is no point to me developing QuinAPI anymore, since you've added all it's features into this API.
Just inherit WorldChunkManager, and add a new set of GenLayers for the biomes.
Added the link. What do you mean by darker? You can change the celestial angle so that it's always night or dusk, or you could change the light calculations in generateLightBrightnessTable to make it inherently dark. Both of those methods would go in your WorldProvider.
I know, I know, hehe.
I have? Oh, sorry... they were all either requested by other modders, something I needed, or something obvious I had planned from the start.
When I use an item as a portal it ends up creating a nether portal upon arriving in my dimension, how to I make it not generate a portal?Haha nevermind got it XD... I love your API by the way, will be a great way to expand my mod
Download the sources for the sample dimension if you want to learn; they're better than any tutorial I could give.
java.lang.NullPointerException
at net.minecraft.src.MC_GenLayerBiome.getInts(MC_GenLayerBiome.java:48)
Here is line 48:
What the heck is wrong?
Also How to you change the sky color?
It flickers when I change it
For the lighting, just play around with the numbers until you find something right. For the biomes, you need to make a new WorldChunkManager if you already haven't and then make several custom GenLayer classes. Looking at the existing code for it would probably help the most.
Apparently one of the biomes you've listed is null somehow; I would need to see more to figure it out. I recommend changing the sky color in your biome's file, not your WorldProvider, since it's simpler that way. I only included the sky color hook on the small chance it was needed in a way that the biome sky color couldn't fulfill.
Really? You did?
yeah u fixed it, now forge gonna look at ur sources!a nullpointerexception doesnt mean that u used a null, its something else causing the problem and is very hard to figure out where exactly
I haven't uploaded the fix or anything yet, since I wanted to see if I could fix it without editing a class.
Well yeah, obviously, but that's about all I could say when given such little information.
Anyway:
---Temporary fix for block error---
Add this to line 49 of ExtendedBlockStorage.java:
Use this until I look at the problem further. (I know, tiny fix for huge bug. :D)
You need to create a new set of GenLayers:
You might have to copy pretty much all the code from WorldChunkManager for it to work.
You have to make your dimension's equivalent of the base GenLayer and several other GenLayers, then replace or eliminate some of the arguments where necessary. You can't just have a single GenLayer for biomes; you need a base (which you would reference in your WorldChunkManager) and possibly several others.
Thanks for the link! I will add it.
I think it should be like this
Or like this
By the way, this api is awesome, I tried the modloader version and it worked great!
Here's the error:
src\minecraft\net\minecraft\src\DimensionAPI.java:138: error: '(' or '[' expected
World var10000 = new World;
^
- src\minecraft\net\minecraft\src\DimensionAPI.java:140: error: <identifier> expected
var10000.<init>(var1.theWorld, WorldProvider.getProviderForDimension(var5));
^
19:05:04 - 2 errors
And here's the file:
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.client.Minecraft;
public class DimensionAPI
{
public static int timeInPortal = 0;
public static HashMap dimensionMap = new HashMap();
public static HashMap interceptMap = new HashMap();
public static void registerDimension(WorldProviderBase var0)
{
int var1 = var0.getDimensionID();
dimensionMap.put(var0, Integer.valueOf(var1));
}
public static void setInPortal(WorldProviderBase var0, Minecraft var1, Entity var2, ISpecialTeleportation var3, BlockPortalBase var4)
{
EntityPlayerSP var5 = (EntityPlayerSP)var2;
int var6 = var5.dimension;
if (var4 != null && !isInPortal(var5, var4.blockID))
{
timeInPortal = 0;
}
else
{
if (var3.canTeleportFromDimension().contains(Integer.valueOf(var6)) || var6 == var0.getDimensionID())
{
if (var3.isPortalImmediate())
{
usePortal(var0, var1, var5, var3);
}
else
{
++timeInPortal;
if (timeInPortal == var3.getPortalDelay() && var5.timeUntilPortal <= 0)
{
timeInPortal = 0;
var5.timeUntilPortal = 10;
usePortal(var0, var1, var5, var3);
}
}
}
}
}
public static boolean isInPortal(EntityPlayerSP var0, int var1)
{
int var2 = (int)Math.floor(var0.posX);
int var3 = (int)Math.floor(var0.posY);
int var4 = (int)Math.floor(var0.posZ);
return var0.worldObj.getBlockId(var2, var3, var4) == var1 || var0.worldObj.getBlockId(var2, var3 - 1, var4) == var1;
}
public static void usePortal(WorldProviderBase var0, Minecraft var1, EntityPlayerSP var2, ISpecialTeleportation var3)
{
int var4 = var2.dimension;
if (var2.dimension != var0.getDimensionID())
{
teleportToDimension(var0, var1, var2, var3);
}
else if (var2.dimension == var0.getDimensionID())
{
teleportFromDimension(var0, var1, var2, var3, false, 0);
}
}
public static void teleportToDimension(WorldProviderBase var0, Minecraft var1, EntityPlayerSP var2, ISpecialTeleportation var3)
{
var1.theWorld.setEntityDead(var2);
var2.isDead = false;
double var4 = 1.0D / var3.getDistanceRatio();
double var6 = var2.posX;
double var8 = var2.posZ;
var6 *= var4;
var8 *= var4;
var2.setLocationAndAngles(var6, var2.posY, var8, var2.rotationYaw, var2.rotationPitch);
if (var2.isEntityAlive())
{
var1.theWorld.updateEntityWithOptionalForce(var2, false);
}
World var10 = null;
var10 = new World(var1.theWorld, var0);
String var11 = var3.getEnteringMessage();
var1.changeWorld(var10, var11, var2);
var2.dimension = var0.getDimensionID();
var2.worldObj = var1.theWorld;
if (var2.isEntityAlive())
{
var2.setLocationAndAngles(var2.posX, var2.posY, var2.posZ, var2.rotationYaw, var2.rotationPitch);
var1.theWorld.updateEntityWithOptionalForce(var2, false);
var3.getTeleporter().placeInPortal(var1.theWorld, var2);
}
if (var3.triggerAchievement() != null)
{
var2.addStat(var3.triggerAchievement(), 1);
}
}
public static void teleportFromDimension(WorldProviderBase var0, Minecraft var1, EntityPlayerSP var2, ISpecialTeleportation var3, boolean var4, int var5)
{
if (!var4)
{
var5 = var3.returnsPlayerToDimension();
}
var1.theWorld.setEntityDead(var2);
var2.isDead = false;
double var6 = 1.0D;
if (!var4)
{
var6 = var3.getDistanceRatio();
}
double var8 = var2.posX;
double var10 = var2.posZ;
var8 *= var6;
var10 *= var6;
var2.setLocationAndAngles(var8, var2.posY, var10, var2.rotationYaw, var2.rotationPitch);
if (var2.isEntityAlive())
{
var1.theWorld.updateEntityWithOptionalForce(var2, false);
}
World var12 = null;
World var10000 = new World;
WorldProvider var10003 = var1.theWorld.worldProvider;
var10000.<init>(var1.theWorld, WorldProvider.getProviderForDimension(var5));
var12 = var10000;
String var13 = "Respawning";
if (!var4)
{
var13 = var3.getLeavingMessage();
}
else
{
var13 = var0.getRespawnMessage();
}
var1.changeWorld(var12, var13, var2);
var2.dimension = var5;
var2.worldObj = var1.theWorld;
if (var2.isEntityAlive() && !var4)
{
var2.setLocationAndAngles(var2.posX, var2.posY, var2.posZ, var2.rotationYaw, var2.rotationPitch);
var1.theWorld.updateEntityWithOptionalForce(var2, false);
var3.getTeleporter().placeInPortal(var1.theWorld, var2);
}
}
public static Object getKeyFromValue(Map var0, Object var1)
{
Iterator var2 = var0.keySet().iterator();
Object var3;
do
{
if (!var2.hasNext())
{
return null;
}
var3 = var2.next();
}
while (!var0.get(var3).equals(var1));
return var3;
}
public static WorldProvider getProviderByDimension(int var0)
{
WorldProvider var1 = (WorldProvider)getKeyFromValue(dimensionMap, new Integer(var0));
return var1;
}
public static void respawnPlayer(Minecraft var0)
{
WorldProviderBase var1 = (WorldProviderBase)var0.theWorld.worldProvider;
int var2 = var1.respawnInDimension();
teleportFromDimension(var1, var0, var0.thePlayer, (ISpecialTeleportation)null, true, var2);
var0.respawn(false, var2, false);
}
public static void registerPortalTexture(Block var0, float var1, float var2, float var3, float var4)
{
ModLoader.getMinecraftInstance().renderEngine.registerTextureFX(new TextureCustomPortalFX(var0.blockIndexInTexture, var1, var2, var3, var4));
}
public static void addItemUseIntercept(int var0, IItemUse var1)
{
interceptMap.put(Integer.valueOf(var0), var1);
}
}
If you could lend some advise on how to fix it, I would appreciate it. Thanks.