From 5e9e0f3c2bdac0c06699050a35d3089770c27837 Mon Sep 17 00:00:00 2001 From: drcrazy Date: Fri, 20 Dec 2019 16:34:24 +0300 Subject: [PATCH] Omnitool WIP mark lost --- .../blocks/misc/BlockRubberLog.java | 4 +- .../java/techreborn/events/ModRegistry.java | 54 +++++++-------- .../{ItemChainsaw.java => ChainsawItem.java} | 7 +- ...{ItemDebugTool.java => DebugToolItem.java} | 4 +- .../tool/{ItemDrill.java => DrillItem.java} | 22 ++++-- ...temJackhammer.java => JackhammerItem.java} | 22 +++--- .../{ItemTreeTap.java => TreeTapItem.java} | 4 +- .../tool/{ItemWrench.java => WrenchItem.java} | 4 +- ...hainsaw.java => AdvancedChainsawItem.java} | 8 +-- ...ancedDrill.java => AdvancedDrillItem.java} | 10 +-- ...ammer.java => AdvancedJackhammerItem.java} | 6 +- ...temRockCutter.java => RockCutterItem.java} | 4 +- ...icChainsaw.java => BasicChainsawItem.java} | 6 +- ...temBasicDrill.java => BasicDrillItem.java} | 6 +- ...ckhammer.java => BasicJackhammerItem.java} | 6 +- ...cTreetap.java => ElectricTreetapItem.java} | 4 +- ...insaw.java => IndustrialChainsawItem.java} | 10 +-- ...ialDrill.java => IndustrialDrillItem.java} | 39 +++++------ ...mer.java => IndustrialJackhammerItem.java} | 6 +- ...{ItemNanosaber.java => NanosaberItem.java} | 4 +- .../{ItemOmniTool.java => OmniToolItem.java} | 69 ++++++++----------- .../crafting_table/tool/omni_tool.json | 22 ++++++ 22 files changed, 166 insertions(+), 155 deletions(-) rename src/main/java/techreborn/items/tool/{ItemChainsaw.java => ChainsawItem.java} (95%) rename src/main/java/techreborn/items/tool/{ItemDebugTool.java => DebugToolItem.java} (98%) rename src/main/java/techreborn/items/tool/{ItemDrill.java => DrillItem.java} (90%) rename src/main/java/techreborn/items/tool/{ItemJackhammer.java => JackhammerItem.java} (88%) rename src/main/java/techreborn/items/tool/{ItemTreeTap.java => TreeTapItem.java} (95%) rename src/main/java/techreborn/items/tool/{ItemWrench.java => WrenchItem.java} (95%) rename src/main/java/techreborn/items/tool/advanced/{ItemAdvancedChainsaw.java => AdvancedChainsawItem.java} (93%) rename src/main/java/techreborn/items/tool/advanced/{ItemAdvancedDrill.java => AdvancedDrillItem.java} (93%) rename src/main/java/techreborn/items/tool/advanced/{ItemAdvancedJackhammer.java => AdvancedJackhammerItem.java} (93%) rename src/main/java/techreborn/items/tool/advanced/{ItemRockCutter.java => RockCutterItem.java} (98%) rename src/main/java/techreborn/items/tool/basic/{ItemBasicChainsaw.java => BasicChainsawItem.java} (94%) rename src/main/java/techreborn/items/tool/basic/{ItemBasicDrill.java => BasicDrillItem.java} (94%) rename src/main/java/techreborn/items/tool/basic/{ItemBasicJackhammer.java => BasicJackhammerItem.java} (93%) rename src/main/java/techreborn/items/tool/basic/{ItemElectricTreetap.java => ElectricTreetapItem.java} (96%) rename src/main/java/techreborn/items/tool/industrial/{ItemIndustrialChainsaw.java => IndustrialChainsawItem.java} (96%) rename src/main/java/techreborn/items/tool/industrial/{ItemIndustrialDrill.java => IndustrialDrillItem.java} (94%) rename src/main/java/techreborn/items/tool/industrial/{ItemIndustrialJackhammer.java => IndustrialJackhammerItem.java} (93%) rename src/main/java/techreborn/items/tool/industrial/{ItemNanosaber.java => NanosaberItem.java} (98%) rename src/main/java/techreborn/items/tool/industrial/{ItemOmniTool.java => OmniToolItem.java} (81%) create mode 100644 src/main/resources/data/techreborn/recipes/crafting_table/tool/omni_tool.json diff --git a/src/main/java/techreborn/blocks/misc/BlockRubberLog.java b/src/main/java/techreborn/blocks/misc/BlockRubberLog.java index 4be2cea66..1a251733f 100644 --- a/src/main/java/techreborn/blocks/misc/BlockRubberLog.java +++ b/src/main/java/techreborn/blocks/misc/BlockRubberLog.java @@ -52,7 +52,7 @@ import team.reborn.energy.Energy; import techreborn.events.TRRecipeHandler; import techreborn.init.ModSounds; import techreborn.init.TRContent; -import techreborn.items.tool.ItemTreeTap; +import techreborn.items.tool.TreeTapItem; import java.util.Random; /** @@ -135,7 +135,7 @@ public class BlockRubberLog extends LogBlock { return ActionResult.SUCCESS; } - if ((Energy.valid(stack) && Energy.of(stack).getEnergy() > 20) || stack.getItem() instanceof ItemTreeTap) { + if ((Energy.valid(stack) && Energy.of(stack).getEnergy() > 20) || stack.getItem() instanceof TreeTapItem) { if (state.get(HAS_SAP) && state.get(SAP_SIDE) == hitResult.getSide()) { worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, Direction.fromHorizontal(0))); worldIn.playSound(playerIn, pos, ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS, 0.6F, 1F); diff --git a/src/main/java/techreborn/events/ModRegistry.java b/src/main/java/techreborn/events/ModRegistry.java index f3346c729..c0f4eea8d 100644 --- a/src/main/java/techreborn/events/ModRegistry.java +++ b/src/main/java/techreborn/events/ModRegistry.java @@ -64,17 +64,17 @@ import techreborn.items.armor.ItemLithiumIonBatpack; import techreborn.items.armor.ItemQuantumSuit; import techreborn.items.armor.ItemTRArmour; import techreborn.items.battery.*; -import techreborn.items.tool.ItemDebugTool; -import techreborn.items.tool.ItemTreeTap; -import techreborn.items.tool.ItemWrench; -import techreborn.items.tool.advanced.ItemAdvancedChainsaw; -import techreborn.items.tool.advanced.ItemAdvancedDrill; -import techreborn.items.tool.advanced.ItemAdvancedJackhammer; -import techreborn.items.tool.advanced.ItemRockCutter; -import techreborn.items.tool.basic.ItemBasicChainsaw; -import techreborn.items.tool.basic.ItemBasicDrill; -import techreborn.items.tool.basic.ItemBasicJackhammer; -import techreborn.items.tool.basic.ItemElectricTreetap; +import techreborn.items.tool.DebugToolItem; +import techreborn.items.tool.TreeTapItem; +import techreborn.items.tool.WrenchItem; +import techreborn.items.tool.advanced.AdvancedChainsawItem; +import techreborn.items.tool.advanced.AdvancedDrillItem; +import techreborn.items.tool.advanced.AdvancedJackhammerItem; +import techreborn.items.tool.advanced.RockCutterItem; +import techreborn.items.tool.basic.BasicChainsawItem; +import techreborn.items.tool.basic.BasicDrillItem; +import techreborn.items.tool.basic.BasicJackhammerItem; +import techreborn.items.tool.basic.ElectricTreetapItem; import techreborn.items.tool.industrial.*; import techreborn.items.tool.vanilla.*; import techreborn.utils.InitUtils; @@ -202,24 +202,24 @@ public class ModRegistry { RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORBPACK = InitUtils.setup(new ItemLapotronicOrbpack(), "lapotronic_orbpack")); // Tools - RebornRegistry.registerItem(TRContent.TREE_TAP = InitUtils.setup(new ItemTreeTap(), "treetap")); - RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new ItemWrench(), "wrench")); + RebornRegistry.registerItem(TRContent.TREE_TAP = InitUtils.setup(new TreeTapItem(), "treetap")); + RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new WrenchItem(), "wrench")); - RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new ItemBasicDrill(), "basic_drill")); - RebornRegistry.registerItem(TRContent.BASIC_CHAINSAW = InitUtils.setup(new ItemBasicChainsaw(), "basic_chainsaw")); - RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new ItemBasicJackhammer(), "basic_jackhammer")); - RebornRegistry.registerItem(TRContent.ELECTRIC_TREE_TAP = InitUtils.setup(new ItemElectricTreetap(), "electric_treetap")); + RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new BasicDrillItem(), "basic_drill")); + RebornRegistry.registerItem(TRContent.BASIC_CHAINSAW = InitUtils.setup(new BasicChainsawItem(), "basic_chainsaw")); + RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new BasicJackhammerItem(), "basic_jackhammer")); + RebornRegistry.registerItem(TRContent.ELECTRIC_TREE_TAP = InitUtils.setup(new ElectricTreetapItem(), "electric_treetap")); - RebornRegistry.registerItem(TRContent.ADVANCED_DRILL = InitUtils.setup(new ItemAdvancedDrill(), "advanced_drill")); - RebornRegistry.registerItem(TRContent.ADVANCED_CHAINSAW = InitUtils.setup(new ItemAdvancedChainsaw(), "advanced_chainsaw")); - RebornRegistry.registerItem(TRContent.ADVANCED_JACKHAMMER = InitUtils.setup(new ItemAdvancedJackhammer(), "advanced_jackhammer")); - RebornRegistry.registerItem(TRContent.ROCK_CUTTER = InitUtils.setup(new ItemRockCutter(), "rock_cutter")); + RebornRegistry.registerItem(TRContent.ADVANCED_DRILL = InitUtils.setup(new AdvancedDrillItem(), "advanced_drill")); + RebornRegistry.registerItem(TRContent.ADVANCED_CHAINSAW = InitUtils.setup(new AdvancedChainsawItem(), "advanced_chainsaw")); + RebornRegistry.registerItem(TRContent.ADVANCED_JACKHAMMER = InitUtils.setup(new AdvancedJackhammerItem(), "advanced_jackhammer")); + RebornRegistry.registerItem(TRContent.ROCK_CUTTER = InitUtils.setup(new RockCutterItem(), "rock_cutter")); - RebornRegistry.registerItem(TRContent.INDUSTRIAL_DRILL = InitUtils.setup(new ItemIndustrialDrill(), "industrial_drill")); - RebornRegistry.registerItem(TRContent.INDUSTRIAL_CHAINSAW = InitUtils.setup(new ItemIndustrialChainsaw(), "industrial_chainsaw")); - RebornRegistry.registerItem(TRContent.INDUSTRIAL_JACKHAMMER = InitUtils.setup(new ItemIndustrialJackhammer(), "industrial_jackhammer")); - RebornRegistry.registerItem(TRContent.NANOSABER = InitUtils.setup(new ItemNanosaber(), "nanosaber")); - RebornRegistry.registerItem(TRContent.OMNI_TOOL = InitUtils.setup(new ItemOmniTool(), "omni_tool")); + RebornRegistry.registerItem(TRContent.INDUSTRIAL_DRILL = InitUtils.setup(new IndustrialDrillItem(), "industrial_drill")); + RebornRegistry.registerItem(TRContent.INDUSTRIAL_CHAINSAW = InitUtils.setup(new IndustrialChainsawItem(), "industrial_chainsaw")); + RebornRegistry.registerItem(TRContent.INDUSTRIAL_JACKHAMMER = InitUtils.setup(new IndustrialJackhammerItem(), "industrial_jackhammer")); + RebornRegistry.registerItem(TRContent.NANOSABER = InitUtils.setup(new NanosaberItem(), "nanosaber")); + RebornRegistry.registerItem(TRContent.OMNI_TOOL = InitUtils.setup(new OmniToolItem(), "omni_tool")); // Armor RebornRegistry.registerItem(TRContent.CLOAKING_DEVICE = InitUtils.setup(new ItemCloakingDevice(), "cloaking_device")); @@ -228,7 +228,7 @@ public class ModRegistry { RebornRegistry.registerItem(TRContent.FREQUENCY_TRANSMITTER = InitUtils.setup(new ItemFrequencyTransmitter(), "frequency_transmitter")); RebornRegistry.registerItem(TRContent.SCRAP_BOX = InitUtils.setup(new ItemScrapBox(), "scrap_box")); RebornRegistry.registerItem(TRContent.MANUAL = InitUtils.setup(new ItemManual(), "manual")); - RebornRegistry.registerItem(TRContent.DEBUG_TOOL = InitUtils.setup(new ItemDebugTool(), "debug_tool")); + RebornRegistry.registerItem(TRContent.DEBUG_TOOL = InitUtils.setup(new DebugToolItem(), "debug_tool")); RebornRegistry.registerItem(TRContent.CELL = InitUtils.setup(new ItemDynamicCell(), "cell")); TechReborn.LOGGER.debug("TechReborns Items Loaded"); diff --git a/src/main/java/techreborn/items/tool/ItemChainsaw.java b/src/main/java/techreborn/items/tool/ChainsawItem.java similarity index 95% rename from src/main/java/techreborn/items/tool/ItemChainsaw.java rename to src/main/java/techreborn/items/tool/ChainsawItem.java index 0441f1608..ba18e86da 100644 --- a/src/main/java/techreborn/items/tool/ItemChainsaw.java +++ b/src/main/java/techreborn/items/tool/ChainsawItem.java @@ -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; diff --git a/src/main/java/techreborn/items/tool/ItemDebugTool.java b/src/main/java/techreborn/items/tool/DebugToolItem.java similarity index 98% rename from src/main/java/techreborn/items/tool/ItemDebugTool.java rename to src/main/java/techreborn/items/tool/DebugToolItem.java index 34ea79026..35e97f756 100644 --- a/src/main/java/techreborn/items/tool/ItemDebugTool.java +++ b/src/main/java/techreborn/items/tool/DebugToolItem.java @@ -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)); } diff --git a/src/main/java/techreborn/items/tool/ItemDrill.java b/src/main/java/techreborn/items/tool/DrillItem.java similarity index 90% rename from src/main/java/techreborn/items/tool/ItemDrill.java rename to src/main/java/techreborn/items/tool/DrillItem.java index 66ed08fe1..0c0d79bf7 100644 --- a/src/main/java/techreborn/items/tool/ItemDrill.java +++ b/src/main/java/techreborn/items/tool/DrillItem.java @@ -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; diff --git a/src/main/java/techreborn/items/tool/ItemJackhammer.java b/src/main/java/techreborn/items/tool/JackhammerItem.java similarity index 88% rename from src/main/java/techreborn/items/tool/ItemJackhammer.java rename to src/main/java/techreborn/items/tool/JackhammerItem.java index c94f45ef0..1ca73ea3b 100644 --- a/src/main/java/techreborn/items/tool/ItemJackhammer.java +++ b/src/main/java/techreborn/items/tool/JackhammerItem.java @@ -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; diff --git a/src/main/java/techreborn/items/tool/ItemTreeTap.java b/src/main/java/techreborn/items/tool/TreeTapItem.java similarity index 95% rename from src/main/java/techreborn/items/tool/ItemTreeTap.java rename to src/main/java/techreborn/items/tool/TreeTapItem.java index d3a81d906..f49533282 100644 --- a/src/main/java/techreborn/items/tool/ItemTreeTap.java +++ b/src/main/java/techreborn/items/tool/TreeTapItem.java @@ -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)); } } diff --git a/src/main/java/techreborn/items/tool/ItemWrench.java b/src/main/java/techreborn/items/tool/WrenchItem.java similarity index 95% rename from src/main/java/techreborn/items/tool/ItemWrench.java rename to src/main/java/techreborn/items/tool/WrenchItem.java index 850061ad2..4dbaff573 100644 --- a/src/main/java/techreborn/items/tool/ItemWrench.java +++ b/src/main/java/techreborn/items/tool/WrenchItem.java @@ -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)); } diff --git a/src/main/java/techreborn/items/tool/advanced/ItemAdvancedChainsaw.java b/src/main/java/techreborn/items/tool/advanced/AdvancedChainsawItem.java similarity index 93% rename from src/main/java/techreborn/items/tool/advanced/ItemAdvancedChainsaw.java rename to src/main/java/techreborn/items/tool/advanced/AdvancedChainsawItem.java index 25737255d..37fa9248e 100644 --- a/src/main/java/techreborn/items/tool/advanced/ItemAdvancedChainsaw.java +++ b/src/main/java/techreborn/items/tool/advanced/AdvancedChainsawItem.java @@ -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; } diff --git a/src/main/java/techreborn/items/tool/advanced/ItemAdvancedDrill.java b/src/main/java/techreborn/items/tool/advanced/AdvancedDrillItem.java similarity index 93% rename from src/main/java/techreborn/items/tool/advanced/ItemAdvancedDrill.java rename to src/main/java/techreborn/items/tool/advanced/AdvancedDrillItem.java index 5b30eac55..f0423e199 100644 --- a/src/main/java/techreborn/items/tool/advanced/ItemAdvancedDrill.java +++ b/src/main/java/techreborn/items/tool/advanced/AdvancedDrillItem.java @@ -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; } diff --git a/src/main/java/techreborn/items/tool/advanced/ItemAdvancedJackhammer.java b/src/main/java/techreborn/items/tool/advanced/AdvancedJackhammerItem.java similarity index 93% rename from src/main/java/techreborn/items/tool/advanced/ItemAdvancedJackhammer.java rename to src/main/java/techreborn/items/tool/advanced/AdvancedJackhammerItem.java index 482644bbe..bab10c63c 100644 --- a/src/main/java/techreborn/items/tool/advanced/ItemAdvancedJackhammer.java +++ b/src/main/java/techreborn/items/tool/advanced/AdvancedJackhammerItem.java @@ -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; diff --git a/src/main/java/techreborn/items/tool/advanced/ItemRockCutter.java b/src/main/java/techreborn/items/tool/advanced/RockCutterItem.java similarity index 98% rename from src/main/java/techreborn/items/tool/advanced/ItemRockCutter.java rename to src/main/java/techreborn/items/tool/advanced/RockCutterItem.java index e499efee5..ff2b1c1de 100644 --- a/src/main/java/techreborn/items/tool/advanced/ItemRockCutter.java +++ b/src/main/java/techreborn/items/tool/advanced/RockCutterItem.java @@ -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)); } diff --git a/src/main/java/techreborn/items/tool/basic/ItemBasicChainsaw.java b/src/main/java/techreborn/items/tool/basic/BasicChainsawItem.java similarity index 94% rename from src/main/java/techreborn/items/tool/basic/ItemBasicChainsaw.java rename to src/main/java/techreborn/items/tool/basic/BasicChainsawItem.java index 6e94ba85a..17cabf6ef 100644 --- a/src/main/java/techreborn/items/tool/basic/ItemBasicChainsaw.java +++ b/src/main/java/techreborn/items/tool/basic/BasicChainsawItem.java @@ -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; } diff --git a/src/main/java/techreborn/items/tool/basic/ItemBasicDrill.java b/src/main/java/techreborn/items/tool/basic/BasicDrillItem.java similarity index 94% rename from src/main/java/techreborn/items/tool/basic/ItemBasicDrill.java rename to src/main/java/techreborn/items/tool/basic/BasicDrillItem.java index e491518f2..92157dd18 100644 --- a/src/main/java/techreborn/items/tool/basic/ItemBasicDrill.java +++ b/src/main/java/techreborn/items/tool/basic/BasicDrillItem.java @@ -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; } diff --git a/src/main/java/techreborn/items/tool/basic/ItemBasicJackhammer.java b/src/main/java/techreborn/items/tool/basic/BasicJackhammerItem.java similarity index 93% rename from src/main/java/techreborn/items/tool/basic/ItemBasicJackhammer.java rename to src/main/java/techreborn/items/tool/basic/BasicJackhammerItem.java index 52e3e3f03..64231fe66 100644 --- a/src/main/java/techreborn/items/tool/basic/ItemBasicJackhammer.java +++ b/src/main/java/techreborn/items/tool/basic/BasicJackhammerItem.java @@ -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; } diff --git a/src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java b/src/main/java/techreborn/items/tool/basic/ElectricTreetapItem.java similarity index 96% rename from src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java rename to src/main/java/techreborn/items/tool/basic/ElectricTreetapItem.java index 7a6b82fd0..24e4a888a 100644 --- a/src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java +++ b/src/main/java/techreborn/items/tool/basic/ElectricTreetapItem.java @@ -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)); } diff --git a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java b/src/main/java/techreborn/items/tool/industrial/IndustrialChainsawItem.java similarity index 96% rename from src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java rename to src/main/java/techreborn/items/tool/industrial/IndustrialChainsawItem.java index b201d9c8c..6b351a91e 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java +++ b/src/main/java/techreborn/items/tool/industrial/IndustrialChainsawItem.java @@ -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); } } diff --git a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java b/src/main/java/techreborn/items/tool/industrial/IndustrialDrillItem.java similarity index 94% rename from src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java rename to src/main/java/techreborn/items/tool/industrial/IndustrialDrillItem.java index 6a0a8b37a..9c9275fdc 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java +++ b/src/main/java/techreborn/items/tool/industrial/IndustrialDrillItem.java @@ -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 getTargetBlocks(World worldIn, BlockPos pos, @Nullable PlayerEntity playerIn) { - Set targetBlocks = new HashSet(); + Set 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 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 itemList) { diff --git a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialJackhammer.java b/src/main/java/techreborn/items/tool/industrial/IndustrialJackhammerItem.java similarity index 93% rename from src/main/java/techreborn/items/tool/industrial/ItemIndustrialJackhammer.java rename to src/main/java/techreborn/items/tool/industrial/IndustrialJackhammerItem.java index 2ce688478..38ea40156 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialJackhammer.java +++ b/src/main/java/techreborn/items/tool/industrial/IndustrialJackhammerItem.java @@ -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; diff --git a/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java b/src/main/java/techreborn/items/tool/industrial/NanosaberItem.java similarity index 98% rename from src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java rename to src/main/java/techreborn/items/tool/industrial/NanosaberItem.java index 01eb1c214..a22f32215 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java +++ b/src/main/java/techreborn/items/tool/industrial/NanosaberItem.java @@ -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 diff --git a/src/main/java/techreborn/items/tool/industrial/ItemOmniTool.java b/src/main/java/techreborn/items/tool/industrial/OmniToolItem.java similarity index 81% rename from src/main/java/techreborn/items/tool/industrial/ItemOmniTool.java rename to src/main/java/techreborn/items/tool/industrial/OmniToolItem.java index 683b553b1..a26660432 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemOmniTool.java +++ b/src/main/java/techreborn/items/tool/industrial/OmniToolItem.java @@ -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 itemList) { + if (!isIn(par2ItemGroup)) { + return; + } + InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList); } + @Environment(EnvType.CLIENT) @Override public void appendTooltip(ItemStack stack, @Nullable World worldIn, List 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 itemList) { - if (!isIn(par2ItemGroup)) { - return; - } - InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList); - } - - // IEnergyItemInfo + // EnergyHolder @Override public double getMaxStoredPower() { return maxCharge; diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/tool/omni_tool.json b/src/main/resources/data/techreborn/recipes/crafting_table/tool/omni_tool.json new file mode 100644 index 000000000..88bcbc448 --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/tool/omni_tool.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "D ", + " C ", + " S" + ], + "key": { + "D": { + "item": "techreborn:advanced_drill" + }, + "C": { + "item": "techreborn:advanced_chainsaw" + }, + "S": { + "item": "minecraft:diamond_sword" + } + }, + "result": { + "item": "techreborn:omni_tool" + } +} \ No newline at end of file