Drills use energy to mine. Closes #2007
This commit is contained in:
parent
1cb6623dd7
commit
0eb89ee122
1 changed files with 15 additions and 0 deletions
|
@ -25,9 +25,13 @@
|
|||
package techreborn.items.tool;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
@ -38,6 +42,8 @@ import team.reborn.energy.EnergyTier;
|
|||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public final int maxCharge;
|
||||
|
@ -76,6 +82,15 @@ public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabili
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||
Energy.of(stack).use(cost);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ToolItem
|
||||
@Override
|
||||
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
|
||||
|
|
Loading…
Reference in a new issue