ldtteam / StorageRacks

GNU General Public License v3.0
4 stars 2 forks source link

[Bug] Controller rack capacity is 1 less than advertised #14

Closed jzisser9 closed 2 years ago

jzisser9 commented 2 years ago

See screenshot:

2022-01-07_15 14 44

Raycoms commented 2 years ago

Oh no, did I do the classic < instead of <= =D

jzisser9 commented 2 years ago

Wouldn't be the first time I've done it! :)

jzisser9 commented 2 years ago

Hmm...this is where I thought the issue would be:

EventManager.java:62

if (posSet.size() > controller.getTier() * 20)

But if we consider a stone controller to be tier == 1, then this logic works. So maybe posSet.size() is the issue...

jzisser9 commented 2 years ago

Just did a little more testing in-game, and it's not just the stone controller that has this issue. All controllers support one less rack than they advertise.

I think it's because of that code snippet I shared above. My guess is that posSet.size() is including a block it shouldn't be, like maybe the controller itself.

UPDATE: And it looks like that's exactly what's happening:

TileEntityRack.java

public static BlockPos visitPositions(final World level, final Set<BlockPos> visitedPositions, final BlockPos current)
    {
        BlockPos controller = null;
        if (level.getBlockEntity(current) instanceof TileEntityController)
        {
            controller = current;
        }

        visitedPositions.add(current);