Storage Drawers

Storage Drawers

151M Downloads

[1.12] Compacting Drawers and Compressed Blocks (with fix)

cenneunborifisms opened this issue ยท 4 comments

commented

I think you may be calculating what items go in the compacting drawer wrong. In

/src/com/jaquadro/minecraft/storagedrawers/block/tile/tiledata/FractionalDrawerGroup.java

in

private void populateSlots (@Nonnull ItemStack itemPrototype)

on lines 442 - 467 you have

            Stack<CompactingHelper.Result> resultStack = new Stack<>();

            @Nonnull ItemStack lookupTarget = itemPrototype;
            for (int i = 0; i < slotCount; i++) {
                CompactingHelper.Result lookup = compacting.findHigherTier(lookupTarget);
                if (lookup.getStack().isEmpty())
                    break;

                resultStack.push(lookup);
                lookupTarget = lookup.getStack();
            }

            int index = 0;
            for (int n = resultStack.size(); index < n; index++) {
                CompactingHelper.Result result = resultStack.pop();
                populateRawSlot(index, result.getStack(), result.getSize());
                group.log("Picked candidate " + result.getStack().toString() + " with conv=" + result.getSize());

                for (int i = 0; i < index; i++)
                    convRate[i] *= result.getSize();
            }

            if (index == slotCount)
                return;

            populateRawSlot(index++, itemPrototype, 1);

I think the range for the first for loop is wrong? It should be one less? Because you go to slotCount, so for compressed blocks with many levels of compression you never get the original item in the lowest slot.

Lets say I place stone that has 4 levels of compressions. The items in the resultStack are 1x, 2x and 3x. But because there are 3 items in the resultStack, in the second loop the index goes to slotCount, so after the loop index == slotCount, and so populateRawSlot doesn't get called with itemPrototype.

I think you need to change (and I've done this for myself and it solved the problem for me locally)

445 for (int i = 0; i < slotCount; i++)

to

445 for (int i = 1; i < slotCount; i++)

commented

Yes, I tried to make a cobblestone compacting drawer and it made a drawer that had compressed, double compressed and triple compressed cobblestone.

commented

if you try to put cobble into a compacting drawer via the hopper, it puts 1 Triple Compressed Cobblestone

commented

This is pretty serious as, if you use a hopper to insert the items, you can get to octuple compressed cobblestone in a matter of seconds. I am running the live version (5.2.9) and I can use this to dupe large amounts of octuple compressed cobble from basic cobblestone quickly. Hope this gets some attention, good job looking through things @Sediments .

commented

Thanks for the analysis. I had only ever done testing with 2- and 3-tier items so I missed it. It's fixed in 5.3.0.