Fix various issues relating to armor [Fixes #1952]
This commit is contained in:
parent
bcc9368bf9
commit
960b064b5a
22 changed files with 138 additions and 127 deletions
|
@ -52,9 +52,9 @@ import techreborn.utils.MessageIDs;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemFrequencyTransmitter extends Item {
|
||||
public class FrequencyTransmitterItem extends Item {
|
||||
|
||||
public ItemFrequencyTransmitter() {
|
||||
public FrequencyTransmitterItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
this.addPropertyGetter(new Identifier("techreborn", "coords"), new ItemPropertyGetter() {
|
||||
@Override
|
||||
|
@ -145,7 +145,7 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
String text = "";
|
||||
Formatting gold = Formatting.GOLD;
|
||||
Formatting grey = Formatting.GRAY;
|
||||
if (stack.getItem() instanceof ItemFrequencyTransmitter) {
|
||||
if (stack.getItem() instanceof FrequencyTransmitterItem) {
|
||||
if (stack.hasTag() && stack.getTag() != null && stack.getTag().contains("x") && stack.getTag().contains("y") && stack.getTag().contains("z") && stack.getTag().contains("dim")) {
|
||||
int coordX = stack.getTag().getInt("x");
|
||||
int coordY = stack.getTag().getInt("y");
|
|
@ -37,9 +37,9 @@ import net.minecraft.world.World;
|
|||
import techreborn.TechReborn;
|
||||
import techreborn.client.gui.GuiManual;
|
||||
|
||||
public class ItemManual extends Item {
|
||||
public class ManualItem extends Item {
|
||||
|
||||
public ItemManual() {
|
||||
public ManualItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
}
|
||||
|
|
@ -38,9 +38,9 @@ import techreborn.init.ModRecipes;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemScrapBox extends Item {
|
||||
public class ScrapBoxItem extends Item {
|
||||
|
||||
public ItemScrapBox() {
|
||||
public ScrapBoxItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
}
|
||||
|
|
@ -44,12 +44,12 @@ import javax.annotation.Nonnull;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemUpgrade extends Item implements IUpgrade {
|
||||
public class UpgradeItem extends Item implements IUpgrade {
|
||||
|
||||
public final String name;
|
||||
public final IUpgrade behavior;
|
||||
|
||||
public ItemUpgrade(String name, IUpgrade process) {
|
||||
public UpgradeItem(String name, IUpgrade process) {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(16));
|
||||
this.name = name;
|
||||
this.behavior = process;
|
|
@ -26,14 +26,12 @@ package techreborn.items.armor;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.items.ArmorRemoveHandler;
|
||||
import reborncore.api.items.ArmorTickable;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
|
@ -42,12 +40,13 @@ import team.reborn.energy.Energy;
|
|||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRArmorMaterials;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemCloakingDevice extends ItemTRArmour implements EnergyHolder, ArmorTickable, ArmorRemoveHandler {
|
||||
public class CloakingDeviceItem extends TRArmourItem implements EnergyHolder, ArmorTickable, ArmorRemoveHandler {
|
||||
|
||||
public static int maxCharge = TechRebornConfig.cloakingDeviceCharge;
|
||||
public static int usage = TechRebornConfig.cloackingDeviceUsage;
|
||||
|
@ -55,8 +54,13 @@ public class ItemCloakingDevice extends ItemTRArmour implements EnergyHolder, Ar
|
|||
public static boolean isActive;
|
||||
|
||||
// 40M FE capacity with 10k FE\t charge rate
|
||||
public ItemCloakingDevice() {
|
||||
super(TRArmorMaterial.CLOAKING, EquipmentSlot.CHEST);
|
||||
public CloakingDeviceItem() {
|
||||
super(TRArmorMaterials.CLOAKING_DEVICE, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxDamage(-1).maxCount(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRepair(ItemStack stack, ItemStack ingredient) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ItemTRArmour
|
||||
|
@ -70,6 +74,11 @@ public class ItemCloakingDevice extends ItemTRArmour implements EnergyHolder, Ar
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnchantable(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
|
@ -40,18 +40,18 @@ import team.reborn.energy.EnergyHolder;
|
|||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRArmorMaterials;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLapotronicOrbpack extends ArmorItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class LapotronicOrbpackItem extends ArmorItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
// 400M FE maxCharge and 100k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = TechRebornConfig.lapotronPackCharge;
|
||||
public int transferLimit = 100_000;
|
||||
|
||||
public ItemLapotronicOrbpack() {
|
||||
super(TRArmorMaterial.LAPOTRONPACK, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
public LapotronicOrbpackItem() {
|
||||
super(TRArmorMaterials.LAPOTRONIC_ORBPACK, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
}
|
||||
|
||||
// Item
|
||||
|
@ -62,11 +62,11 @@ public class ItemLapotronicOrbpack extends ArmorItem implements EnergyHolder, It
|
|||
}
|
||||
InitUtils.initPoweredItems(TRContent.LAPOTRONIC_ORBPACK, itemList);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (entityIn instanceof PlayerEntity) {
|
||||
ItemLithiumIonBatpack.distributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack, transferLimit);
|
||||
LithiumIonBatpackItem.distributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack, transferLimit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,11 @@ public class ItemLapotronicOrbpack extends ArmorItem implements EnergyHolder, It
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnchantable(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
|
@ -43,18 +43,18 @@ import team.reborn.energy.EnergyHolder;
|
|||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRArmorMaterials;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLithiumIonBatpack extends ArmorItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class LithiumIonBatpackItem extends ArmorItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
// 8M FE maxCharge and 2k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = TechRebornConfig.lithiumBatpackCharge;
|
||||
public int transferLimit = 2_000;
|
||||
|
||||
public ItemLithiumIonBatpack() {
|
||||
super(TRArmorMaterial.LITHIUMBATPACK, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
public LithiumIonBatpackItem() {
|
||||
super(TRArmorMaterials.LITHIUM_BATPACK, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
}
|
||||
|
||||
public static void distributePowerToInventory(World world, PlayerEntity player, ItemStack itemStack, int maxSend) {
|
||||
|
@ -101,6 +101,11 @@ public class ItemLithiumIonBatpack extends ArmorItem implements EnergyHolder, It
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnchantable(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
|
@ -35,6 +35,7 @@ import net.minecraft.entity.effect.StatusEffectInstance;
|
|||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
|
@ -48,17 +49,18 @@ import team.reborn.energy.Energy;
|
|||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemQuantumSuit extends ItemTRArmour implements ItemStackModifiers, ArmorTickable, ArmorRemoveHandler, ArmorFovHandler, EnergyHolder {
|
||||
public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers, ArmorTickable, ArmorRemoveHandler, ArmorFovHandler, EnergyHolder {
|
||||
|
||||
public static final double ENERGY_FLY = 50;
|
||||
public static final double ENERGY_SWIM = 20;
|
||||
public static final double ENERGY_BREATHING = 20;
|
||||
public static final double ENERGY_SPRINTING = 20;
|
||||
|
||||
public ItemQuantumSuit(ArmorMaterial material, EquipmentSlot slot) {
|
||||
super(material, slot);
|
||||
public QuantumSuitItem(ArmorMaterial material, EquipmentSlot slot) {
|
||||
super(material, slot, new Item.Settings().group(TechReborn.ITEMGROUP).maxDamage(-1).maxCount(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,11 +69,11 @@ public class ItemQuantumSuit extends ItemTRArmour implements ItemStackModifiers,
|
|||
|
||||
if (this.slot == EquipmentSlot.LEGS && equipmentSlot == EquipmentSlot.LEGS) {
|
||||
if (Energy.of(stack).getEnergy() > ENERGY_SPRINTING) {
|
||||
attributes.put(EntityAttributes.MOVEMENT_SPEED.getId(), new EntityAttributeModifier(MODIFIERS[equipmentSlot.getEntitySlotId()],"Movement Speed", 0.15, EntityAttributeModifier.Operation.ADDITION));
|
||||
attributes.put(EntityAttributes.MOVEMENT_SPEED.getId(), new EntityAttributeModifier(MODIFIERS[equipmentSlot.getEntitySlotId()], "Movement Speed", 0.15, EntityAttributeModifier.Operation.ADDITION));
|
||||
}
|
||||
}
|
||||
|
||||
if(equipmentSlot == this.slot && Energy.of(stack).getEnergy() > 0) {
|
||||
if (equipmentSlot == this.slot && Energy.of(stack).getEnergy() > 0) {
|
||||
attributes.put(EntityAttributes.ARMOR.getId(), new EntityAttributeModifier(MODIFIERS[slot.getEntitySlotId()], "Armor modifier", 20, EntityAttributeModifier.Operation.ADDITION));
|
||||
attributes.put(EntityAttributes.KNOCKBACK_RESISTANCE.getId(), new EntityAttributeModifier(MODIFIERS[slot.getEntitySlotId()], "Knockback modifier", 2, EntityAttributeModifier.Operation.ADDITION));
|
||||
}
|
||||
|
@ -148,6 +150,11 @@ public class ItemQuantumSuit extends ItemTRArmour implements ItemStackModifiers,
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnchantable(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
|
@ -38,37 +38,21 @@ import java.util.UUID;
|
|||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
*/
|
||||
public class ItemTRArmour extends ArmorItem implements ItemDurabilityExtensions {
|
||||
public class TRArmourItem extends ArmorItem implements ItemDurabilityExtensions {
|
||||
|
||||
//Thanks for being private
|
||||
public static final UUID[] MODIFIERS = new UUID[] {
|
||||
public static final UUID[] MODIFIERS = new UUID[]{
|
||||
UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"),
|
||||
UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"),
|
||||
UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"),
|
||||
UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")
|
||||
};
|
||||
|
||||
String repairOreDict;
|
||||
|
||||
public ItemTRArmour(ArmorMaterial material, EquipmentSlot slot) {
|
||||
this(material, slot, "");
|
||||
public TRArmourItem(ArmorMaterial material, EquipmentSlot slot) {
|
||||
this(material, slot, new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
}
|
||||
|
||||
public ItemTRArmour(ArmorMaterial material, EquipmentSlot slot, String repairOreDict) {
|
||||
super(material, slot, (new Item.Settings()).group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRepair(ItemStack toRepair, ItemStack repair) {
|
||||
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, true);
|
||||
}
|
||||
return super.canRepair(toRepair, repair);
|
||||
public TRArmourItem(ArmorMaterial material, EquipmentSlot slot, Item.Settings settings) {
|
||||
super(material, slot, settings);
|
||||
}
|
||||
}
|
|
@ -42,12 +42,12 @@ import techreborn.TechReborn;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemBattery extends Item implements EnergyHolder, ItemDurabilityExtensions {
|
||||
public class BatteryItem extends Item implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
private final int maxEnergy;
|
||||
private final EnergyTier tier;
|
||||
|
||||
public ItemBattery(int maxEnergy, EnergyTier tier) {
|
||||
public BatteryItem(int maxEnergy, EnergyTier tier) {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(1));
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.tier = tier;
|
|
@ -34,10 +34,10 @@ import techreborn.config.TechRebornConfig;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemEnergyCrystal extends ItemBattery {
|
||||
public class EnergyCrystalItem extends BatteryItem {
|
||||
|
||||
// 4M FE storage with 1k charge rate
|
||||
public ItemEnergyCrystal() {
|
||||
public EnergyCrystalItem() {
|
||||
super(TechRebornConfig.energyCrystalMaxCharge, EnergyTier.HIGH);
|
||||
}
|
||||
|
|
@ -34,10 +34,10 @@ import techreborn.config.TechRebornConfig;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLapotronCrystal extends ItemBattery {
|
||||
public class LapotronCrystalItem extends BatteryItem {
|
||||
|
||||
// 40M FE capacity with 10k FE\t charge rate
|
||||
public ItemLapotronCrystal() {
|
||||
public LapotronCrystalItem() {
|
||||
super(TechRebornConfig.lapotronCrystalMaxCharge, EnergyTier.EXTREME);
|
||||
}
|
||||
|
|
@ -34,10 +34,10 @@ import techreborn.config.TechRebornConfig;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLapotronicOrb extends ItemBattery {
|
||||
public class LapotronicOrbItem extends BatteryItem {
|
||||
|
||||
// 400M capacity with 100k FE\t charge rate
|
||||
public ItemLapotronicOrb() {
|
||||
public LapotronicOrbItem() {
|
||||
super(TechRebornConfig.lapotronicOrbMaxCharge, EnergyTier.EXTREME);
|
||||
}
|
||||
|
|
@ -33,10 +33,10 @@ import team.reborn.energy.EnergyTier;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLithiumIonBattery extends ItemBattery {
|
||||
public class LithiumIonBatteryItem extends BatteryItem {
|
||||
|
||||
// 400k FE with 1k FE\t charge rate
|
||||
public ItemLithiumIonBattery() {
|
||||
public LithiumIonBatteryItem() {
|
||||
super(400_000, EnergyTier.HIGH);
|
||||
}
|
||||
|
|
@ -33,10 +33,10 @@ import team.reborn.energy.EnergyTier;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemRedCellBattery extends ItemBattery {
|
||||
public class RedCellBatteryItem extends BatteryItem {
|
||||
|
||||
// 40k FE capacity with 100 FE\t charge rate
|
||||
public ItemRedCellBattery() {
|
||||
public RedCellBatteryItem() {
|
||||
super(40_000, EnergyTier.LOW);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue