only link and synchronize laser blocks if the connecting side is enabled
@@ -89,19 +89,18 @@ public class LaserBlock extends DisguisableBlock {
else if (offsetBlock == SCContent.LASER_BLOCK.get()) {
LaserBlockBlockEntity thatBe = (LaserBlockBlockEntity) level.getBlockEntity(offsetPos);
- if (thisBe.getOwner().owns(thatBe)) {
+ if (thisBe.getOwner().owns(thatBe) && thisBe.isEnabled() && thatBe.isEnabled()) {
+ if (!thatBe.isSideEnabled(facing.getOpposite())) {
+ thisBe.setSideEnabled(facing, false);
+ return;
+ }
+
LinkableBlockEntity.link(thisBe, thatBe);
for (ModuleType type : thatBe.getInsertedModules()) {
thisBe.insertModule(thatBe.getModule(type), false);
}
- if (thisBe.isEnabled() && thatBe.isEnabled()) {
- if (!thatBe.isSideEnabled(facing.getOpposite())) {
- thisBe.setSideEnabled(facing, false);
- return;
- }
-
for (int j = 1; j < i; j++) {
offsetPos = pos.relative(facing, j);
offsetState = level.getBlockState(offsetPos);
@@ -117,7 +116,6 @@ public class LaserBlock extends DisguisableBlock {
}
}
}
- }
@Override
public void destroy(LevelAccessor level, BlockPos pos, BlockState state) {
