From 844783d3cdcb4274ea8d5a03c889b5f1522fa422 Mon Sep 17 00:00:00 2001 From: Silent Program <72319773+Silent-Program@users.noreply.github.com> Date: Thu, 10 Mar 2022 18:40:50 -0800 Subject: [PATCH 1/3] Made lucky blocks not only spawn on water --- .../thebusybiscuit/slimefunluckyblocks/WorldGenerator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java index 717a0bc..dc87b81 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java @@ -36,8 +36,12 @@ public void onRandomSpawn(ChunkPopulateEvent e) { int x = e.getChunk().getX() * 16 + random.nextInt(16); int z = e.getChunk().getZ() * 16 + random.nextInt(16); int y = e.getWorld().getHighestBlockYAt(x, z); - + Block current = e.getWorld().getBlockAt(x, y, z); + if(current.getType() != Material.WATER){ + current = e.getWorld().getBlockAt(x, y+1, z); + } + if (!current.getType().isSolid() && current.getRelative(BlockFace.DOWN).getType().isSolid()) { plugin.spawnLuckyBlock(current); } From 8c330161075c50571c97d9d22da880457204ef58 Mon Sep 17 00:00:00 2001 From: Silent-Program <72319773+Silent-Program@users.noreply.github.com> Date: Fri, 11 Mar 2022 10:23:49 -0800 Subject: [PATCH 2/3] Forgot to commit import of material --- .../thebusybiscuit/slimefunluckyblocks/WorldGenerator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java index dc87b81..b8fbf05 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java @@ -4,6 +4,7 @@ import java.util.Random; import java.util.concurrent.ThreadLocalRandom; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.event.EventHandler; From 0cfc0b6e2cc13d5be0f9ec50922705428f78ac2f Mon Sep 17 00:00:00 2001 From: Silent Program <72319773+Silent-Program@users.noreply.github.com> Date: Mon, 20 Feb 2023 07:51:34 -0800 Subject: [PATCH 3/3] Update src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java Co-authored-by: J3fftw <44972470+J3fftw1@users.noreply.github.com> --- .../thebusybiscuit/slimefunluckyblocks/WorldGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java index b8fbf05..a9327f4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefunluckyblocks/WorldGenerator.java @@ -37,9 +37,9 @@ public void onRandomSpawn(ChunkPopulateEvent e) { int x = e.getChunk().getX() * 16 + random.nextInt(16); int z = e.getChunk().getZ() * 16 + random.nextInt(16); int y = e.getWorld().getHighestBlockYAt(x, z); - + Block current = e.getWorld().getBlockAt(x, y, z); - if(current.getType() != Material.WATER){ + if (current.getType() != Material.WATER) { current = e.getWorld().getBlockAt(x, y+1, z); }