From 878a8852465d992f656d03a8f53ec6349e88b9e3 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 17 Aug 2019 15:21:28 +0200 Subject: [PATCH] Code cleanup --- src/main/java/cr0s/warpdrive/WarpDrive.java | 1 + .../block/collection/TileEntityLaserTreeFarm.java | 10 ++++++---- .../block/movement/TileEntityTransporterCore.java | 7 ++++--- src/main/java/cr0s/warpdrive/data/JumpBlock.java | 5 +++-- src/main/resources/assets/warpdrive/lang/de_de.lang | 2 +- src/main/resources/assets/warpdrive/lang/en_us.lang | 2 +- src/main/resources/assets/warpdrive/lang/fr_fr.lang | 2 +- src/main/resources/assets/warpdrive/lang/nl_nl.lang | 2 +- src/main/resources/assets/warpdrive/lang/ru_ru.lang | 2 +- src/main/resources/assets/warpdrive/lang/zh_cn.lang | 2 +- src/main/resources/assets/warpdrive/lang/zh_tw.lang | 2 +- 11 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/WarpDrive.java b/src/main/java/cr0s/warpdrive/WarpDrive.java index c1073183..fef6af06 100644 --- a/src/main/java/cr0s/warpdrive/WarpDrive.java +++ b/src/main/java/cr0s/warpdrive/WarpDrive.java @@ -904,6 +904,7 @@ public class WarpDrive { return block; } + assert !blocks.contains(block); blocks.add(block); if (itemBlock != null) { diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java index aa468d8d..0b7321ce 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java @@ -559,7 +559,9 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { harvestBlock(blockPosValuable, blockStateValuable); - tickCurrentTask = isLog ? WarpDriveConfig.TREE_FARM_HARVEST_LOG_DELAY_TICKS : enableSilktouch ? WarpDriveConfig.TREE_FARM_SILKTOUCH_LEAF_DELAY_TICKS : WarpDriveConfig.TREE_FARM_BREAK_LEAF_DELAY_TICKS; + tickCurrentTask = isLog ? WarpDriveConfig.TREE_FARM_HARVEST_LOG_DELAY_TICKS + : enableSilktouch ? WarpDriveConfig.TREE_FARM_SILKTOUCH_LEAF_DELAY_TICKS + : WarpDriveConfig.TREE_FARM_BREAK_LEAF_DELAY_TICKS; return EnumTaskResult.CONTINUE; } @@ -1038,7 +1040,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { if (!(tileEntity instanceof TileEntityLaserTreeFarm)) { if (WarpDriveConfig.LOGGING_COLLECTION) { WarpDrive.logger.error(String.format("%s Scanning aborted", - this)); + this )); } } else { @@ -1054,7 +1056,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { if (WarpDriveConfig.LOGGING_COLLECTION) { WarpDrive.logger.debug(String.format("%s Calculation started for %s", - this, stringTileEntity)); + this, stringTileEntity )); } blockPosSoils = calculate_getSoilPositions(blockAccess, axisAlignedBBSoil); @@ -1063,7 +1065,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { if (WarpDriveConfig.LOGGING_COLLECTION) { WarpDrive.logger.debug(String.format("%s Calculation done: %s soil positions, %s valuables positions", - this, blockPosSoils.size(), blockStatePosValuables.size())); + this, blockPosSoils.size(), blockStatePosValuables.size() )); } } } catch (final Exception exception) { diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterCore.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterCore.java index 21fa6f76..a3ab5905 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterCore.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporterCore.java @@ -335,9 +335,10 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon if (worldRemote == null) { WarpDrive.logger.error(String.format("Unable to initialize dimension %d for %s", globalPositionRemote.dimensionId, - this)); + this )); isJammed = true; - reasonJammed = String.format("Unable to initialize dimension %d", globalPositionRemote.dimensionId); + reasonJammed = String.format("Unable to initialize dimension %d", + globalPositionRemote.dimensionId); return; } @@ -812,7 +813,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon if (worldRemote == null) { WarpDrive.logger.error(String.format("Unable to initialize dimension %d for %s", celestialObjectRemote.dimensionId, - this)); + this )); isJammed = true; reasonJammed = String.format("Unable to initialize dimension %d", celestialObjectRemote.dimensionId); diff --git a/src/main/java/cr0s/warpdrive/data/JumpBlock.java b/src/main/java/cr0s/warpdrive/data/JumpBlock.java index f110ccba..fefe7b1e 100644 --- a/src/main/java/cr0s/warpdrive/data/JumpBlock.java +++ b/src/main/java/cr0s/warpdrive/data/JumpBlock.java @@ -136,6 +136,7 @@ public class JumpBlock { return worldSource.getTileEntity(new BlockPos(x, y, z)); } + @Nullable private NBTTagCompound getBlockNBT(@Nonnull final World worldSource) { if (weakTileEntity == null) { return blockNBT == null ? null : blockNBT.copy(); @@ -502,7 +503,7 @@ public class JumpBlock { } } - public void writeToNBT(final World worldSource, final NBTTagCompound tagCompound) { + public void writeToNBT(final World worldSource, @Nonnull final NBTTagCompound tagCompound) { tagCompound.setString("block", Block.REGISTRY.getNameForObject(block).toString()); tagCompound.setByte("blockMeta", (byte) blockMeta); final NBTTagCompound nbtTileEntity = getBlockNBT(worldSource); @@ -540,7 +541,7 @@ public class JumpBlock { tagCompound.removeTag("label"); } - // WarpDrive UUID + // WarpDrive machine signature UUID if (tagCompound.hasKey(ICoreSignature.UUID_MOST_TAG)) { tagCompound.removeTag(ICoreSignature.UUID_MOST_TAG); tagCompound.removeTag(ICoreSignature.UUID_LEAST_TAG); diff --git a/src/main/resources/assets/warpdrive/lang/de_de.lang b/src/main/resources/assets/warpdrive/lang/de_de.lang index 11450a39..c9cf8fda 100644 --- a/src/main/resources/assets/warpdrive/lang/de_de.lang +++ b/src/main/resources/assets/warpdrive/lang/de_de.lang @@ -930,7 +930,7 @@ warpdrive.ship.guide.max_chunkloading=Close the game, update config/forgeChunkLo warpdrive.ship.guide.chunkloading_rejected_in_target_world=Chunkloading rejected in target world %s. Aborting. warpdrive.ship.guide.no_celestial_object_in_hyperspace=No star system exists in %1$s (%2$d), there's nowhere to exit hyperspace! warpdrive.ship.guide.no_star_system_in_range=Ship won't survive in deep space.\nClosest star system is ~%1$d m away (%2$d %3$d %4$d) to (%5$d %6$d %7$d). -warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or configuration. +warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or misconfiguration. warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet=Unable to engage Alcubierre drive on a planet.\nGet into orbit, then try again. warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent=Current location has no hyperspace connection.\nThere's no parent defined for %1$s (%2$d). warpdrive.ship.guide.unable_to_reach_space_no_parent=Current location as no space connection.\nThere's no parent defined for %1$s (%2$d). diff --git a/src/main/resources/assets/warpdrive/lang/en_us.lang b/src/main/resources/assets/warpdrive/lang/en_us.lang index 028c09ca..61b6a355 100644 --- a/src/main/resources/assets/warpdrive/lang/en_us.lang +++ b/src/main/resources/assets/warpdrive/lang/en_us.lang @@ -930,7 +930,7 @@ warpdrive.ship.guide.max_chunkloading=Close the game, update config/forgeChunkLo warpdrive.ship.guide.chunkloading_rejected_in_target_world=Chunkloading rejected in target world %s. Aborting. warpdrive.ship.guide.no_celestial_object_in_hyperspace=No star system exists in %1$s (%2$d), there's nowhere to exit hyperspace! warpdrive.ship.guide.no_star_system_in_range=Ship won't survive in deep space.\nClosest star system is ~%1$d m away (%2$d %3$d %4$d) to (%5$d %6$d %7$d). -warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or configuration. +warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or misconfiguration. warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet=Unable to engage Alcubierre drive on a planet.\nGet into orbit, then try again. warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent=Current location has no hyperspace connection.\nThere's no parent defined for %1$s (%2$d). warpdrive.ship.guide.unable_to_reach_space_no_parent=Current location as no space connection.\nThere's no parent defined for %1$s (%2$d). diff --git a/src/main/resources/assets/warpdrive/lang/fr_fr.lang b/src/main/resources/assets/warpdrive/lang/fr_fr.lang index c914247b..be92c39f 100644 --- a/src/main/resources/assets/warpdrive/lang/fr_fr.lang +++ b/src/main/resources/assets/warpdrive/lang/fr_fr.lang @@ -930,7 +930,7 @@ warpdrive.ship.guide.max_chunkloading=Close the game, update config/forgeChunkLo warpdrive.ship.guide.chunkloading_rejected_in_target_world=Chunkloading rejected in target world %s. Aborting. warpdrive.ship.guide.no_celestial_object_in_hyperspace=No star system exists in %1$s (%2$d), there's nowhere to exit hyperspace! warpdrive.ship.guide.no_star_system_in_range=Ship won't survive in deep space.\nClosest star system is ~%1$d m away (%2$d %3$d %4$d) to (%5$d %6$d %7$d). -warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or configuration. +warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or misconfiguration. warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet=Unable to engage Alcubierre drive on a planet.\nGet into orbit, then try again. warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent=Current location has no hyperspace connection.\nThere's no parent defined for %1$s (%2$d). warpdrive.ship.guide.unable_to_reach_space_no_parent=Current location as no space connection.\nThere's no parent defined for %1$s (%2$d). diff --git a/src/main/resources/assets/warpdrive/lang/nl_nl.lang b/src/main/resources/assets/warpdrive/lang/nl_nl.lang index d525a358..ab2356ce 100644 --- a/src/main/resources/assets/warpdrive/lang/nl_nl.lang +++ b/src/main/resources/assets/warpdrive/lang/nl_nl.lang @@ -929,7 +929,7 @@ warpdrive.ship.guide.max_chunkloading=Close the game, update config/forgeChunkLo warpdrive.ship.guide.chunkloading_rejected_in_target_world=Chunkloading rejected in target world %s. Aborting. warpdrive.ship.guide.no_celestial_object_in_hyperspace=No star system exists in %1$s (%2$d), there's nowhere to exit hyperspace! warpdrive.ship.guide.no_star_system_in_range=Ship won't survive in deep space.\nClosest star system is ~%1$d m away (%2$d %3$d %4$d) to (%5$d %6$d %7$d). -warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or configuration. +warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or misconfiguration. warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet=Unable to engage Alcubierre drive on a planet.\nGet into orbit, then try again. warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent=Current location has no hyperspace connection.\nThere's no parent defined for %1$s (%2$d). warpdrive.ship.guide.unable_to_reach_space_no_parent=Current location as no space connection.\nThere's no parent defined for %1$s (%2$d). diff --git a/src/main/resources/assets/warpdrive/lang/ru_ru.lang b/src/main/resources/assets/warpdrive/lang/ru_ru.lang index 8b6ef58e..ca978a32 100644 --- a/src/main/resources/assets/warpdrive/lang/ru_ru.lang +++ b/src/main/resources/assets/warpdrive/lang/ru_ru.lang @@ -930,7 +930,7 @@ warpdrive.ship.guide.max_chunkloading=Close the game, update config/forgeChunkLo warpdrive.ship.guide.chunkloading_rejected_in_target_world=Chunkloading rejected in target world %s. Aborting. warpdrive.ship.guide.no_celestial_object_in_hyperspace=No star system exists in %1$s (%2$d), there's nowhere to exit hyperspace! warpdrive.ship.guide.no_star_system_in_range=Ship won't survive in deep space.\nClosest star system is ~%1$d m away (%2$d %3$d %4$d) to (%5$d %6$d %7$d). -warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or configuration. +warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or misconfiguration. warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet=Unable to engage Alcubierre drive on a planet.\nGet into orbit, then try again. warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent=Current location has no hyperspace connection.\nThere's no parent defined for %1$s (%2$d). warpdrive.ship.guide.unable_to_reach_space_no_parent=Current location as no space connection.\nThere's no parent defined for %1$s (%2$d). diff --git a/src/main/resources/assets/warpdrive/lang/zh_cn.lang b/src/main/resources/assets/warpdrive/lang/zh_cn.lang index 81f53a0b..ec62e1a1 100644 --- a/src/main/resources/assets/warpdrive/lang/zh_cn.lang +++ b/src/main/resources/assets/warpdrive/lang/zh_cn.lang @@ -935,7 +935,7 @@ warpdrive.ship.guide.max_chunkloading=Close the game, update config/forgeChunkLo warpdrive.ship.guide.chunkloading_rejected_in_target_world=Chunkloading rejected in target world %s. Aborting. warpdrive.ship.guide.no_celestial_object_in_hyperspace=No star system exists in %1$s (%2$d), there's nowhere to exit hyperspace! warpdrive.ship.guide.no_star_system_in_range=Ship won't survive in deep space.\nClosest star system is ~%1$d m away (%2$d %3$d %4$d) to (%5$d %6$d %7$d). -warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or configuration. +warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or misconfiguration. warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet=Unable to engage Alcubierre drive on a planet.\nGet into orbit, then try again. warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent=Current location has no hyperspace connection.\nThere's no parent defined for %1$s (%2$d). warpdrive.ship.guide.unable_to_reach_space_no_parent=Current location as no space connection.\nThere's no parent defined for %1$s (%2$d). diff --git a/src/main/resources/assets/warpdrive/lang/zh_tw.lang b/src/main/resources/assets/warpdrive/lang/zh_tw.lang index adf4e5a5..3d0788a7 100644 --- a/src/main/resources/assets/warpdrive/lang/zh_tw.lang +++ b/src/main/resources/assets/warpdrive/lang/zh_tw.lang @@ -929,7 +929,7 @@ warpdrive.ship.guide.max_chunkloading=Close the game, update config/forgeChunkLo warpdrive.ship.guide.chunkloading_rejected_in_target_world=Chunkloading rejected in target world %s. Aborting. warpdrive.ship.guide.no_celestial_object_in_hyperspace=No star system exists in %1$s (%2$d), there's nowhere to exit hyperspace! warpdrive.ship.guide.no_star_system_in_range=Ship won't survive in deep space.\nClosest star system is ~%1$d m away (%2$d %3$d %4$d) to (%5$d %6$d %7$d). -warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or configuration. +warpdrive.ship.guide.exception_loading_dimension=Unable to load dimension %1$d.\nCheck console for a missing mod or misconfiguration. warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet=Unable to engage Alcubierre drive on a planet.\nGet into orbit, then try again. warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent=Current location has no hyperspace connection.\nThere's no parent defined for %1$s (%2$d). warpdrive.ship.guide.unable_to_reach_space_no_parent=Current location as no space connection.\nThere's no parent defined for %1$s (%2$d).