diff options
author | Caedis <Caedis@users.noreply.github.com> | 2024-01-12 13:53:09 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-12 13:53:09 -0600 |
commit | ba1a9b290a09e39b100ff8d9f1f5e70cdc3f0fab (patch) | |
tree | 3895304c8c934ba84b93a6ab427f5fa0546200ac /src/main/java/gregtech/common/blocks/GT_Block_Machines.java | |
parent | a3adb6c9e2b0093b3e6ed6f2d4ce9c0ae5fe3520 (diff) | |
download | GT5-Unofficial-ba1a9b290a09e39b100ff8d9f1f5e70cdc3f0fab.tar.gz GT5-Unofficial-ba1a9b290a09e39b100ff8d9f1f5e70cdc3f0fab.tar.bz2 GT5-Unofficial-ba1a9b290a09e39b100ff8d9f1f5e70cdc3f0fab.zip |
Allow tools to break stuff with a lower harvest level (#2435)
* Allow tools to break stuff with a lower harvest level
* Dont allow drops of improper tool usage
Diffstat (limited to 'src/main/java/gregtech/common/blocks/GT_Block_Machines.java')
-rw-r--r-- | src/main/java/gregtech/common/blocks/GT_Block_Machines.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index af41710054..b2d62e3f3a 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -37,12 +37,14 @@ import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IDebugableBlock; +import gregtech.api.interfaces.IToolStats; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IColoredTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IDebugableTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_Generic_Block; +import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.BaseTileEntity; @@ -73,6 +75,19 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo } @Override + public boolean canHarvestBlock(EntityPlayer player, int meta) { + + ItemStack stack = player.inventory.getCurrentItem(); + if (stack != null && stack.getItem() instanceof GT_MetaGenerated_Tool gTool) { + IToolStats tStats = gTool.getToolStats(stack); + if (tStats == null) return false; + return tStats.isMinableBlock(this, (byte) meta); + } + + return super.canHarvestBlock(player, meta); + } + + @Override public String getHarvestTool(int aMeta) { if (aMeta >= 8 && aMeta <= 11) { return "cutter"; |