mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Fixed the drill sometimes acting up on redstone or glowstone
This commit is contained in:
parent
346dbf2ccd
commit
bdc6f179cf
2 changed files with 2 additions and 13 deletions
|
@ -268,9 +268,8 @@ public class ItemDrill extends ItemEnergy{
|
|||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state, ItemStack stack){
|
||||
int harvestLevel = this.getHarvestLevel(stack, "");
|
||||
Block block = state.getBlock();
|
||||
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial(state).isToolNotRequired() || (block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? harvestLevel >= 3 : (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? (block.getMaterial(state) == Material.ROCK || (block.getMaterial(state) == Material.IRON || block.getMaterial(state) == Material.ANVIL)) : harvestLevel >= 2) : harvestLevel >= 1) : harvestLevel >= 1) : harvestLevel >= 2) : harvestLevel >= 2) : harvestLevel >= 2))));
|
||||
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial(state).isToolNotRequired() || (block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? HARVEST_LEVEL >= 3 : (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? (block.getMaterial(state) == Material.ROCK || (block.getMaterial(state) == Material.IRON || block.getMaterial(state) == Material.ANVIL)) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 1) : HARVEST_LEVEL >= 1) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 2))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -341,6 +341,7 @@ public final class WorldUtil{
|
|||
|
||||
//Cobbled together from Tinkers' Construct (with permission, thanks!) and PlayerInteractionManager code.
|
||||
//Breaking blocks is a hideous pain so yea.
|
||||
//This doesn't do any additional harvestability checks that the blocks itself don't do!
|
||||
public static boolean playerHarvestBlock(ItemStack stack, World world, EntityPlayer player, BlockPos pos){
|
||||
if(world.isAirBlock(pos)){
|
||||
return false;
|
||||
|
@ -349,17 +350,6 @@ public final class WorldUtil{
|
|||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
boolean effective = false;
|
||||
for(String type : stack.getItem().getToolClasses(stack)){
|
||||
if(block.isToolEffective(type, state)){
|
||||
effective = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!effective || !ForgeHooks.canHarvestBlock(block, player, world, pos)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(player.capabilities.isCreativeMode){
|
||||
block.onBlockHarvested(world, pos, state, player);
|
||||
if(block.removedByPlayer(state, world, pos, player, false)){
|
||||
|
|
Loading…
Reference in a new issue