diff --git a/src/main/java/techreborn/events/ModRegistry.java b/src/main/java/techreborn/events/ModRegistry.java index c773fa117..f3346c729 100644 --- a/src/main/java/techreborn/events/ModRegistry.java +++ b/src/main/java/techreborn/events/ModRegistry.java @@ -61,6 +61,7 @@ import techreborn.items.ItemScrapBox; import techreborn.items.armor.ItemCloakingDevice; import techreborn.items.armor.ItemLapotronicOrbpack; import techreborn.items.armor.ItemLithiumIonBatpack; +import techreborn.items.armor.ItemQuantumSuit; import techreborn.items.armor.ItemTRArmour; import techreborn.items.battery.*; import techreborn.items.tool.ItemDebugTool; @@ -138,6 +139,11 @@ public class ModRegistry { Arrays.stream(Parts.values()).forEach(value -> RebornRegistry.registerItem(value.item)); Arrays.stream(Upgrades.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + RebornRegistry.registerItem(TRContent.QUANTUM_HELMET = InitUtils.setup(new ItemQuantumSuit(TRArmorMaterial.QUANTUM, EquipmentSlot.HEAD), "quantum_helmet")); + RebornRegistry.registerItem(TRContent.QUANTUM_CHESTPLATE = InitUtils.setup(new ItemQuantumSuit(TRArmorMaterial.QUANTUM, EquipmentSlot.CHEST), "quantum_chestplate")); + RebornRegistry.registerItem(TRContent.QUANTUM_LEGGINGS = InitUtils.setup(new ItemQuantumSuit(TRArmorMaterial.QUANTUM, EquipmentSlot.LEGS), "quantum_leggings")); + RebornRegistry.registerItem(TRContent.QUANTUM_BOOTS = InitUtils.setup(new ItemQuantumSuit(TRArmorMaterial.QUANTUM, EquipmentSlot.FEET), "quantum_boots")); + // Gem armor & tools if (TechRebornConfig.enableGemArmorAndTools) { // Todo: repair with tags diff --git a/src/main/java/techreborn/init/TRArmorMaterial.java b/src/main/java/techreborn/init/TRArmorMaterial.java index 32721e9ba..430fab9c1 100644 --- a/src/main/java/techreborn/init/TRArmorMaterial.java +++ b/src/main/java/techreborn/init/TRArmorMaterial.java @@ -42,13 +42,14 @@ public enum TRArmorMaterial implements ArmorMaterial { }), RUBY(16, new int[] { 2, 7, 5, 2 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> { return Ingredient.ofItems(TRContent.Gems.RUBY.asItem()); - }), + }), SAPPHIRE(19, new int[] { 4, 4, 4, 4 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> { return Ingredient.ofItems(TRContent.Gems.SAPPHIRE.asItem()); }), PERIDOT(17, new int[] { 3, 8, 3, 2 }, 16, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> { return Ingredient.ofItems(TRContent.Gems.PERIDOT.asItem()); - }), + }), + QUANTUM(75, new int[] { 3, 6, 8, 3 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> Ingredient.EMPTY), CLOAKING(5, new int[] { 1, 2, 3, 1 }, 0, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, () -> Ingredient.EMPTY), LITHIUMBATPACK(25, new int[]{2, 5, 6, 2}, 10, SoundEvents.ITEM_ARMOR_EQUIP_TURTLE, 0.0F, () -> Ingredient.EMPTY), LAPOTRONPACK(33, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 2.0F, () -> Ingredient.EMPTY); diff --git a/src/main/java/techreborn/init/TRContent.java b/src/main/java/techreborn/init/TRContent.java index 9f0f963f0..2a1fb693f 100644 --- a/src/main/java/techreborn/init/TRContent.java +++ b/src/main/java/techreborn/init/TRContent.java @@ -67,6 +67,7 @@ import techreborn.config.TechRebornConfig; import techreborn.entities.EntityNukePrimed; import techreborn.items.ItemDynamicCell; import techreborn.items.ItemUpgrade; +import techreborn.items.armor.ItemQuantumSuit; import techreborn.utils.InitUtils; import javax.annotation.Nullable; @@ -135,6 +136,12 @@ public class TRContent { public static Item MANUAL; public static ItemDynamicCell CELL; + //Quantum Suit + public static ItemQuantumSuit QUANTUM_HELMET; + public static ItemQuantumSuit QUANTUM_CHESTPLATE; + public static ItemQuantumSuit QUANTUM_LEGGINGS; + public static ItemQuantumSuit QUANTUM_BOOTS; + // Gem armor & tools @Nullable public static Item BRONZE_SWORD; diff --git a/src/main/java/techreborn/items/armor/ItemQuantumSuit.java b/src/main/java/techreborn/items/armor/ItemQuantumSuit.java new file mode 100644 index 000000000..b9b2f5b21 --- /dev/null +++ b/src/main/java/techreborn/items/armor/ItemQuantumSuit.java @@ -0,0 +1,160 @@ +package techreborn.items.armor; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.attribute.EntityAttributeModifier; +import net.minecraft.entity.attribute.EntityAttributes; +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.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DefaultedList; +import reborncore.api.items.ArmorFovHandler; +import reborncore.api.items.ArmorRemoveHandler; +import reborncore.api.items.ArmorTickable; +import reborncore.api.items.ItemStackModifiers; +import reborncore.common.powerSystem.PowerSystem; +import reborncore.common.util.ItemUtils; +import team.reborn.energy.Energy; +import team.reborn.energy.EnergyHolder; +import team.reborn.energy.EnergySide; +import team.reborn.energy.EnergyTier; +import techreborn.utils.InitUtils; + +public class ItemQuantumSuit extends ItemTRArmour 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); + } + + @Override + public void getAttributeModifiers(EquipmentSlot equipmentSlot, ItemStack stack, Multimap attributes) { + attributes.removeAll(EntityAttributes.MOVEMENT_SPEED.getId()); + + 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)); + } + } + + 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)); + } + } + + @Override + public void tickArmor(ItemStack stack, PlayerEntity playerEntity) { + switch (this.slot) { + case HEAD: + if (playerEntity.isInWater()) { + if (Energy.of(stack).use(ENERGY_BREATHING)) { + playerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.WATER_BREATHING, 5, 1)); + } + } + break; + case CHEST: + if (Energy.of(stack).getEnergy() > ENERGY_FLY) { + playerEntity.abilities.allowFlying = true; + if (playerEntity.abilities.flying) { + Energy.of(stack).use(ENERGY_FLY); + } + } else { + playerEntity.abilities.allowFlying = false; + playerEntity.abilities.flying = false; + } + break; + case LEGS: + if (playerEntity.isSprinting()) { + Energy.of(stack).use(ENERGY_SPRINTING); + } + break; + case FEET: + if (playerEntity.isSwimming()) { + if (Energy.of(stack).use(ENERGY_SWIM)) { + playerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.DOLPHINS_GRACE, 5, 1)); + } + } + break; + default: + + } + } + + @Override + public Multimap getModifiers(EquipmentSlot slot) { + return HashMultimap.create(); + } + + @Override + public void onRemoved(PlayerEntity playerEntity) { + if (this.slot == EquipmentSlot.CHEST) { + if (!playerEntity.isCreative() && !playerEntity.isSpectator()) { + playerEntity.abilities.allowFlying = false; + playerEntity.abilities.flying = false; + } + } + } + + @Override + public float changeFov(float old, ItemStack stack, PlayerEntity playerEntity) { + if (this.slot == EquipmentSlot.LEGS && Energy.of(stack).getEnergy() > ENERGY_SPRINTING) { + old -= 0.6; //TODO possibly make it better + } + return old; + } + + @Override + public double getDurability(ItemStack stack) { + return 1 - ItemUtils.getPowerForDurabilityBar(stack); + } + + @Override + public boolean showDurability(ItemStack stack) { + return true; + } + + @Override + public int getDurabilityColor(ItemStack stack) { + return PowerSystem.getDisplayPower().colour; + } + + @Override + public boolean canRepair(ItemStack itemStack_1, ItemStack itemStack_2) { + return false; + } + + @Override + public double getMaxStoredPower() { + return 40_000_000; + } + + @Override + public EnergyTier getTier() { + return EnergyTier.HIGH; + } + + @Override + public double getMaxInput(EnergySide side) { + return 2048; + } + + @Environment(EnvType.CLIENT) + @Override + public void appendStacks(ItemGroup group, DefaultedList itemList) { + if (!isIn(group)) { + return; + } + InitUtils.initPoweredItems(this, itemList); + } +} diff --git a/src/main/java/techreborn/items/armor/ItemTRArmour.java b/src/main/java/techreborn/items/armor/ItemTRArmour.java index 25efb34fe..fa03a0388 100644 --- a/src/main/java/techreborn/items/armor/ItemTRArmour.java +++ b/src/main/java/techreborn/items/armor/ItemTRArmour.java @@ -33,11 +33,21 @@ import reborncore.common.util.ItemDurabilityExtensions; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; +import java.util.UUID; + /** * Created by modmuss50 on 26/02/2016. */ public class ItemTRArmour extends ArmorItem implements ItemDurabilityExtensions { + //Thanks for being private + 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) { diff --git a/src/main/resources/assets/minecraft/textures/models/armor/quantum_layer_1.png b/src/main/resources/assets/minecraft/textures/models/armor/quantum_layer_1.png new file mode 100644 index 000000000..a6e5ca99c Binary files /dev/null and b/src/main/resources/assets/minecraft/textures/models/armor/quantum_layer_1.png differ diff --git a/src/main/resources/assets/minecraft/textures/models/armor/quantum_layer_2.png b/src/main/resources/assets/minecraft/textures/models/armor/quantum_layer_2.png new file mode 100644 index 000000000..a1e61fb29 Binary files /dev/null and b/src/main/resources/assets/minecraft/textures/models/armor/quantum_layer_2.png differ diff --git a/src/main/resources/assets/techreborn/lang/en_us.json b/src/main/resources/assets/techreborn/lang/en_us.json index db3700bc1..23560caed 100644 --- a/src/main/resources/assets/techreborn/lang/en_us.json +++ b/src/main/resources/assets/techreborn/lang/en_us.json @@ -538,6 +538,11 @@ "item.techreborn.energy_storage_upgrade": "Energy Storage Upgrade", "item.techreborn.superconductor_upgrade": "Superconductor Upgrade", + "item.techreborn.quantum_helmet" : "Quantum Helmet", + "item.techreborn.quantum_chestplate" : "Quantum Chestplate", + "item.techreborn.quantum_leggings" : "Quantum Leggings", + "item.techreborn.quantum_boots" : "Quantum Boots", + "item.techreborn.bronze_sword": "Bronze Sword", "item.techreborn.bronze_pickaxe": "Bronze Pickaxe", "item.techreborn.bronze_spade": "Bronze Shovel", diff --git a/src/main/resources/assets/techreborn/models/item/quantum_boots.json b/src/main/resources/assets/techreborn/models/item/quantum_boots.json new file mode 100644 index 000000000..0b2efa464 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/quantum_boots.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "techreborn:item/armor/quantum_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/quantum_chestplate.json b/src/main/resources/assets/techreborn/models/item/quantum_chestplate.json new file mode 100644 index 000000000..548e7e9b9 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/quantum_chestplate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "techreborn:item/armor/quantum_chestplate" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/quantum_helmet.json b/src/main/resources/assets/techreborn/models/item/quantum_helmet.json new file mode 100644 index 000000000..845073011 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/quantum_helmet.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "techreborn:item/armor/quantum_helmet" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/quantum_leggings.json b/src/main/resources/assets/techreborn/models/item/quantum_leggings.json new file mode 100644 index 000000000..54aa04f82 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/quantum_leggings.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "techreborn:item/armor/quantum_leggings" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/textures/item/armor/quantum_boots.png b/src/main/resources/assets/techreborn/textures/item/armor/quantum_boots.png new file mode 100644 index 000000000..3553121d6 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/item/armor/quantum_boots.png differ diff --git a/src/main/resources/assets/techreborn/textures/item/armor/quantum_chestplate.png b/src/main/resources/assets/techreborn/textures/item/armor/quantum_chestplate.png new file mode 100644 index 000000000..f98ac0dc2 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/item/armor/quantum_chestplate.png differ diff --git a/src/main/resources/assets/techreborn/textures/item/armor/quantum_helmet.png b/src/main/resources/assets/techreborn/textures/item/armor/quantum_helmet.png new file mode 100644 index 000000000..2cb427ebf Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/item/armor/quantum_helmet.png differ diff --git a/src/main/resources/assets/techreborn/textures/item/armor/quantum_leggings.png b/src/main/resources/assets/techreborn/textures/item/armor/quantum_leggings.png new file mode 100644 index 000000000..6a03d9e2f Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/item/armor/quantum_leggings.png differ diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_boots.json b/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_boots.json new file mode 100644 index 000000000..b050ee3d5 --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_boots.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "L L", + "D D", + "S S" + ], + "key": { + "S": { + "item": "techreborn:superconductor" + }, + "L": { + "item": "techreborn:lapotron_crystal" + }, + "D": { + "item": "techreborn:data_storage_chip" + } + }, + "result": { + "item": "techreborn:quantum_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_chestplate.json b/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_chestplate.json new file mode 100644 index 000000000..17460e379 --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_chestplate.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "P P", + "SLS", + "DID" + ], + "key": { + "P": { + "item": "techreborn:tungstensteel_plate" + }, + "S": { + "item": "techreborn:superconductor" + }, + "L": { + "item": "techreborn:lapotron_crystal" + }, + "D": { + "item": "techreborn:data_storage_chip" + }, + "I": { + "item": "techreborn:iridium_neutron_reflector" + } + }, + "result": { + "item": "techreborn:quantum_chestplate" + } +} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_helmet.json b/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_helmet.json new file mode 100644 index 000000000..692e3efd8 --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_helmet.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "DLD", + "S S", + " " + ], + "key": { + "S": { + "item": "techreborn:superconductor" + }, + "L": { + "item": "techreborn:lapotron_crystal" + }, + "D": { + "item": "techreborn:data_storage_chip" + } + }, + "result": { + "item": "techreborn:quantum_helmet" + } +} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_leggings.json b/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_leggings.json new file mode 100644 index 000000000..1e16303a4 --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/armor/quantum_leggings.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "DLD", + "S S", + "P P" + ], + "key": { + "P": { + "item": "techreborn:tungstensteel_plate" + }, + "S": { + "item": "techreborn:superconductor" + }, + "L": { + "item": "techreborn:lapotron_crystal" + }, + "D": { + "item": "techreborn:data_storage_chip" + } + }, + "result": { + "item": "techreborn:quantum_leggings" + } +} \ No newline at end of file