From 671948754bcdb3704905d21167922d78a7e06dee Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 4 Jun 2022 21:30:30 -0700 Subject: [PATCH 1/2] Plenty of changes --- .../nei/GasCentrifugeRecipeHandler.java | 24 +- .../container/ContainerMachineGasCent.java | 58 ++--- .../hbm/inventory/gui/GUIMachineGasCent.java | 2 +- .../recipes/GasCentrifugeRecipes.java | 36 +-- .../machine/TileEntityMachineGasCent.java | 232 +++++++++--------- .../hbm/textures/gui/centrifuge_gas.png | Bin 3362 -> 0 bytes .../gui/processing/gui_centrifuge_gas.png | Bin 0 -> 3291 bytes 7 files changed, 169 insertions(+), 183 deletions(-) delete mode 100644 src/main/resources/assets/hbm/textures/gui/centrifuge_gas.png create mode 100644 src/main/resources/assets/hbm/textures/gui/processing/gui_centrifuge_gas.png diff --git a/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java b/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java index 194d572d0..246a9e5fb 100644 --- a/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java +++ b/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java @@ -22,16 +22,15 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe { PositionedStack input; - PositionedStack result1; - PositionedStack result2; - PositionedStack result3; + List output = new ArrayList(); - public SmeltingSet(ItemStack input, ItemStack result1, ItemStack result2, ItemStack result3) { + public SmeltingSet(ItemStack input, ItemStack[] results) { input.stackSize = 1; this.input = new PositionedStack(input, 25, 35 - 11); - this.result1 = new PositionedStack(result1, 128, 26 - 11); - this.result2 = new PositionedStack(result2, 128, 44 - 11); - this.result3 = new PositionedStack(result3, 146, 35 - 11); + + for(byte i = 0; i < results.length; i++) { + this.output.add(new PositionedStack(results[i], i % 2 == 0 ? 128 : 146, i < 2 ? 26 - 11 : 44 - 11 )); + } } @Override @@ -43,14 +42,13 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { public List getOtherStacks() { List stacks = new ArrayList(); stacks.add(fuels.get((cycleticks / 48) % fuels.size()).stack); - stacks.add(result2); - stacks.add(result3); + stacks.addAll(output); return stacks; } @Override public PositionedStack getResult() { - return result1; + return output.get(0); } } @@ -93,7 +91,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { if((outputId.equals("gascentprocessing")) && getClass() == GasCentrifugeRecipeHandler.class) { Map recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes(); for(Map.Entry recipe : recipes.entrySet()) { - this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack) recipe.getValue()[0], (ItemStack) recipe.getValue()[1], (ItemStack) recipe.getValue()[2])); + this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue())); } } else { super.loadCraftingRecipes(outputId, results); @@ -106,7 +104,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { for(Map.Entry recipe : recipes.entrySet()) { if(NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[0], result) || NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[1], result) || NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[2], result)) - this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack) recipe.getValue()[0], (ItemStack) recipe.getValue()[1], (ItemStack) recipe.getValue()[2])); + this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue())); } } @@ -124,7 +122,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { Map recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes(); for(Map.Entry recipe : recipes.entrySet()) { if(compareFluidStacks(ingredient, (ItemStack) recipe.getKey())) - this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack) recipe.getValue()[0], (ItemStack) recipe.getValue()[1], (ItemStack) recipe.getValue()[2])); + this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue())); } } diff --git a/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java b/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java index d6cd0f928..26d58fac5 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java +++ b/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java @@ -18,27 +18,27 @@ public class ContainerMachineGasCent extends Container { gasCent = tedf; - //Battery - this.addSlotToContainer(new Slot(tedf, 0, 8, 53)); - //Fluid ID IO - this.addSlotToContainer(new Slot(tedf, 1, 30, 35)); //Output - this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 133, 26)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 3, 133, 44)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 4, 151, 35)); - //upgrade - this.addSlotToContainer(new Slot(tedf, 5, 82, 19)); + for(int i = 0; i < 2; i++) { + for(int j = 0; j < 2; j++) { + this.addSlotToContainer(new SlotMachineOutput(tedf, j + i * 2, 133 + j * 18, 26 + i * 18)); + } + } - for(int i = 0; i < 3; i++) - { - for(int j = 0; j < 9; j++) - { + //Battery + this.addSlotToContainer(new Slot(tedf, 4, 8, 53)); + //Fluid ID IO + this.addSlotToContainer(new Slot(tedf, 5, 30, 35)); + //upgrade + this.addSlotToContainer(new Slot(tedf, 6, 82, 19)); + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } - for(int i = 0; i < 9; i++) - { + for(int i = 0; i < 9; i++) { this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); } } @@ -51,37 +51,29 @@ public class ContainerMachineGasCent extends Container { @Override public ItemStack transferStackInSlot(EntityPlayer player, int index) { - ItemStack var3 = null; + ItemStack returnStack = null; Slot slot = (Slot) this.inventorySlots.get(index); - if (slot != null && slot.getHasStack()) - { + if(slot != null && slot.getHasStack()) { ItemStack stack = slot.getStack(); - var3 = stack.copy(); + returnStack = stack.copy(); - if (index <= 5) { - if (!this.mergeItemStack(stack, 6, this.inventorySlots.size(), true)) - { + if(index <= 6) { + if (!this.mergeItemStack(stack, 7, this.inventorySlots.size(), true)) { return null; } - } - else if (!this.mergeItemStack(stack, 0, 2, false)) - { - if (!this.mergeItemStack(stack, 3, 4, false)) - return null; + } else if(!this.mergeItemStack(stack, 4, 7, false)) { + return null; } - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { slot.putStack((ItemStack) null); - } - else - { + } else { slot.onSlotChanged(); } } - return var3; + return returnStack; } @Override diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java b/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java index 9427e4045..9202e0d18 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java @@ -15,7 +15,7 @@ import net.minecraft.util.ResourceLocation; public class GUIMachineGasCent extends GuiInfoContainer { - public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/centrifuge_gas.png"); + public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_centrifuge_gas.png"); private TileEntityMachineGasCent gasCent; public GUIMachineGasCent(InventoryPlayer invPlayer, TileEntityMachineGasCent tedf) { diff --git a/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java b/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java index 62e08f5e5..de95ef888 100644 --- a/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java @@ -14,27 +14,28 @@ import net.minecraft.item.ItemStack; public class GasCentrifugeRecipes { + //TODO: Change "String name" to I18n instead of unlocalized BS public static enum PseudoFluidType { - NONE (0, 0, "NONE", "Empty", false, (ItemStack[])null), + NONE (0, 0, null, "Empty", false, (ItemStack[])null), - NUF6 (400, 300, "LEUF6", "Natural UF6", false, new ItemStack(ModItems.nugget_u238, 1)), - LEUF6 (300, 200, "MEUF6", "Low Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)), - MEUF6 (200, 100, "HEUF6", "Medium Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1)), - HEUF6 (300, 0, "NONE", "High Enriched UF6", true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)), + HEUF6 (300, 0, NONE, "High Enriched UF6", true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)), + MEUF6 (200, 100, HEUF6, "Medium Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1)), + LEUF6 (300, 200, MEUF6, "Low Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)), + NUF6 (400, 300, LEUF6, "Natural UF6", false, new ItemStack(ModItems.nugget_u238, 1)), - PF6 (300, 0, "NONE", "Plutonium Hexafluoride", false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)), - - MUD (1000, 500, "MUD_HEAVY", "Poisonous Mud", false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1)), - MUD_HEAVY (500, 0, "NONE", "Heavy Mud Fraction", false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)); + PF6 (300, 0, NONE, "Plutonium Hexafluoride", false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)), + + MUD_HEAVY (500, 0, NONE, "Heavy Mud Fraction", false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)), + MUD (1000, 500, MUD_HEAVY, "Poisonous Mud", false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1)); int fluidConsumed; int fluidProduced; - String outputFluid; + PseudoFluidType outputFluid; String name; boolean isHighSpeed; ItemStack[] output; - PseudoFluidType(int fluidConsumed, int fluidProduced, String outputFluid, String name, boolean isHighSpeed, ItemStack... output) { + PseudoFluidType(int fluidConsumed, int fluidProduced, PseudoFluidType outputFluid, String name, boolean isHighSpeed, ItemStack... output) { this.fluidConsumed = fluidConsumed; this.fluidProduced = fluidProduced; this.outputFluid = outputFluid; @@ -51,8 +52,8 @@ public class GasCentrifugeRecipes { return this.fluidProduced; } - public PseudoFluidType getOutputFluid() { - return this.valueOf(this.outputFluid); + public PseudoFluidType getOutputType() { + return this.outputFluid; } public String getName() { @@ -97,8 +98,11 @@ public class GasCentrifugeRecipes { } public static void register() { - gasCent.put(new FluidStack(1200, Fluids.UF6), new ItemStack[] {new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)}); - gasCent.put(new FluidStack(900, Fluids.PUF6), new ItemStack[] {new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)}); - gasCent.put(new FluidStack(1000, Fluids.WATZ), new ItemStack[] {new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)}); + gasCent.put(new FluidStack(1200, Fluids.UF6), new ItemStack[] + {new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)}); + gasCent.put(new FluidStack(900, Fluids.PUF6), new ItemStack[] + {new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)}); + gasCent.put(new FluidStack(1000, Fluids.WATZ), 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)}); } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java index 5ca39fbc3..c097ec771 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java @@ -4,21 +4,22 @@ import java.util.HashMap; import com.hbm.blocks.BlockDummyable; import com.hbm.interfaces.IFluidAcceptor; -import com.hbm.interfaces.IFluidContainer; -import com.hbm.interfaces.Spaghetti; -import com.hbm.interfaces.Untested; import com.hbm.inventory.FluidTank; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType; import com.hbm.items.ModItems; +import com.hbm.items.machine.IItemFluidIdentifier; import com.hbm.items.machine.ItemFluidIdentifier; import com.hbm.lib.Library; import com.hbm.packet.LoopedSoundPacket; import com.hbm.packet.PacketDispatcher; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.InventoryUtil; +import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energy.IEnergyUser; +import api.hbm.fluid.IFluidStandardReceiver; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -28,10 +29,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -@Spaghetti("I still can't believe this was my idea of a 'rework'") -public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidContainer, IFluidAcceptor { +//epic! +public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, IFluidStandardReceiver { - public byte age; public long power; public int progress; public boolean isProgressing; @@ -42,11 +42,10 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I public PseudoFluidTank inputTank; public PseudoFluidTank outputTank; - private static final int[] slots_top = new int[] {0}; + private static final int[] slots_io = new int[] { 0, 2, 3, 4 }; private static final int[] slots_bottom = new int[] {2, 3, 4}; private static final int[] slots_side = new int[] { }; - @Untested private static HashMap fluidConversions = new HashMap(); static { @@ -56,7 +55,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I } public TileEntityMachineGasCent() { - super(6); + super(7); tank = new FluidTank(Fluids.UF6, 2000, 0); inputTank = new PseudoFluidTank(PseudoFluidType.NUF6, 8000); outputTank = new PseudoFluidTank(PseudoFluidType.LEUF6, 8000); @@ -66,10 +65,15 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I public String getName() { return "container.gasCentrifuge"; } - + + @Override + public boolean canExtractItem(int i, ItemStack itemStack, int j) { + return i < 4; + } + @Override public int[] getAccessibleSlotsFromSide(int side) { - return side == 0 ? slots_bottom : side == 1 ? slots_top : slots_side; + return slots_io; } @Override @@ -92,11 +96,6 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I inputTank.writeToNBT(nbt, "inputTank"); outputTank.writeToNBT(nbt, "outputTank"); } - - @Override - public boolean canExtractItem(int i, ItemStack itemStack, int j) { - return (i != 0 && i != 1) || j == 1; - } public int getCentrifugeProgressScaled(int i) { return (progress * i) / getProcessingSpeed(); @@ -121,31 +120,17 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I ItemStack[] list = inputTank.getTankType().getOutput(); if(this.inputTank.getTankType().getIfHighSpeed()) - if(!(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed)) + if(!(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed)) return false; if(list == null) return false; - if(list.length < 1 || list.length > 3) + if(list.length < 1) return false; - for(int i = 0; i < list.length; i++) { - - int slot = i + 2; - - if(slots[slot] == null) - continue; - - if(slots[slot].getItem() == list[i].getItem() && - slots[slot].getItemDamage() == list[i].getItemDamage() && - slots[slot].stackSize + list[i].stackSize <= slots[slot].getMaxStackSize()) - continue; - - return false; - } - - return true; + if(InventoryUtil.doesArrayHaveSpace(slots, 0, 3, list)) + return true; } return false; @@ -158,54 +143,42 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I inputTank.setFill(inputTank.getFill() - inputTank.getTankType().getFluidConsumed()); outputTank.setFill(outputTank.getFill() + inputTank.getTankType().getFluidProduced()); - for(byte i = 0; i < output.length && i < 3; i++) { - if(slots[i + 2] == null) { - slots[i + 2] = output[i].copy(); - } else { - slots[i + 2].stackSize += output[i].stackSize; - } - } + for(byte i = 0; i < output.length; i++) + InventoryUtil.tryAddItemToInventory(slots, 0, 3, output[i].copy()); //reference types almost got me again } private void attemptConversion() { - if(inputTank.getFill() <= inputTank.getMaxFill() && tank.getFill() > 0) { - int fill = inputTank.getMaxFill() - inputTank.getFill(); + if(inputTank.getFill() < inputTank.getMaxFill() && tank.getFill() > 0) { + int fill = Math.min(inputTank.getMaxFill() - inputTank.getFill(), tank.getFill()); - if(tank.getFill() >= fill) { - tank.setFill(tank.getFill() - fill); - inputTank.setFill(inputTank.getFill() + fill); - } else { - inputTank.setFill(inputTank.getFill() + tank.getFill()); - tank.setFill(0); - } + tank.setFill(tank.getFill() - fill); + inputTank.setFill(inputTank.getFill() + fill); } } private boolean attemptTransfer(TileEntity te) { if(te instanceof TileEntityMachineGasCent) { - TileEntityMachineGasCent gasCent = (TileEntityMachineGasCent) te; + TileEntityMachineGasCent cent = (TileEntityMachineGasCent) te; - if(gasCent.tank.getFill() == 0 && gasCent.tank.getTankType() == this.tank.getTankType()) { - if(gasCent.inputTank.getTankType() != this.outputTank.getTankType()) { - gasCent.inputTank.setTankType(this.outputTank.getTankType()); - gasCent.outputTank.setTankType(this.outputTank.getTankType().getOutputFluid()); + if(cent.tank.getFill() == 0 && cent.tank.getTankType() == tank.getTankType()) { + if(cent.inputTank.getTankType() != outputTank.getTankType()) { + cent.inputTank.setTankType(outputTank.getTankType()); + cent.outputTank.setTankType(outputTank.getTankType().getOutputType()); } - if(gasCent.inputTank.getFill() < gasCent.inputTank.getMaxFill() && this.outputTank.getFill() > 0) { - int fill = gasCent.inputTank.getMaxFill() - gasCent.inputTank.getFill(); + //God, why did I forget about the entirety of the fucking math library? + if(cent.inputTank.getFill() < cent.inputTank.getMaxFill() && outputTank.getFill() > 0) { + int fill = Math.min(cent.inputTank.getMaxFill() - cent.inputTank.getFill(), outputTank.getFill()); - if(this.outputTank.getFill() >= fill) { - this.outputTank.setFill(this.outputTank.getFill() - fill); - gasCent.inputTank.setFill(gasCent.inputTank.getFill() + fill); - } else { - gasCent.inputTank.setFill(gasCent.inputTank.getFill() + this.outputTank.getFill()); - this.outputTank.setFill(0); - } + outputTank.setFill(outputTank.getFill() - fill); + cent.inputTank.setFill(cent.inputTank.getFill() + fill); } - return false; + + return true; } } - return true; + + return false; } public void networkUnpack(NBTTagCompound data) { @@ -220,26 +193,25 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I @Override public void updateEntity() { - + if(!worldObj.isRemote) { - this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord); + updateConnections(); power = Library.chargeTEFromItems(slots, 0, power, maxPower); - setTankType(1); + setTankType(5); - if(inputTank.getTankType() == PseudoFluidType.PF6 || inputTank.getTankType() == PseudoFluidType.NUF6 || inputTank.getTankType() == PseudoFluidType.MUD) { - tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); + if(fluidConversions.containsValue(inputTank.getTankType())) { + tank.updateTank(this); attemptConversion(); } if(canEnrich()) { isProgressing = true; - this.progress++; - if(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed) + if(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed) this.power -= 300; else this.power -= 200; @@ -251,28 +223,20 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I if(progress >= getProcessingSpeed()) enrich(); - } else { isProgressing = false; this.progress = 0; } - age++; - if(age >= 10) { - age = 0; - + if(worldObj.getTotalWorldTime() % 10 == 0) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); TileEntity te = worldObj.getTileEntity(this.xCoord - dir.offsetX, this.yCoord, this.zCoord - dir.offsetZ); - if(attemptTransfer(te) && this.inputTank.getTankType() == PseudoFluidType.LEUF6) { - if(this.outputTank.getFill() >= 100 && (slots[4] == null || (slots[4].getItem() == ModItems.nugget_uranium_fuel && slots[4].stackSize + 1 <= slots[4].getMaxStackSize()))) { + //*AT THE MOMENT*, there's not really any need for a dedicated method for this. Yet. + if(!attemptTransfer(te) && this.inputTank.getTankType() == PseudoFluidType.LEUF6) { + if(this.outputTank.getFill() >= 100 && InventoryUtil.tryAddItemToInventory(slots, 0, 3, new ItemStack(ModItems.nugget_uranium_fuel)) == null) { this.outputTank.setFill(this.outputTank.getFill() - 100); - if(slots[4] == null) { - slots[4] = new ItemStack(ModItems.nugget_uranium_fuel, 1); - } else { - slots[4].stackSize += 1; - } } } } @@ -290,6 +254,26 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); } } + + private void updateConnections() { + for(DirPos pos : getConPos()) { + this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + + if(fluidConversions.containsValue(inputTank.getTankType())) { + this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + } + } + } + + private DirPos[] getConPos() { + return new DirPos[] { + new DirPos(xCoord, yCoord - 1, zCoord, Library.NEG_Y), + new DirPos(xCoord + 1, yCoord, zCoord, Library.POS_X), + new DirPos(xCoord - 1, yCoord, zCoord, Library.NEG_X), + new DirPos(xCoord, yCoord, zCoord + 1, Library.POS_Z), + new DirPos(xCoord, yCoord, zCoord - 1, Library.NEG_Z) + }; + } @Override public void setPower(long i) { @@ -308,58 +292,62 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I } public int getProcessingSpeed() { - if(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed) { + if(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed) { return processingSpeed - 70; } return processingSpeed; } - + + public void setTankType(int in) { + + 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]); + + if(tank.getTankType() != newType) { + PseudoFluidType pseudo = fluidConversions.get(newType); + + if(pseudo != null) { + inputTank.setTankType(pseudo); + outputTank.setTankType(pseudo.getOutputType()); + tank.setTankType(newType); + } + } + + } + } + + @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 setTypeForSync(FluidType type, int index) { - tank.setTankType(type); + public void setFluidFill(int fill, FluidType type) { + if(type == tank.getTankType()) + tank.setFill(fill); } - public void setTankType(int in) { - - if(slots[in] != null && slots[in].getItem() instanceof ItemFluidIdentifier) { - FluidType newType = ItemFluidIdentifier.getType(slots[in]); - - if(tank.getTankType() != newType) { - - PseudoFluidType pseudo = fluidConversions.get(newType); - - if(pseudo != null) { - inputTank.setTankType(pseudo); - outputTank.setTankType(pseudo.getOutputFluid()); - tank.setTankType(newType); - tank.setFill(0); - } - } - return; - } + @Override + public int getFluidFill(FluidType type) { + return tank.getTankType() == type ? tank.getFill() : 0; } @Override public int getMaxFluidFill(FluidType type) { - return type.name().equals(this.tank.getTankType().name()) ? tank.getMaxFill() : 0; + return tank.getTankType() == type ? tank.getMaxFill() : 0; } - + @Override - public int getFluidFill(FluidType type) { - return type.name().equals(this.tank.getTankType().name()) ? tank.getFill() : 0; + public FluidTank[] getReceivingTanks() { + return new FluidTank[] { tank }; } - - @Override - public void setFluidFill(int i, FluidType type) { - if(type.name().equals(tank.getTankType().name())) - tank.setFill(i); - } - + AxisAlignedBB bb = null; @Override @@ -394,10 +382,14 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I public void setTankType(PseudoFluidType type) { - if(this.type.name().equals(type.name())) + if(this.type.equals(type)) return; - this.type = type; + if(type == null) + this.type = PseudoFluidType.NONE; + else + this.type = type; + this.setFill(0); } diff --git a/src/main/resources/assets/hbm/textures/gui/centrifuge_gas.png b/src/main/resources/assets/hbm/textures/gui/centrifuge_gas.png deleted file mode 100644 index 1300c56f928c03969ebe1ce3ff1f7062525e1ab5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3362 zcmc&%cT|&E7XK21G^HsDLy03O3JfBHAd#k03@9Md5wIW(ID}|u1_%LGQKSfnh?EEc z0g)Q%hGGkd1R11A3>`uXK_Cf32-%OBowKuZ_MDyn_MLmq`_6su{%(Euz3-l#jpa_U z@5BHA*oi!2W)A=m@Dl=vYzL={H;aA135Gd^bPxeYgoyWD0NC*bX?D^fESpJh2~=Px zQNBrO z{V1f%;WqVQ+p$KMi#l)7F@V+X&S^dfLCdszh7jeM>oO5 zxniJqv8iQ%N=+ILXOXLDCV~yjgwoAaI-TCe7-Q%jgUU5wS}oXE4>)cuZ*iDR8zA)! z@-#HPKC!*Ne(o)@t*NTYBNA1V;Bd)WuX^-J{lKIV<;BN-M-61;!~lfJ%_5KZhS>5= z?ns4$=AORUpqI_fYv6d0+zE!5Hwk-6U?NhvF*N;%S6E2I-duL~Qh?dyR zjfO^gIqGYDUSeWmn~G0Bcl^B`VF*4VOAmU;EK@lwKRsQxtfHcnj+&>yqdx18L=ZtU zPgY#~HC^@G*W8+%oSZ?Pi_Q`PzwpvoEy_@%Yx9$<@W{~6cRN<##u3F%rN_eJU1_9B z5{ZZUf)8mbD=a)9d*2)+UR$I?5mfiBe0nC-NcpZ$Ra7K?(5@vnI@^u#Z$c$dH! z&*QR6FKU71R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Xt-x@Xl=LbbEs9L|3*YqqVqO<)BQDBOK?Sj| z>A5*()Xh^=U_2wa^mZUSL?#Zu@^SD^28b1rvl{LOt0FfWR#3i#O^xpyB+lURX5UX$ z4m5t@oF@i(VyIC6LSWKPTW^_{^AR$HZceX!n}0A&1?#RBU#wz+(Zt#H-B!a4z!@AP zIUgo}D-|9+P~sK4D$XNZ!7O)=J$XcRif#0p^hCgY;fkGbh73Csb5*38durRt+1{$q zrMqb4z-IOB2VnMg|4uL&&C=p%-tZsqV@2U%kP^$w?26DDK2Qv1bNoE1DTZQcasAtD_4`j5TeiF%*s;slfWtx$2;ocVphxG zT{txIaIb8n5R>0hwm+-Ph#Y@j#%&+5x1;0p9^j1AcSQG10DU!2FXMi8w zCC6KQWAl}m;a-1#7{g_dx0fEoCCl!a_X76-pHjI@@z(PLW_fC8`wTPj9a+yOtugK! z;Lnw1iD;+fp-~QDUjln944D#J|KgRzT0R|ElgZgHHN!vO;&06VIR&5EI#HZfdp&aEL{v9yfyEtDsl~3O7SCD&bc( zrSR+%Zut$Mcx|WbH01Nf2?TfCZ;vHJa%)*94? z?jR{ir1K~hOL`>1RFtG=K4jb~o|j|saP)?kk+iCzN-vDsjTQ2uMeefMTJ zT)2c#QaU41;z~{Nt52L=xuahmf9IX^IuT9WwnG%wbh8HS#NCi&Qu4n>@kbbx(f%Z} XG;N>O+lT(_PZ+Sl*;`bZ6BGXf`H&Ri literal 0 HcmV?d00001 From cfe90f281ad7f1986de82ca72e5189f55d416650 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 5 Jun 2022 20:32:47 -0700 Subject: [PATCH 2/2] plenty more changes; RBMK rounding errors fixed --- .../nei/GasCentrifugeRecipeHandler.java | 71 +++++++++--- .../container/ContainerMachineGasCent.java | 12 +- .../hbm/inventory/gui/GUIMachineGasCent.java | 105 +++++++++++------- .../recipes/GasCentrifugeRecipes.java | 53 +++++---- .../java/com/hbm/main/CraftingManager.java | 2 +- .../machine/TileEntityMachineGasCent.java | 27 ++--- .../machine/rbmk/TileEntityRBMKBoiler.java | 31 ++++-- src/main/resources/assets/hbm/lang/en_US.lang | 8 ++ .../gui/nei/gui_nei_centrifuge_gas.png | Bin 0 -> 2391 bytes .../gui/processing/gui_centrifuge_gas.png | Bin 3291 -> 2501 bytes 10 files changed, 195 insertions(+), 114 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/gui/nei/gui_nei_centrifuge_gas.png diff --git a/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java b/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java index 246a9e5fb..8fdda9e8a 100644 --- a/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java +++ b/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java @@ -1,18 +1,27 @@ package com.hbm.handler.nei; +import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; + import java.awt.Rectangle; import java.util.ArrayList; import java.util.Arrays; +import java.util.LinkedList; import java.util.List; import java.util.Map; +import com.hbm.handler.nei.AnvilRecipeHandler.RecipeSet; import com.hbm.inventory.gui.GUIMachineGasCent; import com.hbm.inventory.recipes.GasCentrifugeRecipes; import com.hbm.inventory.recipes.MachineRecipes; +import com.hbm.lib.RefStrings; import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRectHandler; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; @@ -23,13 +32,17 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe { PositionedStack input; List output = new ArrayList(); + boolean isHighSpeed; + int centNumber; - public SmeltingSet(ItemStack input, ItemStack[] results) { + public SmeltingSet(ItemStack input, ItemStack[] results, boolean isHighSpeed, int centNumber) { input.stackSize = 1; - this.input = new PositionedStack(input, 25, 35 - 11); + this.input = new PositionedStack(input, 52 - 5, 35 - 11); + this.isHighSpeed = isHighSpeed; + this.centNumber = centNumber; for(byte i = 0; i < results.length; i++) { - this.output.add(new PositionedStack(results[i], i % 2 == 0 ? 128 : 146, i < 2 ? 26 - 11 : 44 - 11 )); + this.output.add(new PositionedStack(results[i], i % 2 == 0 ? 134 - 5 : 152 - 5, i < 2 ? 26 - 11 : 44 - 11 )); } } @@ -68,12 +81,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { @Override public String getGuiTexture() { - return GUIMachineGasCent.texture.toString(); - } - - @Override - public Class getGuiClass() { - return GUIMachineGasCent.class; + return RefStrings.MODID + ":textures/gui/nei/gui_nei_centrifuge_gas.png"; } @Override @@ -91,7 +99,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { if((outputId.equals("gascentprocessing")) && getClass() == GasCentrifugeRecipeHandler.class) { Map recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes(); for(Map.Entry recipe : recipes.entrySet()) { - this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue())); + this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue()[0], (boolean) recipe.getValue()[1], (int) recipe.getValue()[2])); } } else { super.loadCraftingRecipes(outputId, results); @@ -102,9 +110,9 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { public void loadCraftingRecipes(ItemStack result) { Map recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes(); for(Map.Entry recipe : recipes.entrySet()) { - if(NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[0], result) || NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[1], result) - || NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[2], result)) - this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue())); + if(NEIServerUtils.areStacksSameType(((ItemStack[]) recipe.getValue()[0])[0], result) || NEIServerUtils.areStacksSameType(((ItemStack[]) recipe.getValue()[0])[1], result) + || NEIServerUtils.areStacksSameType(((ItemStack[]) recipe.getValue()[0])[2], result) || NEIServerUtils.areStacksSameType(((ItemStack[]) recipe.getValue()[0])[3], result)) + this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue()[0], (boolean) recipe.getValue()[1], (int) recipe.getValue()[2])); } } @@ -122,7 +130,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { Map recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes(); for(Map.Entry recipe : recipes.entrySet()) { if(compareFluidStacks(ingredient, (ItemStack) recipe.getKey())) - this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue())); + this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue()[0], (boolean) recipe.getValue()[1], (int) recipe.getValue()[2])); } } @@ -133,11 +141,42 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { @Override public void drawExtras(int recipe) { drawProgressBar(3, 51 - 45, 176, 0, 16, 34, 480, 7); - drawProgressBar(69, 26, 208, 0, 33, 12, 200, 0); + + SmeltingSet set = (SmeltingSet) this.arecipes.get(recipe); + + drawProgressBar(79 - 5, 28 - 11, 208, 0, 44, 37, set.isHighSpeed ? 150 - 70 : 150, 0); + + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; + + String centrifuges = set.centNumber + " G. Cents"; + fontRenderer.drawString(centrifuges, (50 - fontRenderer.getStringWidth(centrifuges) / 2), 21 - 11, 65280); } + + public LinkedList transferRectsRec = new LinkedList(); + public LinkedList transferRectsGui = new LinkedList(); + public LinkedList> guiRec = new LinkedList>(); + public LinkedList> guiGui = new LinkedList>(); @Override public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(69, 26, 32, 12), "gascentprocessing")); + transferRectsGui = new LinkedList(); + guiGui = new LinkedList>(); + + transferRects.add(new RecipeTransferRect(new Rectangle(79 - 5, 26 - 11, 44, 40), "gascentprocessing")); + transferRectsGui.add(new RecipeTransferRect(new Rectangle(70 - 5, 36 - 11, 36, 12), "gascentprocessing")); + + guiGui.add(GUIMachineGasCent.class); + RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects); + RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui); + } + + @Override + public void drawBackground(int recipe) { + super.drawBackground(recipe); + + SmeltingSet set = (SmeltingSet) this.arecipes.get(recipe); + + if(set.isHighSpeed) + drawTexturedModalRect(30 - 5, 35 - 11, 192, 0, 16, 16); } } diff --git a/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java b/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java index 26d58fac5..6381575fb 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java +++ b/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java @@ -21,25 +21,25 @@ public class ContainerMachineGasCent extends Container { //Output for(int i = 0; i < 2; i++) { for(int j = 0; j < 2; j++) { - this.addSlotToContainer(new SlotMachineOutput(tedf, j + i * 2, 133 + j * 18, 26 + i * 18)); + this.addSlotToContainer(new SlotMachineOutput(tedf, j + i * 2, 71 + j * 18, 53 + i * 18)); } } //Battery - this.addSlotToContainer(new Slot(tedf, 4, 8, 53)); + this.addSlotToContainer(new Slot(tedf, 4, 182, 71)); //Fluid ID IO - this.addSlotToContainer(new Slot(tedf, 5, 30, 35)); + this.addSlotToContainer(new Slot(tedf, 5, 91, 15)); //upgrade - this.addSlotToContainer(new Slot(tedf, 6, 82, 19)); + this.addSlotToContainer(new Slot(tedf, 6, 69, 15)); for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) { - this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 122 + i * 18)); } } for(int i = 0; i < 9; i++) { - this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 180)); } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java b/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java index 9202e0d18..8577cbbcd 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java @@ -9,8 +9,10 @@ import com.hbm.tileentity.machine.TileEntityMachineGasCent; import com.hbm.util.I18nUtil; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; public class GUIMachineGasCent extends GuiInfoContainer { @@ -22,31 +24,42 @@ public class GUIMachineGasCent extends GuiInfoContainer { super(new ContainerMachineGasCent(invPlayer, tedf)); gasCent = tedf; - this.xSize = 176; - this.ySize = 168; + this.xSize = 206; + this.ySize = 204; } @Override public void drawScreen(int mouseX, int mouseY, float f) { super.drawScreen(mouseX, mouseY, f); - this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 58, guiTop + 30, 8, 33, mouseX, mouseY, new String[] {gasCent.inputTank.getTankType().getName(), gasCent.inputTank.getFill() + " / " + gasCent.inputTank.getMaxFill() + " mB"}); - this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 114, guiTop + 30, 8, 33, mouseX, mouseY, new String[] {gasCent.outputTank.getTankType().getName(), gasCent.outputTank.getFill() + " / " + gasCent.outputTank.getMaxFill() + " mB"}); + String[] inTankInfo = new String[] {gasCent.inputTank.getTankType().getName(), gasCent.inputTank.getFill() + " / " + gasCent.inputTank.getMaxFill() + " mB"}; + if(gasCent.inputTank.getTankType().getIfHighSpeed()) { + if(gasCent.getProcessingSpeed() > gasCent.processingSpeed - 70) + inTankInfo[0] = EnumChatFormatting.DARK_RED + inTankInfo[0]; + else + inTankInfo[0] = EnumChatFormatting.GOLD + inTankInfo[0]; + } + String[] outTankInfo = new String[] {gasCent.outputTank.getTankType().getName(), gasCent.outputTank.getFill() + " / " + gasCent.outputTank.getMaxFill() + " mB"}; + if(gasCent.outputTank.getTankType().getIfHighSpeed()) + outTankInfo[0] = EnumChatFormatting.GOLD + outTankInfo[0]; - this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 51 - 34, 16, 34, gasCent.power, gasCent.maxPower); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 15, guiTop + 15, 24, 55, mouseX, mouseY, inTankInfo); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 137, guiTop + 15, 25, 55, mouseX, mouseY, outTankInfo); + + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 182, guiTop + 69 - 52, 16, 52, gasCent.power, gasCent.maxPower); String[] enrichmentText = I18nUtil.resolveKeyArray("desc.gui.gasCent.enrichment"); - this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 16, 16, 16, guiLeft - 8, guiTop + 16 + 16, enrichmentText); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 12, guiTop + 16, 16, 16, guiLeft - 8, guiTop + 16 + 16, enrichmentText); String[] transferText = I18nUtil.resolveKeyArray("desc.gui.gasCent.output"); - this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 32, 16, 16, guiLeft - 8, guiTop + 32 + 16, transferText); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 12, guiTop + 32, 16, 16, guiLeft - 8, guiTop + 32 + 16, transferText); } @Override protected void drawGuiContainerForegroundLayer(int i, int j) { String name = this.gasCent.hasCustomInventoryName() ? this.gasCent.getInventoryName() : I18n.format(this.gasCent.getInventoryName()); - this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + //this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } @@ -56,44 +69,50 @@ public class GUIMachineGasCent extends GuiInfoContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - int i = (int)gasCent.getPowerRemainingScaled(34); - drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 176, 34 - i, 16, i); + int i = (int)gasCent.getPowerRemainingScaled(52); + drawTexturedModalRect(guiLeft + 182, guiTop + 69 - i, 206, 52 - i, 16, i); - int j = (int)gasCent.getCentrifugeProgressScaled(33); - drawTexturedModalRect(guiLeft + 74, guiTop + 37, 208, 0, j, 12); + int j = (int)gasCent.getCentrifugeProgressScaled(36); + drawTexturedModalRect(guiLeft + 70, guiTop + 35, 206, 52, j, 13); - int a = gasCent.getTankScaled(31, 0); - switch (gasCent.inputTank.getTankType()) { - case PF6: - drawTexturedModalRect(guiLeft + 58, guiTop + 62 - a, 200, 31 - a, 8, a); - break; - case MUD: - drawTexturedModalRect(guiLeft + 58, guiTop + 62 - a, 192, 63 - a, 8, a); - break; - case MUD_HEAVY: - drawTexturedModalRect(guiLeft + 58, guiTop + 62 - a, 192, 63 - a, 8, a); - break; - case NONE: - break; - default: - drawTexturedModalRect(guiLeft + 58, guiTop + 62 - a, 192, 31 - a, 8, a); - } + this.renderTank(guiLeft + 16, guiTop + 16, this.zLevel, 6, 52, gasCent.inputTank.getFill(), gasCent.inputTank.getMaxFill()); + this.renderTank(guiLeft + 32, guiTop + 16, this.zLevel, 6, 52, gasCent.inputTank.getFill(), gasCent.inputTank.getMaxFill()); - int b = gasCent.getTankScaled(31, 1); - switch (gasCent.outputTank.getTankType()) { - case PF6: - drawTexturedModalRect(guiLeft + 114, guiTop + 62 - b, 200, 31 - b, 8, b); - break; - case MUD_HEAVY: - drawTexturedModalRect(guiLeft + 114, guiTop + 62 - b, 192, 63 - b, 8, b); - break; - case NONE: - break; - default: - drawTexturedModalRect(guiLeft + 114, guiTop + 62 - b, 192, 31 - b, 8, b); - } + this.renderTank(guiLeft + 138, guiTop + 16, this.zLevel, 6, 52, gasCent.outputTank.getFill(), gasCent.outputTank.getMaxFill()); + this.renderTank(guiLeft + 154, guiTop + 16, this.zLevel, 6, 52, gasCent.outputTank.getFill(), gasCent.outputTank.getMaxFill()); - this.drawInfoPanel(guiLeft - 16, guiTop + 16, 16, 16, 3); - this.drawInfoPanel(guiLeft - 16, guiTop + 32, 16, 16, 2); + this.drawInfoPanel(guiLeft - 12, guiTop + 16, 16, 16, 3); + this.drawInfoPanel(guiLeft - 12, guiTop + 32, 16, 16, 2); + } + + public void renderTank(int x, int y, double z, int width, int height, int fluid, int maxFluid) { + + GL11.glEnable(GL11.GL_BLEND); + + y += height; + + Minecraft.getMinecraft().getTextureManager().bindTexture(gasCent.tank.getTankType().getTexture()); + + int i = (fluid * height) / maxFluid; + + double minX = x; + double maxX = x + width; + double minY = y - height; + double maxY = y - (height - i); + + double minV = 1D; + double maxV = 1D - i / 16D; + double minU = 0D; + double maxU = width / 16D; + + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(minX, maxY, z, minU, maxV); + tessellator.addVertexWithUV(maxX, maxY, z, maxU, maxV); + tessellator.addVertexWithUV(maxX, minY, z, maxU, minV); + tessellator.addVertexWithUV(minX, minY, z, minU, minV); + tessellator.draw(); + + GL11.glDisable(GL11.GL_BLEND); } } diff --git a/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java b/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java index de95ef888..a7b78c542 100644 --- a/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java @@ -9,37 +9,41 @@ import com.hbm.inventory.FluidStack; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemFluidIcon; +import com.hbm.util.I18nUtil; +import com.hbm.util.Tuple.Pair; import net.minecraft.item.ItemStack; public class GasCentrifugeRecipes { - //TODO: Change "String name" to I18n instead of unlocalized BS public static enum PseudoFluidType { - NONE (0, 0, null, "Empty", false, (ItemStack[])null), + NONE (0, 0, null, false, (ItemStack[])null), - HEUF6 (300, 0, NONE, "High Enriched UF6", true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)), - MEUF6 (200, 100, HEUF6, "Medium Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1)), - LEUF6 (300, 200, MEUF6, "Low Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)), - NUF6 (400, 300, LEUF6, "Natural UF6", false, new ItemStack(ModItems.nugget_u238, 1)), + 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)), - PF6 (300, 0, NONE, "Plutonium Hexafluoride", false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)), + PF6 (300, 0, NONE, false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)), - MUD_HEAVY (500, 0, NONE, "Heavy Mud Fraction", false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)), - MUD (1000, 500, MUD_HEAVY, "Poisonous Mud", false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1)); + 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)); + + //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... + // int fluidConsumed; int fluidProduced; PseudoFluidType outputFluid; - String name; boolean isHighSpeed; ItemStack[] output; - PseudoFluidType(int fluidConsumed, int fluidProduced, PseudoFluidType outputFluid, String name, boolean isHighSpeed, ItemStack... output) { + PseudoFluidType(int fluidConsumed, int fluidProduced, PseudoFluidType outputFluid, boolean isHighSpeed, ItemStack... output) { this.fluidConsumed = fluidConsumed; this.fluidProduced = fluidProduced; this.outputFluid = outputFluid; - this.name = name; this.isHighSpeed = isHighSpeed; this.output = output; } @@ -57,7 +61,7 @@ public class GasCentrifugeRecipes { } public String getName() { - return this.name; + return I18nUtil.resolveKey("hbmpseudofluid.".concat(this.toString().toLowerCase())); } public boolean getIfHighSpeed() { @@ -71,7 +75,8 @@ public class GasCentrifugeRecipes { }; /* Recipe NEI Handler */ - private static Map gasCent = new HashMap(); + //Fluid input; ItemStack[] outputs, isHighSpeed, # of centrifuges + private static Map gasCent = new HashMap(); //Iterators are lots of fun public static Map getGasCentrifugeRecipes() { @@ -79,10 +84,10 @@ public class GasCentrifugeRecipes { Iterator itr = gasCent.entrySet().iterator(); while(itr.hasNext()) { - Map.Entry entry = (Entry) itr.next(); + Map.Entry entry = (Entry) itr.next(); FluidStack input = (FluidStack) entry.getKey(); ItemStack[] out = new ItemStack[4]; - ItemStack[] outputs = (ItemStack[]) entry.getValue(); + ItemStack[] outputs = (ItemStack[]) entry.getValue()[0]; for(int j = 0; j < outputs.length; j++) { out[j] = outputs[j].copy(); @@ -91,18 +96,20 @@ public class GasCentrifugeRecipes { if(out[j] == null) out[j] = new ItemStack(ModItems.nothing); - recipes.put(ItemFluidIcon.make(input.type, input.fill), outputs); + recipes.put(ItemFluidIcon.make(input.type, input.fill), new Object[] { out, entry.getValue()[1], entry.getValue()[2] }); } return recipes; } public static void register() { - gasCent.put(new FluidStack(1200, Fluids.UF6), new ItemStack[] - {new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)}); - gasCent.put(new FluidStack(900, Fluids.PUF6), new ItemStack[] - {new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)}); - gasCent.put(new FluidStack(1000, Fluids.WATZ), 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)}); + 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, 2), 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/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 66f82c33b..d67fc1072 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -767,7 +767,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.upgrade_centrifuge, 1), new Object[] { "PHP", "PUP", "DTD", 'P', ModItems.centrifuge_element, 'H', Blocks.hopper, 'U', ModItems.upgrade_shredder, 'D', ANY_PLASTIC.ingot(), 'T', ModBlocks.machine_transformer }); addRecipeAuto(new ItemStack(ModItems.upgrade_crystallizer, 1), new Object[] { "PHP", "CUC", "DTD", 'P', new ItemStack(ModItems.fluid_barrel_full, 1, Fluids.ACID.getID()), 'H', ModItems.circuit_targeting_tier4, 'C', ModBlocks.barrel_steel, 'U', ModItems.upgrade_centrifuge, 'D', ModItems.motor, 'T', ModBlocks.machine_transformer }); addRecipeAuto(new ItemStack(ModItems.upgrade_screm, 1), new Object[] { "SUS", "SCS", "SUS", 'S', STEEL.plate(), 'U', ModItems.upgrade_template, 'C', ModItems.crystal_xen }); - addRecipeAuto(new ItemStack(ModItems.upgrade_gc_speed, 1), new Object[] {"GNG", "RUR", "GMG", 'R', RUBBER.ingot(), 'M', ModItems.motor, 'G', ModItems.coil_gold, 'N', TCALLOY.ingot(), 'U', ModItems.upgrade_template}); + addRecipeAuto(new ItemStack(ModItems.upgrade_gc_speed, 1), new Object[] {"GNG", "RUR", "GMG", 'R', RUBBER.ingot(), 'M', ModItems.motor, 'G', ModItems.coil_gold, 'N', TCALLOY.ingot(), 'U', ModItems.upgrade_template}); //TODO: gate this behind the upwards gate of the oil chain when it exists addRecipeAuto(new ItemStack(ModItems.mech_key, 1), new Object[] { "MCM", "MKM", "MMM", 'M', ModItems.ingot_meteorite_forged, 'C', ModItems.coin_maskman, 'K', ModItems.key }); addRecipeAuto(new ItemStack(ModItems.spawn_ufo, 1), new Object[] { "MMM", "DCD", "MMM", 'M', ModItems.ingot_meteorite, 'D', DNT.ingot(), 'C', ModItems.coin_worm }); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java index c097ec771..6dcf61f47 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java @@ -42,9 +42,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I public PseudoFluidTank inputTank; public PseudoFluidTank outputTank; - private static final int[] slots_io = new int[] { 0, 2, 3, 4 }; - private static final int[] slots_bottom = new int[] {2, 3, 4}; - private static final int[] slots_side = new int[] { }; + private static final int[] slots_io = new int[] { 0, 1, 2, 3 }; private static HashMap fluidConversions = new HashMap(); @@ -105,15 +103,6 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I return (power * i) / maxPower; } - public int getTankScaled(int i, int id) { - if(id == 0) { - return (this.inputTank.getFill() * i) / inputTank.getMaxFill(); - } else if(id == 1) { - return (this.outputTank.getFill() * i) / outputTank.getMaxFill(); - } - return i; - } - private boolean canEnrich() { if(power > 0 && this.inputTank.getFill() >= inputTank.getTankType().getFluidConsumed() && this.outputTank.getFill() + this.inputTank.getTankType().getFluidProduced() <= outputTank.getMaxFill()) { @@ -161,7 +150,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I TileEntityMachineGasCent cent = (TileEntityMachineGasCent) te; if(cent.tank.getFill() == 0 && cent.tank.getTankType() == tank.getTankType()) { - if(cent.inputTank.getTankType() != outputTank.getTankType()) { + if(cent.inputTank.getTankType() != outputTank.getTankType() && outputTank.getTankType() != PseudoFluidType.NONE) { cent.inputTank.setTankType(outputTank.getTankType()); cent.outputTank.setTankType(outputTank.getTankType().getOutputType()); } @@ -198,11 +187,11 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I updateConnections(); - power = Library.chargeTEFromItems(slots, 0, power, maxPower); + power = Library.chargeTEFromItems(slots, 4, power, maxPower); setTankType(5); + tank.updateTank(this); if(fluidConversions.containsValue(inputTank.getTankType())) { - tank.updateTank(this); attemptConversion(); } @@ -235,8 +224,12 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I //*AT THE MOMENT*, there's not really any need for a dedicated method for this. Yet. if(!attemptTransfer(te) && this.inputTank.getTankType() == PseudoFluidType.LEUF6) { - if(this.outputTank.getFill() >= 100 && InventoryUtil.tryAddItemToInventory(slots, 0, 3, new ItemStack(ModItems.nugget_uranium_fuel)) == null) { - this.outputTank.setFill(this.outputTank.getFill() - 100); + ItemStack[] converted = new ItemStack[] { new ItemStack(ModItems.nugget_uranium_fuel, 6), new ItemStack(ModItems.fluorite) }; + + if(this.outputTank.getFill() >= 600 && InventoryUtil.doesArrayHaveSpace(slots, 0, 3, converted)) { + this.outputTank.setFill(this.outputTank.getFill() - 600); + for(ItemStack stack : converted) + InventoryUtil.tryAddItemToInventory(slots, 0, 3, stack); } } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java index b89800e81..985666099 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java @@ -47,17 +47,32 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I double heatProvided = this.heat - heatCap; if(heatProvided > 0) { - int waterUsed = (int)Math.floor(heatProvided / RBMKDials.getBoilerHeatConsumption(worldObj)); - waterUsed = Math.min(waterUsed, feed.getFill()); - feed.setFill(feed.getFill() - waterUsed); - int steamProduced = (int)Math.floor((waterUsed * 100) / getFactorFromSteam(steam.getTankType())); - steam.setFill(steam.getFill() + steamProduced); + double HEAT_PER_MB_WATER = RBMKDials.getBoilerHeatConsumption(worldObj); + double steamFactor = getFactorFromSteam(steam.getTankType()); + int waterUsed; + int steamProduced; - if(steam.getFill() > steam.getMaxFill()) { - steam.setFill(steam.getMaxFill()); + if(steam.getTankType() == Fluids.ULTRAHOTSTEAM) { + steamProduced = (int)Math.floor((heatProvided / HEAT_PER_MB_WATER) * 100D / steamFactor); + waterUsed = (int)Math.floor(steamProduced / 100D * steamFactor); + + if(feed.getFill() < waterUsed) { + steamProduced = (int)Math.floor(feed.getFill() * 100D / steamFactor); + waterUsed = (int)Math.floor(steamProduced / 100D * steamFactor); + } + } else { + waterUsed = (int)Math.floor(heatProvided / HEAT_PER_MB_WATER); + waterUsed = Math.min(waterUsed, feed.getFill()); + steamProduced = (int)Math.floor((waterUsed * 100D) / steamFactor); } - this.heat -= waterUsed * RBMKDials.getBoilerHeatConsumption(worldObj); + feed.setFill(feed.getFill() - waterUsed); + steam.setFill(steam.getFill() + steamProduced); + + if(steam.getFill() > steam.getMaxFill()) + steam.setFill(steam.getMaxFill()); + + this.heat -= waterUsed * HEAT_PER_MB_WATER; } fillFluidInit(steam.getTankType()); diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index fe780307e..16bf8e684 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -758,6 +758,14 @@ hbmfluid.water=Water hbmfluid.watz=Poisonous Mud hbmfluid.xenon=Xenon Gas hbmfluid.xpjuice=Experience Juice +hbmpseudofluid.none=Empty +hbmpseudofluid.heuf6=Highly Enriched UF6 +hbmpseudofluid.meuf6=Medium Enriched UF6 +hbmpseudofluid.leuf6=Low Enriched UF6 +hbmpseudofluid.nuf6=Natural UF6 +hbmpseudofluid.pf6=Plutonium Hexafluoride +hbmpseudofluid.mud_heavy=Heavy Sludge Fraction +hbmpseudofluid.mud=Poisonous Sludge Gas info.coil=Coil Strength info.templatefolder=Created with %s diff --git a/src/main/resources/assets/hbm/textures/gui/nei/gui_nei_centrifuge_gas.png b/src/main/resources/assets/hbm/textures/gui/nei/gui_nei_centrifuge_gas.png new file mode 100644 index 0000000000000000000000000000000000000000..b291ba662721101527385e9bc323a533ef73432f GIT binary patch literal 2391 zcmeHIX;f2L60Y}}pa#&Otb!0>Ms@}i1P8^?64?X;iO8ZL0uo!0h>CHcdB|cL+7=WW z+lDq676ApqVh}+BvW7(z5k@dXNvlLb!KiTvWTMXepI`H9>YRJ(R(*A=zWbeX&pk`= z^U%Pr!~=kam#2FG0HWL?u=qQrJ8&b2_9Z$T;PE|F^czkp1C2$iCon1#qhm(_&LZM)@*~!WR*%}4Y<<3gbchiL#TPdgW zS@`9Gf&!2@beP3)I2;hWC?=B?BT!si3{Txas2l_BMNnE=3d5c-;!$2+4iEfNQ&SZ* zlZuK8=%Ha4Mx)WVTrRYQ*4EZS(_S8r2fY0a4GqAJ2kybf#zrVhgz}@!&CO7F3W`p) zwzfikYI}QoW@aW_KHJ&ZNg|OTD@z~{K<2M~eSMIY59xUW0|Su6fgd@8gM)Ca449=u zLql+=YGh;t4)8`tM}KE>FH^3emyfY19r1uKP#0=!Ab_!pOp6b^JlqSuDtB(b<7P)7k4DUkE+z|e`a8F z>yeLg@Dhe+@L_R8!PHsN%w0c)iQ^ zMn@lw+hi9qJ~B2oX3kz^*_x?79R6f4vs}?diKmI`rryhmiHSK_8XjqT%n0N^e(1}x zzQg~ybGEB`Xefx^$MQx(?`^=*uk*}_B)#z7YDe@v=O5FSmMUEh7e1amul^yh{r1#M zdR^U2T<)tw*(!Sus`q_NB>#yg7S0Pzw=_ix@_T2GFRyaCdqj7W0G$rZOVMU*7YPkr zaUE=Hkt_KUESODwGSZjK+bIoHU&3LzlP0y8+x!=25fFK; zS$b2<`ObgVn`pDQrnIX(#V$Umn z567Ed!wTYe*x?Kf4L9oEi*C;+q;#je)IN)8RBU!e{$^hPMzD4>df9;KpS@V`(EKjG z=epqVmvgK&dm3+=qG17yVD&YN!UEgSt=$%OSIl3nm$1GZ_ii)_t<2L}ZjQQAmHLE4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