Refactoring & cleaning
This commit is contained in:
parent
874559c21e
commit
e5736669ca
200 changed files with 1382 additions and 1596 deletions
|
@ -26,6 +26,7 @@ package techreborn.items.battery;
|
|||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -38,28 +39,28 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.items.ItemTR;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemBattery extends ItemTR implements IEnergyItemInfo {
|
||||
public class ItemBattery extends Item implements IEnergyItemInfo {
|
||||
|
||||
String name;
|
||||
int maxEnergy = 0;
|
||||
int maxTransfer = 0;
|
||||
|
||||
public ItemBattery(String name, int maxEnergy, int maxTransfer) {
|
||||
public ItemBattery(int maxEnergy, int maxTransfer) {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(1);
|
||||
setTranslationKey("techreborn." + name);
|
||||
this.name = name;
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxTransfer = maxTransfer;
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
public float apply(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn,
|
||||
@Nullable
|
||||
EntityLivingBase entityIn) {
|
||||
if (!stack.isEmpty() && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ public class ItemBattery extends ItemTR implements IEnergyItemInfo {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
|
@ -86,7 +87,9 @@ public class ItemBattery extends ItemTR implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
NBTTagCompound nbt) {
|
||||
return new PoweredItemCapabilityProvider(stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ItemEnergyCrystal extends ItemBattery {
|
|||
|
||||
// 4M FE storage with 1k charge rate
|
||||
public ItemEnergyCrystal() {
|
||||
super("energyCrystal", ConfigTechReborn.EnergyCrystalMaxCharge, 1_000);
|
||||
super(ConfigTechReborn.EnergyCrystalMaxCharge, 1_000);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ItemLapotronCrystal extends ItemBattery {
|
|||
|
||||
// 40M FE capacity with 10k FE\t charge rate
|
||||
public ItemLapotronCrystal() {
|
||||
super("lapotronCrystal", ConfigTechReborn.LapotronCrystalMaxCharge, 10_000);
|
||||
super(ConfigTechReborn.LapotronCrystalMaxCharge, 10_000);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -45,12 +45,12 @@ public class ItemLapotronCrystal extends ItemBattery {
|
|||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRItems.LAPOTRONIC_CRYSTAL);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
ItemStack stack = new ItemStack(TRItems.LAPOTRON_CRYSTAL);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
// itemList.add(charged);
|
||||
// itemList.add(charged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ItemLapotronicOrb extends ItemBattery {
|
|||
|
||||
// 400M capacity with 100k FE\t charge rate
|
||||
public ItemLapotronicOrb() {
|
||||
super("lapotronicorb", ConfigTechReborn.LapotronicOrbMaxCharge, 100_000);
|
||||
super(ConfigTechReborn.LapotronicOrbMaxCharge, 100_000);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -31,11 +31,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import techreborn.init.TRItems;
|
||||
|
||||
public class ItemLithiumBattery extends ItemBattery {
|
||||
public class ItemLithiumIonBattery extends ItemBattery {
|
||||
|
||||
// 400k FE with 1k FE\t charge rate
|
||||
public ItemLithiumBattery() {
|
||||
super("lithiumBattery", 400_000, 1_000);
|
||||
public ItemLithiumIonBattery() {
|
||||
super(400_000, 1_000);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -44,9 +44,9 @@ public class ItemLithiumBattery extends ItemBattery {
|
|||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRItems.LITHIUM_BATTERY);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
ItemStack stack = new ItemStack(TRItems.LITHIUM_ION_BATTERY);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
//capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
|
@ -31,11 +31,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import techreborn.init.TRItems;
|
||||
|
||||
public class ItemReBattery extends ItemBattery {
|
||||
public class ItemRechargeableBattery extends ItemBattery {
|
||||
|
||||
// 40k FE capacity with 100 FE\t charge rate
|
||||
public ItemReBattery() {
|
||||
super("rebattery", 40_000, 100);
|
||||
public ItemRechargeableBattery() {
|
||||
super(40_000, 100);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -44,8 +44,8 @@ public class ItemReBattery extends ItemBattery {
|
|||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRItems.RE_BATTERY);
|
||||
// ItemStack charged = stack.copy();
|
||||
ItemStack stack = new ItemStack(TRItems.RECHARGEABLE_BATTERY);
|
||||
// ItemStack charged = stack.copy();
|
||||
//IEnergyStorage capEnergy = charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
//capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue