update breaker handler to match master-1.12

This commit is contained in:
Mohammad-Ali Minaie
2018-09-01 17:06:45 -04:00
parent 84992ccdc1
commit 7828c9b110

View File

@@ -53,6 +53,23 @@ public interface BreakerHandler {
if(!smashState.getBlock().equals(Blocks.AIR)) { if(!smashState.getBlock().equals(Blocks.AIR)) {
ItemStack smashStack = new ItemStack(Item.getItemFromBlock(smashState.getBlock()), 1, smashState.getBlock().getMetaFromState(smashState)); ItemStack smashStack = new ItemStack(Item.getItemFromBlock(smashState.getBlock()), 1, smashState.getBlock().getMetaFromState(smashState));
if (RecipeHelper.isOreName(smashStack, "cobblestone")) {
if (tile.getCharge() > getThreshold(world, pos.offset(face))) {
world.setBlockToAir(pos.offset(face));
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(Blocks.GRAVEL, randomChanceReturn(9, 1, 1)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
return true;
}
}
if (RecipeHelper.isOreName(smashStack, "gravel")) {
if (tile.getCharge() > getThreshold(world, pos.offset(face))) {
world.setBlockToAir(pos.offset(face));
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(Blocks.SAND, randomChanceReturn(9, 1, 1)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
return true;
}
}
for (GallagherRecipe recipe : GallagherRecipe.RECIPES) { for (GallagherRecipe recipe : GallagherRecipe.RECIPES) {
if (recipe.match(smashState)) { if (recipe.match(smashState)) {
if (tile.getCharge() > getThreshold(world, pos.offset(face))) { if (tile.getCharge() > getThreshold(world, pos.offset(face))) {