Code cleanup

This commit is contained in:
LemADEC 2022-01-15 12:17:05 +01:00
parent d0a1f2c2c8
commit 087ba26932
5 changed files with 8 additions and 9 deletions

View file

@ -211,8 +211,7 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
} }
@Override @Override
public void breakBlock(final World world, @Nonnull final BlockPos blockPos, @Nonnull final IBlockState blockState) { public void breakBlock(@Nonnull final World world, @Nonnull final BlockPos blockPos, @Nonnull final IBlockState blockState) {
assert world != null;
// cascade to tile entity before it's removed // cascade to tile entity before it's removed
final TileEntity tileEntity = world.getTileEntity(blockPos); final TileEntity tileEntity = world.getTileEntity(blockPos);
if (tileEntity instanceof TileEntityAbstractBase) { if (tileEntity instanceof TileEntityAbstractBase) {

View file

@ -73,7 +73,8 @@ public class CompatWarpDrive implements IBlockTransformer {
@Override @Override
public void removeExternals(final World world, final int x, final int y, final int z, public void removeExternals(final World world, final int x, final int y, final int z,
final Block block, final int blockMeta, final TileEntity tileEntity) { final Block block, final int blockMeta, final TileEntity tileEntity) {
if (block instanceof BlockAirFlow || block instanceof BlockAirSource) { if ( block instanceof BlockAirFlow
|| block instanceof BlockAirSource ) {
final ChunkData chunkData = ChunkHandler.getChunkData(world, x, y, z); final ChunkData chunkData = ChunkHandler.getChunkData(world, x, y, z);
if (chunkData == null) { if (chunkData == null) {
// chunk isn't loaded, skip it // chunk isn't loaded, skip it

View file

@ -419,8 +419,7 @@ public class GlobalRegionManager {
} }
public static void printRegistry(final String trigger) { public static void printRegistry(final String trigger) {
WarpDrive.logger.info(String.format("Global region registry (%s entries after %s):", WarpDrive.logger.info(String.format("Global region registry after %s:", trigger));
registry.size(), trigger));
for (final Map.Entry<Integer, CopyOnWriteArraySet<GlobalRegion>> entryDimension : registry.entrySet()) { for (final Map.Entry<Integer, CopyOnWriteArraySet<GlobalRegion>> entryDimension : registry.entrySet()) {
final StringBuilder message = new StringBuilder(); final StringBuilder message = new StringBuilder();
@ -431,7 +430,7 @@ public class GlobalRegionManager {
registryItem.isolationRate)); registryItem.isolationRate));
} }
WarpDrive.logger.info(String.format("- %d entries in dimension %d: %s", WarpDrive.logger.info(String.format("- %d entries in dimension %d: %s",
entryDimension.getValue().size(), entryDimension.getKey(), message.toString())); entryDimension.getValue().size(), entryDimension.getKey(), message ));
} }
} }

View file

@ -1320,7 +1320,7 @@ public class JumpSequencer extends AbstractSequencer {
} }
} }
final BlockPos target = transformation.apply(jumpBlock.x, jumpBlock.y, jumpBlock.z); final BlockPos target = transformation.apply(jumpBlock.x, jumpBlock.y, jumpBlock.z);
JumpBlock.refreshBlockStateOnClient(worldTarget, target); JumpBlock.refreshBlockStateOnClient(worldTarget, target);
actualIndexInShip++; actualIndexInShip++;

View file

@ -172,8 +172,8 @@ public class PlayerHandler {
final TileEntity tileEntity = entityPlayer.world.getTileEntity(globalRegion.getBlockPos()); final TileEntity tileEntity = entityPlayer.world.getTileEntity(globalRegion.getBlockPos());
if (!(tileEntity instanceof TileEntityShipCore)) { if (!(tileEntity instanceof TileEntityShipCore)) {
if (Commons.throttleMe("onBreakSpeed-InvalidInstance")) { if (Commons.throttleMe("onBreakSpeed-InvalidInstance")) {
WarpDrive.logger.error(String.format("Unable to adjust harvest speed due to invalid tile entity for global region, expecting TileEntityShipCore, got %s", WarpDrive.logger.error(String.format("Unable to adjust harvest speed due to invalid tile entity for global region, expecting TileEntityShipCore, got %s %s. size is %d.",
tileEntity )); tileEntity, Commons.format(entityPlayer.world, globalRegion.getBlockPos()), globalRegions.size() ));
} }
return false; return false;
} }