Fixed mob spawning issues (maybe) and limbo exit issues.

Signed-off-by: StevenRS11 <stevenrs11@aol.com>
This commit is contained in:
StevenRS11
2013-03-28 21:34:38 -04:00
parent 508e2f3b4d
commit 8ccabfc16e
7 changed files with 81 additions and 25 deletions

View File

@@ -51,11 +51,15 @@ public class BlockDimWallPerm extends Block
link =new LinkData(0,0,0,0);
}
if(dimHelper.getWorld(link.destDimID)!=null)
if(dimHelper.getWorld(0)==null)
{
World world = dimHelper.getWorld(0);
dimHelper.initDimension(0);
}
if(dimHelper.getWorld(0)!=null)
{
int x = (link.destXCoord + rand.nextInt(mod_pocketDim.limboExitRange)-mod_pocketDim.limboExitRange/2);
int z = (link.destZCoord + rand.nextInt(mod_pocketDim.limboExitRange)-mod_pocketDim.limboExitRange/2);
@@ -63,20 +67,56 @@ public class BlockDimWallPerm extends Block
x=x+(x>> 4)+1; //make sure I am in the middle of a chunk, andnot on a boundry, so it doesnt load the chunk next to me
z=z+(z>> 4)+1;
world.getChunkProvider().loadChunk(x >> 4, z >> 4);
dimHelper.getWorld(0).getChunkProvider().loadChunk(x >> 4, z >> 4);
int y = world.getHeightValue(x, z);
int y = dimHelper.getWorld(0).getHeightValue(x, z);
//this complicated chunk teleports the player back to the overworld at some random location. Looks funky becaue it has to load the chunk
dimHelper.instance.teleportToPocket(par1World,
new LinkData(0,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket),
dimHelper.instance.teleportToPocket(par1World, new LinkData(par1World.provider.dimensionId,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket),
EntityPlayer.class.cast(par5Entity));
EntityPlayer.class.cast(par5Entity).setPositionAndUpdate( x, y, z );
//makes sure they can breath when they teleport
world.setBlockWithNotify(x, y, z, 0);
dimHelper.getWorld(0).setBlockWithNotify(x, y, z, 0);
int i=x;
int j=y-1;
int k=z;
for(int xc=-3;xc<4;xc++)
{
for(int zc=-3;zc<4;zc++)
{
for(int yc=0;yc<200;yc++)
{
if(yc==0&&dimHelper.getWorld(0).isBlockOpaqueCube(i+xc, j-2,k +zc))
{
if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+2)
{
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, mod_pocketDim.blockLimboID);
}
else if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+3)
{
dimHelper.getWorld(0).setBlockAndMetadata(i+xc, j-1+yc, k+zc, mod_pocketDim.blockLimboID,2);
}
}
}
}
}
{
}
}
}