From 2ea60eae1374818c5e6fb2c719c7fc3cd0e722a4 Mon Sep 17 00:00:00 2001 From: Vaern Date: Mon, 15 May 2023 22:52:32 -0700 Subject: [PATCH] Fixes! --- .../java/com/hbm/blocks/machine/PistonInserter.java | 5 ++++- .../blocks/machine/pile/BlockGraphiteDrilledBase.java | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/hbm/blocks/machine/PistonInserter.java b/src/main/java/com/hbm/blocks/machine/PistonInserter.java index b42828c0b..d0725186f 100644 --- a/src/main/java/com/hbm/blocks/machine/PistonInserter.java +++ b/src/main/java/com/hbm/blocks/machine/PistonInserter.java @@ -109,7 +109,8 @@ public class PistonInserter extends BlockContainerBase { @Override public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { - return world.getBlockMetadata(x, y, z) != side.ordinal(); + int meta = world.getBlockMetadata(x, y, z); + return meta != side.ordinal() && meta != side.getOpposite().ordinal(); } @Override @@ -274,6 +275,8 @@ public class PistonInserter extends BlockContainerBase { } } + //TODO: render AABB that extends out in direction of piston so it will render + /* BS inventory stuff */ @Override public int getSizeInventory() { return 1; } diff --git a/src/main/java/com/hbm/blocks/machine/pile/BlockGraphiteDrilledBase.java b/src/main/java/com/hbm/blocks/machine/pile/BlockGraphiteDrilledBase.java index 9d8b2fc8f..19adfb63e 100644 --- a/src/main/java/com/hbm/blocks/machine/pile/BlockGraphiteDrilledBase.java +++ b/src/main/java/com/hbm/blocks/machine/pile/BlockGraphiteDrilledBase.java @@ -177,6 +177,9 @@ public abstract class BlockGraphiteDrilledBase extends BlockFlammable implements int oldMeta = pureMeta | baseBlock.meta; //metablocks are kinda inconvenient to work with so Block oldBlock = baseBlock.block; NBTTagCompound oldTag = new NBTTagCompound(); //In case of TEs + oldTag.setInteger("x", x); //giving tags prevents issues and resets any lingering tes. + oldTag.setInteger("y", y); + oldTag.setInteger("z", z); //now actually make the change for(int i = 0; i <= 3; i++) { //yeah yeah we know it's safe but let's be *extra cautious* of infinite loops @@ -193,15 +196,13 @@ public abstract class BlockGraphiteDrilledBase extends BlockFlammable implements if(newBlock instanceof BlockGraphiteDrilledTE) { TileEntity te = world.getTileEntity(ix, iy, iz); te.writeToNBT(newTag); - newTag.setInteger("x", newTag.getInteger("x") + dir.offsetX); //malformed positions is very very bad and prevents the pile TEs from ticking - newTag.setInteger("y", newTag.getInteger("y") + dir.offsetY); - newTag.setInteger("z", newTag.getInteger("z") + dir.offsetZ); + newTag.setInteger("x", te.xCoord + dir.offsetX); //malformed positions is very very bad and prevents the pile TEs from ticking + newTag.setInteger("y", te.yCoord + dir.offsetY); + newTag.setInteger("z", te.zCoord + dir.offsetZ); } world.setBlock(ix, iy, iz, oldBlock, (oldMeta & ~0b100) | (newMeta & 0b100), 2); - //TODO: fix buggy interaction when a pu239 rod is inserted into another pu239 rod. the te doesn't disappear in time (even when invalidated) so the progress is 'duplicated' in the new rod. - //the fix might be to make an additional part after the oldTag is initalized, where the id + x,y,z are set, meaning that all other values will be set back to 0 and fixed. if(oldBlock instanceof BlockGraphiteDrilledTE && !oldTag.hasNoTags()) { //safety first TileEntity te = world.getTileEntity(ix, iy, iz); te.readFromNBT(oldTag);