Powered items should be indestructible now (#1970)
This commit is contained in:
parent
f1731fe925
commit
e4bc2a0cb7
8 changed files with 33 additions and 8 deletions
|
@ -51,7 +51,7 @@ public class ItemLapotronicOrbpack extends ArmorItem implements EnergyHolder, It
|
||||||
public int transferLimit = 100_000;
|
public int transferLimit = 100_000;
|
||||||
|
|
||||||
public ItemLapotronicOrbpack() {
|
public ItemLapotronicOrbpack() {
|
||||||
super(TRArmorMaterial.LAPOTRONPACK, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
super(TRArmorMaterial.LAPOTRONPACK, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item
|
// Item
|
||||||
|
@ -70,6 +70,11 @@ public class ItemLapotronicOrbpack extends ArmorItem implements EnergyHolder, It
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDamageable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurability(ItemStack stack) {
|
public double getDurability(ItemStack stack) {
|
||||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class ItemLithiumIonBatpack extends ArmorItem implements EnergyHolder, It
|
||||||
public int transferLimit = 2_000;
|
public int transferLimit = 2_000;
|
||||||
|
|
||||||
public ItemLithiumIonBatpack() {
|
public ItemLithiumIonBatpack() {
|
||||||
super(TRArmorMaterial.LITHIUMBATPACK, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
super(TRArmorMaterial.LITHIUMBATPACK, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void distributePowerToInventory(World world, PlayerEntity player, ItemStack itemStack, int maxSend) {
|
public static void distributePowerToInventory(World world, PlayerEntity player, ItemStack itemStack, int maxSend) {
|
||||||
|
@ -86,6 +86,11 @@ public class ItemLithiumIonBatpack extends ArmorItem implements EnergyHolder, It
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDamageable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getDurability(ItemStack stack) {
|
public double getDurability(ItemStack stack) {
|
||||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||||
|
|
|
@ -55,10 +55,15 @@ public class ItemTRArmour extends ArmorItem implements ItemDurabilityExtensions
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemTRArmour(ArmorMaterial material, EquipmentSlot slot, String repairOreDict) {
|
public ItemTRArmour(ArmorMaterial material, EquipmentSlot slot, String repairOreDict) {
|
||||||
super(material, slot, (new Item.Settings()).group(TechReborn.ITEMGROUP).maxCount(1));
|
super(material, slot, (new Item.Settings()).group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
this.repairOreDict = repairOreDict;
|
this.repairOreDict = repairOreDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDamageable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRepair(ItemStack toRepair, ItemStack repair) {
|
public boolean canRepair(ItemStack toRepair, ItemStack repair) {
|
||||||
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
|
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ChainsawItem extends AxeItem implements EnergyHolder, ItemDurabilit
|
||||||
public int transferLimit = 100;
|
public int transferLimit = 100;
|
||||||
|
|
||||||
public ChainsawItem(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));
|
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
this.maxCharge = energyCapacity;
|
this.maxCharge = energyCapacity;
|
||||||
|
|
||||||
this.addPropertyGetter(new Identifier("techreborn", "animated"), (stack, worldIn, entityIn) -> {
|
this.addPropertyGetter(new Identifier("techreborn", "animated"), (stack, worldIn, entityIn) -> {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabili
|
||||||
public int transferLimit = 100;
|
public int transferLimit = 100;
|
||||||
|
|
||||||
public DrillItem(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));
|
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
this.maxCharge = energyCapacity;
|
this.maxCharge = energyCapacity;
|
||||||
this.unpoweredSpeed = unpoweredSpeed;
|
this.unpoweredSpeed = unpoweredSpeed;
|
||||||
this.poweredSpeed = efficiencyOnProperMaterial;
|
this.poweredSpeed = efficiencyOnProperMaterial;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
||||||
public int transferLimit = EnergyTier.MEDIUM.getMaxInput();
|
public int transferLimit = EnergyTier.MEDIUM.getMaxInput();
|
||||||
|
|
||||||
public JackhammerItem(ToolMaterials material, int energyCapacity) {
|
public JackhammerItem(ToolMaterials material, int energyCapacity) {
|
||||||
super(material, (int) material.getAttackDamage(), 1f, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
super(material, (int) material.getAttackDamage(), 1f, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
this.maxCharge = energyCapacity;
|
this.maxCharge = energyCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +82,11 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDamageable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ToolItem
|
// ToolItem
|
||||||
@Override
|
@Override
|
||||||
public boolean canRepair(ItemStack stack, ItemStack ingredient) {
|
public boolean canRepair(ItemStack stack, ItemStack ingredient) {
|
||||||
|
|
|
@ -48,7 +48,12 @@ public class ElectricTreetapItem extends Item implements EnergyHolder, ItemDurab
|
||||||
public int cost = 20;
|
public int cost = 20;
|
||||||
|
|
||||||
public ElectricTreetapItem() {
|
public ElectricTreetapItem() {
|
||||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDamageable() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
|
||||||
|
|
||||||
// 4M FE max charge with 1k charge rate
|
// 4M FE max charge with 1k charge rate
|
||||||
public NanosaberItem() {
|
public NanosaberItem() {
|
||||||
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
this.addPropertyGetter(new Identifier("techreborn:active"), (stack, worldIn, entityIn) -> {
|
this.addPropertyGetter(new Identifier("techreborn:active"), (stack, worldIn, entityIn) -> {
|
||||||
if (ItemUtils.isActive(stack)) {
|
if (ItemUtils.isActive(stack)) {
|
||||||
if (Energy.of(stack).getMaxStored() - Energy.of(stack).getEnergy() >= 0.9 * Energy.of(stack).getMaxStored()) {
|
if (Energy.of(stack).getMaxStored() - Energy.of(stack).getEnergy() >= 0.9 * Energy.of(stack).getMaxStored()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue