Paper/nms-patches/WorldGenTreeProvider.patch

66 lines
3.4 KiB
Diff
Raw Normal View History

2018-07-15 02:00:00 +02:00
--- a/net/minecraft/server/WorldGenTreeProvider.java
+++ b/net/minecraft/server/WorldGenTreeProvider.java
@@ -2,6 +2,7 @@
import java.util.Random;
import javax.annotation.Nullable;
+import org.bukkit.TreeType; // CraftBukkit
public abstract class WorldGenTreeProvider {
2018-07-28 00:41:45 +02:00
@@ -16,6 +17,7 @@
2019-12-10 23:00:00 +01:00
if (worldgenfeatureconfigured == null) {
2018-07-15 02:00:00 +02:00
return false;
} else {
2019-12-10 23:00:00 +01:00
+ setTreeType(worldgenfeatureconfigured); // CraftBukkit
2018-07-15 02:00:00 +02:00
generatoraccess.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 4);
2019-12-10 23:00:00 +01:00
((WorldGenFeatureSmallTreeConfigurationConfiguration) worldgenfeatureconfigured.c).a();
if (worldgenfeatureconfigured.a(generatoraccess, chunkgenerator, random, blockposition)) {
@@ -26,4 +28,46 @@
2018-07-28 00:41:45 +02:00
}
}
}
+
+ // CraftBukkit start
2019-12-10 23:00:00 +01:00
+ protected void setTreeType(WorldGenFeatureConfigured<?, ?> worldgentreeabstract) {
+ if (worldgentreeabstract.c == BiomeDecoratorGroups.NORMAL_TREE) {
+ BlockSapling.treeType = TreeType.TREE;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.HUGE_RED_MUSHROOM) {
+ BlockSapling.treeType = TreeType.RED_MUSHROOM;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM) {
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.JUNGLE_TREE) {
+ BlockSapling.treeType = TreeType.COCOA_TREE;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.JUNGLE_TREE_NOVINE) {
+ BlockSapling.treeType = TreeType.SMALL_JUNGLE;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.PINE_TREE) {
+ BlockSapling.treeType = TreeType.TALL_REDWOOD;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.SPRUCE_TREE) {
+ BlockSapling.treeType = TreeType.REDWOOD;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.ACACIA_TREE) {
2018-07-28 00:41:45 +02:00
+ BlockSapling.treeType = TreeType.ACACIA;
2019-12-10 23:00:00 +01:00
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.BIRCH_TREE) {
2018-07-28 00:41:45 +02:00
+ BlockSapling.treeType = TreeType.BIRCH;
2019-12-10 23:00:00 +01:00
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.TALL_BIRCH_TREE) {
+ BlockSapling.treeType = TreeType.TALL_BIRCH;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.SWAMP_TREE) {
+ BlockSapling.treeType = TreeType.SWAMP;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.FANCY_TREE) {
+ BlockSapling.treeType = TreeType.BIG_TREE;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.JUNGLE_BUSH) {
+ BlockSapling.treeType = TreeType.JUNGLE_BUSH;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.DARK_OAK_TREE) {
2018-07-28 00:41:45 +02:00
+ BlockSapling.treeType = TreeType.DARK_OAK;
2019-12-10 23:00:00 +01:00
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.MEGA_SPRUCE_TREE) {
2018-07-28 00:41:45 +02:00
+ BlockSapling.treeType = TreeType.MEGA_REDWOOD;
2019-12-10 23:00:00 +01:00
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.MEGA_PINE_TREE) {
+ BlockSapling.treeType = TreeType.MEGA_REDWOOD;
+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.MEGA_JUNGLE_TREE) {
+ BlockSapling.treeType = TreeType.JUNGLE;
2018-07-28 00:41:45 +02:00
+ } else {
+ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract);
+ }
+ }
+ // CraftBukkit end
}