small further cleanup in InventoryScannerFieldBlock
@@ -217,12 +217,19 @@ public class InventoryScannerFieldBlock extends OwnableBlock {
private static void updateInventoryScannerPower(InventoryScannerBlockEntity be)
{
- if(!be.shouldProvidePower())
- be.setShouldProvidePower(true);
+ InventoryScannerBlockEntity connectedScanner = InventoryScannerBlock.getConnectedInventoryScanner(be.getLevel(), be.getBlockPos());
+
+ if(connectedScanner == null)
+ return;
+ updateInvScanner(be);
+ updateInvScanner(connectedScanner);
+ }
+
+ private static void updateInvScanner(InventoryScannerBlockEntity be) {
+ be.setShouldProvidePower(true);
be.setCooldown(60);
- checkAndUpdateBEAppropriately(be);
- BlockUtils.updateAndNotify(be.getLevel(), be.getBlockPos(), be.getLevel().getBlockState(be.getBlockPos()).getBlock(), 1, true);
+ BlockUtils.updateAndNotify(be.getLevel(), be.getBlockPos(), be.getBlockState().getBlock(), 1, true);
BlockUtils.updateIndirectNeighbors(be.getLevel(), be.getBlockPos(), SCContent.INVENTORY_SCANNER.get());
}
@@ -239,24 +246,6 @@ public class InventoryScannerFieldBlock extends OwnableBlock {
return ItemStack.matches(s1, s2);
}
- private static void checkAndUpdateBEAppropriately(InventoryScannerBlockEntity be)
- {
- InventoryScannerBlockEntity connectedScanner = InventoryScannerBlock.getConnectedInventoryScanner(be.getLevel(), be.getBlockPos());
-
- if(connectedScanner == null)
- return;
-
- updateInvScanner(be);
- updateInvScanner(connectedScanner);
- }
-
- private static void updateInvScanner(InventoryScannerBlockEntity be) {
- be.setShouldProvidePower(true);
- be.setCooldown(60);
- BlockUtils.updateAndNotify(be.getLevel(), be.getBlockPos(), be.getBlockState().getBlock(), 1, true);
- BlockUtils.updateIndirectNeighbors(be.getLevel(), be.getBlockPos(), SCContent.INVENTORY_SCANNER.get());
- }
-
@Override
public void destroy(LevelAccessor level, BlockPos pos, BlockState state)
{
