Itemgroup filler moved to init utils.

This commit is contained in:
drcrazy 2019-08-13 17:02:34 +03:00
parent 62f1c521f0
commit f9023d7b0f
21 changed files with 62 additions and 150 deletions

View file

@ -41,6 +41,7 @@ import reborncore.common.util.ItemUtils;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRArmorMaterial; import techreborn.init.TRArmorMaterial;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo { public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo {
@ -76,16 +77,11 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) { public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) { if (!isIn(group)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.CLOAKING_DEVICE); InitUtils.initPoweredItems(TRContent.CLOAKING_DEVICE, itemList);
ItemStack charged = new ItemStack(TRContent.CLOAKING_DEVICE);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
items.add(uncharged);
items.add(charged);
} }
@Override @Override

View file

@ -31,13 +31,13 @@ import net.minecraft.item.*;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.api.power.IEnergyItemInfo; import reborncore.api.power.IEnergyItemInfo;
import reborncore.api.power.ItemPowerManager;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions; import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions { public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
@ -51,16 +51,11 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo,
// Item // Item
@Override @Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) { public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) { if (!isIn(group)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.LAPOTRONIC_ORBPACK); InitUtils.initPoweredItems(TRContent.LAPOTRONIC_ORBPACK, itemList);
ItemStack charged = new ItemStack(TRContent.LAPOTRONIC_ORBPACK);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
items.add(uncharged);
items.add(charged);
} }
@Override @Override

View file

@ -40,6 +40,7 @@ import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions { public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
@ -91,16 +92,11 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) { public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) { if (!isIn(group)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.LITHIUM_ION_BATPACK); InitUtils.initPoweredItems(TRContent.LITHIUM_ION_BATPACK, itemList);
ItemStack charged = new ItemStack(TRContent.LITHIUM_ION_BATPACK);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
items.add(uncharged);
items.add(charged);
} }
// IEnergyItemInfo // IEnergyItemInfo

View file

@ -29,9 +29,9 @@ import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
public class ItemEnergyCrystal extends ItemBattery { public class ItemEnergyCrystal extends ItemBattery {
@ -42,15 +42,10 @@ public class ItemEnergyCrystal extends ItemBattery {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) { public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) { if (!isIn(group)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.ENERGY_CRYSTAL); InitUtils.initPoweredItems(TRContent.ENERGY_CRYSTAL, itemList);
ItemStack charged = new ItemStack(TRContent.ENERGY_CRYSTAL);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
items.add(uncharged);
items.add(charged);
} }
} }

View file

@ -29,9 +29,9 @@ import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
public class ItemLapotronCrystal extends ItemBattery { public class ItemLapotronCrystal extends ItemBattery {
@ -42,15 +42,10 @@ public class ItemLapotronCrystal extends ItemBattery {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) { public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) { if (!isIn(group)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.LAPOTRON_CRYSTAL); InitUtils.initPoweredItems(TRContent.LAPOTRON_CRYSTAL, itemList);
ItemStack charged = new ItemStack(TRContent.LAPOTRON_CRYSTAL);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
items.add(uncharged);
items.add(charged);
} }
} }

View file

@ -29,9 +29,9 @@ import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
public class ItemLapotronicOrb extends ItemBattery { public class ItemLapotronicOrb extends ItemBattery {
@ -42,15 +42,10 @@ public class ItemLapotronicOrb extends ItemBattery {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) { public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) { if (!isIn(group)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.LAPOTRONIC_ORB); InitUtils.initPoweredItems(TRContent.LAPOTRONIC_ORB, itemList);
ItemStack charged = new ItemStack(TRContent.LAPOTRONIC_ORB);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
items.add(uncharged);
items.add(charged);
} }
} }

View file

@ -29,8 +29,8 @@ import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
public class ItemLithiumIonBattery extends ItemBattery { public class ItemLithiumIonBattery extends ItemBattery {
@ -41,16 +41,11 @@ public class ItemLithiumIonBattery extends ItemBattery {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) { public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) { if (!isIn(group)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.LITHIUM_ION_BATTERY); InitUtils.initPoweredItems(TRContent.LITHIUM_ION_BATTERY, itemList);
ItemStack charged = new ItemStack(TRContent.LITHIUM_ION_BATTERY);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
items.add(uncharged);
items.add(charged);
} }
} }

View file

@ -29,8 +29,8 @@ import net.fabricmc.api.Environment;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
public class ItemRedCellBattery extends ItemBattery { public class ItemRedCellBattery extends ItemBattery {
@ -41,15 +41,10 @@ public class ItemRedCellBattery extends ItemBattery {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) { public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) { if (!isIn(group)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.RED_CELL_BATTERY); InitUtils.initPoweredItems(TRContent.RED_CELL_BATTERY, itemList);
ItemStack charged = new ItemStack(TRContent.RED_CELL_BATTERY);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
items.add(uncharged);
items.add(charged);
} }
} }

View file

@ -32,10 +32,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemChainsaw; import techreborn.items.tool.ItemChainsaw;
import techreborn.utils.InitUtils;
public class ItemAdvancedChainsaw extends ItemChainsaw { public class ItemAdvancedChainsaw extends ItemChainsaw {
@ -52,13 +52,7 @@ public class ItemAdvancedChainsaw extends ItemChainsaw {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.ADVANCED_CHAINSAW); InitUtils.initPoweredItems(TRContent.ADVANCED_CHAINSAW, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
@Override @Override

View file

@ -32,10 +32,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemDrill; import techreborn.items.tool.ItemDrill;
import techreborn.utils.InitUtils;
public class ItemAdvancedDrill extends ItemDrill { public class ItemAdvancedDrill extends ItemDrill {
@ -52,13 +52,7 @@ public class ItemAdvancedDrill extends ItemDrill {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.ADVANCED_DRILL); InitUtils.initPoweredItems(TRContent.ADVANCED_DRILL, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
@Override @Override

View file

@ -30,10 +30,10 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemJackhammer; import techreborn.items.tool.ItemJackhammer;
import techreborn.utils.InitUtils;
public class ItemAdvancedJackhammer extends ItemJackhammer { public class ItemAdvancedJackhammer extends ItemJackhammer {
@ -50,12 +50,6 @@ public class ItemAdvancedJackhammer extends ItemJackhammer {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.ADVANCED_JACKHAMMER); InitUtils.initPoweredItems(TRContent.ADVANCED_JACKHAMMER, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
} }

View file

@ -139,7 +139,7 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored()); capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(uncharged); itemList.add(uncharged);
// itemList.add(charged); itemList.add(charged);
} }
// IEnergyItemInfo // IEnergyItemInfo

View file

@ -32,10 +32,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemChainsaw; import techreborn.items.tool.ItemChainsaw;
import techreborn.utils.InitUtils;
public class ItemBasicChainsaw extends ItemChainsaw { public class ItemBasicChainsaw extends ItemChainsaw {
@ -50,13 +50,7 @@ public class ItemBasicChainsaw extends ItemChainsaw {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.BASIC_CHAINSAW); InitUtils.initPoweredItems(TRContent.BASIC_CHAINSAW, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
@Override @Override

View file

@ -32,10 +32,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemDrill; import techreborn.items.tool.ItemDrill;
import techreborn.utils.InitUtils;
public class ItemBasicDrill extends ItemDrill { public class ItemBasicDrill extends ItemDrill {
@ -50,13 +50,7 @@ public class ItemBasicDrill extends ItemDrill {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.BASIC_DRILL); InitUtils.initPoweredItems(TRContent.BASIC_DRILL, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
@Override @Override

View file

@ -30,10 +30,10 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemJackhammer; import techreborn.items.tool.ItemJackhammer;
import techreborn.utils.InitUtils;
public class ItemBasicJackhammer extends ItemJackhammer { public class ItemBasicJackhammer extends ItemJackhammer {
@ -48,12 +48,6 @@ public class ItemBasicJackhammer extends ItemJackhammer {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.BASIC_JACKHAMMER); InitUtils.initPoweredItems(TRContent.BASIC_JACKHAMMER, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
} }

View file

@ -31,13 +31,13 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.IEnergyItemInfo; import reborncore.api.power.IEnergyItemInfo;
import reborncore.api.power.ItemPowerManager;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions; import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
/** /**
* Created by modmuss50 on 05/11/2016. * Created by modmuss50 on 05/11/2016.
@ -72,13 +72,7 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDu
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.ELECTRIC_TREE_TAP); InitUtils.initPoweredItems(TRContent.ELECTRIC_TREE_TAP, itemList);
ItemStack charged = new ItemStack(TRContent.ELECTRIC_TREE_TAP);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(uncharged);
itemList.add(charged);
} }
// IEnergyItemInfo // IEnergyItemInfo

View file

@ -51,6 +51,7 @@ import reborncore.common.util.ItemUtils;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemChainsaw; import techreborn.items.tool.ItemChainsaw;
import techreborn.utils.InitUtils;
import techreborn.utils.MessageIDs; import techreborn.utils.MessageIDs;
import techreborn.utils.TagUtils; import techreborn.utils.TagUtils;
@ -76,13 +77,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.INDUSTRIAL_CHAINSAW); InitUtils.initPoweredItems(TRContent.INDUSTRIAL_CHAINSAW, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
@Override @Override

View file

@ -54,6 +54,7 @@ import reborncore.common.util.ItemUtils;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemDrill; import techreborn.items.tool.ItemDrill;
import techreborn.utils.InitUtils;
import techreborn.utils.MessageIDs; import techreborn.utils.MessageIDs;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -71,7 +72,7 @@ public class ItemIndustrialDrill extends ItemDrill {
this.transferLimit = 1000; this.transferLimit = 1000;
} }
public Set<BlockPos> getTargetBlocks(World worldIn, BlockPos pos, @Nullable PlayerEntity playerIn) { private Set<BlockPos> getTargetBlocks(World worldIn, BlockPos pos, @Nullable PlayerEntity playerIn) {
Set<BlockPos> targetBlocks = new HashSet<BlockPos>(); Set<BlockPos> targetBlocks = new HashSet<BlockPos>();
if (playerIn == null) { if (playerIn == null) {
return new HashSet<>(); return new HashSet<>();
@ -117,7 +118,7 @@ public class ItemIndustrialDrill extends ItemDrill {
return targetBlocks; return targetBlocks;
} }
public void breakBlock(BlockPos pos, World world, PlayerEntity playerIn, ItemStack drill) { private void breakBlock(BlockPos pos, World world, PlayerEntity playerIn, ItemStack drill) {
BlockState blockState = world.getBlockState(pos); BlockState blockState = world.getBlockState(pos);
ItemPowerManager capEnergy = new ItemPowerManager(drill); ItemPowerManager capEnergy = new ItemPowerManager(drill);
@ -243,12 +244,6 @@ public class ItemIndustrialDrill extends ItemDrill {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.INDUSTRIAL_DRILL); InitUtils.initPoweredItems(TRContent.INDUSTRIAL_DRILL, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
} }

View file

@ -30,10 +30,10 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import reborncore.api.power.ItemPowerManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.items.tool.ItemJackhammer; import techreborn.items.tool.ItemJackhammer;
import techreborn.utils.InitUtils;
public class ItemIndustrialJackhammer extends ItemJackhammer { public class ItemIndustrialJackhammer extends ItemJackhammer {
@ -51,12 +51,6 @@ public class ItemIndustrialJackhammer extends ItemJackhammer {
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack stack = new ItemStack(TRContent.INDUSTRIAL_JACKHAMMER); InitUtils.initPoweredItems(TRContent.INDUSTRIAL_JACKHAMMER, itemList);
ItemStack charged = stack.copy();
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(stack);
itemList.add(charged);
} }
} }

View file

@ -49,6 +49,7 @@ import reborncore.common.util.TorchHelper;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
@ -157,13 +158,7 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
if (!isIn(par2ItemGroup)) { if (!isIn(par2ItemGroup)) {
return; return;
} }
ItemStack uncharged = new ItemStack(TRContent.OMNI_TOOL); InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList);
ItemStack charged = new ItemStack(TRContent.OMNI_TOOL);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(uncharged);
itemList.add(charged);
} }
// IEnergyItemInfo // IEnergyItemInfo

View file

@ -26,10 +26,13 @@ package techreborn.utils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import reborncore.RebornRegistry; import reborncore.RebornRegistry;
import reborncore.api.power.ItemPowerManager;
import techreborn.TechReborn; import techreborn.TechReborn;
public class InitUtils { public class InitUtils {
@ -47,4 +50,14 @@ public class InitUtils {
Identifier identifier = new Identifier(TechReborn.MOD_ID, name); Identifier identifier = new Identifier(TechReborn.MOD_ID, name);
return Registry.register(Registry.SOUND_EVENT, identifier, new SoundEvent(identifier)); return Registry.register(Registry.SOUND_EVENT, identifier, new SoundEvent(identifier));
} }
public static void initPoweredItems(Item item, DefaultedList<ItemStack> itemList) {
ItemStack uncharged = new ItemStack(item);
ItemStack charged = new ItemStack(item);
ItemPowerManager capEnergy = new ItemPowerManager(charged);
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
itemList.add(uncharged);
itemList.add(charged);
}
} }