Implemented Nano suit
This commit is contained in:
parent
e8bad0f009
commit
eb19a8b8d4
20 changed files with 157 additions and 14 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
92
src/main/java/techreborn/items/armor/NanoSuitItem.java
Normal file
92
src/main/java/techreborn/items/armor/NanoSuitItem.java
Normal file
|
@ -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<EntityAttribute, EntityAttributeModifier> getAttributeModifiers(EquipmentSlot slot) {
|
||||
return HashMultimap.create();
|
||||
}
|
||||
|
||||
// FabricItem
|
||||
@Override
|
||||
public Multimap<EntityAttribute, EntityAttributeModifier> 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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",
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/armor/nano_boots"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/armor/nano_chestplate"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/armor/nano_helmet"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/armor/nano_leggings"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/tool/omni_tool"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 302 B |
Binary file not shown.
After Width: | Height: | Size: 375 B |
Binary file not shown.
After Width: | Height: | Size: 356 B |
Binary file not shown.
After Width: | Height: | Size: 359 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 666 B |
Loading…
Reference in a new issue