From 64bffdb74b92aaa3a92e1b8c97397fa9e5f807b3 Mon Sep 17 00:00:00 2001 From: Golem Date: Thu, 16 Jun 2022 12:07:32 +0200 Subject: [PATCH] Hadron and cladding fixes --- .../java/com/hbm/handler/HazmatRegistry.java | 20 ++++++++++++++++--- src/main/java/com/hbm/lib/Library.java | 11 ++++------ .../tileentity/machine/TileEntityHadron.java | 13 +++++------- src/main/resources/assets/hbm/lang/en_us.lang | 2 +- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/hbm/handler/HazmatRegistry.java b/src/main/java/com/hbm/handler/HazmatRegistry.java index 9d20707b71..fc702adb9d 100644 --- a/src/main/java/com/hbm/handler/HazmatRegistry.java +++ b/src/main/java/com/hbm/handler/HazmatRegistry.java @@ -4,6 +4,8 @@ import java.util.Map; import com.hbm.items.ModItems; +import com.hbm.items.armor.ItemModCladding; +import com.hbm.lib.Library; import com.hbm.potion.HbmPotion; import net.minecraft.entity.EntityLivingBase; @@ -36,14 +38,26 @@ public static double getResistance(ItemStack stack) { public static float getCladding(ItemStack stack) { - if(stack.hasTagCompound() && stack.getTagCompound().getFloat("hfr_cladding") > 0) + if (stack.hasTagCompound() && stack.getTagCompound().getFloat("hfr_cladding") > 0.0F) { return stack.getTagCompound().getFloat("hfr_cladding"); + } else { + if (ArmorModHandler.hasMods(stack)) { + ItemStack[] mods = ArmorModHandler.pryMods(stack); + ItemStack cladding = mods[5]; + if (cladding != null && cladding.getItem() instanceof ItemModCladding) { + return (float)((ItemModCladding)cladding.getItem()).rad; + } + } - return 0; + return 0.0F; + } } public static float getResistance(EntityLivingBase player) { float res = 0.0F; + if (player.getUniqueID().toString().equals(Library.Pu_238)) { + res += 0.4F; + } for(ItemStack stack : player.getArmorInventoryList()) { if(!stack.isEmpty()) { @@ -52,7 +66,7 @@ public static float getResistance(EntityLivingBase player) { } if(player.isPotionActive(HbmPotion.radx)) - res += 0.4F; + res += 0.2F; return res; diff --git a/src/main/java/com/hbm/lib/Library.java b/src/main/java/com/hbm/lib/Library.java index d6cd41044a..0249aecc44 100644 --- a/src/main/java/com/hbm/lib/Library.java +++ b/src/main/java/com/hbm/lib/Library.java @@ -101,7 +101,7 @@ public class Library { public static String ShimmeringBlaze = "061bc566-ec74-4307-9614-ac3a70d2ef38"; public static String FifeMiner = "37e5eb63-b9a2-4735-9007-1c77d703daa3"; public static String lag_add = "259785a0-20e9-4c63-9286-ac2f93ff528f"; - + public static String Pu_238 = "c95fdfd3-bea7-4255-a44b-d21bc3df95e3"; public static Set contributors = Sets.newHashSet(new String[] { "06ab7c03-55ce-43f8-9d3c-2850e3c652de", //mustang_rudolf "5bf069bc-5b46-4179-aafe-35c0a07dee8b", //JMF781 @@ -1079,10 +1079,6 @@ else if (a.getMetadata() != b.getMetadata()) { return false; } - else if (a.getTagCompound() == null && b.getTagCompound() != null) - { - return false; - } else { return (a.getTagCompound() == null || a.getTagCompound().equals(b.getTagCompound())) && a.areCapsCompatible(b); @@ -1138,8 +1134,9 @@ public static boolean areItemStacksCompatible(ItemStack base, ItemStack toTest){ public static boolean tagContainsOther(NBTTagCompound tester, NBTTagCompound container){ if(tester == null && container == null){ return true; - } if(tester == null ^ container == null){ - return false; + } else if (tester == null && container != null) { + return true; + } else if (tester != null && container == null) { } else { for(String s : tester.getKeySet()){ if(!container.hasKey(s)){ diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java index db39ca9f26..d6eb42b149 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java @@ -37,7 +37,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements ITickable, IConsumer { public long power; - public static final long maxPower = 1000000000; + public static final long maxPower = 10000000; public boolean isOn = false; public boolean analysisOnly = false; @@ -268,7 +268,6 @@ public class Particle { int momentum; int charge; int analysis; - static final int maxCharge = 80; boolean isCheckExempt = false; boolean expired = false; @@ -283,7 +282,7 @@ public Particle(ItemStack item1, ItemStack item2, ForgeDirection dir, int posX, this.posY = posY; this.posZ = posZ; - this.charge = maxCharge; + this.charge = 0; this.momentum = 0; } @@ -453,15 +452,13 @@ public void checkSegment(Particle p) { TileEntityHadronPower plug = (TileEntityHadronPower)te; - int req = Particle.maxCharge - p.charge; //how many "charge points" the particle needs to be fully charged - long bit = TileEntityHadronPower.maxPower / Particle.maxCharge; //how much HE one "charge point" is + long bit = 10000; //how much HE one "charge point" is int times = (int) (plug.getPower() / bit); //how many charges the plug has to offer - int total = Math.min(req, times); //whichever is less, the charges in the plug or the required charges + p.charge += times; //whichever is less, the charges in the plug or the required charges - p.charge += total; - plug.setPower(plug.getPower() - total * bit); + plug.setPower(plug.getPower() - times * bit); continue; } diff --git a/src/main/resources/assets/hbm/lang/en_us.lang b/src/main/resources/assets/hbm/lang/en_us.lang index 969305c546..fa7bfc394b 100644 --- a/src/main/resources/assets/hbm/lang/en_us.lang +++ b/src/main/resources/assets/hbm/lang/en_us.lang @@ -1018,7 +1018,7 @@ tile.hadron_plating_voltz.name=Particle Accelerator Plating (VOLTZ) tile.hadron_plating_yellow.name=Particle Accelerator Plating (YelloDye) tile.hadron_access.name=Particle Accelerator Access Terminal tile.hadron_core.name=Particle Accelerator Core Component -tile.hadron_power.name=Particle Accelerator Power Plugtankish wanted +tile.hadron_power.name=Particle Accelerator Power Plug tile.dfc_emitter.name=DFC Emitter container.dfcEmitter=DFC Emitter