Force cluster-rebuilds on the first detected change, if their bounds do not match.

Also use a client-side method to update connected textures
for crafting cubes if two previously distinct clusters are connected.
Refactored MBCalculator to use generics for type checks and remove more casts.
This commit is contained in:
Sebastian Hartte
2020-07-19 00:16:33 +02:00
parent 7121426fc9
commit e1f9e01404
12 changed files with 178 additions and 247 deletions
@@ -43,7 +43,7 @@ import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.AENetworkProxyMultiblock;
import appeng.tile.grid.AENetworkTileEntity;
public class SpatialPylonTileEntity extends AENetworkTileEntity implements IAEMultiBlock {
public class SpatialPylonTileEntity extends AENetworkTileEntity implements IAEMultiBlock<SpatialPylonCluster> {
public static final ModelProperty<Integer> STATE = new ModelProperty<>(value -> {
// The lower 6 bits are used
@@ -88,7 +88,7 @@ public class SpatialPylonTileEntity extends AENetworkTileEntity implements IAEMu
@Override
public void onReady() {
super.onReady();
this.calc.calculateMultiblock(world, getLocation());
this.calc.calculateMultiblock(world, pos);
}
@Override
@@ -98,7 +98,7 @@ public class SpatialPylonTileEntity extends AENetworkTileEntity implements IAEMu
}
public void neighborChanged(BlockPos changedPos) {
this.calc.updateMultiblockAfterNeighborUpdate(this.world, this.getLocation(), changedPos);
this.calc.updateMultiblockAfterNeighborUpdate(this.world, pos, changedPos);
}
@Override
@@ -131,9 +131,9 @@ public class SpatialPylonTileEntity extends AENetworkTileEntity implements IAEMu
this.displayBits = 0;
if (this.cluster != null) {
if (this.cluster.getBoundsMin().equals(this.getLocation())) {
if (this.cluster.getBoundsMin().equals(this.pos)) {
this.displayBits = DISPLAY_END_MIN;
} else if (this.cluster.getBoundsMax().equals(this.getLocation())) {
} else if (this.cluster.getBoundsMax().equals(this.pos)) {
this.displayBits = DISPLAY_END_MAX;
} else {
this.displayBits = DISPLAY_MIDDLE;