Skip to content

Commit

Permalink
Hadron and cladding fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOriginalGolem committed Jun 16, 2022
1 parent 1c2151f commit 64bffdb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
20 changes: 17 additions & 3 deletions src/main/java/com/hbm/handler/HazmatRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand All @@ -52,7 +66,7 @@ public static float getResistance(EntityLivingBase player) {
}

if(player.isPotionActive(HbmPotion.radx))
res += 0.4F;
res += 0.2F;

return res;

Expand Down
11 changes: 4 additions & 7 deletions src/main/java/com/hbm/lib/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> contributors = Sets.newHashSet(new String[] {
"06ab7c03-55ce-43f8-9d3c-2850e3c652de", //mustang_rudolf
"5bf069bc-5b46-4179-aafe-35c0a07dee8b", //JMF781
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)){
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -268,7 +268,6 @@ public class Particle {
int momentum;
int charge;
int analysis;
static final int maxCharge = 80;
boolean isCheckExempt = false;

boolean expired = false;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/hbm/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 64bffdb

Please sign in to comment.