From 34aee6995732407cb6650c82a7ddf0b44aa1a129 Mon Sep 17 00:00:00 2001 From: Boblet Date: Tue, 21 Nov 2023 16:39:36 +0100 Subject: [PATCH] guh --- .../recipes/GasCentrifugeRecipes.java | 80 ++++++++---------- .../machine/TileEntityMachineGasCent.java | 69 ++++----------- .../textures/gui/machine/gui_radar_link.png | Bin 0 -> 1491 bytes .../assets/hbm/textures/items/radar_link.png | Bin 0 -> 230 bytes 4 files changed, 51 insertions(+), 98 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/gui/machine/gui_radar_link.png create mode 100644 src/main/resources/assets/hbm/textures/items/radar_link.png diff --git a/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java b/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java index 7b7743f2c..c352c085d 100644 --- a/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java @@ -7,6 +7,7 @@ import java.util.Map; import java.util.Map.Entry; import com.hbm.inventory.FluidStack; +import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemFluidIcon; @@ -16,63 +17,47 @@ import net.minecraft.item.ItemStack; public class GasCentrifugeRecipes { - public static enum PseudoFluidType { - NONE (0, 0, null, false, (ItemStack[])null), + public static class PseudoFluidType { - HEUF6 (300, 0, NONE, true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)), - MEUF6 (200, 100, HEUF6, false, new ItemStack(ModItems.nugget_u238, 1)), - LEUF6 (300, 200, MEUF6, false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)), - NUF6 (400, 300, LEUF6, false, new ItemStack(ModItems.nugget_u238, 1)), + public static HashMap types = new HashMap(); - PF6 (300, 0, NONE, false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)), + public static PseudoFluidType NONE = new PseudoFluidType("NONE", 0, 0, null, false, (ItemStack[])null); - MUD_HEAVY (500, 0, NONE, false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)), - MUD (1000, 500, MUD_HEAVY, false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1)); + public static PseudoFluidType HEUF6 = new PseudoFluidType("HEUF6", 300, 0, NONE, true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)); + public static PseudoFluidType MEUF6 = new PseudoFluidType("MEUF6", 200, 100, HEUF6, false, new ItemStack(ModItems.nugget_u238, 1)); + public static PseudoFluidType LEUF6 = new PseudoFluidType("LEUF6", 300, 200, MEUF6, false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)); + public static PseudoFluidType NUF6 = new PseudoFluidType("NUF6", 400, 300, LEUF6, false, new ItemStack(ModItems.nugget_u238, 1)); - //TODO for bob: consider more fluid types - //Schraranium Trisulfide for more schrab-containing, pre-SILEX processing using the crystals? - //Gaseous Nuclear Waste: because why not? Large inputs could output Xe-135 and maybe some other fun stuff... - // + public static PseudoFluidType PF6 = new PseudoFluidType("PF6", 300, 0, NONE, false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)); + public static PseudoFluidType MUD_HEAVY = new PseudoFluidType("MUD_HEAVY", 500, 0, NONE, false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)); + public static PseudoFluidType MUD = new PseudoFluidType("MUD", 1000, 500, MUD_HEAVY, false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1)); + + public String name; int fluidConsumed; int fluidProduced; PseudoFluidType outputFluid; boolean isHighSpeed; ItemStack[] output; - PseudoFluidType(int fluidConsumed, int fluidProduced, PseudoFluidType outputFluid, boolean isHighSpeed, ItemStack... output) { + PseudoFluidType(String name, int fluidConsumed, int fluidProduced, PseudoFluidType outputFluid, boolean isHighSpeed, ItemStack... output) { + this.name = name; this.fluidConsumed = fluidConsumed; this.fluidProduced = fluidProduced; this.outputFluid = outputFluid; this.isHighSpeed = isHighSpeed; this.output = output; + types.put(name, this); } - public int getFluidConsumed() { - return this.fluidConsumed; - } + public int getFluidConsumed() { return this.fluidConsumed; } + public int getFluidProduced() { return this.fluidProduced; } + public PseudoFluidType getOutputType() { return this.outputFluid; } + public ItemStack[] getOutput() { return this.output; } + public boolean getIfHighSpeed() { return this.isHighSpeed; } + public String getName() { return I18nUtil.resolveKey("hbmpseudofluid.".concat(this.name.toLowerCase(Locale.US))); } - public int getFluidProduced() { - return this.fluidProduced; - } - - public PseudoFluidType getOutputType() { - return this.outputFluid; - } - - public String getName() { - return I18nUtil.resolveKey("hbmpseudofluid.".concat(this.toString().toLowerCase(Locale.US))); - } - - public boolean getIfHighSpeed() { - return this.isHighSpeed; - } - - public ItemStack[] getOutput() { - return this.output; - } - - }; + } /* Recipe NEI Handler */ //Fluid input; ItemStack[] outputs, isHighSpeed, # of centrifuges @@ -102,14 +87,17 @@ public class GasCentrifugeRecipes { return recipes; } + public static HashMap fluidConversions = new HashMap(); + public static void register() { - gasCent.put(new FluidStack(1200, Fluids.UF6), new Object[] { new ItemStack[] - {new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)}, true, 4 }); - gasCent.put(new FluidStack(1200, Fluids.UF6), new Object[] { new ItemStack[] - {new ItemStack(ModItems.nugget_u238, 6), new ItemStack(ModItems.nugget_uranium_fuel, 6), new ItemStack(ModItems.fluorite, 4)}, false, 2 }); - gasCent.put(new FluidStack(900, Fluids.PUF6), new Object[] { new ItemStack[] - {new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)}, false, 1 }); - gasCent.put(new FluidStack(1000, Fluids.WATZ), new Object[] { new ItemStack[] - {new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1), new ItemStack(ModItems.dust, 2)}, false, 2 }); + + fluidConversions.put(Fluids.UF6, PseudoFluidType.NUF6); + fluidConversions.put(Fluids.PUF6, PseudoFluidType.PF6); + fluidConversions.put(Fluids.WATZ, PseudoFluidType.MUD); + + gasCent.put(new FluidStack(1200, Fluids.UF6), new Object[] { new ItemStack[] {new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)}, true, 4 }); + gasCent.put(new FluidStack(1200, Fluids.UF6), new Object[] { new ItemStack[] {new ItemStack(ModItems.nugget_u238, 6), new ItemStack(ModItems.nugget_uranium_fuel, 6), new ItemStack(ModItems.fluorite, 4)}, false, 2 }); + gasCent.put(new FluidStack(900, Fluids.PUF6), new Object[] { new ItemStack[] {new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)}, false, 1 }); + gasCent.put(new FluidStack(1000, Fluids.WATZ), new Object[] { new ItemStack[] {new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1), new ItemStack(ModItems.dust, 2)}, false, 2 }); } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java index ac797a691..eb993e4f7 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java @@ -1,14 +1,12 @@ package com.hbm.tileentity.machine; -import java.util.HashMap; - import com.hbm.blocks.BlockDummyable; -import com.hbm.interfaces.IFluidAcceptor; import com.hbm.inventory.container.ContainerMachineGasCent; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.gui.GUIMachineGasCent; +import com.hbm.inventory.recipes.GasCentrifugeRecipes; import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType; import com.hbm.items.ModItems; import com.hbm.items.machine.IItemFluidIdentifier; @@ -36,7 +34,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; //epic! -public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, IFluidStandardReceiver, IGUIProvider { +public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidStandardReceiver, IGUIProvider { public long power; public int progress; @@ -50,17 +48,9 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I private static final int[] slots_io = new int[] { 0, 1, 2, 3 }; - private static HashMap fluidConversions = new HashMap(); - - static { - fluidConversions.put(Fluids.UF6, PseudoFluidType.NUF6); - fluidConversions.put(Fluids.PUF6, PseudoFluidType.PF6); - fluidConversions.put(Fluids.WATZ, PseudoFluidType.MUD); - } - public TileEntityMachineGasCent() { super(7); - tank = new FluidTank(Fluids.UF6, 2000, 0); + tank = new FluidTank(Fluids.UF6, 2000); inputTank = new PseudoFluidTank(PseudoFluidType.NUF6, 8000); outputTank = new PseudoFluidTank(PseudoFluidType.LEUF6, 8000); } @@ -180,10 +170,11 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I this.power = data.getLong("power"); this.progress = data.getInteger("progress"); this.isProgressing = data.getBoolean("isProgressing"); - this.inputTank.setTankType(PseudoFluidType.valueOf(data.getString("inputType"))); - this.outputTank.setTankType(PseudoFluidType.valueOf(data.getString("outputType"))); + this.inputTank.setTankType(PseudoFluidType.types.get(data.getString("inputType"))); + this.outputTank.setTankType(PseudoFluidType.types.get(data.getString("outputType"))); this.inputTank.setFill(data.getInteger("inputFill")); this.outputTank.setFill(data.getInteger("outputFill")); + this.tank.readFromNBT(data, "t"); } @Override @@ -195,9 +186,8 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I power = Library.chargeTEFromItems(slots, 4, power, maxPower); setTankType(5); - tank.updateTank(this); - if(fluidConversions.containsValue(inputTank.getTankType())) { + if(GasCentrifugeRecipes.fluidConversions.containsValue(inputTank.getTankType())) { attemptConversion(); } @@ -246,8 +236,9 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I data.setBoolean("isProgressing", isProgressing); data.setInteger("inputFill", inputTank.getFill()); data.setInteger("outputFill", outputTank.getFill()); - data.setString("inputType", inputTank.getTankType().toString()); - data.setString("outputType", outputTank.getTankType().toString()); + data.setString("inputType", inputTank.getTankType().name); + data.setString("outputType", outputTank.getTankType().name); + tank.writeToNBT(data, "t"); this.networkPack(data, 50); PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); @@ -258,7 +249,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - if(fluidConversions.containsValue(inputTank.getTankType())) { + if(GasCentrifugeRecipes.fluidConversions.containsValue(inputTank.getTankType())) { this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } @@ -301,10 +292,10 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I if(slots[in] != null && slots[in].getItem() instanceof IItemFluidIdentifier) { IItemFluidIdentifier id = (IItemFluidIdentifier) slots[in].getItem(); - FluidType newType = id.getType(null, 0, 0, 0, slots[in]); + FluidType newType = id.getType(worldObj, xCoord, yCoord, zCoord, slots[in]); if(tank.getTankType() != newType) { - PseudoFluidType pseudo = fluidConversions.get(newType); + PseudoFluidType pseudo = GasCentrifugeRecipes.fluidConversions.get(newType); if(pseudo != null) { inputTank.setTankType(pseudo); @@ -316,32 +307,6 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I } } - @Override - public void setTypeForSync(FluidType type, int index) { - tank.setTankType(type); - } - - @Override - public void setFillForSync(int fill, int index) { - tank.setFill(fill); - } - - @Override - public void setFluidFill(int fill, FluidType type) { - if(type == tank.getTankType()) - tank.setFill(fill); - } - - @Override - public int getFluidFill(FluidType type) { - return tank.getTankType() == type ? tank.getFill() : 0; - } - - @Override - public int getMaxFluidFill(FluidType type) { - return tank.getTankType() == type ? tank.getMaxFill() : 0; - } - @Override public FluidTank[] getReceivingTanks() { return new FluidTank[] { tank }; @@ -413,16 +378,16 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I public void writeToNBT(NBTTagCompound nbt, String s) { nbt.setInteger(s, fluid); nbt.setInteger(s + "_max", maxFluid); - nbt.setString(s + "_type", type.toString()); + nbt.setString(s + "_type", type.name); } //Called by TE to load fillstate public void readFromNBT(NBTTagCompound nbt, String s) { fluid = nbt.getInteger(s); int max = nbt.getInteger(s + "_max"); - if(max > 0) - maxFluid = nbt.getInteger(s + "_max"); - type = PseudoFluidType.valueOf(nbt.getString(s + "_type")); + if(max > 0) maxFluid = nbt.getInteger(s + "_max"); + type = PseudoFluidType.types.get(nbt.getString(s + "_type")); + if(type == null) type = PseudoFluidType.NONE; } /* ______ ______ diff --git a/src/main/resources/assets/hbm/textures/gui/machine/gui_radar_link.png b/src/main/resources/assets/hbm/textures/gui/machine/gui_radar_link.png new file mode 100644 index 0000000000000000000000000000000000000000..dafca0ee5008dd68020698ad8aa9b3db38d24317 GIT binary patch literal 1491 zcmcgsTTqi%5I%oECaB?}h~+9u)mRZ>kZUDG_(cN9%_|xt2!a+7j0U3+2tJS?SgaO7 z6e1`fqM&FRfsh16C{Pj@VnPX-NMitrglka2VE<10(3$eweff62-E+?De!C|pEMyO6 zx#e;I0EQ3%M*sjJE(Fj92oT8+;t|k4=S$d+Ml2m2#{^*66#~3#KlRSITuvDXG&AUN zc_b$1qLX?8B;<9Dtr^^HZ_l5QGhp|_roKLU*FDns{l9*))1NtYAKIJaQ%t8}6YB)e zPP)hS?HKS`2n)7`no2*cdw=G~))4&)cy zvME1DhU@}VS^(&+`rzA5z|I*0Iffu07~qeiz^c{YTG8L3xp7nDX=Qutj%Z>rW`W}y>OP_-@}~G< zWR+Z*bb?m;)JW?+YmMgwd2n*6UL`#4Pmv2@o@LWTCYJ5W^l!9Y@oml)R z=T*kfOGgRMDL*`jtnz)G0vVgi)%yI_0hm#9UY8EQP2Ti{K6+#I*fRhkea+Il=q{c8KO5Y$|W*2gyAJq`G! zWr;*059>BnuVifH8`;84Ritr_+}YYFJ*L z>L-KmYz1L@tO0Fu^sGiyE$)b9sLU~Xj-JDc0V>C9;h~>RO&&@dm`))}%4}HzdaJn> zw594ok@j=B4i~YMRnnmhUa+y|<%$nk?_1Po(Mv0bi25{YFJ{=+e&G*_g2$j)oP57_ zSFkBN^w`HFt2N+U-JE?xjO^fNuavF=()8G|wSonb%?;GuK*tic?^>R2;y~FMA zz>8E{(su|ktd(aIpdM+@i2mg*WftElG~nx@rG(0I^i)NQxfql7oW34xkUtYGjA zAIXWz4MjPYtSKVaYG-E`B~R7WE&WxAEWNi={>$ht3*yR_Pxe1Uk1^7l$8O%qX#tbr zA=EQQP=A3`DrFxUs!q>kMg*Qhw&^r6pmH4gc|yUjYuw=US|&RR!;xv;bG1#-?E?~2 zW#6Z**s0Jyc!w!Ngssqhwg@lAG88^tBZYiU7w=26P9dx(f70>o*WGJ+q|*gmJ(_=3 zIWbT2Gj6a*rde6x(sY=uZ>pxywF@T&Rsr2Z`AWJ1d=T{vU4zfr#( pWD;I+)+n3aX1qid|38Iy{0f~HqLP?~M{NFjov=FuuJt8d{u9DUdzJtI literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/radar_link.png b/src/main/resources/assets/hbm/textures/items/radar_link.png new file mode 100644 index 0000000000000000000000000000000000000000..274181b4b59a71aca94b41b1935bdf7123ff0a21 GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf!p)=jVDEXGWhU0oLzEk~iYe5# z&G6#2$uHj~+NW-0XTRjqD%l+EGs$PARy7DPedf6AbX01SlZy)P;SY7kCA6I*muOD^ a-!5)uWt*n?E>s=pPzFy|KbLh*2~7Y