diff --git a/src/main/java/cr0s/warpdrive/block/BlockAbstractContainer.java b/src/main/java/cr0s/warpdrive/block/BlockAbstractContainer.java index 64486b2a..3ed04c0c 100644 --- a/src/main/java/cr0s/warpdrive/block/BlockAbstractContainer.java +++ b/src/main/java/cr0s/warpdrive/block/BlockAbstractContainer.java @@ -212,11 +212,7 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I WarpDrive.logger.error(String.format("Bad multithreading detected from mod %s %s, please report to mod author", registryName == null ? blockNeighbor : registryName.getNamespace(), Commons.format(blockAccess, blockPosNeighbor) )); - try { - throw new ConcurrentModificationException(); - } catch (final Exception exception) { - exception.printStackTrace(); - } + new ConcurrentModificationException().printStackTrace(); } return; } diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java index 19223de8..0af6f47a 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java @@ -308,7 +308,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergyConsumer { final int energyRequired_new; int volume_new = 0; final MutableBlockPos mutableBlockPos = new MutableBlockPos(pos); - if (!isFullyTransparent) {// partial transparency = gaz and air blocks don't count + if (!isFullyTransparent) {// partial transparency = gas and air blocks don't count for (y = minY; y <= maxY; y++) { for (x = minX; x <= maxX; x++) { for (z = minZ; z <= maxZ; z++) { diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceField.java index e64b1440..55775bcd 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/BlockForceField.java @@ -93,8 +93,8 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR @Nonnull @Override public MapColor getMapColor(final IBlockState blockState, final IBlockAccess blockAccess, final BlockPos blockPos) { - IExtendedBlockState blockStateExtended = (IExtendedBlockState) getExtendedState(blockState, blockAccess, blockPos); - IBlockState blockStateCamouflage = blockStateExtended.getValue(BlockProperties.CAMOUFLAGE); + final IExtendedBlockState blockStateExtended = (IExtendedBlockState) getExtendedState(blockState, blockAccess, blockPos); + final IBlockState blockStateCamouflage = blockStateExtended.getValue(BlockProperties.CAMOUFLAGE); if (blockStateCamouflage != Blocks.AIR) { try { return blockStateCamouflage.getMapColor(blockAccess, blockPos); @@ -336,7 +336,7 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR if (enumTier.getIndex() > 1) { final TileEntityForceFieldProjector tileEntityForceFieldProjector = getProjector(world, blockPos); final IBlockState blockState = world.getBlockState(blockPos); - final int frequency = blockState.getValue(FREQUENCY); + final int frequency = blockState.getBlock() == this ? blockState.getValue(FREQUENCY) : 0; world.setBlockState(blockPos, WarpDrive.blockForceFields[enumTier.getIndex() - 1].getDefaultState().withProperty(FREQUENCY, (frequency + 1) % 16), 2); if (tileEntityForceFieldProjector != null) { final TileEntity tileEntity = world.getTileEntity(blockPos); diff --git a/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java b/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java index 55a72d33..688135ff 100644 --- a/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java +++ b/src/main/java/cr0s/warpdrive/config/WarpDriveConfig.java @@ -987,7 +987,7 @@ public class WarpDriveConfig { LASER_CANNON_BOOSTER_BEAM_ENERGY_EFFICIENCY = Commons.clamp(0.01D, 10.0D, config.get("laser_cannon", "booster_beam_energy_efficiency", LASER_CANNON_BOOSTER_BEAM_ENERGY_EFFICIENCY, "Energy factor applied from boosting to main laser").getDouble(0.6D)); LASER_CANNON_ENERGY_ATTENUATION_PER_AIR_BLOCK = Commons.clamp(0.0D, 0.1D, - config.get("laser_cannon", "energy_attenuation_per_air_block", LASER_CANNON_ENERGY_ATTENUATION_PER_AIR_BLOCK, "Energy attenuation when going through air blocks (on a planet or any gaz in space)").getDouble()); + config.get("laser_cannon", "energy_attenuation_per_air_block", LASER_CANNON_ENERGY_ATTENUATION_PER_AIR_BLOCK, "Energy attenuation when going through air blocks (on a planet or any gas in space)").getDouble()); LASER_CANNON_ENERGY_ATTENUATION_PER_VOID_BLOCK = Commons.clamp(0.0D, 0.1D, config.get("laser_cannon", "energy_attenuation_per_air_block", LASER_CANNON_ENERGY_ATTENUATION_PER_VOID_BLOCK, "Energy attenuation when going through void blocks (in space or hyperspace)").getDouble()); LASER_CANNON_ENERGY_ATTENUATION_PER_BROKEN_BLOCK = Commons.clamp(0.0D, 1.0D, diff --git a/src/main/java/cr0s/warpdrive/config/structures/AsteroidFieldInstance.java b/src/main/java/cr0s/warpdrive/config/structures/AsteroidFieldInstance.java index 4913a526..642d197f 100644 --- a/src/main/java/cr0s/warpdrive/config/structures/AsteroidFieldInstance.java +++ b/src/main/java/cr0s/warpdrive/config/structures/AsteroidFieldInstance.java @@ -46,13 +46,13 @@ public class AsteroidFieldInstance extends AbstractStructureInstance { @Override public boolean generate(@Nonnull final World world, @Nonnull final Random random, @Nonnull final BlockPos blockPos) { LocalProfiler.start("AsteroidFieldInstance.generate"); - // 6.0.1 au = 120 radius with 60 to 140 big + 60 to 140 small + 5 to 13 gaz + // 6.0.1 au = 120 radius with 60 to 140 big + 60 to 140 small + 5 to 13 gas // 45238 blocks surface with 120 to 280 asteroids => 161 to 376 blocks per asteroid (big & small) - // 6.0.2 av big = 80 to 180 radius with 40 to 90 big + 80 to 200 small + 5 to 13 gaz + // 6.0.2 av big = 80 to 180 radius with 40 to 90 big + 80 to 200 small + 5 to 13 gas // 20106 to 101787 surface with 120 to 290 asteroids => 69 to 848 blocks per asteroid - // 6.0.2 av small = 30 to 80 radius with 2 to 22 big + 15 to 75 small + 0 to 3 gaz + // 6.0.2 av small = 30 to 80 radius with 2 to 22 big + 15 to 75 small + 0 to 3 gas // 2827 to 20106 surface with 17 to 97 asteroids => 29 to 1182 blocks per asteroid // random distanced one = 89727 surface 256 asteroids => 350 blocks per asteroid diff --git a/src/main/java/cr0s/warpdrive/event/TooltipHandler.java b/src/main/java/cr0s/warpdrive/event/TooltipHandler.java index 3eea7673..55645136 100644 --- a/src/main/java/cr0s/warpdrive/event/TooltipHandler.java +++ b/src/main/java/cr0s/warpdrive/event/TooltipHandler.java @@ -251,9 +251,9 @@ public class TooltipHandler { final Fluid fluid = FluidRegistry.lookupFluidForBlock(block); if (fluid != null) { if (fluid.isGaseous()) { - Commons.addTooltip(event.getToolTip(), String.format("Gaz viscosity is %d", + Commons.addTooltip(event.getToolTip(), String.format("Gas viscosity is %d", fluid.getViscosity())); - Commons.addTooltip(event.getToolTip(), String.format("Gaz density is %d", + Commons.addTooltip(event.getToolTip(), String.format("Gas density is %d", fluid.getDensity())); } else { Commons.addTooltip(event.getToolTip(), String.format("Liquid viscosity is %d", diff --git a/src/main/java/cr0s/warpdrive/render/MyCustomModelLoader.java b/src/main/java/cr0s/warpdrive/render/MyCustomModelLoader.java index a80fccb1..a865d47b 100644 --- a/src/main/java/cr0s/warpdrive/render/MyCustomModelLoader.java +++ b/src/main/java/cr0s/warpdrive/render/MyCustomModelLoader.java @@ -34,10 +34,10 @@ public enum MyCustomModelLoader implements ICustomModelLoader { private static boolean spriteInitialisationDone = false; private static TextureAtlasSprite spriteShape_none; - private static HashMap spriteShapes = new HashMap<>(EnumForceFieldShape.length); + private static final HashMap spriteShapes = new HashMap<>(EnumForceFieldShape.length); private static void initSprites() { if (!spriteInitialisationDone) { - TextureMap textureMapBlocks = Minecraft.getMinecraft().getTextureMapBlocks(); + final TextureMap textureMapBlocks = Minecraft.getMinecraft().getTextureMapBlocks(); spriteShapes.put(EnumForceFieldShape.NONE , textureMapBlocks.getAtlasSprite("warpdrive:blocks/forcefield/projector-shape_none")); spriteShapes.put(EnumForceFieldShape.CUBE , textureMapBlocks.getAtlasSprite("warpdrive:blocks/forcefield/projector-shape_cube")); spriteShapes.put(EnumForceFieldShape.CYLINDER_H, textureMapBlocks.getAtlasSprite("warpdrive:blocks/forcefield/projector-shape_cylinder_h")); @@ -51,13 +51,13 @@ public enum MyCustomModelLoader implements ICustomModelLoader { } @Override - public void onResourceManagerReload(@Nonnull IResourceManager resourceManager) { + public void onResourceManagerReload(@Nonnull final IResourceManager resourceManager) { OBJLoader.INSTANCE.onResourceManagerReload(resourceManager); spriteInitialisationDone = false; } @Override - public boolean accepts(ResourceLocation modelLocation) { + public boolean accepts(final ResourceLocation modelLocation) { return WarpDrive.MODID.equals(modelLocation.getNamespace()) && modelLocation.getPath().endsWith(".wobj"); } @@ -110,15 +110,16 @@ public enum MyCustomModelLoader implements ICustomModelLoader { @Nonnull @Override - public List getQuads(@Nullable IBlockState blockState, @Nullable EnumFacing side, long rand) { + public List getQuads(@Nullable final IBlockState blockState, @Nullable final EnumFacing side, final long rand) { - List bakedQuadsIn = bakedModel.getQuads(blockState, side, rand); - IExtendedBlockState exState = (IExtendedBlockState) blockState; - EnumForceFieldShape enumForceFieldShape = exState != null ? exState.getValue(BlockForceFieldProjector.SHAPE) : EnumForceFieldShape.NONE; - List bakedQuadsOut = Lists.newArrayList(); - for(BakedQuad bakedQuadIn : bakedQuadsIn) { + final List bakedQuadsIn = bakedModel.getQuads(blockState, side, rand); + final IExtendedBlockState exState = (IExtendedBlockState) blockState; + final EnumForceFieldShape enumForceFieldShape = exState != null ? exState.getValue(BlockForceFieldProjector.SHAPE) : EnumForceFieldShape.NONE; + final TextureAtlasSprite spriteShape = spriteShapes.get(enumForceFieldShape); + final List bakedQuadsOut = Lists.newArrayList(); + for(final BakedQuad bakedQuadIn : bakedQuadsIn) { if (bakedQuadIn.getSprite().equals(spriteShape_none)) { - BakedQuad bakedQuadOut = new BakedQuadRetextured(bakedQuadIn, spriteShapes.get(enumForceFieldShape)); + final BakedQuad bakedQuadOut = new BakedQuadRetextured(bakedQuadIn, spriteShape); bakedQuadsOut.add(bakedQuadOut); } else { bakedQuadsOut.add(bakedQuadIn);