Fix drill mistake

This commit is contained in:
Mrbysco 2024-03-07 01:35:53 +01:00
parent 4ef880aa15
commit d9961a3926

View file

@ -59,7 +59,6 @@ import net.neoforged.neoforge.items.IItemHandler;
import net.neoforged.neoforge.items.IItemHandlerModifiable; import net.neoforged.neoforge.items.IItemHandlerModifiable;
public class DrillItem extends ItemEnergy { public class DrillItem extends ItemEnergy {
public static final int HARVEST_LEVEL = 4; public static final int HARVEST_LEVEL = 4;
private static final int ENERGY_USE = 100; private static final int ENERGY_USE = 100;
@ -161,14 +160,12 @@ public class DrillItem extends ItemEnergy {
* @return The Upgrade, if it's installed * @return The Upgrade, if it's installed
*/ */
public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade) { public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade) {
CompoundTag compound = stack.getOrCreateTag();
ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerDrill.SLOT_AMOUNT); ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerDrill.SLOT_AMOUNT);
loadSlotsFromNBT(inv, stack); loadSlotsFromNBT(inv, stack);
for (int i = 0; i < inv.getSlots(); i++) { for (int i = 0; i < inv.getSlots(); i++) {
ItemStack slotStack = inv.getStackInSlot(i); ItemStack slotStack = inv.getStackInSlot(i);
if (StackUtil.isValid(slotStack) && slotStack.getItem() instanceof ItemDrillUpgrade) { if (StackUtil.isValid(slotStack) && slotStack.getItem() instanceof ItemDrillUpgrade drillUpgrade) {
if (((ItemDrillUpgrade) slotStack.getItem()).type == upgrade) { if (drillUpgrade.type == upgrade) {
return slotStack; return slotStack;
} }
} }
@ -213,11 +210,8 @@ public class DrillItem extends ItemEnergy {
@Override @Override
public float getDestroySpeed(ItemStack stack, BlockState state) { public float getDestroySpeed(ItemStack stack, BlockState state) {
if(!state.is(ActuallyTags.Blocks.MINEABLE_WITH_DRILL))
return 1.0F;
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack)
? (this.hasExtraWhitelist(state.getBlock())) ? (this.hasExtraWhitelist(state.getBlock()) || state.is(ActuallyTags.Blocks.MINEABLE_WITH_DRILL))
? this.getEfficiencyFromUpgrade(stack) ? this.getEfficiencyFromUpgrade(stack)
: 1.0F : 1.0F
: 0.1F; : 0.1F;