From 8e1b32cb42b19aa3271d3a4ad82fad75162a3d71 Mon Sep 17 00:00:00 2001 From: Boblet Date: Mon, 22 Aug 2022 12:18:36 +0200 Subject: [PATCH] fixes, fluid trait improvements --- .../hbm/entity/projectile/EntityChemical.java | 127 ++++++++++++++++-- .../java/com/hbm/inventory/fluid/Fluids.java | 14 +- .../inventory/fluid/trait/FT_Flammable.java | 16 +++ .../hbm/inventory/fluid/trait/FT_Poison.java | 29 ++++ .../hbm/inventory/gui/GUIMachineBattery.java | 7 +- .../inventory/recipes/CyclotronRecipes.java | 17 ++- src/main/java/com/hbm/lib/RefStrings.java | 2 +- .../storage/TileEntityMachineBattery.java | 22 +-- src/main/resources/mcmod.info | 2 +- 9 files changed, 201 insertions(+), 35 deletions(-) create mode 100644 src/main/java/com/hbm/inventory/fluid/trait/FT_Poison.java diff --git a/src/main/java/com/hbm/entity/projectile/EntityChemical.java b/src/main/java/com/hbm/entity/projectile/EntityChemical.java index 4c798bc3d..ea7f07050 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityChemical.java +++ b/src/main/java/com/hbm/entity/projectile/EntityChemical.java @@ -3,6 +3,7 @@ package com.hbm.entity.projectile; import java.awt.Color; import java.util.List; +import com.hbm.blocks.ModBlocks; import com.hbm.extprop.HbmLivingProps; import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.inventory.fluid.FluidType; @@ -10,11 +11,13 @@ import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.trait.FT_Combustible; import com.hbm.inventory.fluid.trait.FT_Corrosive; import com.hbm.inventory.fluid.trait.FT_Flammable; +import com.hbm.inventory.fluid.trait.FT_Poison; import com.hbm.inventory.fluid.trait.FT_VentRadiation; import com.hbm.lib.ModDamageSource; import com.hbm.main.MainRegistry; import com.hbm.util.ArmorUtil; import com.hbm.util.ContaminationUtil; +import com.hbm.util.EnchantmentUtil; import com.hbm.util.ContaminationUtil.ContaminationType; import com.hbm.util.ContaminationUtil.HazardType; import com.hbm.util.EntityDamageUtil; @@ -22,12 +25,14 @@ import com.hbm.util.EntityDamageUtil; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSourceIndirect; +import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -146,6 +151,7 @@ public class EntityChemical extends EntityThrowableNT { intensity = 1D; if(style == ChemicalStyle.AMAT) { + EntityDamageUtil.attackEntityFromIgnoreIFrame(e, ModDamageSource.radiation, 1F); if(living != null) { ContaminationUtil.contaminate(living, HazardType.RADIATION, ContaminationType.CREATIVE, 50F * (float) intensity); return; @@ -182,14 +188,13 @@ public class EntityChemical extends EntityThrowableNT { if(living != null) { HbmLivingProps.setOil(living, 300); //doused in oil for 15 seconds } - } else { - - if(type.temperature < 50) { - e.extinguish(); //if it's a cold non-flammable liquid (that isn't burning), extinguish - } } } + if(this.isExtinguishing()) { + e.extinguish(); + } + if(style == ChemicalStyle.BURNING) { FT_Combustible trait = type.getTrait(FT_Combustible.class); EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_flamethrower), 2F + (trait != null ? (trait.getCombustionEnergy() / 100_000F) : 0)); @@ -224,6 +229,30 @@ public class EntityChemical extends EntityThrowableNT { } ChunkRadiationManager.proxy.incrementRad(worldObj, (int) Math.floor(e.posX), (int) Math.floor(e.posY), (int) Math.floor(e.posZ), trait.getRadPerMB() * 5); } + + if(type.hasTrait(FT_Poison.class)) { + FT_Poison trait = type.getTrait(FT_Poison.class); + + if(living != null) { + living.addPotionEffect(new PotionEffect(trait.isWithering() ? Potion.wither.id : Potion.poison.id, (int) (5 * 20 * intensity))); + } + } + + if(type == Fluids.XPJUICE) { + + if(e instanceof EntityPlayer) { + EnchantmentUtil.addExperience((EntityPlayer) e, 1, false); + this.setDead(); + } + } + + if(type == Fluids.ENDERJUICE) { + this.teleportRandomly(e); + } + } + + protected boolean isExtinguishing() { + return this.getStyle() == ChemicalStyle.LIQUID && this.getType().temperature < 50 && !this.getType().hasTrait(FT_Flammable.class); } protected DamageSource getDamage(String name) { @@ -234,6 +263,73 @@ public class EntityChemical extends EntityThrowableNT { return new DamageSource(name); } } + + //terribly copy-pasted from EntityEnderman.class + protected boolean teleportRandomly(Entity e) { + double x = this.posX + (this.rand.nextDouble() - 0.5D) * 64.0D; + double y = this.posY + (double) (this.rand.nextInt(64) - 32); + double z = this.posZ + (this.rand.nextDouble() - 0.5D) * 64.0D; + return this.teleportTo(e, x, y, z); + } + + protected boolean teleportTo(Entity e, double x, double y, double z) { + + double targetX = e.posX; + double targetY = e.posY; + double targetZ = e.posZ; + e.posX = x; + e.posY = y; + e.posZ = z; + boolean flag = false; + int i = MathHelper.floor_double(e.posX); + int j = MathHelper.floor_double(e.posY); + int k = MathHelper.floor_double(e.posZ); + + if(e.worldObj.blockExists(i, j, k)) { + boolean flag1 = false; + + while(!flag1 && j > 0) { + Block block = e.worldObj.getBlock(i, j - 1, k); + + if(block.getMaterial().blocksMovement()) { + flag1 = true; + } else { + --e.posY; + --j; + } + } + + if(flag1) { + e.setPosition(e.posX, e.posY, e.posZ); + + if(e.worldObj.getCollidingBoundingBoxes(e, e.boundingBox).isEmpty() && !e.worldObj.isAnyLiquid(e.boundingBox)) { + flag = true; + } + } + } + + if(!flag) { + e.setPosition(targetX, targetY, targetZ); + return false; + } else { + short short1 = 128; + + for(int l = 0; l < short1; ++l) { + double d6 = (double) l / ((double) short1 - 1.0D); + float f = (this.rand.nextFloat() - 0.5F) * 0.2F; + float f1 = (this.rand.nextFloat() - 0.5F) * 0.2F; + float f2 = (this.rand.nextFloat() - 0.5F) * 0.2F; + double d7 = targetX + (e.posX - targetX) * d6 + (this.rand.nextDouble() - 0.5D) * (double) e.width * 2.0D; + double d8 = targetY + (e.posY - targetY) * d6 + this.rand.nextDouble() * (double) e.height; + double d9 = targetZ + (e.posZ - targetZ) * d6 + (this.rand.nextDouble() - 0.5D) * (double) e.width * 2.0D; + e.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); + } + + e.worldObj.playSoundEffect(targetX, targetY, targetZ, "mob.endermen.portal", 1.0F, 1.0F); + e.playSound("mob.endermen.portal", 1.0F, 1.0F); + return true; + } + } @Override protected void onImpact(MovingObjectPosition mop) { @@ -261,8 +357,24 @@ public class EntityChemical extends EntityThrowableNT { int z = mop.blockZ; for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + + Block fire = type == Fluids.BALEFIRE ? ModBlocks.balefire : Blocks.fire; + if(worldObj.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).isAir(worldObj, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) { - worldObj.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, Blocks.fire); + worldObj.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, fire); + } + } + } + + if(this.isExtinguishing()) { + int x = mop.blockX; + int y = mop.blockY; + int z = mop.blockZ; + + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + + if(worldObj.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == Blocks.fire) { + worldObj.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, Blocks.air); } } } @@ -302,9 +414,8 @@ public class EntityChemical extends EntityThrowableNT { case GAS: return 60; case GASFLAME: return 20; case LIQUID: return 600; + default: return 100; } - - return 100; } @Override diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index 867f1789e..99c90d18c 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -143,7 +143,7 @@ public class Fluids { NAPHTHA = new FluidType("NAPHTHA", 0x595744, 2, 1, 0, EnumSymbol.NONE).addContainers(0x5F6D44, ExtContainer.CANISTER).addTraits(new FT_Flammable(125_000), new FT_Combustible(FuelGrade.MEDIUM, 200_000), LIQUID); DIESEL = new FluidType("DIESEL", 0xf2eed5, 1, 2, 0, EnumSymbol.NONE).addContainers(0xFF2C2C, ExtContainer.CANISTER).addTraits(new FT_Flammable(200_000), new FT_Combustible(FuelGrade.HIGH, 500_000), LIQUID); LIGHTOIL = new FluidType("LIGHTOIL", 0x8c7451, 1, 2, 0, EnumSymbol.NONE).addContainers(0xB46B52, ExtContainer.CANISTER).addTraits(new FT_Flammable(200_000), new FT_Combustible(FuelGrade.MEDIUM, 500_000), LIQUID); - KEROSENE = new FluidType("KEROSENE", 0xffa5d2, 1, 2, 0, EnumSymbol.NONE).addContainers(0xFF377D, ExtContainer.CANISTER).addTraits(new FT_Flammable(300_000), new FT_Combustible(FuelGrade.AERO, 1_250_000)); + KEROSENE = new FluidType("KEROSENE", 0xffa5d2, 1, 2, 0, EnumSymbol.NONE).addContainers(0xFF377D, ExtContainer.CANISTER).addTraits(new FT_Flammable(300_000), new FT_Combustible(FuelGrade.AERO, 1_250_000), LIQUID); GAS = new FluidType("GAS", 0xfffeed, 1, 4, 1, EnumSymbol.NONE).addTraits(new FT_Flammable(10_000), GASEOUS); PETROLEUM = new FluidType("PETROLEUM", 0x7cb7c9, 1, 4, 1, EnumSymbol.NONE).addTraits(new FT_Flammable(25_000), GASEOUS); LPG = new FluidType("LPG", 0x4747EA, 1, 3, 1, EnumSymbol.NONE).addTraits(new FT_Flammable(200_000), new FT_Combustible(FuelGrade.HIGH, 400_000), LIQUID); @@ -153,24 +153,24 @@ public class Fluids { UF6 = new FluidType("UF6", 0xD1CEBE, 4, 0, 2, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(0.2F), new FT_Corrosive(15), GASEOUS); PUF6 = new FluidType("PUF6", 0x4C4C4C, 4, 0, 4, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(0.1F), new FT_Corrosive(15), GASEOUS); SAS3 = new FluidType("SAS3", 0x4ffffc, 5, 0, 4, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(1F), new FT_Corrosive(30), LIQUID); - SCHRABIDIC = new FluidType("SCHRABIDIC", 0x006B6B, 5, 0, 5, EnumSymbol.ACID).addTraits(new FT_VentRadiation(1F), new FT_Corrosive(75), LIQUID); + SCHRABIDIC = new FluidType("SCHRABIDIC", 0x006B6B, 5, 0, 5, EnumSymbol.ACID).addTraits(new FT_VentRadiation(1F), new FT_Corrosive(75), new FT_Poison(true, 2), LIQUID); AMAT = new FluidType("AMAT", 0x010101, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS); ASCHRAB = new FluidType("ASCHRAB", 0xb50000, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS); ACID = new FluidType("ACID", 0xfff7aa, 3, 0, 3, EnumSymbol.OXIDIZER).addTraits(new FT_Corrosive(40), LIQUID); - WATZ = new FluidType("WATZ", 0x86653E, 4, 0, 3, EnumSymbol.ACID).addTraits(new FT_Corrosive(60), LIQUID); + WATZ = new FluidType("WATZ", 0x86653E, 4, 0, 3, EnumSymbol.ACID).addTraits(new FT_Corrosive(60), new FT_VentRadiation(0.1F), LIQUID); CRYOGEL = new FluidType("CRYOGEL", 0x32ffff, 2, 0, 0, EnumSymbol.CROYGENIC).setTemp(-170).addTraits(LIQUID); HYDROGEN = new FluidType("HYDROGEN", 0x4286f4, 3, 4, 0, EnumSymbol.CROYGENIC).setTemp(-260).addTraits(new FT_Flammable(5_000), new FT_Combustible(FuelGrade.HIGH, 10_000), LIQUID, EVAP); OXYGEN = new FluidType("OXYGEN", 0x98bdf9, 3, 0, 0, EnumSymbol.CROYGENIC).setTemp(-100).addTraits(LIQUID, EVAP); XENON = new FluidType("XENON", 0xba45e8, 0, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS); BALEFIRE = new FluidType("BALEFIRE", 0x28e02e, 4, 4, 3, EnumSymbol.RADIATION).setTemp(1500).addTraits(new FT_Corrosive(50), new FT_Flammable(1_000_000), new FT_Combustible(FuelGrade.HIGH, 2_500_000), LIQUID); - MERCURY = new FluidType("MERCURY", 0x808080, 2, 0, 0, EnumSymbol.NONE).addTraits(LIQUID); - PAIN = new FluidType("PAIN", 0x938541, 2, 0, 1, EnumSymbol.ACID).setTemp(300).addTraits(new FT_Corrosive(30)); + MERCURY = new FluidType("MERCURY", 0x808080, 2, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, new FT_Poison(false, 2)); + PAIN = new FluidType("PAIN", 0x938541, 2, 0, 1, EnumSymbol.ACID).setTemp(300).addTraits(new FT_Corrosive(30), new FT_Poison(true, 2), LIQUID); WASTEFLUID = new FluidType("WASTEFLUID", 0x544400, 2, 0, 1, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(0.5F), NOCON, LIQUID); WASTEGAS = new FluidType("WASTEGAS", 0xB8B8B8, 2, 0, 1, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(0.5F), NOCON, GASEOUS); GASOLINE = new FluidType("GASOLINE", 0x445772, 1, 2, 0, EnumSymbol.NONE).addContainers(0x2F7747, ExtContainer.CANISTER).addTraits(new FT_Flammable(400_000), new FT_Combustible(FuelGrade.HIGH, 1_000_000), LIQUID); COALGAS = new FluidType("COALGAS", 0x445772, 1, 2, 0, EnumSymbol.NONE).addContainers(0x2E155F, ExtContainer.CANISTER).addTraits(new FT_Flammable(75_000), new FT_Combustible(FuelGrade.MEDIUM, 150_000), LIQUID); SPENTSTEAM = new FluidType("SPENTSTEAM", 0x445772, 2, 0, 0, EnumSymbol.NONE).setCompression(1D).addTraits(NOCON, GASEOUS); - FRACKSOL = new FluidType("FRACKSOL", 0x798A6B, 1, 3, 3, EnumSymbol.ACID).addContainers(0x4F887F, ExtContainer.CANISTER).addTraits(new FT_Corrosive(15), LIQUID); + FRACKSOL = new FluidType("FRACKSOL", 0x798A6B, 1, 3, 3, EnumSymbol.ACID).addContainers(0x4F887F, ExtContainer.CANISTER).addTraits(new FT_Corrosive(15), new FT_Poison(false, 0), LIQUID); PLASMA_DT = new FluidType("PLASMA_DT", 0xF7AFDE, 0, 4, 0, EnumSymbol.RADIATION).setTemp(3250).addTraits(NOCON, NOID, PLASMA); PLASMA_HD = new FluidType("PLASMA_HD", 0xF0ADF4, 0, 4, 0, EnumSymbol.RADIATION).setTemp(2500).addTraits(NOCON, NOID, PLASMA); PLASMA_HT = new FluidType("PLASMA_HT", 0xD1ABF2, 0, 4, 0, EnumSymbol.RADIATION).setTemp(3000).addTraits(NOCON, NOID, PLASMA); @@ -179,7 +179,7 @@ public class Fluids { CARBONDIOXIDE = new FluidType("CARBONDIOXIDE", 0x404040, 3, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS); PLASMA_DH3 = new FluidType("PLASMA_DH3", 0xFF83AA, 0, 4, 0, EnumSymbol.RADIATION).setTemp(3480).addTraits(NOCON, NOID, PLASMA); HELIUM3 = new FluidType("HELIUM3", 0xFCF0C4, 3, 4, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS); - DEATH = new FluidType("DEATH", 0x717A88, 2, 0, 1, EnumSymbol.ACID).setTemp(300).addTraits(new FT_Corrosive(80), LEADCON, LIQUID); + DEATH = new FluidType("DEATH", 0x717A88, 2, 0, 1, EnumSymbol.ACID).setTemp(300).addTraits(new FT_Corrosive(80), new FT_Poison(true, 4), LEADCON, LIQUID); ETHANOL = new FluidType("ETHANOL", 0xe0ffff, 2, 3, 0, EnumSymbol.NONE).addContainers(0xEAFFF3, ExtContainer.CANISTER).addTraits(new FT_Flammable(75_000), new FT_Combustible(FuelGrade.HIGH, 200_000), LIQUID); HEAVYWATER = new FluidType("HEAVYWATER", 0x00a0b0, 1, 0, 0, EnumSymbol.NONE).addTraits(LIQUID); CRACKOIL = new FluidType("CRACKOIL", 0x020202, 2, 1, 0, EnumSymbol.NONE).addContainers(0x424242, ExtContainer.CANISTER).addTraits(new FT_Flammable(10_000), LIQUID); diff --git a/src/main/java/com/hbm/inventory/fluid/trait/FT_Flammable.java b/src/main/java/com/hbm/inventory/fluid/trait/FT_Flammable.java index 9899fccf7..c2b582ae5 100644 --- a/src/main/java/com/hbm/inventory/fluid/trait/FT_Flammable.java +++ b/src/main/java/com/hbm/inventory/fluid/trait/FT_Flammable.java @@ -1,5 +1,11 @@ package com.hbm.inventory.fluid.trait; +import java.util.List; + +import com.hbm.util.BobMathUtil; + +import net.minecraft.util.EnumChatFormatting; + public class FT_Flammable extends FluidTrait { /** How much heat energy (usually translates into HE 1:1) 1000mB hold */ @@ -12,4 +18,14 @@ public class FT_Flammable extends FluidTrait { public long getHeatEnergy() { return this.energy; } + + @Override + public void addInfo(List info) { + super.addInfo(info); + + info.add(EnumChatFormatting.YELLOW + "[Flammable]"); + + if(energy > 0) + info.add(EnumChatFormatting.YELLOW + "Provides " + EnumChatFormatting.RED + "" + BobMathUtil.getShortNumber(energy) + "TU " + EnumChatFormatting.YELLOW + "per bucket"); + } } diff --git a/src/main/java/com/hbm/inventory/fluid/trait/FT_Poison.java b/src/main/java/com/hbm/inventory/fluid/trait/FT_Poison.java new file mode 100644 index 000000000..a8154c1f5 --- /dev/null +++ b/src/main/java/com/hbm/inventory/fluid/trait/FT_Poison.java @@ -0,0 +1,29 @@ +package com.hbm.inventory.fluid.trait; + +import java.util.List; + +import net.minecraft.util.EnumChatFormatting; + +public class FT_Poison extends FluidTrait { + + protected boolean withering = false; + protected int level = 0; + + public FT_Poison(boolean withering, int level) { + this.withering = withering; + this.level = level; + } + + public boolean isWithering() { + return this.withering; + } + + public int getLevel() { + return this.level; + } + + @Override + public void addInfoHidden(List info) { + info.add(EnumChatFormatting.GREEN + "[Toxic Fumes]"); + } +} diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineBattery.java b/src/main/java/com/hbm/inventory/gui/GUIMachineBattery.java index 8ea6d2891..5b2e00658 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineBattery.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineBattery.java @@ -39,11 +39,10 @@ public class GUIMachineBattery extends GuiInfoContainer { this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 52, 52, battery.power, battery.getMaxPower()); - long delta = battery.log[19] - battery.log[0]; - String deltaText = BobMathUtil.getShortNumber(Math.abs(delta)) + "HE/s"; + String deltaText = BobMathUtil.getShortNumber(Math.abs(battery.delta)) + "HE/s"; - if(delta > 0) deltaText = EnumChatFormatting.GREEN + "+" + deltaText; - else if(delta < 0) deltaText = EnumChatFormatting.RED + "-" + deltaText; + if(battery.delta > 0) deltaText = EnumChatFormatting.GREEN + "+" + deltaText; + else if(battery.delta < 0) deltaText = EnumChatFormatting.RED + "-" + deltaText; else deltaText = EnumChatFormatting.YELLOW + "+" + deltaText; String[] info = { BobMathUtil.getShortNumber(battery.power) + "/" + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE", deltaText }; diff --git a/src/main/java/com/hbm/inventory/recipes/CyclotronRecipes.java b/src/main/java/com/hbm/inventory/recipes/CyclotronRecipes.java index 538047e74..61afb281d 100644 --- a/src/main/java/com/hbm/inventory/recipes/CyclotronRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CyclotronRecipes.java @@ -16,7 +16,6 @@ import com.hbm.inventory.RecipesCommon.OreDictStack; import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.items.ModItems; import com.hbm.main.MainRegistry; -import com.hbm.util.ItemStackUtil; import com.hbm.util.Tuple.Pair; import net.minecraft.item.ItemStack; @@ -116,7 +115,17 @@ public class CyclotronRecipes extends SerializableRecipe { ComparableStack boxStack = new ComparableStack(box).makeSingular(); ComparableStack comp = new ComparableStack(stack).makeSingular(); - Pair output = recipes.get(new Pair(boxStack, comp)); + //boo hoo we iterate over a hash map, cry me a river + for(Entry, Pair> entry : recipes.entrySet()) { + + if(entry.getKey().getKey().isApplicable(boxStack) && entry.getKey().getValue().isApplicable(comp)) { + return new Object[] { entry.getValue().getKey(), entry.getValue().getValue() }; + } + } + + //there's literally 0 reason why this doesn't work yet it refuses, fuck this + + /*Pair output = recipes.get(new Pair(boxStack, comp)); if(output != null) { return new Object[] { output.getKey().copy(), output.getValue() }; @@ -124,12 +133,12 @@ public class CyclotronRecipes extends SerializableRecipe { for(String name : ItemStackUtil.getOreDictNames(stack)) { OreDictStack ods = new OreDictStack(name); - output = recipes.get(new Pair(boxStack, comp)); + output = recipes.get(new Pair(new ComparableStack(ModItems.part_beryllium), new OreDictStack("dustCobalt"))); if(output != null) { return new Object[] { output.getKey().copy(), output.getValue() }; } - } + }*/ return null; } diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 867d48a7e..834f7e2f4 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (4333)"; + public static final String VERSION = "1.0.27 BETA (4334)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java index 88864eb4e..3266b3397 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java @@ -25,6 +25,7 @@ import li.cil.oc.api.network.SimpleComponent; public class TileEntityMachineBattery extends TileEntityMachineBase implements IEnergyUser, IPersistentNBT, SimpleComponent { public long[] log = new long[20]; + public long delta = 0; public long power = 0; //0: input only @@ -161,22 +162,22 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I power = Library.chargeTEFromItems(slots, 0, power, getMaxPower()); power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower()); - - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setLong("power", (power + prevPower) / 2); - nbt.setShort("redLow", redLow); - nbt.setShort("redHigh", redHigh); - nbt.setByte("priority", (byte) this.priority.ordinal()); - this.networkPack(nbt, 20); - } - - if(worldObj.isRemote) { + + this.delta = this.power - this.log[0]; for(int i = 1; i < this.log.length; i++) { this.log[i - 1] = this.log[i]; } this.log[19] = this.power; + + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setLong("power", (power + prevPower) / 2); + nbt.setLong("delta", delta); + nbt.setShort("redLow", redLow); + nbt.setShort("redHigh", redHigh); + nbt.setByte("priority", (byte) this.priority.ordinal()); + this.networkPack(nbt, 20); } } @@ -227,6 +228,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I public void networkUnpack(NBTTagCompound nbt) { this.power = nbt.getLong("power"); + this.delta = nbt.getLong("delta"); this.redLow = nbt.getShort("redLow"); this.redHigh = nbt.getShort("redHigh"); this.priority = ConnectionPriority.values()[nbt.getByte("priority")]; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index b80e198dd..12e1e91a4 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "hbm", "name": "Hbm's Nuclear Tech", "description": "A mod that adds weapons, nuclear themed stuff and machines", - "version":"1.0.27_X4333", + "version":"1.0.27_X4334", "mcversion": "1.7.10", "url": "", "updateUrl": "",