From 82b7766203f2de4aeb15632a4f45f6e141f8058d Mon Sep 17 00:00:00 2001 From: msudol Date: Tue, 31 Dec 2019 23:17:26 -0500 Subject: [PATCH] bonemeal on grass, bamboo and bamboo sapling, should all be working now --- config.yml | 24 +++++++++++++++++-- plugin.yml | 2 +- .../PwnPlantGrowth/BlockGrowListener.java | 16 ++++++------- .../PwnPlantGrowth/BlockSpreadListener.java | 6 ++--- .../pwn9/PwnPlantGrowth/PwnPlantGrowth.java | 2 +- .../PwnPlantGrowth/StructureGrowListener.java | 4 ++-- 6 files changed, 37 insertions(+), 17 deletions(-) diff --git a/config.yml b/config.yml index c1279d2..89a7f45 100644 --- a/config.yml +++ b/config.yml @@ -192,6 +192,12 @@ COCOA: - JUNGLE_HILLS - JUNGLE_EDGE +# In this example grass, tallgrass, bonemeal used on grass - will grow anywhere - Biome: [] - but only at 50% +GRASS: + Growth: 50 + Death: 0 + Biome: [] + # In this example kelp will grow anywhere - Biome: [] - but only at 50% KELP: Growth: 50 @@ -335,7 +341,21 @@ JUNGLE_SAPLING: Biome: - JUNGLE - JUNGLE_HILLS + +BAMBOO: + Growth: 50 + Death: 5 + Biome: + - JUNGLE + - JUNGLE_HILLS +BAMBOO_SAPLING: + Growth: 50 + Death: 5 + Biome: + - JUNGLE + - JUNGLE_HILLS + OAK_SAPLING: Growth: 50 Death: 5 @@ -361,5 +381,5 @@ RED_MUSHROOM: - MUSHROOM_SHORE # Plugin will check for the following list of plants as of ver. 2.5.2 -# Plants: "BEETROOTS", "CACTUS", "CARROTS", "COCOA", "CHORUS_FLOWER", "KELP", "MELON", "MELON_STEM", "NETHER_WART", "POTATOS", "PUMPKIN", "PUMPKIN_STEM", "SUGAR_CANE", "WHEAT", "SWEET_BERRY_BUSH" -# Trees: "ACACIA_SAPLING", "BIRCH_SAPLING", "DARK_OAK_SAPLING", "JUNGLE_SAPLING", "OAK_SAPLING", "SPRUCE_SAPLING", "RED_MUSHROOM", "BROWN_MUSHROOM" +# Plants: "BEETROOTS", "CACTUS", "CARROTS", "COCOA", "CHORUS_FLOWER", "GRASS", "KELP", "MELON", "MELON_STEM", "NETHER_WART", "POTATOS", "PUMPKIN", "PUMPKIN_STEM", "SUGAR_CANE", "WHEAT", "SWEET_BERRY_BUSH" +# Trees: "ACACIA_SAPLING", "BAMBOO", "BAMBOO_SAPLING", "BIRCH_SAPLING", "DARK_OAK_SAPLING", "JUNGLE_SAPLING", "OAK_SAPLING", "SPRUCE_SAPLING", "RED_MUSHROOM", "BROWN_MUSHROOM" diff --git a/plugin.yml b/plugin.yml index 013d4d3..18bfb73 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ main: com.pwn9.PwnPlantGrowth.PwnPlantGrowth name: PwnPlantGrowth -version: 2.5.3 +version: 2.5.4 author: tremor77 description: Take control over all plant growth website: http://pwn9.com diff --git a/src/com/pwn9/PwnPlantGrowth/BlockGrowListener.java b/src/com/pwn9/PwnPlantGrowth/BlockGrowListener.java index 45238a0..d2baada 100644 --- a/src/com/pwn9/PwnPlantGrowth/BlockGrowListener.java +++ b/src/com/pwn9/PwnPlantGrowth/BlockGrowListener.java @@ -20,6 +20,7 @@ public BlockGrowListener(PwnPlantGrowth plugin) plugin.getServer().getPluginManager().registerEvents(this, plugin); this.plugin = plugin; } + // called to run the calculations and determine what happens to the plant on the event public String runCalcs(BlockGrowEvent e, String thisBlock, String curBiome, Boolean isDark) @@ -188,7 +189,7 @@ public String runCalcs(BlockGrowEvent e, String thisBlock, String curBiome, Bool e.getBlock().setType(Material.VINE); } else { - e.getBlock().setType(Material.GRASS); + e.getBlock().setType(Material.DEAD_BUSH); } toLog += " Died (Rate: " + curDeath + ")"; } @@ -207,7 +208,7 @@ public String runCalcs(BlockGrowEvent e, String thisBlock, String curBiome, Bool e.getBlock().setType(Material.VINE); } else { - e.getBlock().setType(Material.GRASS); + e.getBlock().setType(Material.DEAD_BUSH); } toLog += " Died (Rate: " + curDeath + ")"; } @@ -352,7 +353,7 @@ public void plantGrow(BlockGrowEvent e) else if ((curBlock == "AIR")) { - // Handle Cactus, Sugar Cane; Kelp; the plants that grow vertically only. + // Handle Cactus, Sugar Cane; the plants that grow vertically only. if (downBlock == "CACTUS" || downBlock == "SUGAR_CANE") { @@ -363,16 +364,15 @@ else if ((curBlock == "AIR")) } - // This is probably the regular growing grass, let's just leave this alone for now + // This is regular growing grass or bonemeal on grass else if (downBlock == "GRASS" || downBlock == "GRASS_BLOCK" || downBlock == "TALL_GRASS") { // log it, generally only occurs with bonemeal use but can be spammy in the logs toLog += downBlock; + + // run calcs - we're using GRASS as the downblock for all of these so that we only need one config + toLog += runCalcs(e, "GRASS", curBiome, isDark); - // run calcs - toLog += runCalcs(e, downBlock, curBiome, isDark); - - //TODO: this is an odd case, we need to handle this in some other way because it's not canceling in runcalcs. } // Specially Handle Melon/Pumpkin Blocks diff --git a/src/com/pwn9/PwnPlantGrowth/BlockSpreadListener.java b/src/com/pwn9/PwnPlantGrowth/BlockSpreadListener.java index ae82205..9f20708 100644 --- a/src/com/pwn9/PwnPlantGrowth/BlockSpreadListener.java +++ b/src/com/pwn9/PwnPlantGrowth/BlockSpreadListener.java @@ -188,7 +188,7 @@ public String runCalcs(BlockSpreadEvent e, String thisBlock, String curBiome, Bo e.getBlock().setType(Material.SEAGRASS); } else { - e.getBlock().setType(Material.GRASS); + e.getBlock().setType(Material.DEAD_BUSH); } toLog += " Died (Rate: " + curDeath + ")"; } @@ -209,7 +209,7 @@ public String runCalcs(BlockSpreadEvent e, String thisBlock, String curBiome, Bo e.getBlock().setType(Material.SEAGRASS); } else { - e.getBlock().setType(Material.GRASS); + e.getBlock().setType(Material.DEAD_BUSH); } toLog += " Died (Rate: " + curDeath + ")"; } @@ -292,7 +292,7 @@ public void blockSpread(BlockSpreadEvent e) String sourceBlock = String.valueOf(e.getSource().getType()); // we only care about these 2 for now - if (sourceBlock != "CHORUS_FLOWER" && sourceBlock != "KELP") + if (sourceBlock != "CHORUS_FLOWER" && sourceBlock != "KELP" && sourceBlock != "BAMBOO" && sourceBlock != "BAMBOO_SAPLING") { return; } diff --git a/src/com/pwn9/PwnPlantGrowth/PwnPlantGrowth.java b/src/com/pwn9/PwnPlantGrowth/PwnPlantGrowth.java index b18ffbd..e34b212 100644 --- a/src/com/pwn9/PwnPlantGrowth/PwnPlantGrowth.java +++ b/src/com/pwn9/PwnPlantGrowth/PwnPlantGrowth.java @@ -96,7 +96,7 @@ public void onEnable() PwnPlantGrowth.uvFound = " UV found, allowing false light growth."; // Load all possible plant types - String sArray[] = new String[] { "BEETROOTS", "CACTUS", "CARROTS", "CHORUS_FLOWER", "COCOA", "KELP", "MELON", "MELON_STEM", "NETHER_WART", "POTATOES", "PUMPKIN", "PUMPKIN_STEM", "SUGAR_CANE", "SWEET_BERRY_BUSH", "ACACIA_SAPLING", "BIRCH_SAPLING", "DARK_OAK_SAPLING", "JUNGLE_SAPLING", "OAK_SAPLING", "SPRUCE_SAPLING", "RED_MUSHROOM", "BROWN_MUSHROOM"}; + String sArray[] = new String[] { "BAMBOO", "BAMBOO_SAPLING", "BEETROOTS", "CACTUS", "CARROTS", "CHORUS_FLOWER", "COCOA", "GRASS", "KELP", "MELON", "MELON_STEM", "NETHER_WART", "POTATOES", "PUMPKIN", "PUMPKIN_STEM", "SUGAR_CANE", "SWEET_BERRY_BUSH", "ACACIA_SAPLING", "BIRCH_SAPLING", "DARK_OAK_SAPLING", "JUNGLE_SAPLING", "OAK_SAPLING", "SPRUCE_SAPLING", "RED_MUSHROOM", "BROWN_MUSHROOM"}; PwnPlantGrowth.plantTypes = Arrays.asList(sArray); // Check for TerrainControl diff --git a/src/com/pwn9/PwnPlantGrowth/StructureGrowListener.java b/src/com/pwn9/PwnPlantGrowth/StructureGrowListener.java index 17279c5..4c81224 100644 --- a/src/com/pwn9/PwnPlantGrowth/StructureGrowListener.java +++ b/src/com/pwn9/PwnPlantGrowth/StructureGrowListener.java @@ -307,7 +307,7 @@ public void structureGrow(StructureGrowEvent e) // chance of death if (PwnPlantGrowth.random(curDeath)) { - e.getLocation().getBlock().setType(Material.GRASS); + e.getLocation().getBlock().setType(Material.DEAD_BUSH); toLog += " Died (Rate: " + curDeath + ")"; } } @@ -320,7 +320,7 @@ public void structureGrow(StructureGrowEvent e) // chance of death if (PwnPlantGrowth.random(curDeath)) { - e.getLocation().getBlock().setType(Material.GRASS); + e.getLocation().getBlock().setType(Material.DEAD_BUSH); toLog += " Died (Rate: " + curDeath + ")"; } }