mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 23:47:38 +01:00
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:
parent
b24648b431
commit
a49aad24c2
2 changed files with 36 additions and 13 deletions
|
@ -132,23 +132,30 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
|
|||
if (allFull || allEmpty)
|
||||
syncSet.forEach(te -> te.syncedOutputActive = notifySyncedOut);
|
||||
}
|
||||
|
||||
|
||||
if (validOutputs == null)
|
||||
return;
|
||||
if (stackToDistribute.isEmpty())
|
||||
return;
|
||||
|
||||
for (Pair<BrassTunnelTileEntity, Direction> pair : validOutputs) {
|
||||
BrassTunnelTileEntity tunnel = pair.getKey();
|
||||
Direction output = pair.getValue();
|
||||
if (insertIntoTunnel(tunnel, output, stackToDistribute, true) == null)
|
||||
continue;
|
||||
distributionTargets.add(Pair.of(tunnel.pos, output));
|
||||
int distance = tunnel.pos.getX() + tunnel.pos.getZ() - pos.getX() - pos.getZ();
|
||||
if (distance < 0)
|
||||
distributionDistanceLeft = Math.max(distributionDistanceLeft, -distance);
|
||||
else
|
||||
distributionDistanceRight = Math.max(distributionDistanceRight, distance);
|
||||
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));
|
||||
int distance = tunnel.pos.getX() + tunnel.pos.getZ() - pos.getX() - pos.getZ();
|
||||
if (distance < 0)
|
||||
distributionDistanceLeft = Math.max(distributionDistanceLeft, -distance);
|
||||
else
|
||||
distributionDistanceRight = Math.max(distributionDistanceRight, distance);
|
||||
}
|
||||
|
||||
if (!distributionTargets.isEmpty() && filterPass)
|
||||
break;
|
||||
}
|
||||
|
||||
if (distributionTargets.isEmpty())
|
||||
|
@ -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) {
|
||||
|
|
|
@ -134,7 +134,8 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
canPickUpItems = canDirectlyInsert();
|
||||
if (!world.isRemote)
|
||||
canPickUpItems = canDirectlyInsert();
|
||||
|
||||
float itemMotion = getItemMotion();
|
||||
if (itemMotion != 0 && world != null && world.isRemote)
|
||||
|
|
Loading…
Reference in a new issue