From 34f95c43c7fac0d4e3483f52e522d2de7a627fa8 Mon Sep 17 00:00:00 2001 From: Nedelosk Date: Sat, 28 May 2016 01:43:42 +0200 Subject: [PATCH] Clean Up multiblock error messages and Fix #1199. --- lang | 2 +- .../multiblock/CharcoalPileController.java | 79 ++----------------- .../multiblock/GreenhouseController.java | 6 +- 3 files changed, 11 insertions(+), 76 deletions(-) diff --git a/lang b/lang index fa92575bf..2b40f0ff8 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit fa92575bfcaace38f4f1f6cd3f2deae5e37e6189 +Subproject commit 2b40f0ff8749ff1b733d80bf56074b2d7073e409 diff --git a/src/main/java/forestry/arboriculture/multiblock/CharcoalPileController.java b/src/main/java/forestry/arboriculture/multiblock/CharcoalPileController.java index c8b6fd834..a2f950ca2 100644 --- a/src/main/java/forestry/arboriculture/multiblock/CharcoalPileController.java +++ b/src/main/java/forestry/arboriculture/multiblock/CharcoalPileController.java @@ -141,7 +141,7 @@ public class CharcoalPileController extends RectangularMultiblockControllerBase @Override public String getUnlocalizedType() { - return "for.multiblock.greenhouse.type"; + return "for.multiblock.charcoal.pile.type"; } @Override @@ -259,80 +259,15 @@ public class CharcoalPileController extends RectangularMultiblockControllerBase } if (partsOnLayer < 4) { - throw new MultiblockValidationException(Translator.translateToLocal("for.multiblock.error.small")); + throw new MultiblockValidationException(Translator.translateToLocal("for.multiblock.charcoal.pile.error.small")); } } for(IMultiblockComponent comp : connectedParts){ if(!components.contains(comp.getCoordinates())){ - throw new MultiblockValidationException(Translator.translateToLocal("for.multiblock.error.large" + comp.getCoordinates())); + throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.charcoal.pile.error.large", comp.getCoordinates().getX(), comp.getCoordinates().getY(), comp.getCoordinates().getZ())); } } } - - /* - public void testPileLayer(World world, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) throws MultiblockValidationException { - int partsOnLayer = 0; - for(IMultiblockComponent component : connectedParts) { - BlockPos componentPos = component.getCoordinates(); - if (componentPos.getY() == minY) { - if (componentPos.getX() < minX || componentPos.getX() > maxX || componentPos.getZ() < minZ || componentPos.getZ() > maxZ) { - throw new MultiblockValidationException(Translator.translateToLocal("for.multiblock.error.large" + componentPos)); - } - int extremes = 0; - - int x = componentPos.getX(); - int y = componentPos.getY(); - int z = componentPos.getZ(); - if (x == minX) { - extremes++; - } - if (y == getMinimumCoord().getY()) { - extremes++; - } - if (z == minZ) { - extremes++; - } - - if (x == maxX) { - extremes++; - } - if (y == getMaximumCoord().getY()) { - extremes++; - } - if (z == maxZ) { - extremes++; - } - - if (extremes >= 1) { - // Side - int exteriorLevel = y - getMinimumCoord().getY(); - if (component != null) { - isGoodForExteriorLevel(component, exteriorLevel); - } - } else { - if (component != null) { - isGoodForInterior(component); - } - } - partsOnLayer++; - } - } - if (partsOnLayer < 4) { - throw new MultiblockValidationException(Translator.translateToLocal("for.multiblock.error.small.top")); - } - for(int posX = minX; posX <= maxX; posX++) { - for(int posZ = minZ; posZ <= maxZ; posZ++) { - BlockPos pos = new BlockPos(posX, minY, posZ); - Block block = world.getBlockState(pos).getBlock(); - if (!(block instanceof BlockPile)) { - throw new MultiblockValidationException(Translator.translateToLocal("for.multiblock.error.small" + pos)); - } - } - } - if (minY != getMaximumCoord().getY()) { - testPileLayer(worldObj, minX + 1, minY + 1, minZ + 1, maxX - 1, maxZ - 1); - } - }*/ @Override public NBTTagCompound writeToNBT(NBTTagCompound data) { @@ -398,22 +333,22 @@ public class CharcoalPileController extends RectangularMultiblockControllerBase @Override protected void isGoodForExteriorLevel(IMultiblockComponent part, int level) throws MultiblockValidationException { if(!(part instanceof ICharcoalPileComponent)){ - throw new MultiblockValidationException("for.multiblock.charcoal.pile.error.invalid.exterior"); + throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.charcoal.pile.error.invalid.exterior", part.getCoordinates().getX(), part.getCoordinates().getY(), part.getCoordinates().getZ())); } ICharcoalPileComponent component = (ICharcoalPileComponent) part; if(component.getPileType() != EnumPileType.DIRT){ - throw new MultiblockValidationException("for.multiblock.charcoal.pile.error.invalid.exterior"); + throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.charcoal.pile.error.invalid.exterior", part.getCoordinates().getX(), part.getCoordinates().getY(), part.getCoordinates().getZ())); } } @Override protected void isGoodForInterior(IMultiblockComponent part) throws MultiblockValidationException { if(!(part instanceof ICharcoalPileComponent)){ - throw new MultiblockValidationException("for.multiblock.charcoal.pile.error.invalid.interior"); + throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.charcoal.pile.error.invalid.interior", part.getCoordinates().getX(), part.getCoordinates().getY(), part.getCoordinates().getZ())); } ICharcoalPileComponent component = (ICharcoalPileComponent) part; if(component.getPileType() != EnumPileType.WOOD){ - throw new MultiblockValidationException("for.multiblock.charcoal.pile.error.invalid.interior"); + throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.charcoal.pile.error.invalid.interior", part.getCoordinates().getX(), part.getCoordinates().getY(), part.getCoordinates().getZ())); } } diff --git a/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java b/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java index e67164c84..e7acff568 100644 --- a/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java +++ b/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java @@ -649,7 +649,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im } if (internalBlocks.isEmpty()) { - throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.space.closed")); + throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.greenhouse.error.space.closed")); } int hatches = 0; @@ -659,7 +659,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im } } if (hatches > 1) { - throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.butterflyhatch.toomany")); + throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.greenhouse.error.butterflyhatch.toomany")); } } @@ -690,7 +690,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im BlockPos maxPos = getMaximumCoord(); if (minPos.getX() > posFacing.getX() || minPos.getY() > posFacing.getY() || minPos.getZ() > posFacing.getZ() || maxPos.getX() < posFacing.getX() || maxPos.getY() < posFacing.getY() || maxPos.getZ() < posFacing.getZ()) { - throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.space.closed")); + throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.greenhouse.error.space.closed")); } TileEntity tileFace = worldObj.getTileEntity(posFacing);