Allow omni tool to work as wrench (#3169). Thanks to Thepigcat76
* Allow omni tool to work as wrench * Update OmniToolItem.java
This commit is contained in:
parent
1c92b3f382
commit
aa4abdfdb5
2 changed files with 19 additions and 4 deletions
|
@ -34,7 +34,9 @@ import net.minecraft.item.Items;
|
||||||
import net.minecraft.item.MiningToolItem;
|
import net.minecraft.item.MiningToolItem;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import reborncore.api.IToolHandler;
|
||||||
import reborncore.common.powerSystem.RcEnergyItem;
|
import reborncore.common.powerSystem.RcEnergyItem;
|
||||||
import reborncore.common.powerSystem.RcEnergyTier;
|
import reborncore.common.powerSystem.RcEnergyTier;
|
||||||
import reborncore.common.util.ItemUtils;
|
import reborncore.common.util.ItemUtils;
|
||||||
|
@ -44,7 +46,7 @@ import techreborn.init.TRContent;
|
||||||
import techreborn.init.TRToolMaterials;
|
import techreborn.init.TRToolMaterials;
|
||||||
import techreborn.items.tool.MiningLevel;
|
import techreborn.items.tool.MiningLevel;
|
||||||
|
|
||||||
public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
|
public class OmniToolItem extends MiningToolItem implements RcEnergyItem, IToolHandler {
|
||||||
public final int miningLevel;
|
public final int miningLevel;
|
||||||
|
|
||||||
// 4M FE max charge with 1k charge rate
|
// 4M FE max charge with 1k charge rate
|
||||||
|
@ -136,4 +138,14 @@ public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
|
||||||
public RcEnergyTier getTier() {
|
public RcEnergyTier getTier() {
|
||||||
return RcEnergyTier.EXTREME;
|
return RcEnergyTier.EXTREME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleTool(ItemStack stack, BlockPos pos, World world, PlayerEntity player, Direction side, boolean damage) {
|
||||||
|
if (!player.getWorld().isClient && this.getStoredEnergy(stack) >= 5.0) {
|
||||||
|
this.tryUseEnergy(stack, (long) 5);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"type": "minecraft:crafting_shaped",
|
"type": "minecraft:crafting_shaped",
|
||||||
"pattern": [
|
"pattern": [
|
||||||
"D ",
|
" WD",
|
||||||
" C ",
|
" C ",
|
||||||
" S"
|
"S "
|
||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"D": {
|
"D": {
|
||||||
|
@ -14,6 +14,9 @@
|
||||||
},
|
},
|
||||||
"S": {
|
"S": {
|
||||||
"item": "minecraft:diamond_sword"
|
"item": "minecraft:diamond_sword"
|
||||||
|
},
|
||||||
|
"W": {
|
||||||
|
"item": "techreborn:wrench"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
|
|
Loading…
Reference in a new issue