Fixed mob spawning issues (maybe) and limbo exit issues.
Signed-off-by: StevenRS11 <stevenrs11@aol.com>
This commit is contained in:
parent
508e2f3b4d
commit
8ccabfc16e
7 changed files with 81 additions and 25 deletions
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,12 +49,15 @@ public class EventHookContainer
|
|||
|
||||
if(!mod_pocketDim.hasInitDims&&event.world.provider.dimensionId==0&&!event.world.isRemote)
|
||||
{
|
||||
System.out.println("Registering Pocket Dims");
|
||||
mod_pocketDim.hasInitDims=true;
|
||||
dimHelper.instance.unregsisterDims();
|
||||
dimHelper.dimList.clear();
|
||||
dimHelper.instance.interDimLinkList.clear();
|
||||
dimHelper.instance.linksForRendering.clear();
|
||||
|
||||
dimHelper.instance.initPockets();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class PlayerRespawnTracker implements IPlayerTracker
|
|||
for(EntityItem drop : mod_pocketDim.limboSpawnInventory)
|
||||
{
|
||||
|
||||
// player.inventory.addItemStackToInventory(drop.getEntityItem());
|
||||
player.inventory.addItemStackToInventory(drop.getEntityItem());
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -848,13 +848,17 @@ public class SchematicLoader
|
|||
if(world.getBlockId(point.getX(), point.getY(), point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())==Block.sandStone.blockID)
|
||||
{
|
||||
|
||||
World exitWorld = dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID);
|
||||
|
||||
if(dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID)==null)
|
||||
{
|
||||
dimHelper.initDimension((dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID));
|
||||
}
|
||||
|
||||
|
||||
|
||||
exitWorld.getChunkProvider().loadChunk(point.getX() >> 4, point.getZ() >> 4);
|
||||
dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID).getChunkProvider().loadChunk(point.getX() >> 4, point.getZ() >> 4);
|
||||
|
||||
LinkData sideLink = new LinkData(link.destDimID,dimHelper.dimList.get(link.locDimID).exitDimLink.destDimID,point.getX(), point.getY(), point.getZ(),point.getX(), exitWorld.getHeightValue(point.getX(), point.getZ())+1, point.getZ(),true);
|
||||
LinkData sideLink = new LinkData(link.destDimID,dimHelper.dimList.get(link.locDimID).exitDimLink.destDimID,point.getX(), point.getY(), point.getZ(),point.getX(), dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID).getHeightValue(point.getX(), point.getZ())+1, point.getZ(),true);
|
||||
sideLink.linkOrientation=world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ());
|
||||
dimHelper.instance.createLink(sideLink);
|
||||
dimHelper.instance.createLink(sideLink.destDimID , sideLink.locDimID, sideLink.destXCoord, sideLink.destYCoord, sideLink.destZCoord, sideLink.locXCoord, sideLink.locYCoord, sideLink.locZCoord, dimHelper.instance.flipDoorMetadata(sideLink.linkOrientation));
|
||||
|
|
|
@ -65,7 +65,7 @@ public class TransientDoor extends ExitDoor
|
|||
if(dimHelper.dimList.containsKey(linkData.destDimID))
|
||||
{
|
||||
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
|
||||
par1World.setBlockWithNotify(par2, par3, par4, 0);
|
||||
par1World.setBlockWithNotify(par2, par3-1, par4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public class dimDoor extends BlockContainer
|
|||
|
||||
|
||||
|
||||
|
||||
System.out.println(linkData.destDimID);
|
||||
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
|
||||
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class dimDoor extends BlockContainer
|
|||
else if (!(par5Entity instanceof EntityPlayer)&&num>3)
|
||||
{
|
||||
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
|
||||
|
||||
|
||||
|
||||
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
|
||||
}
|
||||
|
|
|
@ -355,14 +355,10 @@ public class dimHelper extends DimensionManager
|
|||
int y=linkData.destYCoord;
|
||||
int z=linkData.destZCoord;
|
||||
|
||||
if(linkData.destDimID==mod_pocketDim.limboDimID&&entity instanceof EntityPlayerMP)
|
||||
{
|
||||
this.teleportToLimbo(world, linkData, EntityPlayerMP.class.cast(entity));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int depth= this.getDimDepth(world.provider.dimensionId);
|
||||
|
||||
|
||||
if(this.dimList.containsKey(destinationID))
|
||||
{
|
||||
this.generatePocket(linkData);
|
||||
|
@ -371,7 +367,7 @@ public class dimHelper extends DimensionManager
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -474,6 +470,11 @@ public class dimHelper extends DimensionManager
|
|||
this.dimList.put(link.locDimID, locationDimData);
|
||||
link.isLocPocket=false;
|
||||
|
||||
}
|
||||
if(!dimList.containsKey(link.destDimID))
|
||||
{
|
||||
dimHelper.dimList.put(link.destDimID, new DimData(link.destDimID, false, 0, link.locDimID,link.locXCoord,link.locYCoord,link.locZCoord));
|
||||
|
||||
}
|
||||
|
||||
DimData locationDimData= this.dimList.get(link.locDimID);
|
||||
|
@ -766,8 +767,12 @@ public class dimHelper extends DimensionManager
|
|||
this.load();
|
||||
if(!this.dimList.isEmpty())
|
||||
{
|
||||
|
||||
|
||||
Set allDimIds=dimList.keySet();
|
||||
|
||||
|
||||
|
||||
|
||||
Iterator itr =allDimIds.iterator();
|
||||
while(itr.hasNext())
|
||||
{
|
||||
|
@ -785,6 +790,10 @@ public class dimHelper extends DimensionManager
|
|||
{
|
||||
System.out.println("Warning- could not register dim "+dimData.depth+" . Probably caused by a version update/save data corruption/other mods. ");
|
||||
}
|
||||
else
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue