This commit is contained in:
Boblet 2025-10-21 16:27:50 +02:00
parent 10cf45b452
commit bbe41c02a7
7 changed files with 42 additions and 20 deletions

View File

@ -52,6 +52,7 @@
* 256k tanks now use half as much steel * 256k tanks now use half as much steel
* Gerald is now way more expensive * Gerald is now way more expensive
* PWR parts are now subject to expensive mode * PWR parts are now subject to expensive mode
* Fluid container items now keep their custom name when filling or emptying
## Fixed ## Fixed
* Fixed the T-51b set not having radiation resistance * Fixed the T-51b set not having radiation resistance
@ -62,3 +63,5 @@
* Fixed mining lasers targeting blocks with the "gas" material * Fixed mining lasers targeting blocks with the "gas" material
* Fixed gun looping sounds behaving weird when moving while firing * 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 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

View File

@ -60,7 +60,14 @@ public class CoriumFinite extends GenericFiniteFluid {
@Override @Override
public void updateTick(World world, int x, int y, int z, Random rand) { public void updateTick(World world, int x, int y, int z, Random 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); 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) { if(!world.isRemote && rand.nextInt(10) == 0 && world.getBlock(x, y - 1, z) != this) {

View File

@ -118,10 +118,9 @@ public class FluidContainerRegistry {
return null; return null;
for(FluidContainer container : getContainers(type)) { 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 container;
} }
}
return null; return null;
} }
@ -138,7 +137,7 @@ public class FluidContainerRegistry {
return 0; return 0;
for(FluidContainer container : containerMap.get(type)) { 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; return container.content;
} }
@ -152,7 +151,7 @@ public class FluidContainerRegistry {
sta.stackSize = 1; sta.stackSize = 1;
for(FluidContainer container : allContainers) { for(FluidContainer container : allContainers) {
if(ItemStack.areItemStacksEqual(container.fullContainer, sta) && ItemStack.areItemStackTagsEqual(container.fullContainer, sta)) if(container.fullContainer.isItemEqual(sta))
return container.type; return container.type;
} }
@ -168,7 +167,7 @@ public class FluidContainerRegistry {
if(!containerMap.containsKey(type)) return null; if(!containerMap.containsKey(type)) return null;
for(FluidContainer container : containerMap.get(type)) { 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(); return container.fullContainer.copy();
} }
@ -182,7 +181,7 @@ public class FluidContainerRegistry {
sta.stackSize = 1; sta.stackSize = 1;
for(FluidContainer container : allContainers) { 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(); return container.emptyContainer == null ? null : container.emptyContainer.copy();
} }

View File

@ -18,6 +18,8 @@ public class FluidLoaderStandard extends FluidLoadingHandler {
if(full != null && slots[in] != null && tank.getFill() - FluidContainerRegistry.getFluidContent(full, type) >= 0) { 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) { if(slots[out] == null) {
tank.setFill(tank.getFill() - FluidContainerRegistry.getFluidContent(full, type)); tank.setFill(tank.getFill() - FluidContainerRegistry.getFluidContent(full, type));
@ -27,6 +29,8 @@ public class FluidLoaderStandard extends FluidLoadingHandler {
slots[in] = null; 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()) { } 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)); tank.setFill(tank.getFill() - FluidContainerRegistry.getFluidContent(full, type));
@ -36,6 +40,8 @@ public class FluidLoaderStandard extends FluidLoadingHandler {
slots[in] = null; slots[in] = null;
} }
slots[out].stackSize++; 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]); ItemStack emptyContainer = FluidContainerRegistry.getEmptyContainer(slots[in]);
String name = slots[in].hasDisplayName() ? slots[in].getDisplayName() : null;
if(slots[out] == null) { if(slots[out] == null) {
tank.setFill(tank.getFill() + amount); tank.setFill(tank.getFill() + amount);
slots[out] = emptyContainer; slots[out] = emptyContainer;
if(emptyContainer != null) {
if(name != null) slots[out].setStackDisplayName(name);
}
slots[in].stackSize--; slots[in].stackSize--;
if(slots[in].stackSize <= 0) { if(slots[in].stackSize <= 0) {
slots[in] = null; slots[in] = null;
@ -76,6 +88,7 @@ public class FluidLoaderStandard extends FluidLoadingHandler {
if(emptyContainer != null) { if(emptyContainer != null) {
slots[out].stackSize++; slots[out].stackSize++;
if(name != null) slots[out].setStackDisplayName(name);
} }
} }

View File

@ -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) { 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); 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); this.networkPackNT(15);

View File

@ -13,7 +13,7 @@ import com.hbm.tileentity.network.TileEntityPneumoTube;
import com.hbm.uninos.NodeNet; import com.hbm.uninos.NodeNet;
import com.hbm.util.BobMathUtil; import com.hbm.util.BobMathUtil;
import com.hbm.util.ItemStackUtil; 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.IInventory;
import net.minecraft.inventory.ISidedInventory; 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), // 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. // it can actually handle non-TileEntities just fine.
public HashMap<IInventory, Pair<ForgeDirection, Long>> receivers = new HashMap(); public HashMap<IInventory, Triplet<ForgeDirection, Long, TileEntityPneumoTube>> receivers = new HashMap();
public void addReceiver(IInventory inventory, ForgeDirection pipeDir) { public void addReceiver(IInventory inventory, ForgeDirection pipeDir, TileEntityPneumoTube endpoint) {
receivers.put(inventory, new Pair(pipeDir, System.currentTimeMillis())); receivers.put(inventory, new Triplet(pipeDir, System.currentTimeMillis(), endpoint));
} }
@Override public void update() { @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, // technically not necessary since that step is taken during the send operation,
// but we still want to reap garbage data that would otherwise accumulate // but we still want to reap garbage data that would otherwise accumulate
long timestamp = System.currentTimeMillis(); 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) { 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 // 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. // so we just run it again here, just to be sure.
long timestamp = System.currentTimeMillis(); 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; 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 // for round robin, receivers are ordered by proximity to the source
ReceiverComparator comparator = new ReceiverComparator(tube); ReceiverComparator comparator = new ReceiverComparator(tube);
List<Entry<IInventory, Pair<ForgeDirection, Long>>> receiverList = new ArrayList(receivers.size()); List<Entry<IInventory, Triplet<ForgeDirection, Long, TileEntityPneumoTube>>> receiverList = new ArrayList(receivers.size());
receiverList.addAll(receivers.entrySet()); receiverList.addAll(receivers.entrySet());
receiverList.sort(comparator); receiverList.sort(comparator);
int index = nextReceiver % receivers.size(); int index = nextReceiver % receivers.size();
Entry<IInventory, Pair<ForgeDirection, Long>> chosenReceiverEntry = null; Entry<IInventory, Triplet<ForgeDirection, Long, TileEntityPneumoTube>> chosenReceiverEntry = null;
nextReceiver++; nextReceiver++;
if(receiveOrder == RECEIVE_ROBIN) chosenReceiverEntry = receiverList.get(index); 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[] destSlotAccess = getSlotAccess(dest, destSide);
int itemsLeftToSend = ITEMS_PER_TRANSFER; // not actually individual items, but rather the total "mass", based on max stack size 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; 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. */ /** 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<Entry<IInventory, Pair<ForgeDirection, Long>>> { public static class ReceiverComparator implements Comparator<Entry<IInventory, Triplet<ForgeDirection, Long, TileEntityPneumoTube>>> {
private TileEntityPneumoTube origin; private TileEntityPneumoTube origin;
@ -190,7 +190,7 @@ public class PneumaticNetwork extends NodeNet {
} }
@Override @Override
public int compare(Entry<IInventory, Pair<ForgeDirection, Long>> o1, Entry<IInventory, Pair<ForgeDirection, Long>> o2) { public int compare(Entry<IInventory, Triplet<ForgeDirection, Long, TileEntityPneumoTube>> o1, Entry<IInventory, Triplet<ForgeDirection, Long, TileEntityPneumoTube>> o2) {
TileEntity tile1 = o1.getKey() instanceof TileEntity ? (TileEntity) o1.getKey() : null; TileEntity tile1 = o1.getKey() instanceof TileEntity ? (TileEntity) o1.getKey() : null;
TileEntity tile2 = o2.getKey() instanceof TileEntity ? (TileEntity) o2.getKey() : null; TileEntity tile2 = o2.getKey() instanceof TileEntity ? (TileEntity) o2.getKey() : null;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB