Skip to content

Commit

Permalink
Add spore blossoms to the dance list.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Apr 4, 2024
1 parent df902b9 commit 1a20ed6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<java.version>17</java.version>
<powermock.version>1.7.4</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.19-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.20-R0.1-SNAPSHOT</spigot.version>
<!-- BentoBox API version -->
<bentobox.version>1.20.0</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/world/bentobox/farmersdance/configs/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,28 @@ public void setGrowBerries(boolean growBerries)
}


/**
* Is grow spore blossom boolean.
*
* @return the boolean
*/
public boolean isGrowSporeBlossom()
{
return this.growSporeBlossom;
}


/**
* Sets grow spore blossom.
*
* @param growSporeBlossom the grow spore blossom
*/
public void setGrowSporeBlossom(boolean growSporeBlossom)
{
this.growSporeBlossom = growSporeBlossom;
}


/**
* Gets maximal cactus size.
*
Expand Down Expand Up @@ -647,6 +669,13 @@ public void setMaximalSugarCaneSize(int maximalSugarCaneSize)
@ConfigEntry(path = "groups.grow-berries")
private boolean growBerries = true;

@ConfigComment("")
@ConfigComment("Toggles if dancing will affect spore blossoms.")
@ConfigComment("Dancing near spore blossoms will drop new spore blossom.")
@ConfigComment("Default value = false.")
@ConfigEntry(path = "groups.spore-blossoms")
private boolean growSporeBlossom = true;

@ConfigComment("")
@ConfigComment("The maximal cactus size that it can grow to.")
@ConfigComment("Default value = 3.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ protected void buildTask(final World world, final Player player)
boolean growKelpAndDripLeaf = this.addon.getSettings().isGrowKelpAndDripLeaf();
boolean growChorusFlower = this.addon.getSettings().isGrowChorusFlower();
boolean growBerries = this.addon.getSettings().isGrowBerries();
boolean growSporeBlossom = this.addon.getSettings().isGrowSporeBlossom();

final int xRange = this.addon.getSettings().getAffectRadius();
final int zRange = this.addon.getSettings().getAffectRadius();
Expand All @@ -84,7 +85,7 @@ protected void buildTask(final World world, final Player player)
{
Block block = world.getBlockAt(
location.getBlockX() + this.random.nextInt(xRange * 2 + 1) - xRange,
location.getBlockY() + this.random.nextInt(yRange * 2 + 1) - yRange,
(int) Math.round(location.getY()) + this.random.nextInt(yRange * 2 + 1) - yRange,
location.getBlockZ() + this.random.nextInt(zRange * 2 + 1) - zRange);

if (Tag.SAPLINGS.isTagged(block.getType()) ||
Expand Down Expand Up @@ -351,6 +352,15 @@ else if (Material.CHORUS_FLOWER.equals(block.getType()))
}
}
}
else if (Material.SPORE_BLOSSOM.equals(block.getType()))
{
if (growSporeBlossom)
{
// Apply bone meal to spore blossom
block.getDrops().forEach(drop -> block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.5, 0.5), drop));
this.spawnParticle(block.getLocation());
}
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ groups:
# Dancing near berries will produce berries.
# Default value = true.
grow-berries: true
#
# Toggles if dancing will affect spore blossoms.
# Dancing near spore blossoms will drop new spore blossom.
# Default value = true.
grow-spore-blossoms: false
size:
# The maximal cactus size that it can grow to.
# Default value = 3.
Expand Down

0 comments on commit 1a20ed6

Please sign in to comment.