diff --git a/src/main/java/techreborn/config/TechRebornConfig.java b/src/main/java/techreborn/config/TechRebornConfig.java index 029c6215d..5d2936c0b 100644 --- a/src/main/java/techreborn/config/TechRebornConfig.java +++ b/src/main/java/techreborn/config/TechRebornConfig.java @@ -301,6 +301,12 @@ public class TechRebornConfig { @Config(config = "items", category = "power", key = "quantumSuitDamageAbsorbCost", comment = "Quantum Suit Cost for Damage Absorbed") public static double damageAbsorbCost = 10; + @Config(config = "items", category = "power", key = "nanoSuitCapacity", comment = "Nano Suit Energy Capacity") + public static long nanoSuitCapacity = 1_000_000; + + @Config(config = "items", category = "power", key = "nanoSuitNightVisionCost", comment = "Nano Suit Breathing Cost") + public static long nanoSuitNightVisionCost = 2; + @Config(config = "items", category = "upgrades", key = "overclocker_speed", comment = "Overclocker behavior speed multiplier") public static double overclockerSpeed = 0.25; diff --git a/src/main/java/techreborn/events/ModRegistry.java b/src/main/java/techreborn/events/ModRegistry.java index 59a097b2c..e3abb6e15 100644 --- a/src/main/java/techreborn/events/ModRegistry.java +++ b/src/main/java/techreborn/events/ModRegistry.java @@ -41,10 +41,7 @@ import techreborn.config.TechRebornConfig; import techreborn.init.*; import techreborn.init.TRContent.*; import techreborn.items.*; -import techreborn.items.armor.BatpackItem; -import techreborn.items.armor.CloakingDeviceItem; -import techreborn.items.armor.QuantumSuitItem; -import techreborn.items.armor.TRArmourItem; +import techreborn.items.armor.*; import techreborn.items.tool.*; import techreborn.items.tool.advanced.AdvancedJackhammerItem; import techreborn.items.tool.basic.ElectricTreetapItem; @@ -130,6 +127,11 @@ public class ModRegistry { RebornRegistry.registerItem(TRContent.QUANTUM_LEGGINGS = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, ArmorItem.Type.LEGGINGS), "quantum_leggings")); RebornRegistry.registerItem(TRContent.QUANTUM_BOOTS = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, ArmorItem.Type.BOOTS), "quantum_boots")); + RebornRegistry.registerItem(TRContent.NANO_HELMET = InitUtils.setup(new NanoSuitItem(TRArmorMaterials.NANO, ArmorItem.Type.HELMET), "nano_helmet")); + RebornRegistry.registerItem(TRContent.NANO_CHESTPLATE = InitUtils.setup(new NanoSuitItem(TRArmorMaterials.NANO, ArmorItem.Type.CHESTPLATE), "nano_chestplate")); + RebornRegistry.registerItem(TRContent.NANO_LEGGINGS = InitUtils.setup(new NanoSuitItem(TRArmorMaterials.NANO, ArmorItem.Type.LEGGINGS), "nano_leggings")); + RebornRegistry.registerItem(TRContent.NANO_BOOTS = InitUtils.setup(new NanoSuitItem(TRArmorMaterials.NANO, ArmorItem.Type.BOOTS), "nano_boots")); + // Gem armor & tools // Todo: repair with tags RebornRegistry.registerItem(TRContent.BRONZE_SWORD = InitUtils.setup(new TRSwordItem(TRToolTier.BRONZE), "bronze_sword")); diff --git a/src/main/java/techreborn/init/TRArmorMaterials.java b/src/main/java/techreborn/init/TRArmorMaterials.java index 93aadbbde..897bacc02 100644 --- a/src/main/java/techreborn/init/TRArmorMaterials.java +++ b/src/main/java/techreborn/init/TRArmorMaterials.java @@ -56,6 +56,7 @@ public enum TRArmorMaterials implements ArmorMaterial { return Ingredient.ofItems(TRContent.Ingots.STEEL.asItem()); }), QUANTUM(75, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> Ingredient.EMPTY), + NANO(75, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> Ingredient.EMPTY), CLOAKING_DEVICE(5, new int[]{0, 2, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, () -> Ingredient.EMPTY), LITHIUM_BATPACK(25, new int[]{0, 5, 0, 0}, 10, SoundEvents.ITEM_ARMOR_EQUIP_TURTLE, 0.0F, () -> Ingredient.EMPTY), LAPOTRONIC_ORBPACK(33, new int[]{0, 6, 0, 0}, 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 d27aa8b12..d150d1784 100644 --- a/src/main/java/techreborn/init/TRContent.java +++ b/src/main/java/techreborn/init/TRContent.java @@ -98,6 +98,7 @@ import techreborn.events.ModRegistry; import techreborn.items.DynamicCellItem; import techreborn.items.UpgradeItem; import techreborn.items.UpgraderItem; +import techreborn.items.armor.NanoSuitItem; import techreborn.items.armor.QuantumSuitItem; import techreborn.utils.InitUtils; import techreborn.world.OreDistribution; @@ -184,6 +185,10 @@ public class TRContent { public static QuantumSuitItem QUANTUM_LEGGINGS; public static QuantumSuitItem QUANTUM_BOOTS; + public static NanoSuitItem NANO_HELMET; + public static NanoSuitItem NANO_CHESTPLATE; + public static NanoSuitItem NANO_LEGGINGS; + public static NanoSuitItem NANO_BOOTS; // Gem armor & tools @Nullable public static Item BRONZE_SWORD; diff --git a/src/main/java/techreborn/init/TRItemGroup.java b/src/main/java/techreborn/init/TRItemGroup.java index f480428a3..9438cd656 100644 --- a/src/main/java/techreborn/init/TRItemGroup.java +++ b/src/main/java/techreborn/init/TRItemGroup.java @@ -240,6 +240,11 @@ public class TRItemGroup { addPoweredItem(TRContent.QUANTUM_LEGGINGS, entries, null, true); addPoweredItem(TRContent.QUANTUM_BOOTS, entries, null, true); + addPoweredItem(TRContent.NANO_HELMET, entries, null, true); + addPoweredItem(TRContent.NANO_CHESTPLATE, entries, null, true); + addPoweredItem(TRContent.NANO_LEGGINGS, entries, null, true); + addPoweredItem(TRContent.NANO_BOOTS, entries, null, true); + addNanosaber(entries, null, false); addPoweredItem(TRContent.LITHIUM_ION_BATPACK, entries, null, true); @@ -629,6 +634,10 @@ public class TRItemGroup { addPoweredItem(TRContent.QUANTUM_CHESTPLATE, entries, Items.TURTLE_HELMET, false); addPoweredItem(TRContent.QUANTUM_LEGGINGS, entries, Items.TURTLE_HELMET, false); addPoweredItem(TRContent.QUANTUM_BOOTS, entries, Items.TURTLE_HELMET, false); + addPoweredItem(TRContent.NANO_HELMET, entries, Items.TURTLE_HELMET, false); + addPoweredItem(TRContent.NANO_CHESTPLATE, entries, Items.TURTLE_HELMET, false); + addPoweredItem(TRContent.NANO_LEGGINGS, entries, Items.TURTLE_HELMET, false); + addPoweredItem(TRContent.NANO_BOOTS, entries, Items.TURTLE_HELMET, false); addPoweredItem(TRContent.CLOAKING_DEVICE, entries, Items.LEATHER_HORSE_ARMOR, false); entries.addAfter(Items.END_CRYSTAL, TRContent.NUKE); } diff --git a/src/main/java/techreborn/items/armor/NanoSuitItem.java b/src/main/java/techreborn/items/armor/NanoSuitItem.java new file mode 100644 index 000000000..afe21cb25 --- /dev/null +++ b/src/main/java/techreborn/items/armor/NanoSuitItem.java @@ -0,0 +1,92 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2020 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.items.armor; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; +import com.mojang.authlib.minecraft.client.MinecraftClient; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.attribute.EntityAttribute; +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.ItemStack; +import net.minecraft.world.World; +import reborncore.api.items.ArmorBlockEntityTicker; +import reborncore.api.items.ArmorRemoveHandler; +import reborncore.common.powerSystem.RcEnergyTier; +import techreborn.config.TechRebornConfig; + +public class NanoSuitItem extends TREnergyArmourItem implements ArmorBlockEntityTicker { + public NanoSuitItem(ArmorMaterial material, Type slot) { + super(material, slot, TechRebornConfig.nanoSuitCapacity, RcEnergyTier.HIGH); + } + + // TREnergyArmourItem + @Override + public long getEnergyMaxOutput() { return 0; } + + // ArmorItem + @Override + public Multimap getAttributeModifiers(EquipmentSlot slot) { + return HashMultimap.create(); + } + + // FabricItem + @Override + public Multimap getAttributeModifiers(ItemStack stack, EquipmentSlot equipmentSlot) { + var attributes = ArrayListMultimap.create(super.getAttributeModifiers(stack, getSlotType())); + + if (equipmentSlot == this.getSlotType() && getStoredEnergy(stack) > 0) { + attributes.put(EntityAttributes.GENERIC_ARMOR, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Armor modifier", 8, EntityAttributeModifier.Operation.ADDITION)); + attributes.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Knockback modifier", 2, EntityAttributeModifier.Operation.ADDITION)); + } + + return ImmutableMultimap.copyOf(attributes); + } + + // ArmorBlockEntityTicker + @Override + public void tickArmor(ItemStack stack, PlayerEntity playerEntity) { + World world = playerEntity.getWorld(); + switch (this.getSlotType()) { + case HEAD -> { + if ((world.isNight() || world.getLightLevel(playerEntity.getBlockPos()) <= 4) && tryUseEnergy(stack, TechRebornConfig.nanoSuitNightVisionCost)) { + playerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 1000, 1, false, false)); + } else { + playerEntity.removeStatusEffect(StatusEffects.NIGHT_VISION); + } + } + case CHEST, FEET, LEGS -> { + // Future functionality + } + } + } +} diff --git a/src/main/resources/assets/techreborn/lang/en_us.json b/src/main/resources/assets/techreborn/lang/en_us.json index f275863f6..c1ac6e0a2 100644 --- a/src/main/resources/assets/techreborn/lang/en_us.json +++ b/src/main/resources/assets/techreborn/lang/en_us.json @@ -670,6 +670,10 @@ "item.techreborn.quantum_chestplate" : "Quantum Chestplate", "item.techreborn.quantum_leggings" : "Quantum Leggings", "item.techreborn.quantum_boots" : "Quantum Boots", + "item.techreborn.nano_helmet" : "Nano Helmet", + "item.techreborn.nano_chestplate" : "Nano Chestplate", + "item.techreborn.nano_leggings" : "Nano Leggings", + "item.techreborn.nano_boots" : "Nano Boots", "_comment15": "Items-Battery", "item.techreborn.energy_crystal": "Energy Crystal", @@ -852,7 +856,7 @@ "techreborn.message.info.block.techreborn.launchpad.high": "High", "techreborn.message.info.block.techreborn.launchpad.extreme": "Extreme", "techreborn.message.info.block.techreborn.elevator": "Teleports player up or down to the next free elevator block", - + "keys.techreborn.category": "TechReborn Category", "keys.techreborn.config": "Config", diff --git a/src/main/resources/assets/techreborn/models/item/nano_boots.json b/src/main/resources/assets/techreborn/models/item/nano_boots.json new file mode 100644 index 000000000..ca71407f5 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/nano_boots.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "techreborn:item/armor/nano_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/nano_chestplate.json b/src/main/resources/assets/techreborn/models/item/nano_chestplate.json new file mode 100644 index 000000000..432f868a2 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/nano_chestplate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "techreborn:item/armor/nano_chestplate" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/nano_helmet.json b/src/main/resources/assets/techreborn/models/item/nano_helmet.json new file mode 100644 index 000000000..79b4be0c7 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/nano_helmet.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "techreborn:item/armor/nano_helmet" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/nano_leggings.json b/src/main/resources/assets/techreborn/models/item/nano_leggings.json new file mode 100644 index 000000000..cb18e7d33 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/nano_leggings.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "techreborn:item/armor/nano_leggings" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/omni_tool.json b/src/main/resources/assets/techreborn/models/item/omni_tool.json index 9cd6814a3..50baa686c 100644 --- a/src/main/resources/assets/techreborn/models/item/omni_tool.json +++ b/src/main/resources/assets/techreborn/models/item/omni_tool.json @@ -1,5 +1,5 @@ { - "parent": "minecraft:item/generated", + "parent": "minecraft:item/handheld", "textures": { "layer0": "techreborn:item/tool/omni_tool" } diff --git a/src/main/resources/assets/techreborn/models/item/quantum_boots.json b/src/main/resources/assets/techreborn/models/item/quantum_boots.json index 0b2efa464..a11a87cfc 100644 --- a/src/main/resources/assets/techreborn/models/item/quantum_boots.json +++ b/src/main/resources/assets/techreborn/models/item/quantum_boots.json @@ -1,6 +1,6 @@ { - "parent": "minecraft:item/generated", - "textures": { - "layer0": "techreborn:item/armor/quantum_boots" - } + "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_helmet.json b/src/main/resources/assets/techreborn/models/item/quantum_helmet.json index 845073011..e84cbe6a4 100644 --- a/src/main/resources/assets/techreborn/models/item/quantum_helmet.json +++ b/src/main/resources/assets/techreborn/models/item/quantum_helmet.json @@ -1,6 +1,6 @@ { - "parent": "minecraft:item/generated", - "textures": { - "layer0": "techreborn:item/armor/quantum_helmet" - } + "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/textures/item/armor/nano_boots.png b/src/main/resources/assets/techreborn/textures/item/armor/nano_boots.png new file mode 100644 index 000000000..62cab741d Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/item/armor/nano_boots.png differ diff --git a/src/main/resources/assets/techreborn/textures/item/armor/nano_chestplate.png b/src/main/resources/assets/techreborn/textures/item/armor/nano_chestplate.png new file mode 100644 index 000000000..e145df2d0 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/item/armor/nano_chestplate.png differ diff --git a/src/main/resources/assets/techreborn/textures/item/armor/nano_helmet.png b/src/main/resources/assets/techreborn/textures/item/armor/nano_helmet.png new file mode 100644 index 000000000..687a2047f Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/item/armor/nano_helmet.png differ diff --git a/src/main/resources/assets/techreborn/textures/item/armor/nano_leggings.png b/src/main/resources/assets/techreborn/textures/item/armor/nano_leggings.png new file mode 100644 index 000000000..345dcf201 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/item/armor/nano_leggings.png differ diff --git a/src/main/resources/assets/techreborn/textures/models/armor/nano_layer_1.png b/src/main/resources/assets/techreborn/textures/models/armor/nano_layer_1.png new file mode 100644 index 000000000..3163ed6d0 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/models/armor/nano_layer_1.png differ diff --git a/src/main/resources/assets/techreborn/textures/models/armor/nano_layer_2.png b/src/main/resources/assets/techreborn/textures/models/armor/nano_layer_2.png new file mode 100644 index 000000000..8a3d0686f Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/models/armor/nano_layer_2.png differ