Skip to content

Commit

Permalink
bonemeal on grass, bamboo and bamboo sapling, should all be working now
Browse files Browse the repository at this point in the history
  • Loading branch information
msudol committed Jan 1, 2020
1 parent 2667994 commit 82b7766
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
24 changes: 22 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/com/pwn9/PwnPlantGrowth/BlockGrowListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 + ")";
}
Expand All @@ -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 + ")";
}
Expand Down Expand Up @@ -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")
{

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/com/pwn9/PwnPlantGrowth/BlockSpreadListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")";
}
Expand All @@ -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 + ")";
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/pwn9/PwnPlantGrowth/PwnPlantGrowth.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/com/pwn9/PwnPlantGrowth/StructureGrowListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")";
}
}
Expand All @@ -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 + ")";
}
}
Expand Down

0 comments on commit 82b7766

Please sign in to comment.