mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Separate chunk gen and sapling beehive chances
This commit is contained in:
@@ -390,6 +390,26 @@ beehive
|
||||
* can-generate-from-saplings
|
||||
* **default:** false
|
||||
* **description:** Trees grown from saplings have the same chance to have a beehive as if from chunk generation
|
||||
* generation-chance
|
||||
* plains
|
||||
* **default:** 0.05
|
||||
* **description:** Chance a beehive generates on an oak tree in the plains biome
|
||||
* sunflower-plains
|
||||
* **default:** 0.05
|
||||
* **description:** Chance a beehive generates on an oak tree in the sunflower plains biome
|
||||
* flower-forest
|
||||
* **default:** 0.01
|
||||
* **description:** Chance a beehive generates on an oak or birch tree in the flower forest biome
|
||||
* sapling-chance
|
||||
* plains
|
||||
* **default:** 0.05
|
||||
* **description:** Chance a beehive grows on an oak tree in the plains biome from a sapling
|
||||
* sunflower-plains
|
||||
* **default:** 0.05
|
||||
* **description:** Chance a beehive grows on an oak tree in the sunflower plains biome from a sapling
|
||||
* flower-forest
|
||||
* **default:** 0.01
|
||||
* **description:** Chance a beehive grows on an oak or birch tree in the flower forest biome from a sapling
|
||||
|
||||
hay-block-fall-damage
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
From ba45df2abe629108d5390ea37db225890b8f0303 Mon Sep 17 00:00:00 2001
|
||||
From 04ca8f191b83e609498db65956691ecdceeaae62 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 5 Jan 2020 12:07:28 -0600
|
||||
Subject: [PATCH] Add configurable beehive generation chance
|
||||
|
||||
---
|
||||
.../minecraft/server/WorldGenFeatureTreeBeehive.java | 12 ++++++++++--
|
||||
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 6 ++++++
|
||||
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||
.../server/WorldGenFeatureTreeBeehive.java | 18 ++++++++++++++++--
|
||||
.../net/pl3x/purpur/PurpurWorldConfig.java | 12 ++++++++++++
|
||||
2 files changed, 28 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldGenFeatureTreeBeehive.java b/src/main/java/net/minecraft/server/WorldGenFeatureTreeBeehive.java
|
||||
index e85e096cd6..b914bc541f 100644
|
||||
index e85e096cd6..ca4b5b77fb 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldGenFeatureTreeBeehive.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldGenFeatureTreeBeehive.java
|
||||
@@ -10,7 +10,7 @@ import java.util.stream.Collectors;
|
||||
@@ -31,15 +31,21 @@ index e85e096cd6..b914bc541f 100644
|
||||
if (BlockSapling.growing) {
|
||||
MinecraftServer.getServer().scheduleOnMain(() -> {
|
||||
generate(generatoraccess, random, list, list1, set, structureboundingbox);
|
||||
@@ -35,6 +35,14 @@ public class WorldGenFeatureTreeBeehive extends WorldGenFeatureTree {
|
||||
@@ -35,6 +35,20 @@ public class WorldGenFeatureTreeBeehive extends WorldGenFeatureTree {
|
||||
}
|
||||
}
|
||||
|
||||
+ private float getChance(World world, BlockPosition position) {
|
||||
+ BiomeBase biome = world.getBiome(position);
|
||||
+ if (biome == Biomes.PLAINS) return world.purpurConfig.beehivesPlainsChance;
|
||||
+ else if (biome == Biomes.SUNFLOWER_PLAINS) return world.purpurConfig.beehivesSunflowerPlainsChance;
|
||||
+ else if (biome == Biomes.FLOWER_FOREST) return world.purpurConfig.beehivesFlowerForestChance;
|
||||
+ if (BlockSapling.growing) {
|
||||
+ if (biome == Biomes.PLAINS) return world.purpurConfig.beehivesGrowPlainsChance;
|
||||
+ else if (biome == Biomes.SUNFLOWER_PLAINS) return world.purpurConfig.beehivesGrowSunflowerPlainsChance;
|
||||
+ else if (biome == Biomes.FLOWER_FOREST) return world.purpurConfig.beehivesGrowFlowerForestChance;
|
||||
+ } else {
|
||||
+ if (biome == Biomes.PLAINS) return world.purpurConfig.beehivesGeneratePlainsChance;
|
||||
+ else if (biome == Biomes.SUNFLOWER_PLAINS) return world.purpurConfig.beehivesGenerateSunflowerPlainsChance;
|
||||
+ else if (biome == Biomes.FLOWER_FOREST) return world.purpurConfig.beehivesGenerateFlowerForestChance;
|
||||
+ }
|
||||
+ return getChance();
|
||||
+ }
|
||||
+
|
||||
@@ -47,21 +53,27 @@ index e85e096cd6..b914bc541f 100644
|
||||
// Purpur end
|
||||
EnumDirection enumdirection = BlockBeehive.a[random.nextInt(BlockBeehive.a.length)];
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 340697ae53..f09fdf1c1d 100644
|
||||
index 340697ae53..64e00258ac 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -145,8 +145,14 @@ public class PurpurWorldConfig {
|
||||
@@ -145,8 +145,20 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean beeHivesGenerateFromSaplings = false;
|
||||
+ public float beehivesPlainsChance = 0.05F;
|
||||
+ public float beehivesSunflowerPlainsChance = 0.05F;
|
||||
+ public float beehivesFlowerForestChance = 0.01F;
|
||||
+ public float beehivesGeneratePlainsChance = 0.05F;
|
||||
+ public float beehivesGenerateSunflowerPlainsChance = 0.05F;
|
||||
+ public float beehivesGenerateFlowerForestChance = 0.01F;
|
||||
+ public float beehivesGrowPlainsChance = 0.05F;
|
||||
+ public float beehivesGrowSunflowerPlainsChance = 0.05F;
|
||||
+ public float beehivesGrowFlowerForestChance = 0.01F;
|
||||
private void beehiveSettings() {
|
||||
beeHivesGenerateFromSaplings = getBoolean("beehive.can-generate-from-saplings", beeHivesGenerateFromSaplings);
|
||||
+ beehivesPlainsChance = (float) getDouble("beehive.chance.plains", beehivesPlainsChance);
|
||||
+ beehivesSunflowerPlainsChance = (float) getDouble("beehive.chance.sunflower-plains", beehivesSunflowerPlainsChance);
|
||||
+ beehivesFlowerForestChance = (float) getDouble("beehive.chance.flower-forest", beehivesFlowerForestChance);
|
||||
+ beehivesGeneratePlainsChance = (float) getDouble("beehive.generation-chance.plains", beehivesGeneratePlainsChance);
|
||||
+ beehivesGenerateSunflowerPlainsChance = (float) getDouble("beehive.generation-chance.sunflower-plains", beehivesGenerateSunflowerPlainsChance);
|
||||
+ beehivesGenerateFlowerForestChance = (float) getDouble("beehive.generation-chance.flower-forest", beehivesGenerateFlowerForestChance);
|
||||
+ beehivesGrowPlainsChance = (float) getDouble("beehive.grow-chance.plains", beehivesGrowPlainsChance);
|
||||
+ beehivesGrowSunflowerPlainsChance = (float) getDouble("beehive.grow-chance.sunflower-plains", beehivesGrowSunflowerPlainsChance);
|
||||
+ beehivesGrowFlowerForestChance = (float) getDouble("beehive.grow-chance.flower-forest", beehivesGrowFlowerForestChance);
|
||||
}
|
||||
|
||||
public boolean hayBlockFallDamage = true;
|
||||
|
||||
Reference in New Issue
Block a user