Tropicraft

Tropicraft

9M Downloads

Tropical Water Needs to Be Fixed

AFScorp opened this issue ยท 5 comments

commented

When tropical water is placed as forms of water generator, it doesn't work. Once the water is scooped by an empty bucket, where it was isn't be filled automatically. The water should work as the vanila's.

commented

I can confirm the issue continues to exist in 6.0.5 as well.

commented

I cannot duplicate this bug on Forge 1448 and Minecraft 1.7.10.

Which Forge version, Minecraft version, and other mods were you using?

commented

Reproduced. 2 Water sources on the diagonal corners do not make a tropical water generator like the vanilla water would.

  • forge-1.7.10-10.13.4.1481-1.7.10-universal
  • tropicraft-6.0.4
commented

Looks like a change added by forge since 1.7.10. There's a way around it. It helps to add and compile the following change to a local copy of tropicraft:

// in src/main/java/net/tropicraft/block/BlockTropicsWater.java

@@ -49,4 +52,49 @@ public class BlockTropicsWater extends BlockFluidClassic {
        Material material = world.getBlock(x, y, z).getMaterial();
        return material == this.blockMaterial ? false : (side == 1 ? true : super.shouldSideBeRendered(world, x, y, z, side));
    }

+@Override
+public void updateTick(World world, int x, int y, int z, Random rand)
+{      
+   int currentMeta = world.getBlockMetadata(x, y, z);
+   if (currentMeta > 0 &&
+           
+           // The water block can only become source if it's not hovering in the air:
+           world.getBlock(x, y - 1,  z).getMaterial() != Material.air)
+   {
+       // Count the number of neighbouring source blocks
+       int neighbourSources = 0;
+       if (IsNeighbourSource (world, x + 1, y, z))
+           neighbourSources ++;
+       if (IsNeighbourSource (world, x - 1, y, z))
+           neighbourSources ++;
+       if (IsNeighbourSource (world, x, y, z + 1))
+           neighbourSources ++;
+       if (IsNeighbourSource (world, x, y, z - 1))
+           neighbourSources ++;

+       if (neighbourSources >= 2)
+          world.setBlock(x, y, z, this, 0, 3); // set meta to 0, means source
+   }
+   
+   // Execute the parent's version also:
+   super.updateTick(world, x, y, z, rand);
+}

+private boolean IsNeighbourSource(World world, int x, int y, int z)
+{
+       // Is it tropics water and a source block ??
+       if (world.getBlock(x, y, z) == this &&
+               world.getBlockMetadata(x,  y, z) == 0)
+           return true;
+   
+       return false;
+}

This makes the tropic water behave more like vanilla water. Infinite water sources can be created with this change.

commented

Thanks @cbaakman! Fixed in #105