Skip to content
Permalink
Browse files

- Added localization for enums (metal & tier only for now)

- Fixed missing formatting rule for 'else', 'catch', and 'finally'
  • Loading branch information...
dries007 committed Apr 27, 2018
1 parent 66b3019 commit 9c287a7ada868264c4dc4299ec1ee0ed6f709979
Showing with 169 additions and 106 deletions.
  1. +3 −0 CodeStyle.xml
  2. +1 −2 src/main/java/net/dries007/tfc/TerraFirmaCraft.java
  3. +23 −22 src/main/java/net/dries007/tfc/client/gui/GuiCustomizeWorld.java
  4. +10 −5 src/main/java/net/dries007/tfc/client/render/TESRChestTFC.java
  5. +2 −0 src/main/java/net/dries007/tfc/objects/blocks/BlockSlabTFC.java
  6. +2 −1 src/main/java/net/dries007/tfc/objects/blocks/stone/BlockRockVariant.java
  7. +4 −2 src/main/java/net/dries007/tfc/objects/blocks/wood/BlockWorkbenchTFC.java
  8. +6 −3 src/main/java/net/dries007/tfc/objects/entity/EntityFallingBlockTFC.java
  9. +2 −1 src/main/java/net/dries007/tfc/objects/items/ItemFireStarter.java
  10. +2 −1 src/main/java/net/dries007/tfc/objects/items/metal/ItemMetalArmor.java
  11. +2 −1 src/main/java/net/dries007/tfc/objects/items/metal/ItemOreTFC.java
  12. +8 −4 src/main/java/net/dries007/tfc/objects/recipes/MetalToolRecipe.java
  13. +2 −1 src/main/java/net/dries007/tfc/objects/te/TEPitKiln.java
  14. +2 −1 src/main/java/net/dries007/tfc/objects/te/TETorchTFC.java
  15. +2 −1 src/main/java/net/dries007/tfc/objects/trees/TreeRegistry.java
  16. +6 −3 src/main/java/net/dries007/tfc/util/Helpers.java
  17. +2 −1 src/main/java/net/dries007/tfc/util/InsertOnlyEnumTable.java
  18. +6 −3 src/main/java/net/dries007/tfc/util/Schematic.java
  19. +8 −4 src/main/java/net/dries007/tfc/world/classic/ChunkGenTFC.java
  20. +2 −1 src/main/java/net/dries007/tfc/world/classic/ClimateTFC.java
  21. +6 −15 src/main/java/net/dries007/tfc/world/classic/DataLayer.java
  22. +2 −1 src/main/java/net/dries007/tfc/world/classic/genlayers/GenLayerSmoothTFC.java
  23. +2 −1 src/main/java/net/dries007/tfc/world/classic/genlayers/GenLayerTFC.java
  24. +6 −3 src/main/java/net/dries007/tfc/world/classic/genlayers/GenLayerVoronoiZoomTFC.java
  25. +4 −2 src/main/java/net/dries007/tfc/world/classic/genlayers/biome/GenLayerAddIslandTFC.java
  26. +8 −4 src/main/java/net/dries007/tfc/world/classic/genlayers/biome/GenLayerBiomeEdge.java
  27. +2 −1 src/main/java/net/dries007/tfc/world/classic/genlayers/biome/GenLayerDeepOcean.java
  28. +2 −1 src/main/java/net/dries007/tfc/world/classic/genlayers/biome/GenLayerLakes.java
  29. +2 −1 src/main/java/net/dries007/tfc/world/classic/genlayers/biome/GenLayerRemoveOcean.java
  30. +2 −1 src/main/java/net/dries007/tfc/world/classic/genlayers/biome/GenLayerShoreTFC.java
  31. +4 −2 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/drainage/GenLayerAddDrainage.java
  32. +4 −2 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/evt/GenLayerAddEVT.java
  33. +4 −2 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/ph/GenLayerAddPH.java
  34. +4 −2 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/rain/GenLayerAddRain.java
  35. +2 −1 src/main/java/net/dries007/tfc/world/classic/genlayers/river/GenLayerRiverMixTFC.java
  36. +2 −1 src/main/java/net/dries007/tfc/world/classic/genlayers/river/GenLayerRiverTFC.java
  37. +10 −5 src/main/java/net/dries007/tfc/world/classic/mapgen/MapGenCavesTFC.java
  38. +4 −2 src/main/java/net/dries007/tfc/world/classic/worldgen/WorldGenFissure.java
  39. +4 −2 src/main/java/net/dries007/tfc/world/classic/worldgen/WorldGenSoilPits.java
@@ -31,6 +31,9 @@
<option name="BRACE_STYLE" value="2"/>
<option name="CLASS_BRACE_STYLE" value="2"/>
<option name="METHOD_BRACE_STYLE" value="2"/>
<option name="ELSE_ON_NEW_LINE" value="true"/>
<option name="CATCH_ON_NEW_LINE" value="true"/>
<option name="FINALLY_ON_NEW_LINE" value="true"/>
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/>
<option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true"/>
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true"/>
@@ -43,8 +43,6 @@
@Mod.Metadata()
private static ModMetadata metadata = null;

private boolean isSignedBuild = true;

static
{
FluidRegistry.enableUniversalBucket();
@@ -75,6 +73,7 @@ public static TerraFirmaCraft getInstance()
return instance;
}

private boolean isSignedBuild = true;
private Logger log;
private WorldTypeTFC worldTypeTFC;
private SimpleNetworkWrapper network;
@@ -143,27 +143,6 @@ protected void actionPerformed(GuiButton button) throws IOException
update();
}

@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
super.mouseClicked(mouseX, mouseY, mouseButton);
list.mouseClicked(mouseX, mouseY, mouseButton);
}

@Override
public void handleMouseInput() throws IOException
{
super.handleMouseInput();
this.list.handleMouseInput();
}

@Override
protected void mouseReleased(int mouseX, int mouseY, int state)
{
super.mouseReleased(mouseX, mouseY, state);
list.mouseReleased(mouseX, mouseY, state);
}

@Override
public void initGui()
{
@@ -196,6 +175,27 @@ public void initGui()
update();
}

@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
super.mouseClicked(mouseX, mouseY, mouseButton);
list.mouseClicked(mouseX, mouseY, mouseButton);
}

@Override
protected void mouseReleased(int mouseX, int mouseY, int state)
{
super.mouseReleased(mouseX, mouseY, state);
list.mouseReleased(mouseX, mouseY, state);
}

@Override
public void handleMouseInput() throws IOException
{
super.handleMouseInput();
this.list.handleMouseInput();
}

@Override
public void setEntryValue(int id, String value)
{
@@ -220,7 +220,8 @@ private WorldGenSettingsBuilder loadSettings(String str)
try
{
return WorldGenSettings.fromString(str);
} catch (JsonParseException e)
}
catch (JsonParseException e)
{
TerraFirmaCraft.getLog().error("Error parsing s: {}", str);
TerraFirmaCraft.getLog().catching(e);
@@ -81,14 +81,17 @@ public void render(TEChestTFC te, double x, double y, double z, float partialTic
GlStateManager.scale(4.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (te.getChestType() == BlockChest.Type.TRAP)
}
else if (te.getChestType() == BlockChest.Type.TRAP)
{
bindTexture(TRAP_SINGLE_TEXTURES.get(te.getWood()));
} else
}
else
{
bindTexture(SINGLE_TEXTURES.get(te.getWood()));
}
} else
}
else
{
modelchest = largeChest;

@@ -100,10 +103,12 @@ public void render(TEChestTFC te, double x, double y, double z, float partialTic
GlStateManager.scale(8.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (te.getChestType() == BlockChest.Type.TRAP)
}
else if (te.getChestType() == BlockChest.Type.TRAP)
{
bindTexture(TRAP_DOUBLE_TEXTURES.get(te.getWood()));
} else
}
else
{
bindTexture(DOUBLE_TEXTURES.get(te.getWood()));
}
@@ -238,4 +238,6 @@ public boolean isDouble()
return false;
}
}


}
@@ -121,7 +121,8 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra
if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32)))
{
worldIn.spawnEntity(new EntityFallingBlockTFC(worldIn, pos, this, worldIn.getBlockState(pos)));
} else
}
else
{
worldIn.setBlockToAir(pos);
pos = pos.add(0, -1, 0);
@@ -65,7 +65,8 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state,
if (worldIn.isRemote)
{
return true;
} else
}
else
{
playerIn.displayGui(new InterfaceCraftingTable(this, worldIn, pos));
playerIn.addStat(StatList.CRAFTING_TABLE_INTERACTION);
@@ -143,7 +144,8 @@ public boolean canInteractWith(EntityPlayer playerIn)
if (world.getBlockState(pos).getBlock() != block)
{
return false;
} else
}
else
{
return playerIn.getDistanceSq((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D) <= 64.0D;
}
@@ -95,7 +95,8 @@ public void onUpdate()
if (world.getBlockState(pos) == state)
{
world.setBlockToAir(pos);
} else if (!world.isRemote)
}
else if (!world.isRemote)
{
setDead();
return;
@@ -127,7 +128,8 @@ public void onUpdate()
}
setDead();
}
} else // On ground
}
else // On ground
{
final IBlockState current = world.getBlockState(pos);

@@ -166,7 +168,8 @@ public void onUpdate()
te.markDirty();
}
}
} else if (world.getGameRules().getBoolean("doEntityDrops"))
}
else if (world.getGameRules().getBoolean("doEntityDrops"))
{
falling.getDropsFromFall(world, pos, state, teData, fallTime, fallDistance).forEach(x -> entityDropItem(x, 0));
}
@@ -97,7 +97,8 @@ public void onUsingTick(ItemStack stack, EntityLivingBase entityLivingBase, int
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, result.hitVec.x, result.hitVec.y, result.hitVec.z, 0.0F, 0.1F, 0.0F);
if (chance > 0.7 && countLeft < 10 && world.rand.nextFloat() < count / (double) total)
world.spawnParticle(EnumParticleTypes.FLAME, result.hitVec.x, result.hitVec.y, result.hitVec.z, 0.0F, 0.0F, 0.0F);
} else if (countLeft == 1) // Server, and last tick of use
}
else if (countLeft == 1) // Server, and last tick of use
{
stack.damageItem(1, player);

@@ -84,7 +84,8 @@ public ItemMetalArmor(Metal metal, Metal.ItemType type)
playerIn.setItemStackToSlot(slot, heldItem.copy());
heldItem.shrink(1);
return new ActionResult<>(EnumActionResult.SUCCESS, heldItem);
} else
}
else
{
return new ActionResult<>(EnumActionResult.FAIL, heldItem);
}
@@ -53,7 +53,8 @@ public ItemOreTFC(Ore ore)
OreDictionaryHelper.registerMeta(this, grade.getMeta(), "ore", grade);
OreDictionaryHelper.registerMeta(this, grade.getMeta(), "ore", ore, grade);
}
} else // Mineral
}
else // Mineral
{
OreDictionaryHelper.register(this, "gem", ore);
switch (ore)
@@ -45,13 +45,15 @@ public boolean matches(InventoryCrafting inv, World worldIn)
{
if (stick) return false;
stick = true;
} else if (stack.getItem() instanceof ItemMetal)
}
else if (stack.getItem() instanceof ItemMetal)
{
ItemMetal metal = ((ItemMetal) stack.getItem());
if (metal.type != inp) return false;
if (toolhead) return false;
toolhead = true;
} else
}
else
{
return false;
}
@@ -73,13 +75,15 @@ public ItemStack getCraftingResult(InventoryCrafting inv)
{
if (stick) return null;
stick = true;
} else if (stack.getItem() instanceof ItemMetal)
}
else if (stack.getItem() instanceof ItemMetal)
{
ItemMetal metal = ((ItemMetal) stack.getItem());
if (metal.type != inp) return null;
if (toolhead != null) return null;
toolhead = metal;
} else
}
else
{
return null;
}
@@ -60,7 +60,8 @@ public void update()
if (world.isAirBlock(above))
{
world.setBlockState(above, Blocks.FIRE.getDefaultState());
} else
}
else
{
IBlockState stateAbove = world.getBlockState(above);
if (stateAbove.getMaterial() != Material.FIRE)
@@ -53,7 +53,8 @@ public void toggle()
{
world.setBlockState(pos, state.withProperty(BlockTorchTFC.LIT, false));
secondsleft = 0;
} else
}
else
{
world.setBlockState(pos, state.withProperty(BlockTorchTFC.LIT, true));
secondsleft = BURN_SECONDS; // todo: adjust 600 seconds = 10 minutes
@@ -46,7 +46,8 @@ public static void loadTrees()
{
treeSchematic.PostProcess();
TreeRegistry.instance.RegisterSchematic(wood, treeSchematic);
} else
}
else
{
TerraFirmaCraft.getLog().info("ERROR loading " + wood.name());
break;
@@ -36,12 +36,14 @@ public static void spreadGrass(World world, BlockPos pos, IBlockState us, Random
{
//noinspection ConstantConditions
world.setBlockState(pos, BlocksTFC.PEAT.getDefaultState());
} else if (us.getBlock() instanceof BlockRockVariant)
}
else if (us.getBlock() instanceof BlockRockVariant)
{
BlockRockVariant block = ((BlockRockVariant) us.getBlock());
world.setBlockState(pos, block.getVariant(block.type.getNonGrassVersion()).getDefaultState());
}
} else
}
else
{
if (world.getLightFromNeighbors(pos.up()) < 9) return;

@@ -60,7 +62,8 @@ public static void spreadGrass(World world, BlockPos pos, IBlockState us, Random
{
//noinspection ConstantConditions
world.setBlockState(target, BlocksTFC.PEAT_GRASS.getDefaultState());
} else if (current.getBlock() instanceof BlockRockVariant)
}
else if (current.getBlock() instanceof BlockRockVariant)
{
Rock.Type spreader = Rock.Type.GRASS;
if ((us.getBlock() instanceof BlockRockVariant) && ((BlockRockVariant) us.getBlock()).type == Rock.Type.DRY_GRASS)
@@ -98,7 +98,8 @@ public T put(R rowKey, C columnKey, T value)
row = new EnumMap<>(colClass);
row.put(columnKey, value);
rowMap.put(rowKey, row);
} else
}
else
{
if (row.containsKey(columnKey)) throw new UnsupportedOperationException();
row.put(columnKey, value);
@@ -70,7 +70,8 @@ public boolean Load()
{
blockArray[i] = b[i];
}
} else if (tree.hasKey("BlocksInt"))
}
else if (tree.hasKey("BlocksInt"))
{
blockArray = tree.getIntArray("Blocks");
}
@@ -92,11 +93,13 @@ public boolean Load()
}

aabb = new AxisAlignedBB(0, 0, 0, width, height, length);
} catch (FileNotFoundException e)
}
catch (FileNotFoundException e)
{
System.out.println("TFC FileNotFound: " + path);
return false;
} catch (IOException e)
}
catch (IOException e)
{
System.out.println("TFC IOException: " + path);
return false;
@@ -443,7 +443,8 @@ private void generateHeightMap(int xPos, int zPos)
if (scaledNoise6Value < -1.0D) //Error Checking
scaledNoise6Value = -1.0D;
scaledNoise6Value /= 1.4D * 2.0D; // Results in values between 0 and -0.357143
} else
}
else
{
if (scaledNoise6Value > 1.0D)
scaledNoise6Value = 1.0D;
@@ -579,7 +580,8 @@ else if (rain.valueFloat < 125 && biome.getHeightVariation() < 0.5f && temp > 20
if (biome == BiomesTFC.BEACH || biome == BiomesTFC.OCEAN || biome == BiomesTFC.DEEP_OCEAN)
{
subSurfaceBlock = surfaceBlock = rock1.block.getVariant(Rock.Type.SAND).getDefaultState();
} else if (biome == BiomesTFC.GRAVEL_BEACH)
}
else if (biome == BiomesTFC.GRAVEL_BEACH)
{
subSurfaceBlock = surfaceBlock = rock1.block.getVariant(Rock.Type.GRAVEL).getDefaultState();
}
@@ -647,7 +649,8 @@ else if (rain.valueFloat < 125 && biome.getHeightVariation() < 0.5f && temp > 20
{
if (outp.getBlockState(x, y + yOffset, z) != rock1.block.getVariant(Rock.Type.SAND).getDefaultState() && rand.nextInt(5) != 0)
outp.setBlockState(x, y + yOffset, z, rock1.block.getVariant(Rock.Type.GRAVEL).getDefaultState());
} else // Swamp biomes have bottoms that are mostly dirt
}
else // Swamp biomes have bottoms that are mostly dirt
{
if (outp.getBlockState(x, y + yOffset, z) != rock1.block.getVariant(Rock.Type.SAND).getDefaultState())
outp.setBlockState(x, y + yOffset, z, rock1.block.getVariant(Rock.Type.DIRT).getDefaultState());
@@ -669,7 +672,8 @@ else if (inp.getBlockState(x, y, z) == SALT_WATER && !(BiomesTFC.isOceanicBiome(
if (y < 1 + (s.flatBedrock ? 0 : rand.nextInt(3))) // + (seaLevelOffsetMap[colIndex] / 3)
{
outp.setBlockState(x, y, z, BEDROCK);
} else if (outp.isEmpty(x, y, z))
}
else if (outp.isEmpty(x, y, z))
{
if (y <= ROCKLAYER3 + seaLevelOffsetMap[colIndex])
outp.setBlockState(x, y, z, rock3.block.getDefaultState());

0 comments on commit 9c287a7

Please sign in to comment.
You can’t perform that action at this time.