Properly consider world water/lava logging config. Fixes #202

This commit is contained in:
Ammar Askar
2012-09-22 13:12:42 +05:00
parent 2671e015a8
commit 584406a8f6

View File

@@ -30,36 +30,42 @@ public class FluidFlowLogging extends LoggingListener
final int typeTo = to.getTypeId(); final int typeTo = to.getTypeId();
final boolean canFlow = typeTo == 0 || nonFluidProofBlocks.contains(typeTo); final boolean canFlow = typeTo == 0 || nonFluidProofBlocks.contains(typeTo);
if (typeFrom == 10 || typeFrom == 11) { if (typeFrom == 10 || typeFrom == 11) {
if (canFlow) { if (canFlow && wcfg.isLogging(Logging.LAVAFLOW)) {
if (isSurroundedByWater(to) && event.getBlock().getData() <= 2) if (isSurroundedByWater(to) && event.getBlock().getData() <= 2)
consumer.queueBlockReplace("LavaFlow", to.getState(), 4, (byte)0); consumer.queueBlockReplace("LavaFlow", to.getState(), 4, (byte)0);
else if (typeTo == 0) { else if (typeTo == 0) {
if (wcfg.isLogging(Logging.LAVAFLOW)) consumer.queueBlockPlace("LavaFlow", to.getLocation(), 10, (byte)(event.getBlock().getData() + 1));
consumer.queueBlockPlace("LavaFlow", to.getLocation(), 10, (byte)(event.getBlock().getData() + 1)); } else {
} else
consumer.queueBlockReplace("LavaFlow", to.getState(), 10, (byte)(event.getBlock().getData() + 1)); consumer.queueBlockReplace("LavaFlow", to.getState(), 10, (byte)(event.getBlock().getData() + 1));
} else if (typeTo == 8 || typeTo == 9) }
if (event.getFace() == BlockFace.DOWN) } else if (typeTo == 8 || typeTo == 9) {
if (event.getFace() == BlockFace.DOWN) {
consumer.queueBlockReplace("LavaFlow", to.getState(), 1, (byte)0); consumer.queueBlockReplace("LavaFlow", to.getState(), 1, (byte)0);
else } else {
consumer.queueBlockReplace("LavaFlow", to.getState(), 4, (byte)0); consumer.queueBlockReplace("LavaFlow", to.getState(), 4, (byte)0);
} else if (typeFrom == 8 || typeFrom == 9) { }
}
} else if ((typeFrom == 8 || typeFrom == 9) && wcfg.isLogging(Logging.WATERFLOW)) {
if (typeTo == 0) { if (typeTo == 0) {
if (wcfg.isLogging(Logging.WATERFLOW)) consumer.queueBlockPlace("WaterFlow", to.getLocation(), 8, (byte)(event.getBlock().getData() + 1));
consumer.queueBlockPlace("WaterFlow", to.getLocation(), 8, (byte)(event.getBlock().getData() + 1)); } else if (nonFluidProofBlocks.contains(typeTo)) {
} else if (nonFluidProofBlocks.contains(typeTo))
consumer.queueBlockReplace("WaterFlow", to.getState(), 8, (byte)(event.getBlock().getData() + 1)); consumer.queueBlockReplace("WaterFlow", to.getState(), 8, (byte)(event.getBlock().getData() + 1));
else if (typeTo == 10 || typeTo == 11) }
if (to.getData() == 0) else if (typeTo == 10 || typeTo == 11) {
if (to.getData() == 0) {
consumer.queueBlockReplace("WaterFlow", to.getState(), 49, (byte)0); consumer.queueBlockReplace("WaterFlow", to.getState(), 49, (byte)0);
else if (event.getFace() == BlockFace.DOWN) } else if (event.getFace() == BlockFace.DOWN) {
consumer.queueBlockReplace("LavaFlow", to.getState(), 1, (byte)0); consumer.queueBlockReplace("LavaFlow", to.getState(), 1, (byte)0);
if (typeTo == 0 || nonFluidProofBlocks.contains(typeTo)) }
}
if (typeTo == 0 || nonFluidProofBlocks.contains(typeTo)) {
for (final BlockFace face : new BlockFace[]{BlockFace.DOWN, BlockFace.NORTH, BlockFace.WEST, BlockFace.EAST, BlockFace.SOUTH}) { for (final BlockFace face : new BlockFace[]{BlockFace.DOWN, BlockFace.NORTH, BlockFace.WEST, BlockFace.EAST, BlockFace.SOUTH}) {
final Block lower = to.getRelative(face); final Block lower = to.getRelative(face);
if (lower.getTypeId() == 10 || lower.getTypeId() == 11) if (lower.getTypeId() == 10 || lower.getTypeId() == 11) {
consumer.queueBlockReplace("WaterFlow", lower.getState(), lower.getData() == 0 ? 49 : 4, (byte)0); consumer.queueBlockReplace("WaterFlow", lower.getState(), lower.getData() == 0 ? 49 : 4, (byte)0);
}
} }
}
} }
} }
} }