Quantum Armor
Have fun, sorry it took years
This commit is contained in:
parent
2ce0421ae6
commit
6086bc0f0c
20 changed files with 312 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -49,6 +49,7 @@ public enum TRArmorMaterial implements ArmorMaterial {
|
|||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
160
src/main/java/techreborn/items/armor/ItemQuantumSuit.java
Normal file
160
src/main/java/techreborn/items/armor/ItemQuantumSuit.java
Normal file
|
@ -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<String, EntityAttributeModifier> 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<String, EntityAttributeModifier> 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<ItemStack> itemList) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, itemList);
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 672 B |
|
@ -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",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/armor/quantum_boots"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/armor/quantum_chestplate"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/armor/quantum_helmet"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "techreborn:item/armor/quantum_leggings"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 312 B |
Binary file not shown.
After Width: | Height: | Size: 328 B |
Binary file not shown.
After Width: | Height: | Size: 290 B |
Binary file not shown.
After Width: | Height: | Size: 319 B |
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue