From c3f62ed8bff9d1a5ea1e441a5325fd987d7aa545 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 28 Jul 2013 19:25:51 +0200 Subject: [PATCH] Tweak setBlock in update tick - it should only send serverside updates for source blocks. Experimental attempt to fix worldgen issues for fluid blocks --- .../fluids/BlockFluidClassic.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidClassic.java b/common/net/minecraftforge/fluids/BlockFluidClassic.java index 4defe7f6e9..b5349ca6f1 100644 --- a/common/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/common/net/minecraftforge/fluids/BlockFluidClassic.java @@ -10,11 +10,11 @@ import net.minecraft.world.World; /** * This is a fluid block implementation which emulates vanilla Minecraft fluid behavior. - * + * * It is highly recommended that you use/extend this class for "classic" fluid blocks. - * + * * @author King Lemming - * + * */ public class BlockFluidClassic extends BlockFluidBase { @@ -92,8 +92,8 @@ public class BlockFluidClassic extends BlockFluidBase { int y2 = y - densityDir; - if (world.getBlockId(x, y2, z ) == blockID || - world.getBlockId(x - 1, y2, z ) == blockID || + if (world.getBlockId(x, y2, z ) == blockID || + world.getBlockId(x - 1, y2, z ) == blockID || world.getBlockId(x + 1, y2, z ) == blockID || world.getBlockId(x, y2, z - 1) == blockID || world.getBlockId(x, y2, z + 1) == blockID) @@ -128,9 +128,10 @@ public class BlockFluidClassic extends BlockFluidBase } } } - else if (quantaRemaining > quantaPerBlock) + // This is a "source" block, set meta to zero, and send a server only update + else if (quantaRemaining >= quantaPerBlock) { - world.setBlockMetadataWithNotify(x, y, z, 0, 3); + world.setBlockMetadataWithNotify(x, y, z, 0, 2); } // Flow vertically if possible @@ -226,7 +227,7 @@ public class BlockFluidClassic extends BlockFluidBase int cost = 1000; for (int adjSide = 0; adjSide < 4; adjSide++) { - if ((adjSide == 0 && side == 1) || + if ((adjSide == 0 && side == 1) || (adjSide == 1 && side == 0) || (adjSide == 2 && side == 3) || (adjSide == 3 && side == 2)) @@ -302,7 +303,7 @@ public class BlockFluidClassic extends BlockFluidBase { return false; } - + if (this.density > getDensity(world, x, y, z)) { return true;