From e7b064e3cbe3db98e58b22d2df0aa18ea9675f04 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Mon, 17 Jun 2013 03:38:10 -0400 Subject: [PATCH] Fixed Gen Directionality Bug and Minor Tweak I fixed a subtle bug in RiftGenerator. The code for picking random coordinates on the surface of a chunk would subtract a random amount from the coordinate of the chunk's corner. Unfortunately, subtracting meant that we would almost always generate coordinates OUTSIDE the intended chunk. The correct calculation was to add, not subtract. This meant that if you walked in a direction in which our gateways were generated outside of existing chunks, then their data would be lost and no gateways would generate! To reproduce this bug, max out the chance of generating gateways and fly in the direction that decreases X and Z. You must fly into new chunks. After passing the gateways produced when you spawn (if this is a new world) you'll see that gateways don't generate on the landscape. However, if you change directions, they'll begin generating again. In addition to fixing that bug, I also tweaked all the block setting calls in RiftGenerator so that they'll trigger block updates and send update packets to the client. I think triggering block updates will prevent unusual problems with floating sand, gravel, etc. --- .../mod_pocketDim/RiftGenerator.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/RiftGenerator.java b/StevenDimDoors/mod_pocketDim/RiftGenerator.java index da27ae5..6a72de7 100644 --- a/StevenDimDoors/mod_pocketDim/RiftGenerator.java +++ b/StevenDimDoors/mod_pocketDim/RiftGenerator.java @@ -52,8 +52,8 @@ public class RiftGenerator implements IWorldGenerator do { //Pick a random point on the surface of the chunk - x = chunkX * CHUNK_LENGTH - random.nextInt(CHUNK_LENGTH); - z = chunkZ * CHUNK_LENGTH - random.nextInt(CHUNK_LENGTH); + x = chunkX * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH); + z = chunkZ * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH); y = world.getHeightValue(x, z); //If the point is within the acceptable altitude range and the block above is empty, then place a rift @@ -86,8 +86,8 @@ public class RiftGenerator implements IWorldGenerator do { //Pick a random point on the surface of the chunk - x = chunkX * CHUNK_LENGTH - random.nextInt(CHUNK_LENGTH); - z = chunkZ * CHUNK_LENGTH - random.nextInt(CHUNK_LENGTH); + x = chunkX * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH); + z = chunkZ * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH); y = world.getHeightValue(x, z); valid = checkGatewayLocation(world, x, y, z); attempts++; @@ -122,38 +122,38 @@ public class RiftGenerator implements IWorldGenerator if (Math.abs(xc) + Math.abs(zc) < random.nextInt(2) + 3) { //Place Stone Bricks - world.setBlock(x + xc, y - 1, z + zc, blockID,0,2); + world.setBlock(x + xc, y - 1, z + zc, blockID, 0, 3); } else if (Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 3) { //Place Cracked Stone Bricks - world.setBlock(x + xc, y - 1, z + zc, blockID, 2, 2); + world.setBlock(x + xc, y - 1, z + zc, blockID, 2, 3); } } } } //Use Chiseled Stone Bricks to top off the pillars around the door - world.setBlock(x, y + 2, z + 1, blockID, 3, 2); - world.setBlock(x, y + 2, z - 1, blockID, 3, 2); + world.setBlock(x, y + 2, z + 1, blockID, 3, 3); + world.setBlock(x, y + 2, z - 1, blockID, 3, 3); } else { //Build the gateway out of Unraveled Fabric. Since nearly all the blocks in Limbo are of //that type, there is no point replacing the ground. Just build the tops of the columns here. blockID = properties.LimboBlockID; - world.setBlock(x, y + 2, z + 1, blockID, 0, 2); - world.setBlock(x, y + 2, z - 1, blockID, 0, 2); + world.setBlock(x, y + 2, z + 1, blockID, 0, 3); + world.setBlock(x, y + 2, z - 1, blockID, 0, 3); } //Place the shiny transient door into a dungeon ItemRiftBlade.placeDoorBlock(world, x, y + 1, z, 0, mod_pocketDim.transientDoor); //Build the columns around the door - world.setBlock(x, y + 1, z - 1, blockID, 0, 2); - world.setBlock(x, y + 1, z + 1, blockID, 0, 2); - world.setBlock(x, y, z - 1, blockID, 0, 2); - world.setBlock(x, y, z + 1, blockID, 0, 2); + world.setBlock(x, y + 1, z - 1, blockID, 0, 3); + world.setBlock(x, y + 1, z + 1, blockID, 0, 3); + world.setBlock(x, y, z - 1, blockID, 0, 3); + world.setBlock(x, y, z + 1, blockID, 0, 3); } } }