Pipelines
ArturilloD opened this issue · 35 comments
It is a title-entity already:
Is there a specific mod you want me to test it with, searched for "Pipelines" but didn't found one.
Ah, my code that prevent hoppers to mess with the inventory, stops the pippeps from using the inventory.
Senario:
- The hopper wants to send an item
- Hopper checks if its pointing to a tile-entity, if not abort.
- Hopper checks if its an inventory with CapabilityItemHandler.ITEM_HANDLER_CAPABILITY
- if so, try to put the item in each slot in the inventory, done
- if not, check if the inventory is a ISidedInventory
- if so, ask what slots are avaible from the connected side
- try to put the item in each avaible slot.
To prevent the hopper from puting/pulling item from the wrong slots, I answered that it dosn't have ITEM_HANDLER_CAPABILITY.
Pipes check for ITEM_HANDLER_CAPABILITY when it checks if it can connect.
AbstractFurnaceTileEntity using a SidedInvWrapper to solve the same problem,
but by answering that it has ITEM_HANDLER_CAPABILITY, and then act as a filter,
if a tile entity have 3 slots (nr 0, 1 & 2), and only nr 2 is avaible from the bottom,
when accessing the tile entity throght SidedInvWrapper, getSlots() returns 1 insted of 3, and insertItem(0, ...) converts to insertItem(2, ...) and so on.
See row 177-182 in PipeBlock.java
https://github.com/Ellpeck/PrettyPipes/blob/294559ca614fdf2851d0277d6fbb130859f9684a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java#L177-L182
And see row 334-339 in FactoryEntity.java
mc-factory/src/main/java/se/puggan/factory/container/FactoryEntity.java
Lines 334 to 339 in 0ac8b46
I'll play around with 2 mods you sugested, this weekend, and see if I can figure out whats happening.
As you seams to be intrested, Il try to decribing my findings in more details then usal :-)
v1.2.0 solves the connection issue,
It fills the stacks up in a odd way, the chosen receipt was a stone pickaxes, so it has 3 slots for stone.
When it started to fill it up I saw the following step of stones slots: [64, 0, 0] -> [64, 1, 0] -> [64, 64, 0] -> [64, 64, 1].
I'l see what I can do with that for version 1.2.1, but first I want to release the v1.2.0 version for all mc-versions i support.
But I keep this Issue open as it's not completely solved yet.
Oh, now I see 3 part of the problem:
- The pipes didn't connect
- An uneven fill, can make it produce less items, as there can be enough materials, but in the wrong slots.
- For extracting items, it would be nice if the direction is ignored.
The soulotion for "1. The pipes didn't connect"
was replace this code I found somewhare:
mc-factory/src/main/java/se/puggan/factory/container/FactoryEntity.java
Lines 334 to 339 in 0ac8b46
with the code at row 487-501 in AbstractFurnaceTileEntity.java
mc-factory/src/main/java/se/puggan/factory/container/FactoryEntity.java
Lines 340 to 353 in 9210a26
Had some time to test the current version, and some ides how to improve it, but not enough time to write the code yet.
On my mind right now:
-
For an item that just use one type of material like 9 coal -> 1 coal block, the hoppers fill up the item-slots in a way that is efficient, but pipes send more then one at the time, so it fills them up in the same order, but with larger amount, therefor unbalanced.
-
For an item that have more then one material like 1 stone + 2 stick -> 1 shovel, the hopper can't add sticks if there is no stone, I think that it checks the first slot, notice it's empty, ask if it can put the stick there, when the answer is no, it gives up.
-
When trying to make the next item, If any of the required slot is empty, insted of aborting, I could add "balance material"-step, that spread out the material. This whould also solve the problem that accure when manual loading the slots. For exemple if you have the shovel recipt acitve, and put one stack of stone and one stack of sticks, instead of just aborting, it automaticly moves half the stack of stick to the last slot.
-
When an hopper (or pipe) ask what slots that it can insert items in, maybe I should lie, and maybe just say that it has one empty slot, and when it ask if it could add stone or stick to that slot (in the case of the shovel) I can answer yes on both, on when the item is inserted, I move it to the right slot.
That was a bug on my side.
- The pipes didn't connect
- An uneven fill, can make it produce less items, as there can be enough materials, but in the wrong slots.
- For extracting items, it would be nice if the direction is ignored.
I think all 3 issues above, now is solved in v.1.3.1, Please test it:
https://www.curseforge.com/minecraft/mc-mods/workbench-factory/files/3045386
v1.3.0 implement the auto-rebalance, but now there is a new bug with the pipelines, items get lost :-(.