From 814dc25690a60faaaeab710d0dad40fb4386b849 Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Sun, 30 Oct 2016 22:39:40 +0100 Subject: Modular Armor changes 1 --- .../common/items/armor/ArmorCalculation.java | 353 +-------------------- .../gregtech/common/items/armor/ArmorData.java | 298 ++++++++--------- .../common/items/armor/ContainerBasicArmor.java | 48 --- .../items/armor/ContainerElectricArmor1.java | 53 ---- .../common/items/armor/ContainerModularArmor.java | 171 ---------- .../gregtech/common/items/armor/FluidSync.java | 67 ---- .../gregtech/common/items/armor/FluidSync2.java | 67 ---- .../common/items/armor/GuiElectricArmor1.java | 310 ------------------ .../common/items/armor/GuiModularArmor.java | 196 ------------ .../common/items/armor/InventoryArmor.java | 235 -------------- .../common/items/armor/ModularArmor_Item.java | 71 +++-- .../gregtech/common/items/armor/SlotFluid.java | 33 -- .../gregtech/common/items/armor/SlotLocked.java | 33 -- .../java/gregtech/common/items/armor/Values.java | 125 -------- .../items/armor/components/ArmorComponent.java | 57 ++++ .../armor/components/ArmorComponentBattery.java | 19 ++ .../armor/components/ArmorComponentFunction.java | 22 ++ .../armor/components/ArmorElectricComponent.java | 30 ++ .../items/armor/components/ArmorPlating.java | 67 ++++ .../items/armor/components/IArmorComponent.java | 11 + .../armor/components/LoadArmorComponents.java | 230 ++++++++++++++ .../common/items/armor/components/StatType.java | 56 ++++ .../items/armor/gui/ContainerBasicArmor.java | 48 +++ .../items/armor/gui/ContainerElectricArmor1.java | 53 ++++ .../items/armor/gui/ContainerModularArmor.java | 169 ++++++++++ .../gregtech/common/items/armor/gui/FluidSync.java | 67 ++++ .../common/items/armor/gui/FluidSync2.java | 67 ++++ .../common/items/armor/gui/GuiElectricArmor1.java | 311 ++++++++++++++++++ .../common/items/armor/gui/GuiModularArmor.java | 203 ++++++++++++ .../common/items/armor/gui/InventoryArmor.java | 237 ++++++++++++++ .../gregtech/common/items/armor/gui/SlotArmor.java | 18 ++ .../gregtech/common/items/armor/gui/SlotFluid.java | 33 ++ .../common/items/armor/gui/SlotLocked.java | 33 ++ 33 files changed, 1920 insertions(+), 1871 deletions(-) delete mode 100644 src/main/java/gregtech/common/items/armor/ContainerBasicArmor.java delete mode 100644 src/main/java/gregtech/common/items/armor/ContainerElectricArmor1.java delete mode 100644 src/main/java/gregtech/common/items/armor/ContainerModularArmor.java delete mode 100644 src/main/java/gregtech/common/items/armor/FluidSync.java delete mode 100644 src/main/java/gregtech/common/items/armor/FluidSync2.java delete mode 100644 src/main/java/gregtech/common/items/armor/GuiElectricArmor1.java delete mode 100644 src/main/java/gregtech/common/items/armor/GuiModularArmor.java delete mode 100644 src/main/java/gregtech/common/items/armor/InventoryArmor.java delete mode 100644 src/main/java/gregtech/common/items/armor/SlotFluid.java delete mode 100644 src/main/java/gregtech/common/items/armor/SlotLocked.java delete mode 100644 src/main/java/gregtech/common/items/armor/Values.java create mode 100644 src/main/java/gregtech/common/items/armor/components/ArmorComponent.java create mode 100644 src/main/java/gregtech/common/items/armor/components/ArmorComponentBattery.java create mode 100644 src/main/java/gregtech/common/items/armor/components/ArmorComponentFunction.java create mode 100644 src/main/java/gregtech/common/items/armor/components/ArmorElectricComponent.java create mode 100644 src/main/java/gregtech/common/items/armor/components/ArmorPlating.java create mode 100644 src/main/java/gregtech/common/items/armor/components/IArmorComponent.java create mode 100644 src/main/java/gregtech/common/items/armor/components/LoadArmorComponents.java create mode 100644 src/main/java/gregtech/common/items/armor/components/StatType.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/ContainerBasicArmor.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/ContainerElectricArmor1.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/ContainerModularArmor.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/FluidSync.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/FluidSync2.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/GuiElectricArmor1.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/GuiModularArmor.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/InventoryArmor.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/SlotArmor.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/SlotFluid.java create mode 100644 src/main/java/gregtech/common/items/armor/gui/SlotLocked.java (limited to 'src/main/java/gregtech/common/items') diff --git a/src/main/java/gregtech/common/items/armor/ArmorCalculation.java b/src/main/java/gregtech/common/items/armor/ArmorCalculation.java index 440d6aaef9..7c8100db62 100644 --- a/src/main/java/gregtech/common/items/armor/ArmorCalculation.java +++ b/src/main/java/gregtech/common/items/armor/ArmorCalculation.java @@ -14,361 +14,10 @@ import thaumcraft.api.nodes.IRevealer; public class ArmorCalculation { public static float[] calculateArmor(ItemStack[] parts) { - float[] def = new float[32]; - def[0] = 0; // Weight - def[1] = 1; // physical Def - def[2] = 1; // projectileDef - def[3] = 1; // fireDef - def[4] = 1; // magicDef - def[5] = 1; // explosionDef - def[6] = 0; // radiationDef - def[7] = 0; // electricDef - def[8] = 0; // witherDef - def[9] = 0; // fallDef - def[10] = 0; // Thorns - def[11] = 0; // ItemMagnet - def[12] = 0; // ItemCharge - def[13] = 0; // Thaumcraft goggles - def[14] = 0; // Nightvision - def[15] = 0; // tankCap - def[16] = 0; // motorPower - def[17] = 0; // motorEU - def[18] = 0; // pistonPower - def[19] = 0; // pistonEU - def[20] = 0; // ElectrolyzerPower - def[21] = 0; // ElectrolyzerEU - def[22] = 0; // FieldEmmiterPower - def[23] = 0; // FieldEmmiterEU - def[24] = 0; // JetpackFuelPower - def[25] = 0; // FuelUsage - def[26] = 0; // JetpackEUPower - def[27] = 0; // JetpackEU - def[28] = 0; // AntiGravPower - def[29] = 0; // AntiGravEU - def[30] = 0; // ProcessingPower - def[31] = 0; // ProcessingPowerUsed - - if (parts != null) { - def[12] = 0.0f; - for (int i = 0; i < parts.length; i++) { - if (parts[i] != null) { - ItemData data = GT_OreDictUnificator.getItemData(parts[i]); - if (data != null && (data.mPrefix == OrePrefixes.plate || data.mPrefix == OrePrefixes.plateAlloy)) { - // Weight - def[0] = def[0] + Values.INSTANCE.getValues(data.mMaterial.mMaterial).weight; - if (data.mPrefix == OrePrefixes.plateAlloy && data.mMaterial.mMaterial == Materials.Iridium) { - def[0] = def[0] - 20; - } - // physicalDef - float tmp = Values.INSTANCE.getValues(data.mMaterial.mMaterial).physicalDef; - if (data.mPrefix == OrePrefixes.plateAlloy && data.mMaterial.mMaterial == Materials.Iridium) { - tmp = 0.27f; - } - if (tmp > 0.0f) { - def[1] = def[1] - (tmp * def[1]); - } - // projectileDef - tmp = Values.INSTANCE.getValues(data.mMaterial.mMaterial).projectileDef; - if (data.mPrefix == OrePrefixes.plateAlloy && data.mMaterial.mMaterial == Materials.Iridium) { - tmp = 0.27f; - } - if (tmp > 0.0f) { - def[2] = def[2] - (tmp * def[2]); - } - // fireDef - tmp = Values.INSTANCE.getValues(data.mMaterial.mMaterial).fireDef; - if (data.mPrefix == OrePrefixes.plateAlloy && data.mMaterial.mMaterial == Materials.Iridium) { - tmp = 0.25f; - } - if (tmp > 0.0f) { - def[3] = def[3] - (tmp * def[3]); - } - // magicDef - tmp = Values.INSTANCE.getValues(data.mMaterial.mMaterial).magicDef; - if (data.mPrefix == OrePrefixes.plateAlloy && data.mMaterial.mMaterial == Materials.Iridium) { - tmp = 0.25f; - } - if (tmp > 0.0f) { - def[4] = def[4] - (tmp * def[4]); - } - // explosionDef - tmp = Values.INSTANCE.getValues(data.mMaterial.mMaterial).explosionDef; - if (data.mPrefix == OrePrefixes.plateAlloy && data.mMaterial.mMaterial == Materials.Iridium) { - tmp = 0.27f; - } - if (tmp > 0.0f) { - def[5] = def[5] - (tmp * def[5]); - } - if (data.mPrefix == OrePrefixes.plate && data.mMaterial.mMaterial == Materials.Rubber) { - def[7] = def[7] + 0.25f; - def[9] = def[9] + 2.0f; - } - if (data.mPrefix == OrePrefixes.plate && data.mMaterial.mMaterial == Materials.Lead) { - def[6] = def[6] + 0.30f; - } - if (data.mPrefix == OrePrefixes.plate && data.mMaterial.mMaterial == Materials.Plastic) { - def[7] = def[7] + 0.25f; - } - if (data.mPrefix == OrePrefixes.plate && data.mMaterial.mMaterial == Materials.NeodymiumMagnetic) { - def[11] = def[11] + 2.0f; - } - if (data.mPrefix == OrePrefixes.plate && data.mMaterial.mMaterial == Materials.NetherStar) { - def[8] = def[8] + 0.20f; - } - if (data.mPrefix == OrePrefixes.plate && data.mMaterial.mMaterial == Materials.InfusedFire) { - def[10] = def[10] + 3.0f; - } - if (data.mPrefix == OrePrefixes.plate && data.mMaterial.mMaterial == Materials.InfusedEntropy) { - def[10] = def[10] + 4.0f; - } - } else if (GT_ModHandler.isChargerItem(parts[i])) { - def[12] = def[12] + (float) ic2.api.item.ElectricItem.manager.getCharge(parts[i]); - def[0] = (float) (def[0] + Math.pow(ic2.api.item.ElectricItem.manager.getCharge(parts[i]), 0.33f)); - } - else if (Loader.isModLoaded("Thaumcraft") && parts[i].getItem() instanceof IRevealer) { - def[13] = 1; - def[31] += 100; - } - else if (parts[i].getItem().getUnlocalizedName().equals("ic2.itemNightvisionGoggles")) { - def[14] = 1; - def[31] += 100; - } else if (parts[i].getItem().getUnlocalizedName().equals("gt.meta.spring")) {// Once readded: GT Motors - switch (parts[i].getItem().getDamage(parts[i])) { - case 8630: - def[16] += 200; // motorPower - def[17] += 50; - def[31] += 10; - break; - case 8631: - def[16] += 300; // motorPower - def[17] += 100; - def[31] += 20; - break; - case 8632: - def[16] += 400; // motorPower - def[17] += 200; - def[31] += 50; - break; - case 8633: - def[16] += 500; // motorPower - def[17] += 400; - def[31] += 100; - break; - case 8634: - def[16] += 600; // motorPower - def[17] += 800; - def[31] += 200; - break; - } - } else if (parts[i].getItem().getUnlocalizedName().equals("gt.meta.springSmall")) {// Once Readded: GT Electric Pistons - switch (parts[i].getItem().getDamage(parts[i])) { - case 8630: - def[18] += 3; - def[19] += 200; - def[31] += 10; - break; - case 8631: - def[18] += 4; - def[19] += 300; - def[31] += 20; - break; - case 8632: - def[18] += 5; - def[19] += 450; - def[31] += 50; - break; - case 8633: - def[18] += 6; - def[19] += 800; - def[31] += 100; - break; - case 8634: - def[18] += 7; - def[19] += 1600; - def[31] += 200; - break; - } - } else if (parts[i].getItem().getUnlocalizedName().equals("gt.meta.Electrolyzer")) {// Once Readded: GT Electrolyzer - switch (parts[i].getItem().getDamage(parts[i])) { - case 8630: - def[20] += 10; // ElectrolyzerPower - def[21] += 1; // ElectrolyzerEU - def[31] += 50; - break; - case 8631: - def[20] += 20; // ElectrolyzerPower - def[21] += 4; // ElectrolyzerEU - def[31] += 100; - break; - case 8632: - def[20] += 40; // ElectrolyzerPower - def[21] += 16; // ElectrolyzerEU - def[31] += 150; - break; - case 8633: - def[20] += 80; // ElectrolyzerPower - def[21] += 64; // ElectrolyzerEU - def[31] += 200; - break; - case 8634: - def[20] += 160; // ElectrolyzerPower - def[21] += 256; // ElectrolyzerEU - def[31] += 250; - break; - } - } else if (parts[i].getItem().equals(ItemList.Cell_Empty.getItem())) { - def[15] += 8000; - } else if (parts[i].getItem().getUnlocalizedName().equals("gt.meta.cell")) {// Once Readded: GT Fluid Cells (tank) - switch (parts[i].getItem().getDamage(parts[i])) { - case 8630: // steel fluid cell - def[15] += 16000; - break; - case 8631: // tungsten fluid cell - def[15] += 64000; - break; - } - } else if (parts[i].getItem().getUnlocalizedName().equals("gt.meta.emmiter")) {// Once Readded: GT Field Emmiter - switch (parts[i].getItem().getDamage(parts[i])) { - case 8630: - def[22] += 1; // FieldEmmiterPower - def[23] += 1; // FieldEmmiterEU - def[31] += 100; - break; - case 8631: - def[22] += 2; // FieldEmmiterPower - def[23] += 4; // FieldEmmiterEU - def[31] += 200; - break; - case 8632: - def[22] += 3; // FieldEmmiterPower - def[23] += 16; // FieldEmmiterEU - def[31] += 300; - break; - case 8633: - def[22] += 4; // FieldEmmiterPower - def[23] += 64; // FieldEmmiterEU - def[31] += 400; - break; - case 8634: - def[22] += 5; // FieldEmmiterPower - def[23] += 512; // FieldEmmiterEU - def[31] += 500; - break; - } - } else if (data !=null && data.mPrefix == OrePrefixes.circuit) {// processing power stuff - if (data.mMaterial.mMaterial == Materials.Basic) { - def[30] += 100; - } else if (data.mMaterial.mMaterial == Materials.Good) { - def[30] += 200; - } else if (data.mMaterial.mMaterial == Materials.Advanced) { - def[30] += 300; - } else if (data.mMaterial.mMaterial == Materials.Data) { - def[30] += 400; - } else if (data.mMaterial.mMaterial == Materials.Elite) { - def[30] += 500; - } else if (data.mMaterial.mMaterial == Materials.Master) { - def[30] += 600; - } - } else if (parts[i].getItem().getUnlocalizedName().equals("gte.meta.jetpack")) {// jeptack parts - switch (parts[i].getItem().getDamage(parts[i])) { - case 0: - def[24] += 50; // JetpackFuelPower - def[25] += 1; // FuelUsage - def[31] += 10; - break; - case 1: - def[24] += 75; // JetpackFuelPower - def[25] += 2; // FuelUsage - def[31] += 20; - break; - case 2: - def[24] += 100; // JetpackFuelPower - def[25] += 4; // FuelUsage - def[31] += 30; - break; - case 3: - def[24] += 125; // JetpackFuelPower - def[25] += 8; // FuelUsage - def[31] += 40; - break; - case 4: - def[24] += 150; // JetpackFuelPower - def[25] += 16; // FuelUsage - def[31] += 50; - break; - case 5: - def[26] += 20; // JetpackEUPower - def[27] += 8; // JetpackEU - def[31] += 30; - break; - case 6: - def[26] += 30; // JetpackEUPower - def[27] += 16; // JetpackEU - def[31] += 60; - break; - case 7: - def[26] += 40; // JetpackEUPower - def[27] += 32; // JetpackEU - def[31] += 90; - break; - case 8: - def[26] += 50; // JetpackEUPower - def[27] += 64; // JetpackEU - def[31] += 120; - break; - case 9: - def[26] += 60; // JetpackEUPower - def[27] += 128; // JetpackEU - def[31] += 150; - break; - case 10: - def[28] += 100; // AntiGravPower - def[29] += 32; // AntiGravEU - def[31] += 100; - break; - case 11: - def[28] += 133; // AntiGravPower - def[29] += 64; // AntiGravEU - def[31] += 200; - break; - case 12: - def[28] += 166; // AntiGravPower - def[29] += 128; // AntiGravEU - def[31] += 300; - break; - case 13: - def[28] += 200; // AntiGravPower - def[29] += 256; // AntiGravEU - def[31] += 400; - break; - case 14: - def[28] += 233; // AntiGravPower - def[29] += 512; // AntiGravEU - def[31] += 500; - break; - } - } else if (true) { - //System.out.println("Unknown Item: " + parts[i].getItem().getUnlocalizedName()); - } - } - } - } - def[1] = 1 - def[1]; - def[2] = 1 - def[2]; - def[3] = 1 - def[3]; - def[4] = 1 - def[4]; - def[5] = 1 - def[5]; - if (def[7] > 0.95) { - def[7] = 1.0f; - } - if (def[8] > 0.98) { - def[8] = 1.0f; - } - return def; + return new float[32]; } public static int deChargeBatterys(ItemStack[] parts, int amount) { - // System.out.println("deCharge " + amount); int decharged = 0; for (int i = 0; decharged < amount && i < parts.length; i++) { if (GT_ModHandler.isChargerItem(parts[i])) { diff --git a/src/main/java/gregtech/common/items/armor/ArmorData.java b/src/main/java/gregtech/common/items/armor/ArmorData.java index 79c6a20ffa..c6ef4d5bc0 100644 --- a/src/main/java/gregtech/common/items/armor/ArmorData.java +++ b/src/main/java/gregtech/common/items/armor/ArmorData.java @@ -4,13 +4,20 @@ import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Random; import gregtech.api.damagesources.GT_DamageSources; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; +import gregtech.common.items.armor.components.ArmorComponent; +import gregtech.common.items.armor.components.StatType; +import gregtech.common.items.armor.gui.ContainerBasicArmor; +import gregtech.common.items.armor.gui.ContainerModularArmor; +import gregtech.common.items.armor.gui.InventoryArmor; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -32,56 +39,59 @@ public class ArmorData { public ArmorData helmet; public ArmorData chestplate; public ArmorData leggings; - public ArmorData boots; + public ArmorData boots; - public boolean fullArmor; - public boolean fullRadiationDef; - public boolean fullElectricDef; + public Map mStat = new HashMap(); + public Map mBStat = new HashMap(); - public float fallDef; - public float physicalDef; - public float projectileDef; - public float fireDef; - public float magicDef; - public float explosionDef; - public float radiationDef; - public float electricDef; - public float witherDef; - - public float thorns; - public float thornsSingle; - public int magnet; - public int magnetSingle; - - public int partsCharge; +// public boolean fullArmor; +// public boolean fullRadiationDef; +// public boolean fullElectricDef; +// +// public float fallDef; +// public float physicalDef; +// public float projectileDef; +// public float fireDef; +// public float magicDef; +// public float explosionDef; +// public float radiationDef; +// public float electricDef; +// public float witherDef; +// +// public float thorns; +// public float thornsSingle; +// public int magnet; +// public int magnetSingle; +// +// public int partsCharge; public int maxCharge; public int charge; - public boolean thaumicGoggles; - public boolean nightVision; - public boolean potionInjector; - public boolean autoFeeder; +// public boolean thaumicGoggles; +// public boolean nightVision; +// public boolean potionInjector; +// public boolean autoFeeder; public FluidStack fluid; - public int tankCap; - - public int weight; - public int maxWeight; - public int processingPower; - public int processingPowerUsed; - public int partProcessing; - public int partProcessingUsed; - - public int motorPower; - public int motorEUusage; - public int pistonJumpboost; - public int pistonEUusage; - public int electrolyzerProd; - public int electrolyzerEUusage; - public int fieldGenCap; - public int fieldGenEUusage; - - public int jetpackMaxWeight; - public int antiGravMaxWeight; +// public int tankCap; +// +// public int weight; + public float maxWeight; +// public int processingPower; +// public int processingPowerUsed; +// public int partProcessing; +// public int partProcessingUsed; +// +// public int motorPower; +// public int motorEUusage; +// public int pistonJumpboost; +// public int pistonEUusage; +// public int electrolyzerProd; +// public int electrolyzerEUusage; +// public int fieldGenCap; +// public int fieldGenEUusage; +// +// public int jetpackMaxWeight; +// public int antiGravMaxWeight; public ArmorData(EntityPlayer player, ItemStack stack, int type, int tier) { this.type = type; @@ -118,45 +128,14 @@ public class ArmorData { } public ArmorData calculateArmor(ItemStack[] parts) { - float[] def = ArmorCalculation.calculateArmor(parts); - weight = (int) def[0]; - physicalDef = def[1]; - projectileDef = def[2]; - fireDef = def[3]; - magicDef = def[4]; - explosionDef = def[5]; - radiationDef = def[6]; - electricDef = def[7]; - witherDef = def[8]; - fallDef = def[9]; - thornsSingle = def[10]; - magnetSingle = (int) def[11]; - if (armorTier > 0) { - partsCharge = (int) def[12]; - thaumicGoggles = def[13] > 0.5f; - nightVision = def[14] > 0.5f; - tankCap = (int) def[15]; // tankCap - motorPower = (int) def[16]; // motorPower - motorEUusage = (int) def[17]; // motorEU - pistonJumpboost = (int) def[18]; // pistonPower - fallDef += pistonJumpboost; - pistonEUusage = (int) def[19]; // pistonEU - electrolyzerProd = (int) def[20]; // ElectrolyzerPower - electrolyzerEUusage = (int) def[21]; // ElectrolyzerEU - fieldGenCap = (int) def[22]; // FieldEmmiterPower - fieldGenEUusage = (int) def[23]; // FieldEmmiterEU - jetpackMaxWeight = (int) def[24] + (int) def[26]; // JetpackFuelPower// JetpackEUPower - def[25] = 0; // FuelUsage - def[27] = 0; // JetpackEU - antiGravMaxWeight = (int) def[28]; // AntiGravPower - def[29] = 0; // AntiGravEU - if (armorTier == 2) { - partProcessing = (int) def[30] + 500; // ProcessingPower - } else { - partProcessing = (int) def[30] + 300; // ProcessingPower - } - partProcessingUsed = (int) def[31]; // ProcessingPowerUsed + mStat.clear(); + mBStat.clear(); + for(ItemStack tPart : parts){ + if(tPart!=null && ArmorComponent.mStacks.containsKey(tPart.getUnlocalizedName())) + ArmorComponent.mStacks.get(tPart.getUnlocalizedName()).calculateArmor(this); } + for(StatType tType : StatType.values())if(!mStat.containsKey(tType))mStat.put(tType, .0f); + for(StatType tType : StatType.values())if(!mBStat.containsKey(tType))mBStat.put(tType, false); updateTooltip(); return this; } @@ -165,67 +144,67 @@ public class ArmorData { List tagList = new ArrayList(); String tmp2 = ""; if (maxWeight > 4000) { - tmp2 = " " + GT_LanguageManager.getTranslation("hav"); + tmp2 = " " + GT_LanguageManager.getTranslation("Too Heavy"); } if (maxCharge != 0) { DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US); DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols(); symbols.setGroupingSeparator(' '); if (type == 0) { - if (thaumicGoggles) { - tagList.add(GT_LanguageManager.getTranslation("thaum")); + if (mBStat.get(StatType.THAUMICGOGGLES)) { + tagList.add(GT_LanguageManager.getTranslation("Thaumic Goggles installed")); } - if (nightVision) { - tagList.add(GT_LanguageManager.getTranslation("night")); + if (mBStat.get(StatType.NIGHTVISION)) { + tagList.add(GT_LanguageManager.getTranslation("Nightvision installed")); } } - tagList.add("EU: " + formatter.format(charge + partsCharge)); + tagList.add("EU: " + formatter.format(charge + mStat.get(StatType.PARTSCHARGE))); if (type == 2) { - tagList.add(GT_LanguageManager.getTranslation("jum") + ": " + pistonJumpboost / 3 + "m"); + tagList.add(GT_LanguageManager.getTranslation("Jumpboost") + ": " + mStat.get(StatType.PISTONJUMPBOOST) / 3 + "m"); } - if (type == 2 && pistonJumpboost > 0) { - tagList.add(GT_LanguageManager.getTranslation("uph")); + if (type == 2 && mStat.get(StatType.PISTONJUMPBOOST) > 0) { + tagList.add(GT_LanguageManager.getTranslation("Uphill step assist active")); } - if (type == 2 && motorPower > 0) { - tagList.add(GT_LanguageManager.getTranslation("speass") + ": " + motorPower); - tagList.add(GT_LanguageManager.getTranslation("motuse") + ": " + motorEUusage + " EU"); + if (type == 2 && mStat.get(StatType.MOTPRPOWER) > 0) { + tagList.add(GT_LanguageManager.getTranslation("Speedup") + ": " + mStat.get(StatType.MOTPRPOWER)); + tagList.add(GT_LanguageManager.getTranslation("Motor energy usage") + ": " + mStat.get(StatType.MOTOREUUSAGE) + " EU"); if (maxWeight > 4000) { - tagList.add(GT_LanguageManager.getTranslation("over")); + tagList.add(GT_LanguageManager.getTranslation("Too Heavy!!!")); } } - tagList.add(GT_LanguageManager.getTranslation("pro1") + " " + partProcessing + " " + GT_LanguageManager.getTranslation("pro3")); - tagList.add(GT_LanguageManager.getTranslation("pro2") + ": " + partProcessingUsed + " " + GT_LanguageManager.getTranslation("pro3")); - if (type == 0 && electrolyzerProd > 0) { - tagList.add(GT_LanguageManager.getTranslation("elec1") + " " + electrolyzerProd / 2 + GT_LanguageManager.getTranslation("elec2")); + tagList.add(GT_LanguageManager.getTranslation("Processing power ") + " " + mStat.get(StatType.PARTPROCESSING) + " " + GT_LanguageManager.getTranslation("")); + tagList.add(GT_LanguageManager.getTranslation("Processing power used") + ": " + mStat.get(StatType.PARTPROCESSINGUSED) + " " + GT_LanguageManager.getTranslation("")); + if (type == 0 && mStat.get(StatType.ELECTROLYZERPROD) > 0) { + tagList.add(GT_LanguageManager.getTranslation("Electrolyzer produces ") + " " + mStat.get(StatType.ELECTROLYZERPROD) / 2 + GT_LanguageManager.getTranslation("per second")); } - if (tankCap > 0) { + if (mStat.get(StatType.TANKCAP) > 0) { if (fluid != null) { - tagList.add(GT_LanguageManager.getTranslation("tank") + ": " + fluid.getLocalizedName() + " " + fluid.amount + "L (" + tankCap + ")"); + tagList.add(GT_LanguageManager.getTranslation("Tank Capacity") + ": " + fluid.getLocalizedName() + " " + fluid.amount + "L (" + mStat.get(StatType.TANKCAP) + ")"); } else { - tagList.add(GT_LanguageManager.getTranslation("tankcap") + ": " + tankCap); + tagList.add(GT_LanguageManager.getTranslation("tankcap") + ": " + mStat.get(StatType.TANKCAP)); } } } - tagList.add(GT_LanguageManager.getTranslation("weight") + ": " + weight + tmp2); - tagList.add(GT_LanguageManager.getTranslation("phydef") + ": " + (Math.round(physicalDef * 1000) / 10.0) + "%"); - tagList.add(GT_LanguageManager.getTranslation("prodef") + ": " + (Math.round(projectileDef * 1000) / 10.0) + "%"); - tagList.add(GT_LanguageManager.getTranslation("firedef") + ": " + (Math.round(fireDef * 1000) / 10.0) + "%"); - tagList.add(GT_LanguageManager.getTranslation("magdef") + ": " + (Math.round(magicDef * 1000) / 10.0) + "%"); - tagList.add(GT_LanguageManager.getTranslation("expdef") + ": " + (Math.round(explosionDef * 1000) / 10.0) + "%"); - if (fallDef > 0 && type == 3) { - tagList.add(GT_LanguageManager.getTranslation("abs1") + " " + fallDef + GT_LanguageManager.getTranslation("abs2")); + tagList.add(GT_LanguageManager.getTranslation("Weight") + ": " + mStat.get(StatType.WEIGHT) + tmp2); + tagList.add(GT_LanguageManager.getTranslation("Physical Defence") + ": " + (Math.round(mStat.get(StatType.PHYSICALDEFENCE) * 1000) / 10.0) + "%"); + tagList.add(GT_LanguageManager.getTranslation("Projectile Defence") + ": " + (Math.round(mStat.get(StatType.PROJECTILEDEFENCE) * 1000) / 10.0) + "%"); + tagList.add(GT_LanguageManager.getTranslation("Fire Defence") + ": " + (Math.round(mStat.get(StatType.FIREDEFENCE) * 1000) / 10.0) + "%"); + tagList.add(GT_LanguageManager.getTranslation("Magic Defence") + ": " + (Math.round(mStat.get(StatType.MAGICDEFENCE) * 1000) / 10.0) + "%"); + tagList.add(GT_LanguageManager.getTranslation("Explosive Defence") + ": " + (Math.round(mStat.get(StatType.EXPLOSIONDEFENCE) * 1000) / 10.0) + "%"); + if (mStat.get(StatType.FALLDEFENCE) > 0 && type == 3) { + tagList.add(GT_LanguageManager.getTranslation("Absorbs") + " " + mStat.get(StatType.FALLDEFENCE) + GT_LanguageManager.getTranslation(" m of Fall Defence")); } - if (thorns > 0) { - tagList.add(GT_LanguageManager.getTranslation("thorns") + ": " + (int) thorns); + if (mStat.get(StatType.THORNS) > 0) { + tagList.add(GT_LanguageManager.getTranslation("Thorns") + ": " + mStat.get(StatType.THORNS)); } - if (magnet > 0) { - tagList.add(GT_LanguageManager.getTranslation("magnet") + ": " + magnet + "m"); + if (mStat.get(StatType.MAGNET) > 0) { + tagList.add(GT_LanguageManager.getTranslation("Magnet") + ": " + mStat.get(StatType.MAGNET) + "m"); } - if (fullRadiationDef) { - tagList.add(GT_LanguageManager.getTranslation("radim")); + if (mBStat.get(StatType.FULLRADIATIONARMOR)) { + tagList.add(GT_LanguageManager.getTranslation("Is Full Radiation Defence")); } else { - if (radiationDef > 0.01d) { - tagList.add(GT_LanguageManager.getTranslation("raddef") + ": " + (Math.round(radiationDef * 1000) / 10.0) + "%"); + if (mStat.get(StatType.RADIATIONDEFENCE) > 0.01d) { + tagList.add(GT_LanguageManager.getTranslation("Radiation Defence") + ": " + (Math.round(mStat.get(StatType.RADIATIONDEFENCE) * 1000) / 10.0) + "%"); } } info = tagList; @@ -242,12 +221,12 @@ public class ArmorData { ModularArmor_Item tmp = (ModularArmor_Item) stack.getItem(); ContainerModularArmor tmp2 = new ContainerBasicArmor(aPlayer, new InventoryArmor(ModularArmor_Item.class, stack)); if ((this.type + i) == 4) { - fluid = ArmorCalculation.getFluid(tmp2.mInvArmor.parts, tankCap); + fluid = ArmorCalculation.getFluid(tmp2.mInvArmor.parts, Math.round(mStat.get(StatType.TANKCAP))); } if (maxCharge > 0 && charge < maxCharge) { int loaded = ArmorCalculation.deChargeBatterys(tmp2.mInvArmor.parts, maxCharge - charge); charge = charge + loaded; - tmp.data.partsCharge -= loaded; + change(mStat, StatType.PARTSCHARGE, -loaded); } switch (tmp.armorType) { @@ -270,39 +249,39 @@ public class ArmorData { } } if (helmet != null && chestplate != null && leggings != null && boots != null) { - fullArmor = true; + set(mBStat, StatType.FULLARMOR, true); } else { - fullArmor = false; + set(mBStat, StatType.FULLARMOR, false); } - fullRadiationDef = fullArmor && helmet.radiationDef > 0.9f && chestplate.radiationDef > 0.9f && leggings.radiationDef > 0.9f && boots.radiationDef > 0.9f; - fullElectricDef = fullArmor && helmet.electricDef > 0.9f && chestplate.electricDef > 0.9f && leggings.electricDef > 0.9f && boots.electricDef > 0.9f; - magnet = 0; - thorns = 0; - processingPower = 0; - processingPowerUsed = 0; + set(mBStat, StatType.FULLRADIATIONARMOR, mBStat.get(StatType.FULLARMOR) && helmet.mStat.get(StatType.RADIATIONDEFENCE) > 0.9f && chestplate.mStat.get(StatType.RADIATIONDEFENCE) > 0.9f && leggings.mStat.get(StatType.RADIATIONDEFENCE) > 0.9f && boots.mStat.get(StatType.RADIATIONDEFENCE) > 0.9f); + set(mBStat, StatType.FULLELECTRICARMOR, mBStat.get(StatType.FULLARMOR) && chestplate.mStat.get(StatType.ELECTRICALDEFENCE) > 0.9f && chestplate.mStat.get(StatType.ELECTRICALDEFENCE) > 0.9f && leggings.mStat.get(StatType.ELECTRICALDEFENCE) > 0.9f && boots.mStat.get(StatType.ELECTRICALDEFENCE) > 0.9f); + set(mBStat, StatType.MAGNET, 0); + set(mBStat, StatType.THORNS, 0); + set(mBStat, StatType.PROCESSINGPOWER, 0); + set(mBStat, StatType.PROCESSINGPOWERUSED, 0); if (helmet != null) { - magnet += helmet.magnetSingle; - thorns += helmet.thornsSingle; - processingPower += helmet.partProcessing; - processingPowerUsed += helmet.partProcessingUsed; + change(mStat, StatType.MAGNET, helmet.mStat.get(StatType.MAGNET)); + change(mStat, StatType.THORNS, helmet.mStat.get(StatType.THORNS)); + change(mStat, StatType.PROCESSINGPOWER, helmet.mStat.get(StatType.PROCESSINGPOWER)); + change(mStat, StatType.PROCESSINGPOWERUSED, helmet.mStat.get(StatType.PROCESSINGPOWERUSED)); } if (chestplate != null) { - magnet += chestplate.magnetSingle; - thorns += chestplate.thornsSingle; - processingPower += chestplate.partProcessing; - processingPowerUsed += chestplate.partProcessingUsed; + change(mStat, StatType.MAGNET, chestplate.mStat.get(StatType.MAGNET)); + change(mStat, StatType.THORNS, chestplate.mStat.get(StatType.THORNS)); + change(mStat, StatType.PROCESSINGPOWER, chestplate.mStat.get(StatType.PROCESSINGPOWER)); + change(mStat, StatType.PROCESSINGPOWERUSED, chestplate.mStat.get(StatType.PROCESSINGPOWERUSED)); } if (leggings != null) { - magnet += leggings.magnetSingle; - thorns += leggings.thornsSingle; - processingPower += leggings.partProcessing; - processingPowerUsed += leggings.partProcessingUsed; + change(mStat, StatType.MAGNET, leggings.mStat.get(StatType.MAGNET)); + change(mStat, StatType.THORNS, leggings.mStat.get(StatType.THORNS)); + change(mStat, StatType.PROCESSINGPOWER, leggings.mStat.get(StatType.PROCESSINGPOWER)); + change(mStat, StatType.PROCESSINGPOWERUSED, leggings.mStat.get(StatType.PROCESSINGPOWERUSED)); } if (boots != null) { - magnet += boots.magnetSingle; - thorns += boots.thornsSingle; - processingPower += boots.partProcessing; - processingPowerUsed += boots.partProcessingUsed; + change(mStat, StatType.MAGNET, boots.mStat.get(StatType.MAGNET)); + change(mStat, StatType.THORNS, boots.mStat.get(StatType.THORNS)); + change(mStat, StatType.PROCESSINGPOWER, boots.mStat.get(StatType.PROCESSINGPOWER)); + change(mStat, StatType.PROCESSINGPOWERUSED, boots.mStat.get(StatType.PROCESSINGPOWERUSED)); } isTopItem = false; if (type == 0) { @@ -315,18 +294,41 @@ public class ArmorData { isTopItem = true; } if (helmet != null) { - maxWeight = helmet.weight; + maxWeight = helmet.mStat.get(StatType.WEIGHT); } if (chestplate != null) { - maxWeight += chestplate.weight; + maxWeight += chestplate.mStat.get(StatType.WEIGHT); } if (leggings != null) { - maxWeight += leggings.weight; + maxWeight += leggings.mStat.get(StatType.WEIGHT); } if (boots != null) { - maxWeight += boots.weight; + maxWeight += boots.mStat.get(StatType.WEIGHT); } } + + public void set(Map aMap, StatType aType, boolean aSet){ + if(aMap.containsKey(aType))aMap.remove(aType); + aMap.put(aType, aSet); + } + + public void set(Map aMap, StatType aType, float aSet){ + if(aMap.containsKey(aType))aMap.remove(aType); + aMap.put(aType, aSet); + } + + public void change(Map aMap, StatType aType, float aChange){ + float tChange = 0; + if(aMap==null)System.out.println("changeMapnull"); + if(aMap.containsKey(aType)){tChange = (float) aMap.get(aType); + aMap.remove(aType); + } + aMap.put(aType, (tChange + aChange)); + } + + public void dechargeComponents(int aCharge){ + + } public double getBaseAbsorptionRatio() { switch (this.type) { diff --git a/src/main/java/gregtech/common/items/armor/ContainerBasicArmor.java b/src/main/java/gregtech/common/items/armor/ContainerBasicArmor.java deleted file mode 100644 index 108d813707..0000000000 --- a/src/main/java/gregtech/common/items/armor/ContainerBasicArmor.java +++ /dev/null @@ -1,48 +0,0 @@ -package gregtech.common.items.armor; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ContainerBasicArmor extends ContainerModularArmor { - - public ContainerBasicArmor(EntityPlayer player, InventoryArmor aInvArmor) { - super(player, aInvArmor); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mInvArmor, 0, 118, 6)); - addSlotToContainer(new Slot(mInvArmor, 1, 136, 6)); - addSlotToContainer(new Slot(mInvArmor, 2, 154, 6)); - addSlotToContainer(new Slot(mInvArmor, 3, 118, 24)); - addSlotToContainer(new Slot(mInvArmor, 4, 136, 24)); - addSlotToContainer(new Slot(mInvArmor, 5, 154, 24)); - addSlotToContainer(new Slot(mInvArmor, 6, 118, 42)); - addSlotToContainer(new Slot(mInvArmor, 7, 136, 42)); - addSlotToContainer(new Slot(mInvArmor, 8, 154, 42)); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - addSlotToContainer(new Slot(aInventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - ItemStack stackInSlot = aInventoryPlayer.getStackInSlot(i); - if(isIdenticalItem(mInvArmor.parent,stackInSlot)){ - addSlotToContainer(new SlotLocked(aInventoryPlayer,i,8+i*18,142)); - }else{ - addSlotToContainer(new Slot(aInventoryPlayer, i, 8 + i * 18, 142));} - } - } - - public int getSlotCount() { - return 9; - } - - public int getShiftClickSlotCount() { - return 9; - } - -} diff --git a/src/main/java/gregtech/common/items/armor/ContainerElectricArmor1.java b/src/main/java/gregtech/common/items/armor/ContainerElectricArmor1.java deleted file mode 100644 index 063807275c..0000000000 --- a/src/main/java/gregtech/common/items/armor/ContainerElectricArmor1.java +++ /dev/null @@ -1,53 +0,0 @@ -package gregtech.common.items.armor; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ContainerElectricArmor1 extends ContainerBasicArmor { - - public ContainerElectricArmor1(EntityPlayer player, InventoryArmor aInvArmor) { - super(player, aInvArmor); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mInvArmor, 0, 118, 6)); - addSlotToContainer(new Slot(mInvArmor, 1, 136, 6)); - addSlotToContainer(new Slot(mInvArmor, 2, 154, 6)); - addSlotToContainer(new Slot(mInvArmor, 3, 118, 24)); - addSlotToContainer(new Slot(mInvArmor, 4, 136, 24)); - addSlotToContainer(new Slot(mInvArmor, 5, 154, 24)); - addSlotToContainer(new Slot(mInvArmor, 6, 118, 42)); - addSlotToContainer(new Slot(mInvArmor, 7, 136, 42)); - addSlotToContainer(new Slot(mInvArmor, 8, 154, 42)); - addSlotToContainer(new Slot(mInvArmor, 9, 118, 60)); - addSlotToContainer(new Slot(mInvArmor, 10, 136, 60)); - addSlotToContainer(new Slot(mInvArmor, 11, 154, 60)); - - addSlotToContainer(new SlotFluid(mInvArmor,12,94,32)); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - addSlotToContainer(new Slot(aInventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - ItemStack stackInSlot = aInventoryPlayer.getStackInSlot(i); - if(isIdenticalItem(mInvArmor.parent,stackInSlot)){ - addSlotToContainer(new SlotLocked(aInventoryPlayer,i,8+i*18,142)); - }else{ - addSlotToContainer(new Slot(aInventoryPlayer, i, 8 + i * 18, 142));} - } - } - - public int getSlotCount() { - return 12; - } - - public int getShiftClickSlotCount() { - return 12; - } - -} diff --git a/src/main/java/gregtech/common/items/armor/ContainerModularArmor.java b/src/main/java/gregtech/common/items/armor/ContainerModularArmor.java deleted file mode 100644 index 88f1a71599..0000000000 --- a/src/main/java/gregtech/common/items/armor/ContainerModularArmor.java +++ /dev/null @@ -1,171 +0,0 @@ -package gregtech.common.items.armor; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public abstract class ContainerModularArmor extends Container { - - public InventoryArmor mInvArmor; - - public ContainerModularArmor(EntityPlayer player, InventoryArmor aInvArmor) { - this.mInvArmor = aInvArmor; - addSlots(player.inventory); - } - - public ArmorData getData(EntityPlayer aPlayer){ - - - - return null; - } - - @Override - public boolean canInteractWith(EntityPlayer aPlayer) { - return true; - } - - public abstract void addSlots(InventoryPlayer aInventoryPlayer); - - public abstract int getSlotCount(); - - public abstract int getShiftClickSlotCount(); - - public void saveInventory(EntityPlayer entityplayer) { - mInvArmor.onGuiSaved(entityplayer); - } - - @Override - public void onContainerClosed(EntityPlayer player) { - super.onContainerClosed(player); - if (!player.worldObj.isRemote) { - saveInventory(player); - } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) { - if (player == null) { - return null; - } - - ItemStack originalStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); - int numSlots = inventorySlots.size(); - if (slot != null && slot.getHasStack()) { - ItemStack stackInSlot = slot.getStack(); - originalStack = stackInSlot.copy(); - if (slotIndex >= numSlots - 9 * 4 && tryShiftItem(stackInSlot, numSlots)) { - } else if (slotIndex >= numSlots - 9 * 4 && slotIndex < numSlots - 9) { - if (!shiftItemStack(stackInSlot, numSlots - 9, numSlots)) { - return null; - } - } else if (slotIndex >= numSlots - 9 && slotIndex < numSlots) { - if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots - 9)) { - return null; - } - } else if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots)) { - return null; - } - slot.onSlotChange(stackInSlot, originalStack); - if (stackInSlot.stackSize <= 0) { - slot.putStack(null); - } else { - slot.onSlotChanged(); - } - if (stackInSlot.stackSize == originalStack.stackSize) { - return null; - } - slot.onPickupFromSlot(player, stackInSlot); - } - return originalStack; - } - - private boolean tryShiftItem(ItemStack stackToShift, int numSlots) { - for (int machineIndex = 0; machineIndex < numSlots - 9 * 4; machineIndex++) { - Slot slot = (Slot) inventorySlots.get(machineIndex); - if (slot.getHasStack()) { - continue; - } - if(slot instanceof SlotLocked){ - continue; - } - if(slot instanceof SlotFluid){ - continue; - } - - if (!slot.isItemValid(stackToShift)) { - continue; - } - if (shiftItemStack(stackToShift, machineIndex, machineIndex + 1)) { - return true; - } - } - return false; - } - - protected boolean shiftItemStack(ItemStack stackToShift, int start, int end) { - boolean changed = false; - if (stackToShift.isStackable()) { - for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < end; slotIndex++) { - Slot slot = (Slot) inventorySlots.get(slotIndex); - ItemStack stackInSlot = slot.getStack(); - if (stackInSlot != null && isIdenticalItem(stackInSlot, stackToShift)) { - int resultingStackSize = stackInSlot.stackSize + stackToShift.stackSize; - int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit()); - if (resultingStackSize <= max) { - stackToShift.stackSize = 0; - stackInSlot.stackSize = resultingStackSize; - slot.onSlotChanged(); - changed = true; - } else if (stackInSlot.stackSize < max) { - stackToShift.stackSize -= max - stackInSlot.stackSize; - stackInSlot.stackSize = max; - slot.onSlotChanged(); - changed = true; - } - } - } - } - if (stackToShift.stackSize > 0) { - for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < end; slotIndex++) { - Slot slot = (Slot) inventorySlots.get(slotIndex); - ItemStack stackInSlot = slot.getStack(); - if (stackInSlot == null) { - int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit()); - stackInSlot = stackToShift.copy(); - stackInSlot.stackSize = Math.min(stackToShift.stackSize, max); - stackToShift.stackSize -= stackInSlot.stackSize; - slot.putStack(stackInSlot); - slot.onSlotChanged(); - changed = true; - } - } - } - return changed; - } - - public static boolean isIdenticalItem(ItemStack lhs, ItemStack rhs) { - if (lhs == null || rhs == null) { - return false; - } - - if (lhs.getItem() != rhs.getItem()) { - return false; - } - - if (lhs.getItemDamage() != OreDictionary.WILDCARD_VALUE) { - if (lhs.getItemDamage() != rhs.getItemDamage()) { - return false; - } - } - - return ItemStack.areItemStackTagsEqual(lhs, rhs); - } - -} diff --git a/src/main/java/gregtech/common/items/armor/FluidSync.java b/src/main/java/gregtech/common/items/armor/FluidSync.java deleted file mode 100644 index 70ee268188..0000000000 --- a/src/main/java/gregtech/common/items/armor/FluidSync.java +++ /dev/null @@ -1,67 +0,0 @@ -package gregtech.common.items.armor; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import com.google.common.base.Charsets; -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; - -public class FluidSync /**implements IPacket**/ { - String playerName; - int amount; - String fluid; - -// @Override - public byte getPacketID() { - return 0; - } - - public FluidSync(String player, int amount, String fluid) { - this.playerName = player; - this.amount = amount; - this.fluid = fluid.toLowerCase(); - } - -// @Override - public ByteArrayDataOutput encode() { - ByteArrayDataOutput rOut = ByteStreams.newDataOutput(4); - rOut.writeUTF(playerName + ";" + amount + ";" + fluid); - return rOut; - } - -// @Override -// public IPacket decode(ByteArrayDataInput aData) { -// String tmp = aData.readUTF(); -// String[] tmp2 = tmp.split(";"); -// return new FluidSync(tmp2[0], Integer.parseInt(tmp2[1]), tmp2[2].toLowerCase()); -// } -// -// @Override -// public void process(IBlockAccess aWorld, INetworkHandler aNetworkHandler) { -// WorldServer[] worlds = DimensionManager.getWorlds(); -// EntityPlayer tmp; -// for (int i = 0; i < worlds.length; i++) { -// tmp = worlds[i].getPlayerEntityByName(playerName); -// if (tmp != null) { -// try { -// if (fluid.equals("null")) { -// tmp.openContainer.getSlot(12).putStack(null); -// } else { -// tmp.openContainer.getSlot(12).putStack(UT.Fluids.display(new FluidStack(FluidRegistry.getFluid(fluid), amount), true)); -// } -// tmp.openContainer.detectAndSendChanges(); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// -// } -// } -// } - -} diff --git a/src/main/java/gregtech/common/items/armor/FluidSync2.java b/src/main/java/gregtech/common/items/armor/FluidSync2.java deleted file mode 100644 index de801aad8a..0000000000 --- a/src/main/java/gregtech/common/items/armor/FluidSync2.java +++ /dev/null @@ -1,67 +0,0 @@ -package gregtech.common.items.armor; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import com.google.common.base.Charsets; -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; - -public class FluidSync2 /**implements IPacket**/ { - String playerName; - -// @Override - public byte getPacketID() { - return 1; - } - - public FluidSync2(String player) { - this.playerName = player; - } - -// @Override - public ByteArrayDataOutput encode() { - ByteArrayDataOutput rOut = ByteStreams.newDataOutput(4); - rOut.writeUTF(playerName); - return rOut; - } - -// @Override -// public IPacket decode(ByteArrayDataInput aData) { -// return new FluidSync2(aData.readUTF()); -// } -// -// @Override -// public void process(IBlockAccess aWorld, INetworkHandler aNetworkHandler) { -// WorldServer[] worlds = DimensionManager.getWorlds(); -// EntityPlayer tmp; -// for (int i = 0; i < worlds.length; i++) { -// tmp = worlds[i].getPlayerEntityByName(playerName); -// if (tmp != null) { -// try { -// ItemStack tmp2 = tmp.inventory.getItemStack(); -// ItemStack tmp3 = UT.Fluids.getContainerForFilledItem(tmp2, true); -// if (tmp2.stackSize <= 1) { -// tmp2 = null; -// } else { -// tmp2.stackSize--; -// } -// tmp.inventory.setItemStack(tmp2); -// if(tmp3!=null){ -// tmp3.stackSize=1; -// tmp.inventory.addItemStackToInventory(tmp3);} -// } catch (Exception e) { -// e.printStackTrace(); -// } -// -// } -// } -// } - -} diff --git a/src/main/java/gregtech/common/items/armor/GuiElectricArmor1.java b/src/main/java/gregtech/common/items/armor/GuiElectricArmor1.java deleted file mode 100644 index 136630124f..0000000000 --- a/src/main/java/gregtech/common/items/armor/GuiElectricArmor1.java +++ /dev/null @@ -1,310 +0,0 @@ -package gregtech.common.items.armor; - -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; - -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; - -@SideOnly(Side.CLIENT) -public class GuiElectricArmor1 extends GuiContainer { - ContainerModularArmor cont; - EntityPlayer player; - private int tab; - - public GuiElectricArmor1(ContainerModularArmor containerModularArmor, EntityPlayer aPlayer) { - super(containerModularArmor); - player = aPlayer; - cont = containerModularArmor; - tab = 0; - } - - public String seperateNumber(long number){ - DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US); - DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols(); - symbols.setGroupingSeparator(' '); - return formatter.format(number); - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) { - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - int x2 = x - xStart; - int y2 = y - yStart; - drawTooltip(x2, y2 + 5); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { - GL11.glColor4f(1F, 1F, 1F, 1F); - this.mc.getTextureManager().bindTexture(new ResourceLocation("gregtech", "textures/gui/armorgui3x4.png")); - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - //Draw background - drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); - //Draw active arrows - drawTexturedModalRect(xStart + 10, yStart + 70, 219, 11, 14, 5); - //Draw active armor symbol - switch (cont.mInvArmor.data.type) { - case 0: - drawTexturedModalRect(xStart + 73, yStart + 68, 177, 10, 10, 9); - break; - case 1: - drawTexturedModalRect(xStart + 83, yStart + 68, 187, 10, 10, 9); - break; - case 2: - drawTexturedModalRect(xStart + 93, yStart + 68, 197, 10, 10, 9); - break; - case 3: - drawTexturedModalRect(xStart + 103, yStart + 68, 207, 10, 10, 9); - break; - default: - break; - } - //Draw active tab - switch(tab){ - case 0: - break; - case 1: - drawTexturedModalRect(xStart + 7, yStart + 14, 2, 167, 104, 54); - break; - case 2: - drawTexturedModalRect(xStart + 7, yStart + 14, 107, 167, 104, 54); - break; - default: - break; - } - - if(cont.mInvArmor.data.tankCap>0){ - drawTexturedModalRect(xStart + 94, yStart + 32, 231, 69, 16, 34); - } - - int bar = (int) Math.floor(18 * (cont.mInvArmor.data.weight/(float)1000)); - drawTexturedModalRect(xStart + 15, yStart + 7, 217, 26, bar, 5); - drawTexturedModalRect(xStart + bar + 15, yStart + 7, 197+bar, 26, 18-bar, 5); - - if(tab==0){ - //processing power bar - bar = Math.min((int) Math.floor(52 * ((float)cont.mInvArmor.data.processingPowerUsed/(float)cont.mInvArmor.data.processingPower)),52); - drawTexturedModalRect(xStart + 17, yStart + 17, 177, 146, bar, 5); - drawTexturedModalRect(xStart + bar + 17, yStart + 17, 177+bar, 139, 52-bar, 5); - }else if(tab==1){ - - }else{ - //Def tab values - if(cont.mInvArmor.data.physicalDef>0)drawTexturedModalRect(xStart + 30, yStart + 20, 186, 33, 7, 7); - drawBars(31, 20, cont.mInvArmor.data.physicalDef); - if(cont.mInvArmor.data.projectileDef>0)drawTexturedModalRect(xStart + 30, yStart + 29, 186, 42, 7, 7); - drawBars(31, 29, cont.mInvArmor.data.projectileDef); - if(cont.mInvArmor.data.fireDef>0)drawTexturedModalRect(xStart + 30, yStart + 38, 186, 51, 7, 7); - drawBars(31, 38, cont.mInvArmor.data.fireDef); - if(cont.mInvArmor.data.magicDef>0)drawTexturedModalRect(xStart + 30, yStart + 47, 186, 60, 7, 7); - drawBars(31, 47, cont.mInvArmor.data.magicDef); - if(cont.mInvArmor.data.explosionDef>0)drawTexturedModalRect(xStart + 30, yStart + 56, 186, 69, 7, 7); - drawBars(31, 56, cont.mInvArmor.data.explosionDef); - if(cont.mInvArmor.data.radiationDef>0)drawTexturedModalRect(xStart + 61, yStart + 20, 186, 87, 7, 7); - drawBars(62, 20, cont.mInvArmor.data.radiationDef); - if(cont.mInvArmor.data.electricDef>0)drawTexturedModalRect(xStart + 61, yStart + 29, 186, 96, 7, 7); - drawBars(62, 29, cont.mInvArmor.data.electricDef); - if(cont.mInvArmor.data.witherDef>0)drawTexturedModalRect(xStart + 61, yStart + 38, 186, 105, 7, 7); - drawBars(62, 38, cont.mInvArmor.data.witherDef); - if(cont.mInvArmor.data.fallDef>0)drawTexturedModalRect(xStart + 61, yStart + 47, 186, 114, 7, 7); - if(cont.mInvArmor.data.thorns>0)drawTexturedModalRect(xStart + 61, yStart + 56, 186, 123, 7, 7); - if(cont.mInvArmor.data.magnet>0)drawTexturedModalRect(xStart + 70, yStart + 56, 186, 78, 7, 7); - } - - - } - - protected void mouseClicked(int mouseX, int mouseY, int mouseBtn) { - int xStart = mouseX-((width - xSize) / 2); - int yStart = mouseY-((height - ySize) / 2); - if(yStart>68&&yStart<77){ - if(xStart>18&&xStart<26){ - tab++; - }else if(xStart>8&&xStart<17){ - tab--; - } - if(tab>2){tab=0;} - if(tab<0){tab=2;} - if(xStart>72&&xStart<112){ - if(xStart>72&&xStart<81&&cont.mInvArmor.data.helmet!=null){cont.mInvArmor.data.helmet.openGui=true;player.closeScreen();} - if(xStart>82&&xStart<91&&cont.mInvArmor.data.chestplate!=null){cont.mInvArmor.data.chestplate.openGui=true;player.closeScreen();} - if(xStart>92&&xStart<101&&cont.mInvArmor.data.leggings!=null){cont.mInvArmor.data.leggings.openGui=true;player.closeScreen();} - if(xStart>102&&xStart<112&&cont.mInvArmor.data.boots!=null){cont.mInvArmor.data.boots.openGui=true;player.closeScreen();} - } - } -// Slot slot = getSlotAtPosition(mouseX, mouseY); -// if (slot != null && slot instanceof SlotFluid && player != null) { -// ItemStack tmp = player.inventory.getItemStack(); -// if (tmp == null) { -// GTExtras.NET.sendToServer(new FluidSync(player.getCommandSenderName(), 0, "null")); -// } -// if (tmp != null && tmp.getItem() instanceof IFluidContainerItem) { -// FluidStack tmp2 = ((IFluidContainerItem) tmp.getItem()).getFluid(tmp); -// if (!slot.getHasStack() && tmp2 != null) { -// slot.putStack(UT.Fluids.display(tmp2, true)); -// GTExtras.NET.sendToServer(new FluidSync(player.getCommandSenderName(), tmp2.amount, UT.Fluids.name(tmp2, false))); -// ItemStack tmp4 = UT.Fluids.getContainerForFilledItem(tmp, true); -// tmp4.stackSize = 1; -// if (tmp.stackSize > 1) { -// player.inventory.addItemStackToInventory(tmp4); -// tmp.stackSize--; -// player.inventory.setItemStack(tmp); -// GTExtras.NET.sendToServer(new FluidSync2(player.getCommandSenderName())); -// } else { -// player.inventory.setItemStack(null); -// player.inventory.addItemStackToInventory(tmp4); -// GTExtras.NET.sendToServer(new FluidSync2(player.getCommandSenderName())); -// } -// -// } else if (slot.getHasStack() && tmp2 != null) { -// Item fluidSlot = slot.getStack().getItem(); -// if (fluidSlot.getDamage(slot.getStack()) == tmp2.getFluidID()) { -// NBTTagCompound nbt = slot.getStack().getTagCompound(); -// if (nbt != null) { -// tmp2.amount += nbt.getLong("mFluidDisplayAmount"); -// ItemStack tmp3 = player.inventory.getItemStack(); -// if (tmp3.stackSize <= 1) { -// tmp3 = null; -// } else { -// tmp3.stackSize--; -// } -// player.inventory.setItemStack(tmp3); -// GTExtras.NET.sendToServer(new FluidSync2(player.getCommandSenderName())); -// slot.putStack(UT.Fluids.display(tmp2, true)); -// GTExtras.NET.sendToServer(new FluidSync(player.getCommandSenderName(), tmp2.amount, UT.Fluids.name(tmp2, false))); -// } -// } -// } -// } -// } - super.mouseClicked(mouseX, mouseY, mouseBtn); - } - - protected void drawTooltip(int x, int y) { - List list = new ArrayList(); - //General tooltips - if(x>=7&&y>=11&&x<=33&&y<=17){ - list.add(GT_LanguageManager.getTranslation("weight") + ": " + cont.mInvArmor.data.weight); - list.add("Total Weight: "+cont.mInvArmor.data.maxWeight); - if (cont.mInvArmor.data.weight > 1000) - list.add("Too Heavy!"); - } - if(x>=56&&y>=11&&x<=112&&y<=17){ - list.add("Stored Energy: "+seperateNumber(cont.mInvArmor.data.charge)+" EU"); - } - if(y>74&&y<83){ - if(x>8&&x<17){ - list.add("Previous Page"); - }else if(x>18&&x<27){ - list.add("Next Page"); - }else if(x>72&&x<80){ - list.add("Helmet"); - }else if(x>81&&x<90){ - list.add("Chestplate"); - }else if(x>91&&x<100){ - list.add("Leggings"); - }else if(x>101&&x<110){ - list.add("Boots"); - } - } - if(tab==0){ - if(x>=93&&y>=36&&x<=110&&y<=71){list.add("Tank Capacity: "+cont.mInvArmor.data.tankCap+"L"); - } - if(x>=7&&y>=22&&x<=70&&y<=28){list.add("Processing Power Provided: "+cont.mInvArmor.data.processingPower); - list.add("Processing Power Used: "+cont.mInvArmor.data.processingPowerUsed); - } - }else if(tab==1){ - - }else{ - if (x >= 28 && x <= 58) { - if (y >= 25 && y <= 32) { - list.add(GT_LanguageManager.getTranslation("phydef") + ": " + (Math.round(cont.mInvArmor.data.physicalDef * 1000) / 10.0) + "%"); - } else if (y >= 33 && y <= 41) { - list.add(GT_LanguageManager.getTranslation("prodef") + ": " + (Math.round(cont.mInvArmor.data.projectileDef * 1000) / 10.0) + "%"); - } else if (y >= 42 && y <= 50) { - list.add(GT_LanguageManager.getTranslation("firedef") + ": " + (Math.round(cont.mInvArmor.data.fireDef * 1000) / 10.0) + "%"); - } else if (y >= 51 && y <= 59) { - list.add(GT_LanguageManager.getTranslation("magdef") + ": " + (Math.round(cont.mInvArmor.data.magicDef * 1000) / 10.0) + "%"); - } else if (y >= 60 && y <= 68) { - list.add(GT_LanguageManager.getTranslation("expdef") + ": " + (Math.round(cont.mInvArmor.data.explosionDef * 1000) / 10.0) + "%"); - } - } else if (x >= 59 && x <= 90) { - if (y >= 25 && y <= 32) { - list.add(GT_LanguageManager.getTranslation("raddef") + ": " + (Math.round(cont.mInvArmor.data.radiationDef * 1000) / 10.0) + "%"); - if(cont.mInvArmor.data.fullRadiationDef){ - list.add("Radiation Immunity");} - } else if (y >= 33 && y <= 41) { - list.add(GT_LanguageManager.getTranslation("eledef") + ": " + (Math.round(cont.mInvArmor.data.electricDef * 1000) / 10.0) + "%"); - if(cont.mInvArmor.data.fullElectricDef){ - list.add("Electric Immunity");} - } else if (y >= 42 && y <= 50) { - list.add(GT_LanguageManager.getTranslation("whidef") + ": " + (Math.round(cont.mInvArmor.data.witherDef * 1000) / 10.0) + "%"); - } else if (y >= 51 && y <= 59) { - if(cont.mInvArmor.data.type!=3){ - list.add("Fall Damage absorbtion"); - list.add("Only for Boots"); - }else{ - list.add(GT_LanguageManager.getTranslation("abs1") + " " + (int) Math.round(cont.mInvArmor.data.fallDef) + GT_LanguageManager.getTranslation("abs2"));} - } else if (y >= 60 && y <= 68) { - if(x<69){ - list.add(GT_LanguageManager.getTranslation("thorns") + ": " + (int) Math.round(cont.mInvArmor.data.thornsSingle) + " Dmg"); - list.add("Total "+GT_LanguageManager.getTranslation("thorns") + ": " + (int) Math.round(cont.mInvArmor.data.thorns) + " Dmg"); - }else{ - list.add(GT_LanguageManager.getTranslation("magnet") + ": " + cont.mInvArmor.data.magnetSingle + " m"); - list.add("Total "+GT_LanguageManager.getTranslation("magnet") + ": " + cont.mInvArmor.data.magnet + " m");} - } - } - } - if (!list.isEmpty()) - drawHoveringText(list, x, y, fontRendererObj); - } - - public void drawBars(int x, int y, float value) { - - int bar = (int) Math.floor(18 * value); - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - xStart += 8; - yStart += 1; - drawTexturedModalRect(xStart + x, yStart + y, 217, 26, bar, 5); - drawTexturedModalRect(xStart+ bar + x, yStart + y, 197+bar, 26, 18-bar, 5); - } - - protected Slot getSlotAtPosition(int p_146975_1_, int p_146975_2_) { - for (int k = 0; k < cont.inventorySlots.size(); ++k) { - Slot slot = (Slot) cont.inventorySlots.get(k); - if (this.isMouseOverSlot(slot, p_146975_1_, p_146975_2_)) { - return slot; - } - } - return null; - } - - private boolean isMouseOverSlot(Slot p_146981_1_, int p_146981_2_, int p_146981_3_) { - return this.func_146978_c(p_146981_1_.xDisplayPosition, p_146981_1_.yDisplayPosition, 16, 16, p_146981_2_, p_146981_3_); - } -} diff --git a/src/main/java/gregtech/common/items/armor/GuiModularArmor.java b/src/main/java/gregtech/common/items/armor/GuiModularArmor.java deleted file mode 100644 index 17fd84b2fb..0000000000 --- a/src/main/java/gregtech/common/items/armor/GuiModularArmor.java +++ /dev/null @@ -1,196 +0,0 @@ -package gregtech.common.items.armor; - -import gregtech.api.util.GT_LanguageManager; - -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.util.ResourceLocation; - -@SideOnly(Side.CLIENT) -public class GuiModularArmor extends GuiContainer { - ContainerModularArmor cont; - EntityPlayer player; - - public GuiModularArmor(ContainerModularArmor containerModularArmor,EntityPlayer aPlayer) { - super(containerModularArmor); - cont = containerModularArmor; - this.player = aPlayer; - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) { - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - int x2 = x - xStart; - int y2 = y - yStart; - drawTooltip(x2, y2 + 5); - } - - protected void drawTooltip(int x, int y) { - List list = new ArrayList(); - if (x >= 10 && x <= 17) { - if (y >= 20 && y <= 27) { - list.add(GT_LanguageManager.getTranslation("weight") + ": " + cont.mInvArmor.data.weight); - list.add("Total Weight: "+cont.mInvArmor.data.maxWeight); - if (cont.mInvArmor.data.weight > 1000) - list.add("Too Heavy!"); - } else if (y >= 29 && y <= 36) { - list.add(GT_LanguageManager.getTranslation("phydef") + ": " + (Math.round(cont.mInvArmor.data.physicalDef * 1000) / 10.0) + "%"); - } else if (y >= 38 && y <= 45) { - list.add(GT_LanguageManager.getTranslation("prodef") + ": " + (Math.round(cont.mInvArmor.data.projectileDef