Pipes

From Horizon's End Wiki

Pipes are a method of quickly moving items between containers. All pipe networks will have 4 main components: an input container, an extractor (crafting table), a length of pipes (Glass or stained glass), and an output container.

Basics[edit | edit source]

A basic pipe setup. Items will move from the furnace to the chest and from the barrel to the dropper.

When an extractor and pipes are connected to a container, it will try to take items out of that container and move them down the pipe to another container. Items will not move from one colored pipe to a differently colored one.

Containers can be almost anything that holds items; this includes chests, barrels, droppers, dispensers, furnaces, and even decorated pots - but not hoppers.

When a pipe extracts items from a furnace, it extracts from the furnace output. When a pipe leads into a furnace, it will try to place items into both the bottom and top slots, but will only place items you can normally place into furnaces into them.

Pipe transfer is instant - the server moves as much as it possibly can from the input to the output in a single moment. It is impossible for you to lose an item in the middle of it going through a pipe.

Filtering[edit | edit source]

Hoppers act as filters in a pipe network. A hopper will behave similarly to a pipe, taking in items from adjacent pipes, except that only items that are in the hopper will flow through it, and they will always flow the way the spout of the hopper is pointing.

A pipe network with filters.

Pipes do not put items into hoppers, nor do they take items out of hoppers - the hopper acts strictly as a filter.

Hoppers can filter custom items - for example, ores like chetherite. They can also filter items that would not normally stack, such as swords or boats.

The more advanced version of a hopper is a Splitter, which can handle far more items. This is particularly useful for when one wants to filter junk out of their pipe network and into an Incinerator.

Pathfinding[edit | edit source]

A very important detail for pipes is pathfinding. When the server is deciding where items should go in a pipe, and it comes to a crossroads where items could flow either way, it chooses one of those paths at random. This means that if your pipe system has lots of places where the glass splits and goes 2 different ways, your pipes will slow down a lot.

BAD GOOD
In this pipe system, items that enter from the leftmost chest hit a junction multiple times going down the pipe. If the pathfinding chooses to turn right instead of going straight at any of these points, the items will run into a dead end and have nowhere to go. With 5 junctions, this means pathfinding only succeeds 1/32 times. (Items transfer 32x slower) In this pipe system, the junctions are gone, and items will move through much faster. For every chest other than the leftmost, there is a 50% chance the pathfinding will turn left instead of right and hit a dead end, but these pipes will still be quite fast.

With the above example, the slowdown is small - it only takes a few seconds to work properly. However, every dead-end between the input and output doubles the time needed, and in large pipe networks, it quickly becomes way too slow. Thankfully, there are a few ways we can resolve ambiguity in our pipe systems.

Grindstones[edit | edit source]

This pipe system has 0 ambiguous junctions; pathfinding will always succeed.

Grindstones act like pipes, but will always transmit items in the way they are facing. Grindstones are the easiest and most popular method for resolving ambiguous junctions in pipes.

Panes[edit | edit source]

Panes accept and give items to glass of the same color, and also work as pipes - however, they don't work the exact same. When items flowing through a pane reach a junction, they will always try to keep moving straight first before turning. This can be very useful when you want items to move a certain way, but be careful! If your pane pipes are made poorly, they might end up never extracting correctly.

GOOD BAD
This system will be just as efficient as the earlier "good" piping example. None of the junctions will interrupt pathfinding because the panes will always move items in a straight direction if they can. When pathfinding reaches the intersection at the end, it will always attempt to move the items straight, and never turn left to go to the top chest. This means that the top chest will never receive any items.
Each hopper along this zig-zag will be checked, and only items that match none of the filters will make it through to the end of the pipe.

Panes can be good for performing proper junk filtering without a Splitter. Namely, if a pane checks a hopper and sees that it does not match the items being moved, pathfinding will not terminate. This allows us to ensure that all desired items are filtered and the trash goes to the Incinerator without needing specific filters for the trash.

Seen to the right is such a system. For each zig-zag, the pane will attempt to move items in the same way items entered that pane, resulting in the hopper being checked. If the item does not match that hopper, it will continue down the system. This ensures that we always filter out what we want from this system - if we did not force the system to check each hopper, valuable items might not pathfind to the filters, and could instead get funneled into our incinerator.