Omnitool WIP mark lost
This commit is contained in:
parent
b2f4804987
commit
5e9e0f3c2b
22 changed files with 166 additions and 155 deletions
|
@ -47,16 +47,15 @@ import techreborn.TechReborn;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemChainsaw extends AxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class ChainsawItem extends AxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int maxCharge;
|
||||
public int cost = 250;
|
||||
public float poweredSpeed = 20F;
|
||||
public float unpoweredSpeed = 2.0F;
|
||||
public int transferLimit = 100;
|
||||
public boolean isBreaking = false;
|
||||
|
||||
public ItemChainsaw(ToolMaterials material, int energyCapacity, float unpoweredSpeed) {
|
||||
public ChainsawItem(ToolMaterials material, int energyCapacity, float unpoweredSpeed) {
|
||||
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
this.maxCharge = energyCapacity;
|
||||
|
|
@ -45,9 +45,9 @@ import java.util.Map.Entry;
|
|||
/**
|
||||
* Created by Mark on 20/03/2016.
|
||||
*/
|
||||
public class ItemDebugTool extends Item {
|
||||
public class DebugToolItem extends Item {
|
||||
|
||||
public ItemDebugTool() {
|
||||
public DebugToolItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
}
|
||||
|
|
@ -42,20 +42,22 @@ import techreborn.TechReborn;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int maxCharge;
|
||||
public int cost = 250;
|
||||
public float unpoweredSpeed = 2.0F;
|
||||
public float unpoweredSpeed;
|
||||
public float poweredSpeed;
|
||||
public int transferLimit = 100;
|
||||
|
||||
public ItemDrill(ToolMaterial material, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) {
|
||||
public DrillItem(ToolMaterial material, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) {
|
||||
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
this.maxCharge = energyCapacity;
|
||||
this.unpoweredSpeed = unpoweredSpeed;
|
||||
this.poweredSpeed = efficiencyOnProperMaterial;
|
||||
}
|
||||
|
||||
// ItemPickaxe
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public float getMiningSpeed(ItemStack stack, BlockState state) {
|
||||
if (Energy.of(stack).getEnergy() < cost) {
|
||||
|
@ -63,7 +65,7 @@ public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabili
|
|||
}
|
||||
if (Items.WOODEN_PICKAXE.getMiningSpeed(stack, state) > 1.0F
|
||||
|| Items.WOODEN_SHOVEL.getMiningSpeed(stack, state) > 1.0F) {
|
||||
return miningSpeed;
|
||||
return poweredSpeed;
|
||||
} else {
|
||||
return super.getMiningSpeed(stack, state);
|
||||
}
|
||||
|
@ -90,6 +92,12 @@ public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabili
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
@ -105,7 +113,7 @@ public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabili
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
// IEnergyItemInfo
|
||||
// EnergyHolder
|
||||
@Override
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
|
@ -46,18 +46,18 @@ import techreborn.TechReborn;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int maxCharge;
|
||||
public int cost = 250;
|
||||
public int transferLimit = 100;
|
||||
public int transferLimit = EnergyTier.MEDIUM.getMaxInput();
|
||||
|
||||
public ItemJackhammer(ToolMaterials material, int energyCapacity) {
|
||||
public JackhammerItem(ToolMaterials material, int energyCapacity) {
|
||||
super(material, (int) material.getAttackDamage(), 1f, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
this.maxCharge = energyCapacity;
|
||||
}
|
||||
|
||||
// ItemPickaxe
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public float getMiningSpeed(ItemStack stack, BlockState state) {
|
||||
if (state.getMaterial() == Material.STONE && Energy.of(stack).getEnergy() >= cost) {
|
||||
|
@ -67,7 +67,7 @@ public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDur
|
|||
}
|
||||
}
|
||||
|
||||
// ItemTool
|
||||
// MiningToolItem
|
||||
@Override
|
||||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
Random rand = new Random();
|
||||
|
@ -78,17 +78,17 @@ public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDur
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean postHit(ItemStack itemstack, LivingEntity entityliving, LivingEntity entityliving1) {
|
||||
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Item
|
||||
|
||||
// ToolItem
|
||||
@Override
|
||||
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
|
||||
public boolean canRepair(ItemStack stack, ItemStack ingredient) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
@ -104,7 +104,7 @@ public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDur
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
// IEnergyItemInfo
|
||||
// EnergyHolder
|
||||
@Override
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
|
@ -27,9 +27,9 @@ package techreborn.items.tool;
|
|||
import net.minecraft.item.Item;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
public class ItemTreeTap extends Item {
|
||||
public class TreeTapItem extends Item {
|
||||
|
||||
public ItemTreeTap() {
|
||||
public TreeTapItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(20));
|
||||
}
|
||||
}
|
|
@ -37,9 +37,9 @@ import techreborn.TechReborn;
|
|||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
*/
|
||||
public class ItemWrench extends Item implements IToolHandler {
|
||||
public class WrenchItem extends Item implements IToolHandler {
|
||||
|
||||
public ItemWrench() {
|
||||
public WrenchItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
}
|
||||
|
|
@ -34,15 +34,15 @@ import net.minecraft.item.ToolMaterials;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemChainsaw;
|
||||
import techreborn.items.tool.ChainsawItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemAdvancedChainsaw extends ItemChainsaw {
|
||||
public class AdvancedChainsawItem extends ChainsawItem {
|
||||
|
||||
// 400k max charge with 1k charge rate
|
||||
public ItemAdvancedChainsaw() {
|
||||
public AdvancedChainsawItem() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedChainsawCharge, 1.0F);
|
||||
this.cost = 250;
|
||||
this.cost = 100;
|
||||
this.transferLimit = 1000;
|
||||
}
|
||||
|
|
@ -34,15 +34,15 @@ import net.minecraft.item.ToolMaterials;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemDrill;
|
||||
import techreborn.items.tool.DrillItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemAdvancedDrill extends ItemDrill {
|
||||
public class AdvancedDrillItem extends DrillItem {
|
||||
|
||||
// 400k max charge with 1k charge rate
|
||||
public ItemAdvancedDrill() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedDrillCharge, 0.5F, 15F);
|
||||
this.cost = 250;
|
||||
public AdvancedDrillItem() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedDrillCharge, 0.5F, 12F);
|
||||
this.cost = 100;
|
||||
this.transferLimit = 1000;
|
||||
}
|
||||
|
|
@ -32,13 +32,13 @@ import net.minecraft.item.ToolMaterials;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemJackhammer;
|
||||
import techreborn.items.tool.JackhammerItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemAdvancedJackhammer extends ItemJackhammer {
|
||||
public class AdvancedJackhammerItem extends JackhammerItem {
|
||||
|
||||
// 400k max charge with 1k charge rate
|
||||
public ItemAdvancedJackhammer() {
|
||||
public AdvancedJackhammerItem() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedJackhammerCharge);
|
||||
this.cost = 100;
|
||||
this.transferLimit = 1000;
|
|
@ -48,14 +48,14 @@ import techreborn.init.TRContent;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemRockCutter extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class RockCutterItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = TechRebornConfig.rockCutterCharge;
|
||||
public int transferLimit = 1_000;
|
||||
public int cost = 500;
|
||||
|
||||
// 400k FE with 1k FE\t charge rate
|
||||
public ItemRockCutter() {
|
||||
public RockCutterItem() {
|
||||
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
}
|
||||
|
|
@ -34,12 +34,12 @@ import net.minecraft.item.ToolMaterials;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemChainsaw;
|
||||
import techreborn.items.tool.ChainsawItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemBasicChainsaw extends ItemChainsaw {
|
||||
public class BasicChainsawItem extends ChainsawItem {
|
||||
|
||||
public ItemBasicChainsaw() {
|
||||
public BasicChainsawItem() {
|
||||
super(ToolMaterials.IRON, TechRebornConfig.basicChainsawCharge, 0.5F);
|
||||
this.cost = 50;
|
||||
}
|
|
@ -34,12 +34,12 @@ import net.minecraft.item.ToolMaterials;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemDrill;
|
||||
import techreborn.items.tool.DrillItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemBasicDrill extends ItemDrill {
|
||||
public class BasicDrillItem extends DrillItem {
|
||||
|
||||
public ItemBasicDrill() {
|
||||
public BasicDrillItem() {
|
||||
super(ToolMaterials.IRON, TechRebornConfig.basicDrillCharge, 0.5F, 10F);
|
||||
this.cost = 50;
|
||||
}
|
|
@ -32,12 +32,12 @@ import net.minecraft.item.ToolMaterials;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemJackhammer;
|
||||
import techreborn.items.tool.JackhammerItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemBasicJackhammer extends ItemJackhammer {
|
||||
public class BasicJackhammerItem extends JackhammerItem {
|
||||
|
||||
public ItemBasicJackhammer() {
|
||||
public BasicJackhammerItem() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.basicJackhammerCharge);
|
||||
this.cost = 50;
|
||||
}
|
|
@ -42,12 +42,12 @@ import techreborn.utils.InitUtils;
|
|||
/**
|
||||
* Created by modmuss50 on 05/11/2016.
|
||||
*/
|
||||
public class ItemElectricTreetap extends Item implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class ElectricTreetapItem extends Item implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = 10_000;
|
||||
public int cost = 20;
|
||||
|
||||
public ItemElectricTreetap() {
|
||||
public ElectricTreetapItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ import reborncore.common.util.ItemUtils;
|
|||
import team.reborn.energy.Energy;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemChainsaw;
|
||||
import techreborn.items.tool.ChainsawItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
import techreborn.utils.MessageIDs;
|
||||
import techreborn.utils.TagUtils;
|
||||
|
@ -58,13 +58,13 @@ import javax.annotation.Nullable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemIndustrialChainsaw extends ItemChainsaw {
|
||||
public class IndustrialChainsawItem extends ChainsawItem {
|
||||
|
||||
private static final Direction[] SEARCH_ORDER = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST, Direction.UP};
|
||||
|
||||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemIndustrialChainsaw() {
|
||||
public IndustrialChainsawItem() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialChainsawCharge, 1.0F);
|
||||
this.cost = 250;
|
||||
this.transferLimit = 1000;
|
||||
|
@ -136,7 +136,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
} else {
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
stack.getOrCreateTag().putBoolean("isActive", false);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
|
@ -157,7 +157,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating")));
|
||||
}
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
stack.getOrCreateTag().putBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ import reborncore.common.util.ItemUtils;
|
|||
import team.reborn.energy.Energy;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemDrill;
|
||||
import techreborn.items.tool.DrillItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
import techreborn.utils.MessageIDs;
|
||||
|
||||
|
@ -62,17 +62,17 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemIndustrialDrill extends ItemDrill {
|
||||
public class IndustrialDrillItem extends DrillItem {
|
||||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemIndustrialDrill() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialDrillCharge, 2.0F, 10F);
|
||||
public IndustrialDrillItem() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialDrillCharge, 2.0F, 15F);
|
||||
this.cost = 250;
|
||||
this.transferLimit = 1000;
|
||||
}
|
||||
|
||||
private Set<BlockPos> getTargetBlocks(World worldIn, BlockPos pos, @Nullable PlayerEntity playerIn) {
|
||||
Set<BlockPos> targetBlocks = new HashSet<BlockPos>();
|
||||
Set<BlockPos> targetBlocks = new HashSet<>();
|
||||
if (playerIn == null) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
blockState.getBlock().onBlockRemoved(blockState, world, pos, blockState, true);
|
||||
blockState.getBlock().afterBreak(world, playerIn, pos, blockState, world.getBlockEntity(pos), drill);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
world.removeBlockEntity(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,14 +143,10 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
return false;
|
||||
}
|
||||
float originalHardness = worldIn.getBlockState(originalPos).getHardness(worldIn, originalPos);
|
||||
if ((originalHardness / blockHardness) > 10.0F) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !((originalHardness / blockHardness) > 10.0F);
|
||||
}
|
||||
|
||||
// ItemDrill
|
||||
// DrillItem
|
||||
@Override
|
||||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
PlayerEntity playerIn = null;
|
||||
|
@ -166,6 +161,13 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
return super.postMine(stack, worldIn, blockIn, pos, entityLiving);
|
||||
}
|
||||
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public boolean isEffectiveOn(BlockState blockIn) {
|
||||
return (Items.DIAMOND_PICKAXE.isEffectiveOn(blockIn) || Items.DIAMOND_SHOVEL.isEffectiveOn(blockIn)) && !Items.DIAMOND_AXE.isEffectiveOn(blockIn);
|
||||
}
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(final World world, final PlayerEntity player, final Hand hand) {
|
||||
final ItemStack stack = player.getStackInHand(hand);
|
||||
|
@ -179,14 +181,14 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
if (stack.getTag() == null) {
|
||||
stack.setTag(new CompoundTag());
|
||||
}
|
||||
stack.getTag().putBoolean("isActive", true);
|
||||
stack.getOrCreateTag().putBoolean("isActive", true);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
} else {
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
stack.getOrCreateTag().putBoolean("isActive", false);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
|
@ -207,7 +209,7 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating")));
|
||||
}
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
stack.getOrCreateTag().putBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,13 +223,6 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
}
|
||||
}
|
||||
|
||||
// ItemPickaxe
|
||||
@Override
|
||||
public boolean isEffectiveOn(BlockState blockIn) {
|
||||
return (Items.DIAMOND_PICKAXE.isEffectiveOn(blockIn) || Items.DIAMOND_SHOVEL.isEffectiveOn(blockIn)) && !Items.DIAMOND_AXE.isEffectiveOn(blockIn);
|
||||
}
|
||||
|
||||
// Item
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
|
|
@ -32,13 +32,13 @@ import net.minecraft.item.ToolMaterials;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemJackhammer;
|
||||
import techreborn.items.tool.JackhammerItem;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemIndustrialJackhammer extends ItemJackhammer {
|
||||
public class IndustrialJackhammerItem extends JackhammerItem {
|
||||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemIndustrialJackhammer() {
|
||||
public IndustrialJackhammerItem() {
|
||||
super(ToolMaterials.IRON, TechRebornConfig.industrialJackhammerCharge);
|
||||
this.cost = 250;
|
||||
this.transferLimit = 1000;
|
|
@ -59,13 +59,13 @@ import techreborn.utils.MessageIDs;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNanosaber extends SwordItem implements EnergyHolder, ItemDurabilityExtensions, ItemStackModifiers {
|
||||
public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabilityExtensions, ItemStackModifiers {
|
||||
public static final int maxCharge = TechRebornConfig.nanoSaberCharge;
|
||||
public int transferLimit = 1_000;
|
||||
public int cost = 250;
|
||||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemNanosaber() {
|
||||
public NanosaberItem() {
|
||||
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
this.addPropertyGetter(new Identifier("techreborn:active"), new ItemPropertyGetter() {
|
||||
@Override
|
|
@ -55,7 +55,7 @@ import techreborn.utils.InitUtils;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class OmniToolItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = TechRebornConfig.omniToolCharge;
|
||||
public int transferLimit = 1_000;
|
||||
|
@ -63,11 +63,11 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
|
|||
public int hitCost = 125;
|
||||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemOmniTool() {
|
||||
public OmniToolItem() {
|
||||
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
}
|
||||
|
||||
// ItemPickaxe
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public boolean isEffectiveOn(BlockState state) {
|
||||
return Items.DIAMOND_AXE.isEffectiveOn(state) || Items.DIAMOND_SWORD.isEffectiveOn(state)
|
||||
|
@ -75,34 +75,21 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
|
|||
|| Items.SHEARS.isEffectiveOn(state);
|
||||
}
|
||||
|
||||
// ItemTool
|
||||
@Override
|
||||
public float getMiningSpeed(ItemStack stack, BlockState state) {
|
||||
if (Energy.of(stack).getEnergy() >= cost) {
|
||||
return ToolMaterials.DIAMOND.getMiningSpeed();
|
||||
}
|
||||
return super.getMiningSpeed(stack, state);
|
||||
}
|
||||
|
||||
// MiningToolItem
|
||||
@Override
|
||||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
Energy.of(stack).use(cost);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||
// IEnergyStorage capEnergy = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// if (capEnergy.getEnergyStored() >= cost) {
|
||||
// capEnergy.extractEnergy(cost, false);
|
||||
// return 5.0F;
|
||||
// }
|
||||
//
|
||||
// if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F
|
||||
// || Items.wooden_sword.getDigSpeed(stack, state) > 1.0F
|
||||
// || Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F
|
||||
// || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F
|
||||
// || Items.shears.getDigSpeed(stack, state) > 1.0F) {
|
||||
// return efficiencyOnProperMaterial;
|
||||
// } else {
|
||||
// return super.getDigSpeed(stack, state);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean postHit(ItemStack stack, LivingEntity entityliving, LivingEntity attacker) {
|
||||
if(Energy.of(stack).use(hitCost)) {
|
||||
|
@ -111,24 +98,34 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
|
|||
return false;
|
||||
}
|
||||
|
||||
// ToolItem
|
||||
@Override
|
||||
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public ActionResult useOnBlock(ItemUsageContext context) {
|
||||
return TorchHelper.placeTorch(context);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) {
|
||||
return false;
|
||||
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
|
||||
if (!isIn(par2ItemGroup)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
|
||||
tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED));
|
||||
// TODO
|
||||
// Remember to remove WIP override and imports once complete
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Swiss Army Knife"));
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
@ -144,17 +141,7 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void appendStacks(
|
||||
ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
|
||||
if (!isIn(par2ItemGroup)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList);
|
||||
}
|
||||
|
||||
// IEnergyItemInfo
|
||||
// EnergyHolder
|
||||
@Override
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
Loading…
Add table
Add a link
Reference in a new issue