mirror of
https://github.com/GTNewHorizons/ThaumicHorizons.git
synced 2026-10-25 20:32:28 +00:00
Fix pocket plane keystone binding, portal bugs and world saving (#114)
This commit is contained in:
1 parent
892f8941e2
commit
0a54bd5465
5 files changed
+24
-11
No files matched your search
@@ -117,7 +117,7 @@ public class BlockGatewayPortal extends Block {
|
||||
}
|
||||
}
|
||||
final TileEntity te = world.getTileEntity(slotX, slotY, slotZ);
|
||||
if (te instanceof TileSlot) {
|
||||
if (te instanceof TileSlot && ((TileSlot) te).portalOpen) {
|
||||
((TileSlot) te).destroyPortal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class BlockSlot extends BlockContainer {
|
||||
|
||||
public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int md) {
|
||||
final TileSlot tco = (TileSlot) world.getTileEntity(x, y, z);
|
||||
if (tco == null) return;
|
||||
if (tco.portalOpen) {
|
||||
tco.destroyPortal();
|
||||
}
|
||||
@@ -59,15 +60,20 @@ public class BlockSlot extends BlockContainer {
|
||||
if (tco.portalOpen) {
|
||||
tco.destroyPortal();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
} else if (!tco.portalOpen && player.getHeldItem().getItem() instanceof ItemWandCasting) {
|
||||
tco.makePortal(player);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
} else if (theItem != null && theItem.getItem() == ThaumicHorizons.itemKeystone
|
||||
&& theItem.stackTagCompound != null) {
|
||||
tco.insertKeystone(theItem.stackTagCompound.getInteger("dimension"));
|
||||
--theItem.stackSize;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,11 @@ public class ItemKeystone extends Item {
|
||||
|
||||
public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List,
|
||||
final boolean par4) {
|
||||
if (par1ItemStack.getTagCompound() != null && par1ItemStack.getTagCompound().getInteger("dimension") != 0) {
|
||||
par3List.add(PocketPlaneData.planes.get(par1ItemStack.getTagCompound().getInteger("dimension")).name);
|
||||
if (par1ItemStack.getTagCompound() != null) {
|
||||
final int dim = par1ItemStack.getTagCompound().getInteger("dimension");
|
||||
if (dim >= 0 && dim < PocketPlaneData.planes.size()) {
|
||||
par3List.add(PocketPlaneData.planes.get(dim).name);
|
||||
}
|
||||
}
|
||||
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
|
||||
}
|
||||
@@ -71,9 +74,13 @@ public class ItemKeystone extends Item {
|
||||
float hitX, float hitY, float hitZ) {
|
||||
if (stack.getTagCompound() == null && player.dimension == ThaumicHorizons.dimensionPocketId
|
||||
&& !world.isRemote) {
|
||||
if (world.getTileEntity(x, y, z) instanceof TileVortex)
|
||||
(stack.stackTagCompound = new NBTTagCompound()).setInteger("dimension", (z + 128) / 256);
|
||||
return true;
|
||||
final net.minecraft.tileentity.TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileVortex) {
|
||||
(stack.stackTagCompound = new NBTTagCompound()).setInteger("dimension", ((TileVortex) te).dimensionID);
|
||||
player.inventory.markDirty();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.onItemUseFirst(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class PocketPlaneData {
|
||||
data.portalD = new int[4];
|
||||
PocketPlaneData.planes.add(data);
|
||||
PocketPlaneData.positions.put(pocketPlaneMAXID, Vec3.createVectorHelper(vortexX, vortexY, vortexZ));
|
||||
world.getChunkFromBlockCoords(vortexX, vortexZ).isModified = true;
|
||||
world.getChunkFromBlockCoords(xCenter, zCenter).isModified = true;
|
||||
creatures = 0;
|
||||
++pocketPlaneMAXID;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public class TileVortex extends TileThaumcraft implements IWandable, IAspectCont
|
||||
if (player.timeUntilPortal > 0) {
|
||||
player.timeUntilPortal = 10;
|
||||
} else if (player.dimension != ThaumicHorizons.dimensionPocketId) {
|
||||
player.timeUntilPortal = 10;
|
||||
player.timeUntilPortal = 200;
|
||||
player.mcServer.getConfigurationManager().transferPlayerToDimension(
|
||||
player,
|
||||
ThaumicHorizons.dimensionPocketId,
|
||||
@@ -183,7 +183,7 @@ public class TileVortex extends TileThaumcraft implements IWandable, IAspectCont
|
||||
mServer.worldServerForDimension(ThaumicHorizons.dimensionPocketId),
|
||||
this.dimensionID));
|
||||
} else {
|
||||
player.timeUntilPortal = 10;
|
||||
player.timeUntilPortal = 200;
|
||||
player.mcServer.getConfigurationManager().transferPlayerToDimension(
|
||||
player,
|
||||
this.returnID,
|
||||
@@ -321,7 +321,7 @@ public class TileVortex extends TileThaumcraft implements IWandable, IAspectCont
|
||||
this.xCoord,
|
||||
this.yCoord,
|
||||
this.zCoord,
|
||||
this.returnID))).run();
|
||||
this.returnID))).start();
|
||||
}
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user