diff options
author | NotAPenguin <michiel.vandeginste@gmail.com> | 2024-09-12 07:35:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-12 05:35:55 +0000 |
commit | 4221744e308cf19cecf9e0d2b06769abe9d7e8e5 (patch) | |
tree | 3198ab9fe84e3e5ee38d37f3aec9daf36561c3b3 /src/main/java/gregtech/common | |
parent | 118be67d5375cc618016252f9aef9868cbf206c9 (diff) | |
download | GT5-Unofficial-4221744e308cf19cecf9e0d2b06769abe9d7e8e5.tar.gz GT5-Unofficial-4221744e308cf19cecf9e0d2b06769abe9d7e8e5.tar.bz2 GT5-Unofficial-4221744e308cf19cecf9e0d2b06769abe9d7e8e5.zip |
Fix final frame box issues (#3160)
Co-authored-by: BucketBrigade <138534411+CookieBrigade@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r-- | src/main/java/gregtech/common/blocks/BlockFrameBox.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/gregtech/common/blocks/BlockFrameBox.java b/src/main/java/gregtech/common/blocks/BlockFrameBox.java index 59ca98ef8e..ab05d95032 100644 --- a/src/main/java/gregtech/common/blocks/BlockFrameBox.java +++ b/src/main/java/gregtech/common/blocks/BlockFrameBox.java @@ -11,6 +11,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -125,6 +126,7 @@ public class BlockFrameBox extends BlockContainer { ForgeDirection direction = ForgeDirection.getOrientation(side); // If this block already holds a TE, just forward the call TileEntity te = worldIn.getTileEntity(x, y, z); + if (te instanceof BaseMetaPipeEntity baseTileEntity) { // If this baseTileEntity has no MetaTileEntity associated with it, we need to create it // This happens on world load for some reason @@ -139,8 +141,7 @@ public class BlockFrameBox extends BlockContainer { ItemStack item = player.getHeldItem(); if (isCover(item)) { BaseMetaPipeEntity newTileEntity = spawnFrameEntity(worldIn, x, y, z); - newTileEntity.onRightclick(player, direction, subX, subY, subZ); - return true; + return newTileEntity.onRightclick(player, direction, subX, subY, subZ); } return false; @@ -183,7 +184,7 @@ public class BlockFrameBox extends BlockContainer { @Override public int getHarvestLevel(int aMeta) { - return aMeta % 4; + return 3; } @Override @@ -209,6 +210,8 @@ public class BlockFrameBox extends BlockContainer { @Override public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetadata) { + if (aWorld.isRemote) return; + final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof IGregTechTileEntity gtTE) { gtTE.onBlockDestroyed(); @@ -237,6 +240,11 @@ public class BlockFrameBox extends BlockContainer { } @Override + public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { + return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ); + } + + @Override public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); return (tTileEntity instanceof BaseMetaTileEntity baseMTE) && baseMTE.privateAccess() |