Filter redundancy

- Brass tunnels now distribute across matching filtered outputs exclusively before sending items to unfiltered sides
- Less chute logic on render thread pls
This commit is contained in:
simibubi 2020-11-27 18:26:17 +01:00
parent b24648b431
commit a49aad24c2
2 changed files with 36 additions and 13 deletions

View file

@ -138,9 +138,12 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
if (stackToDistribute.isEmpty())
return;
for (boolean filterPass : Iterate.trueAndFalse) {
for (Pair<BrassTunnelTileEntity, Direction> pair : validOutputs) {
BrassTunnelTileEntity tunnel = pair.getKey();
Direction output = pair.getValue();
if (filterPass && tunnel.flapFilterEmpty(output))
continue;
if (insertIntoTunnel(tunnel, output, stackToDistribute, true) == null)
continue;
distributionTargets.add(Pair.of(tunnel.pos, output));
@ -151,6 +154,10 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
distributionDistanceRight = Math.max(distributionDistanceRight, distance);
}
if (!distributionTargets.isEmpty() && filterPass)
break;
}
if (distributionTargets.isEmpty())
return;
@ -317,6 +324,21 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
return filtering.test(side, stack);
}
public boolean flapFilterEmpty(Direction side) {
if (filtering == null)
return false;
if (filtering.get(side) == null) {
FilteringBehaviour adjacentFilter =
TileEntityBehaviour.get(world, pos.offset(side), FilteringBehaviour.TYPE);
if (adjacentFilter == null)
return true;
return adjacentFilter.getFilter()
.isEmpty();
}
return filtering.getFilter(side)
.isEmpty();
}
@Override
public void initialize() {
if (filtering == null) {

View file

@ -134,6 +134,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
public void tick() {
super.tick();
if (!world.isRemote)
canPickUpItems = canDirectlyInsert();
float itemMotion = getItemMotion();