Skip to content

Conversation

multiplemonomials
Copy link
Collaborator

This issue was very helpfully described by @Rishum-P here: #203 (comment)

I tried to reproduce it and I believe it's actually even easier to cause than described. You just need to have a distribution pipe with 0 values for all connected sides. Feeding items into that pipe is enough to cause an infinite loop and eventual crash (when running in singleplayer).

As I understand, this issue basically happens because toNextOpenSide() only tries all possible open sides once before giving up and returning. So if we are in a situation where no side is a valid destination for items, we will just get stuck in the while loop in splitStacks() forever and ever.

I added two different protections against this issue happening. First of all, toNextOpenSide() now returns false if it cannot find a valid side, and in this situation we just set no specific destination for the item stack. This fixes the crash, and causes buildcraft to route the item stack randomly.

However, I wanted un-routable items to be dropped on the ground, so I added a new sideCheck() event handler which disallows items from going to any side that has a distribution amount of 0. This should only have one effect, which is to cause items to be dropped at least there is at least one connected side that has a distribution amount greater than 0.

double horizontalRange = 16;
List<EntityWolf> list = world.getEntitiesWithinAABB(EntityWolf.class, new AxisAlignedBB(player.posX, player.posY, player.posZ,
player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).grow(horizontalRange, 10.0D, horizontalRange));
List<EntityWolf> list = world.getEntitiesWithinAABB(EntityWolf.class, new AxisAlignedBB(player.posX, player.posY + 1.0D, player.posZ,
Copy link
Collaborator Author

@multiplemonomials multiplemonomials Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Randomly noticed that this logic is slightly broken. If we want to create the bounding box centered on the player, then it should be initially created with size of 0 and centered on the player's coordinates.

@multiplemonomials
Copy link
Collaborator Author

Here's a build from this branch: additionalpipes-6.0.1.jar.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant