From b10751460d5f6303d9def6e4eba19dc5cfe5df89 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Thu, 9 May 2013 15:28:32 -0400 Subject: [PATCH] Signed-off-by: StevenRS11 --- .../blocks/BlockDimWallPerm.java | 5 +++-- StevenDimDoors/mod_pocketDim/dimHelper.java | 19 ++++++++++------- .../items/itemLinkSignature.java | 21 +++++++++++++++---- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java index 529c38d5..094340cb 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java @@ -5,6 +5,7 @@ import java.util.Random; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.dimHelper; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -73,9 +74,9 @@ 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; - dimHelper.getWorld(0).getChunkProvider().loadChunk(x >> 4, z >> 4); - int y = dimHelper.getWorld(0).getHeightValue(x, z); + + int y = yCoordHelper.getFirstUncovered(0, x, 63, 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(par1World.provider.dimensionId,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0), diff --git a/StevenDimDoors/mod_pocketDim/dimHelper.java b/StevenDimDoors/mod_pocketDim/dimHelper.java index ad06b4a8..be87faca 100644 --- a/StevenDimDoors/mod_pocketDim/dimHelper.java +++ b/StevenDimDoors/mod_pocketDim/dimHelper.java @@ -274,12 +274,12 @@ public class dimHelper extends DimensionManager if ((entity != null) && (cart != null)) { - if ((entity instanceof EntityPlayerMP)) - { - EntityPlayerMP playerMP = (EntityPlayerMP)entity; - entity.worldObj.updateEntityWithOptionalForce(entity, true); + if ((entity instanceof EntityPlayerMP)) + { + EntityPlayerMP playerMP = (EntityPlayerMP)entity; + entity.worldObj.updateEntityWithOptionalForce(entity, true); - } + } entity.mountEntity(cart); } @@ -351,8 +351,7 @@ public class dimHelper extends DimensionManager if(entity instanceof EntityPlayerMP) { - - + if(world.provider.dimensionId!=linkData.destDimID) { GameRegistry.onPlayerChangedDimension((EntityPlayer)entity); @@ -386,6 +385,12 @@ public class dimHelper extends DimensionManager } + } + + if(entity.worldObj.getBlockId(playerXCoord, playerYCoord-1,playerZCoord )==Block.lavaStill.blockID) + { + entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, mod_pocketDim.blockDimWallID); + } this.generateDoor(world,linkData); diff --git a/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java b/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java index 2bd3b6ea..d3852256 100644 --- a/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java +++ b/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java @@ -89,26 +89,40 @@ public class itemLinkSignature extends Item { offset = 1; } + else if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.ExitDoorID&&par3World.getBlockId(par4, par5+1, par6)==mod_pocketDim.ExitDoorID) { offset = 1; } + else if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.dimDoorID&&par3World.getBlockId(par4, par5-1, par6)==mod_pocketDim.dimDoorID) { offset = 0; } + else if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.ExitDoorID&&par3World.getBlockId(par4, par5-1, par6)==mod_pocketDim.ExitDoorID) { offset = 0; } + int orientation = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; + + for(int count = 0;count<3;count++) + { + if(dimHelper.instance.getLinkDataFromCoords(par4, par5+count, par6,par3World)!=null) + { + orientation = dimHelper.instance.getLinkDataFromCoords(par4, par5+count, par6,par3World).linkOrientation; + } + + } + if(par1ItemStack.getTagCompound()!=null) { if(par1ItemStack.getTagCompound().getBoolean("isCreated")) { // checks to see if the item has a link stored, if so, it creates it - int orientation = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; + dimHelper.instance.createLink(par3World.provider.dimensionId, linkCoords[3], par4, par5+offset, par6, linkCoords[0], linkCoords[1], linkCoords[2],linkCoords[4]); dimHelper.instance.createLink(linkCoords[3], par3World.provider.dimensionId, linkCoords[0], linkCoords[1], linkCoords[2],par4, par5+offset, par6,orientation); @@ -117,7 +131,7 @@ public class itemLinkSignature extends Item --par1ItemStack.stackSize; par2EntityPlayer.sendChatToPlayer("Rift Created"); - par1ItemStack.stackTagCompound=null; + par1ItemStack.stackTagCompound=null; /** else { @@ -125,11 +139,10 @@ public class itemLinkSignature extends Item } **/ - } + } } else { - int orientation = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; //otherwise, it creates the first half of the link. Next click will complete it.