Migrated batteries + TR Itemgroup
This commit is contained in:
parent
0c99a94250
commit
e513e20e5a
16 changed files with 101 additions and 108 deletions
|
@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
|||
import reborncore.api.tile.IUpgrade;
|
||||
import reborncore.common.recipes.IUpgradeHandler;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -39,9 +40,9 @@ public class ItemUpgrade extends Item implements IUpgrade {
|
|||
public final IUpgrade behavior;
|
||||
|
||||
public ItemUpgrade(String name, IUpgrade process) {
|
||||
super(new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(16));
|
||||
this.name = name;
|
||||
this.behavior = process;
|
||||
setMaxStackSize(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,9 +52,7 @@ public class ItemLapotronicOrbpack extends ItemArmor implements IEnergyItemInfo
|
|||
public int transferLimit = 100_000;
|
||||
|
||||
public ItemLapotronicOrbpack() {
|
||||
super(ArmorMaterial.DIAMOND, EntityEquipmentSlot.CHEST, (new Item.Builder()).group(ItemGroup.COMBAT));
|
||||
//TODO: move to builder
|
||||
//setMaxStackSize(1);
|
||||
super(ArmorMaterial.DIAMOND, EntityEquipmentSlot.CHEST, new Item.Properties().maxStackSize(1));
|
||||
}
|
||||
|
||||
// Item
|
||||
|
|
|
@ -56,9 +56,7 @@ public class ItemLithiumIonBatpack extends ItemArmor implements IEnergyItemInfo
|
|||
public int transferLimit = 2_000;
|
||||
|
||||
public ItemLithiumIonBatpack() {
|
||||
super(ArmorMaterial.DIAMOND, EntityEquipmentSlot.CHEST, (new Item.Builder()).group(ItemGroup.COMBAT));
|
||||
//TODO: move to builder
|
||||
//setMaxStackSize(1);
|
||||
super(ArmorMaterial.DIAMOND, EntityEquipmentSlot.CHEST, new Item.Properties().maxStackSize(1));
|
||||
}
|
||||
|
||||
public static void distributePowerToInventory(World world, EntityPlayer player, ItemStack itemStack, int maxSend) {
|
||||
|
|
|
@ -27,6 +27,7 @@ package techreborn.items.armor;
|
|||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.*;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
||||
/**
|
||||
|
@ -41,7 +42,7 @@ public class ItemTRArmour extends ItemArmor {
|
|||
}
|
||||
|
||||
public ItemTRArmour(IArmorMaterial material, EntityEquipmentSlot slot, String repairOreDict) {
|
||||
super(material, slot, (new Item.Properties()).group(ItemGroup.COMBAT));
|
||||
super(material, slot, (new Item.Properties()).group(TechReborn.ITEMGROUP).maxStackSize(1));
|
||||
this.repairOreDict = repairOreDict;
|
||||
if (slot == EntityEquipmentSlot.HEAD)
|
||||
//setTranslationKey(material.name().toLowerCase() + "Helmet");
|
||||
|
|
|
@ -39,6 +39,7 @@ import reborncore.common.powerSystem.PowerSystem;
|
|||
import reborncore.common.powerSystem.PoweredItemContainerProvider;
|
||||
import reborncore.common.powerSystem.forge.ForgePowerItemManager;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -48,15 +49,13 @@ public class ItemBattery extends Item implements IEnergyItemInfo {
|
|||
int maxTransfer = 0;
|
||||
|
||||
public ItemBattery(int maxEnergy, int maxTransfer) {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(1);
|
||||
super(new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(1).defaultMaxDamage(1));
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxTransfer = maxTransfer;
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
public float call(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
if (!stack.isEmpty() && new ForgePowerItemManager(stack).getEnergyStored() == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.items.battery;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -39,19 +39,18 @@ public class ItemEnergyCrystal extends ItemBattery {
|
|||
public ItemEnergyCrystal() {
|
||||
super(ConfigTechReborn.EnergyCrystalMaxCharge, 1_000);
|
||||
}
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList<ItemStack> itemList) {
|
||||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
if (!isInGroup(group)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRContent.ENERGY_CRYSTAL);
|
||||
ItemStack charged = stack.copy();
|
||||
ItemStack uncharged = new ItemStack(TRContent.ENERGY_CRYSTAL);
|
||||
ItemStack charged = new ItemStack(TRContent.ENERGY_CRYSTAL);
|
||||
ForgePowerItemManager capEnergy = new ForgePowerItemManager(charged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
itemList.add(charged);
|
||||
items.add(uncharged);
|
||||
items.add(charged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.items.battery;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -39,19 +39,18 @@ public class ItemLapotronCrystal extends ItemBattery {
|
|||
public ItemLapotronCrystal() {
|
||||
super(ConfigTechReborn.LapotronCrystalMaxCharge, 10_000);
|
||||
}
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList<ItemStack> itemList) {
|
||||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
if (!isInGroup(group)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRContent.LAPOTRON_CRYSTAL);
|
||||
ItemStack charged = stack.copy();
|
||||
ItemStack uncharged = new ItemStack(TRContent.LAPOTRON_CRYSTAL);
|
||||
ItemStack charged = new ItemStack(TRContent.LAPOTRON_CRYSTAL);
|
||||
ForgePowerItemManager capEnergy = new ForgePowerItemManager(charged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
itemList.add(charged);
|
||||
items.add(uncharged);
|
||||
items.add(charged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.items.battery;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -39,19 +39,18 @@ public class ItemLapotronicOrb extends ItemBattery {
|
|||
public ItemLapotronicOrb() {
|
||||
super(ConfigTechReborn.LapotronicOrbMaxCharge, 100_000);
|
||||
}
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList<ItemStack> itemList) {
|
||||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
if (!isInGroup(group)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRContent.LAPOTRONIC_ORB);
|
||||
ItemStack charged = stack.copy();
|
||||
ItemStack uncharged = new ItemStack(TRContent.LAPOTRONIC_ORB);
|
||||
ItemStack charged = new ItemStack(TRContent.LAPOTRONIC_ORB);
|
||||
ForgePowerItemManager capEnergy = new ForgePowerItemManager(charged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
itemList.add(charged);
|
||||
items.add(uncharged);
|
||||
items.add(charged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.items.battery;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -38,20 +38,19 @@ public class ItemLithiumIonBattery extends ItemBattery {
|
|||
public ItemLithiumIonBattery() {
|
||||
super(400_000, 1_000);
|
||||
}
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList<ItemStack> itemList) {
|
||||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
if (!isInGroup(group)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRContent.LITHIUM_ION_BATTERY);
|
||||
ItemStack charged = stack.copy();
|
||||
ItemStack uncharged = new ItemStack(TRContent.LITHIUM_ION_BATTERY);
|
||||
ItemStack charged = new ItemStack(TRContent.LITHIUM_ION_BATTERY);
|
||||
ForgePowerItemManager capEnergy = new ForgePowerItemManager(charged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
itemList.add(charged);
|
||||
items.add(uncharged);
|
||||
items.add(charged);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.items.battery;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -38,19 +38,18 @@ public class ItemRedCellBattery extends ItemBattery {
|
|||
public ItemRedCellBattery() {
|
||||
super(40_000, 100);
|
||||
}
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList<ItemStack> itemList) {
|
||||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
if (!isInGroup(group)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRContent.LITHIUM_ION_BATTERY);
|
||||
ItemStack charged = stack.copy();
|
||||
ItemStack uncharged = new ItemStack(TRContent.RED_CELL_BATTERY);
|
||||
ItemStack charged = new ItemStack(TRContent.RED_CELL_BATTERY);
|
||||
ForgePowerItemManager capEnergy = new ForgePowerItemManager(charged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
itemList.add(charged);
|
||||
items.add(uncharged);
|
||||
items.add(charged);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue