From bbe41c02a7707b8cc01bacbd79aed7eff30e5dc8 Mon Sep 17 00:00:00 2001 From: Boblet Date: Tue, 21 Oct 2025 16:27:50 +0200 Subject: [PATCH] i forgor --- changelog | 3 +++ .../com/hbm/blocks/fluid/CoriumFinite.java | 11 +++++++-- .../hbm/inventory/FluidContainerRegistry.java | 11 ++++----- .../fluid/tank/FluidLoaderStandard.java | 13 +++++++++++ .../network/TileEntityPneumoTube.java | 2 +- .../networkproviders/PneumaticNetwork.java | 22 +++++++++--------- .../gui/storage/gui_pneumatic_endpoint.png | Bin 0 -> 1579 bytes 7 files changed, 42 insertions(+), 20 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/gui/storage/gui_pneumatic_endpoint.png diff --git a/changelog b/changelog index 9c58b7381..b94bd1832 100644 --- a/changelog +++ b/changelog @@ -52,6 +52,7 @@ * 256k tanks now use half as much steel * Gerald is now way more expensive * PWR parts are now subject to expensive mode +* Fluid container items now keep their custom name when filling or emptying ## Fixed * Fixed the T-51b set not having radiation resistance @@ -62,3 +63,5 @@ * Fixed mining lasers targeting blocks with the "gas" material * Fixed gun looping sounds behaving weird when moving while firing * Fixed an issue where weapon mods with the highest stat change priority would break the mod sorting, leading to inconsistent behavior +* Fixed fluid container items breaking when NBT is attached to them +* Potentially fixed a mod conflict where corium fluid would crash when flowing into water diff --git a/src/main/java/com/hbm/blocks/fluid/CoriumFinite.java b/src/main/java/com/hbm/blocks/fluid/CoriumFinite.java index 1861e41b9..be25aadb0 100644 --- a/src/main/java/com/hbm/blocks/fluid/CoriumFinite.java +++ b/src/main/java/com/hbm/blocks/fluid/CoriumFinite.java @@ -59,8 +59,15 @@ public class CoriumFinite extends GenericFiniteFluid { @Override public void updateTick(World world, int x, int y, int z, Random rand) { - - super.updateTick(world, x, y, z, rand); + + // COFH core apparently replaces the water block class with an incompatible type which breaks + // the finite fluid implementation. can't recreate the issue, but according to the provided log + // it seems like this shitty band aid might work + try { + super.updateTick(world, x, y, z, rand); + } catch(ClassCastException ex) { + if(!world.isRemote) world.setBlockToAir(x, y, z); + } if(!world.isRemote && rand.nextInt(10) == 0 && world.getBlock(x, y - 1, z) != this) { diff --git a/src/main/java/com/hbm/inventory/FluidContainerRegistry.java b/src/main/java/com/hbm/inventory/FluidContainerRegistry.java index 4bc72d64a..200efe4a7 100644 --- a/src/main/java/com/hbm/inventory/FluidContainerRegistry.java +++ b/src/main/java/com/hbm/inventory/FluidContainerRegistry.java @@ -118,9 +118,8 @@ public class FluidContainerRegistry { return null; for(FluidContainer container : getContainers(type)) { - if(ItemStack.areItemStacksEqual(container.emptyContainer, sta) && ItemStack.areItemStackTagsEqual(container.emptyContainer, sta)) { + if(container.emptyContainer != null && container.emptyContainer.isItemEqual(sta)) return container; - } } return null; @@ -138,7 +137,7 @@ public class FluidContainerRegistry { return 0; for(FluidContainer container : containerMap.get(type)) { - if(ItemStack.areItemStacksEqual(container.fullContainer, sta) && ItemStack.areItemStackTagsEqual(container.fullContainer, sta)) + if(container.fullContainer.isItemEqual(sta)) return container.content; } @@ -152,7 +151,7 @@ public class FluidContainerRegistry { sta.stackSize = 1; for(FluidContainer container : allContainers) { - if(ItemStack.areItemStacksEqual(container.fullContainer, sta) && ItemStack.areItemStackTagsEqual(container.fullContainer, sta)) + if(container.fullContainer.isItemEqual(sta)) return container.type; } @@ -168,7 +167,7 @@ public class FluidContainerRegistry { if(!containerMap.containsKey(type)) return null; for(FluidContainer container : containerMap.get(type)) { - if(ItemStack.areItemStacksEqual(container.emptyContainer, sta) && ItemStack.areItemStackTagsEqual(container.emptyContainer, sta)) + if(container.emptyContainer != null && container.emptyContainer.isItemEqual(sta)) return container.fullContainer.copy(); } @@ -182,7 +181,7 @@ public class FluidContainerRegistry { sta.stackSize = 1; for(FluidContainer container : allContainers) { - if(ItemStack.areItemStacksEqual(container.fullContainer, sta) && ItemStack.areItemStackTagsEqual(container.fullContainer, sta)) + if(container.fullContainer.isItemEqual(sta)) return container.emptyContainer == null ? null : container.emptyContainer.copy(); } diff --git a/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderStandard.java b/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderStandard.java index 4d0276e7f..3b2b9ac6d 100644 --- a/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderStandard.java +++ b/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderStandard.java @@ -18,6 +18,8 @@ public class FluidLoaderStandard extends FluidLoadingHandler { if(full != null && slots[in] != null && tank.getFill() - FluidContainerRegistry.getFluidContent(full, type) >= 0) { + String name = slots[in].hasDisplayName() ? slots[in].getDisplayName() : null; + if(slots[out] == null) { tank.setFill(tank.getFill() - FluidContainerRegistry.getFluidContent(full, type)); @@ -27,6 +29,8 @@ public class FluidLoaderStandard extends FluidLoadingHandler { slots[in] = null; } + if(name != null) slots[out].setStackDisplayName(name); + } else if(slots[out] != null && slots[out].getItem() == full.getItem() && slots[out].getItemDamage() == full.getItemDamage() && slots[out].stackSize < slots[out].getMaxStackSize()) { tank.setFill(tank.getFill() - FluidContainerRegistry.getFluidContent(full, type)); @@ -36,6 +40,8 @@ public class FluidLoaderStandard extends FluidLoadingHandler { slots[in] = null; } slots[out].stackSize++; + + if(name != null) slots[out].setStackDisplayName(name); } } @@ -55,11 +61,17 @@ public class FluidLoaderStandard extends FluidLoadingHandler { ItemStack emptyContainer = FluidContainerRegistry.getEmptyContainer(slots[in]); + String name = slots[in].hasDisplayName() ? slots[in].getDisplayName() : null; + if(slots[out] == null) { tank.setFill(tank.getFill() + amount); slots[out] = emptyContainer; + if(emptyContainer != null) { + if(name != null) slots[out].setStackDisplayName(name); + } + slots[in].stackSize--; if(slots[in].stackSize <= 0) { slots[in] = null; @@ -76,6 +88,7 @@ public class FluidLoaderStandard extends FluidLoadingHandler { if(emptyContainer != null) { slots[out].stackSize++; + if(name != null) slots[out].setStackDisplayName(name); } } diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityPneumoTube.java b/src/main/java/com/hbm/tileentity/network/TileEntityPneumoTube.java index 5336f61ab..571494c35 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityPneumoTube.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityPneumoTube.java @@ -127,7 +127,7 @@ public class TileEntityPneumoTube extends TileEntityMachineBase implements IGUIP if(this.isEndpoint() && this.node != null && this.node.net != null && worldObj.getTotalWorldTime() % 10 == 0) { TileEntity tile = Compat.getTileStandard(worldObj, xCoord + this.ejectionDir.offsetX, yCoord + this.ejectionDir.offsetY, zCoord + this.ejectionDir.offsetZ); - if(tile instanceof IInventory) this.node.net.addReceiver((IInventory) tile, this.ejectionDir); + if(tile instanceof IInventory) this.node.net.addReceiver((IInventory) tile, this.ejectionDir, this); } this.networkPackNT(15); diff --git a/src/main/java/com/hbm/uninos/networkproviders/PneumaticNetwork.java b/src/main/java/com/hbm/uninos/networkproviders/PneumaticNetwork.java index 0bce26700..39043131a 100644 --- a/src/main/java/com/hbm/uninos/networkproviders/PneumaticNetwork.java +++ b/src/main/java/com/hbm/uninos/networkproviders/PneumaticNetwork.java @@ -13,7 +13,7 @@ import com.hbm.tileentity.network.TileEntityPneumoTube; import com.hbm.uninos.NodeNet; import com.hbm.util.BobMathUtil; import com.hbm.util.ItemStackUtil; -import com.hbm.util.Tuple.Pair; +import com.hbm.util.Tuple.Triplet; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; @@ -38,10 +38,10 @@ public class PneumaticNetwork extends NodeNet { // while the system has parts that expects IInventires to be TileEntities to work properly (mostly range checks), // it can actually handle non-TileEntities just fine. - public HashMap> receivers = new HashMap(); + public HashMap> receivers = new HashMap(); - public void addReceiver(IInventory inventory, ForgeDirection pipeDir) { - receivers.put(inventory, new Pair(pipeDir, System.currentTimeMillis())); + public void addReceiver(IInventory inventory, ForgeDirection pipeDir, TileEntityPneumoTube endpoint) { + receivers.put(inventory, new Triplet(pipeDir, System.currentTimeMillis(), endpoint)); } @Override public void update() { @@ -50,7 +50,7 @@ public class PneumaticNetwork extends NodeNet { // technically not necessary since that step is taken during the send operation, // but we still want to reap garbage data that would otherwise accumulate long timestamp = System.currentTimeMillis(); - receivers.entrySet().removeIf(x -> { return (timestamp - x.getValue().getValue() > timeout) || NodeNet.isBadLink(x.getKey()); }); + receivers.entrySet().removeIf(x -> { return (timestamp - x.getValue().getY() > timeout) || NodeNet.isBadLink(x.getKey()); }); } public boolean send(IInventory source, TileEntityPneumoTube tube, ForgeDirection accessDir, int sendOrder, int receiveOrder, int maxRange) { @@ -58,7 +58,7 @@ public class PneumaticNetwork extends NodeNet { // turns out there may be a short time window where the cleanup hasn't happened yet, but chunkloading has already caused tiles to go invalid // so we just run it again here, just to be sure. long timestamp = System.currentTimeMillis(); - receivers.entrySet().removeIf(x -> { return (timestamp - x.getValue().getValue() > timeout) || NodeNet.isBadLink(x.getKey()); }); + receivers.entrySet().removeIf(x -> { return (timestamp - x.getValue().getY() > timeout) || NodeNet.isBadLink(x.getKey()); }); if(receivers.isEmpty()) return false; @@ -70,12 +70,12 @@ public class PneumaticNetwork extends NodeNet { // for round robin, receivers are ordered by proximity to the source ReceiverComparator comparator = new ReceiverComparator(tube); - List>> receiverList = new ArrayList(receivers.size()); + List>> receiverList = new ArrayList(receivers.size()); receiverList.addAll(receivers.entrySet()); receiverList.sort(comparator); int index = nextReceiver % receivers.size(); - Entry> chosenReceiverEntry = null; + Entry> chosenReceiverEntry = null; nextReceiver++; if(receiveOrder == RECEIVE_ROBIN) chosenReceiverEntry = receiverList.get(index); @@ -98,7 +98,7 @@ public class PneumaticNetwork extends NodeNet { } } - int destSide = chosenReceiverEntry.getValue().getKey().getOpposite().ordinal(); + int destSide = chosenReceiverEntry.getValue().getX().getOpposite().ordinal(); int[] destSlotAccess = getSlotAccess(dest, destSide); int itemsLeftToSend = ITEMS_PER_TRANSFER; // not actually individual items, but rather the total "mass", based on max stack size int itemHardCap = dest instanceof TileEntityMachineAutocrafter ? 1 : ITEMS_PER_TRANSFER; @@ -181,7 +181,7 @@ public class PneumaticNetwork extends NodeNet { } /** Compares IInventory by distance, going off the assumption that they are TileEntities. Uses positional data for tie-breaking if the distance is the same. */ - public static class ReceiverComparator implements Comparator>> { + public static class ReceiverComparator implements Comparator>> { private TileEntityPneumoTube origin; @@ -190,7 +190,7 @@ public class PneumaticNetwork extends NodeNet { } @Override - public int compare(Entry> o1, Entry> o2) { + public int compare(Entry> o1, Entry> o2) { TileEntity tile1 = o1.getKey() instanceof TileEntity ? (TileEntity) o1.getKey() : null; TileEntity tile2 = o2.getKey() instanceof TileEntity ? (TileEntity) o2.getKey() : null; diff --git a/src/main/resources/assets/hbm/textures/gui/storage/gui_pneumatic_endpoint.png b/src/main/resources/assets/hbm/textures/gui/storage/gui_pneumatic_endpoint.png new file mode 100644 index 0000000000000000000000000000000000000000..d6efd318f52fa67e4520aedabc6ecf8c152a3b63 GIT binary patch literal 1579 zcmbtTdsNbA82#pvkm|9{QV6GG8L|WzD z%Q)I ztrlAW0IWl{5WWEb0hb71X$~h!O3eW{nWkV=Ww3 zU(VZ`71(-R^M~QlMOFA+o$Tqz1PQ&Le?mZHl>F#K?H44LTp0~?zVy~i&}V$3b2ZyQ zte6Nm+811D$xj@!xL-hj@@C3eZ}R(Z59KTo`DZm4fEo%s7n>Jc zRn&Dr$t%7|arcw$_TeJ&ZS}VCizE_>XK7bwwAW_PASL1FZTO)(kGmYvm;WH%A@`)j zuXsd!N#q8QYYTrZ53pCmKxq%`Q_VR8{qG;yAG#|vqfYQ2(H@d?3&){l_;G`a#7a@DMm-{H9;m@N#MZEXw`OVEm`WRn!=79 zOyM%p(s~kHYl!O+tQ(l_Kqc>O$FbhenK=v^*9z=!>?_PyfyYH-MgI!grSVa4bz2IY^`b8UuVGMDT>^RpDbh$) zS{=o`+-zakdPGg)NLi&cTBX%$r8fb}vEVz%Zgkr(rOcMlJu20CxYylm7iZ$=gZP6@#8fxsywSmp*eMgIg*>m#5? zv)zS8jtk`9GFI{vW?rjBy{wdqm4e9ExS!TGB+e+FS-@Uju6MAZ+jM3H<|nr|p-BUlLa{igu{qnith_vk(3a+# zm+aQvkv@j-nO?eR!SVl+^NF^{Pg<>~pNn&)PLBDKLv(r)8yh3bcs(4V!s=W7-uaBu z{3rO?XV0GX!Qs3mW!F?R;w_vz;@^(>#6ELD%xxDT&7Td^NS!<-&M$ii1lZ*Sy-t=B zgSuC?SUEsJjjGjaFqkXygtmIwx|p9a9PC3`9VU`7U^2&>bICut_QOr*X}oe9?xZma zW`3!PLe=2Nre9ajV9BO0^E2ms?I*LC4@A$BbXVM34QiE zSEy!h&+fWPXP3$ihmiAb(R}QGE!*r<8$;cybruq?@b(MX=Ch)FR_v&Lr*1c};!Cb1 zsNOVE-It{vHt+VQ>l;Sd!u({DWbY)pNk1kNfs@{~{jfj(_cTl|Vv{FB&Xm`zeoqw= L6i%q!wCnhv)^L6x literal 0 HcmV?d00001