Paper/nms-patches/WorldGenTreeProvider.patch

66 lines
3.5 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
2020-01-21 22:00:00 +01:00
@@ -3,6 +3,7 @@
import java.util.Iterator;
2018-07-15 02:00:00 +02:00
import java.util.Random;
import javax.annotation.Nullable;
+import org.bukkit.TreeType; // CraftBukkit
public abstract class WorldGenTreeProvider {
2020-01-21 22:00:00 +01:00
@@ -17,6 +18,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
2020-06-25 02:00:00 +02:00
worldserver.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 4);
2020-08-11 23:00:00 +02:00
((WorldGenFeatureTreeConfiguration) worldgenfeatureconfigured.f).b();
if (worldgenfeatureconfigured.a(worldserver, chunkgenerator, random, blockposition)) {
2020-01-21 22:00:00 +01:00
@@ -43,4 +45,46 @@
return true;
2018-07-28 00:41:45 +02:00
}
+
+ // CraftBukkit start
2019-12-10 23:00:00 +01:00
+ protected void setTreeType(WorldGenFeatureConfigured<?, ?> worldgentreeabstract) {
2020-08-12 00:54:53 +02:00
+ if (worldgentreeabstract == BiomeDecoratorGroups.OAK || worldgentreeabstract == BiomeDecoratorGroups.OAK_BEES_005) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.TREE;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.HUGE_RED_MUSHROOM) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.RED_MUSHROOM;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.JUNGLE_TREE) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.COCOA_TREE;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.JUNGLE_TREE_NO_VINE) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.SMALL_JUNGLE;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.PINE) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.TALL_REDWOOD;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.SPRUCE) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.REDWOOD;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.ACACIA) {
2018-07-28 00:41:45 +02:00
+ BlockSapling.treeType = TreeType.ACACIA;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.BIRCH || worldgentreeabstract == BiomeDecoratorGroups.BIRCH_BEES_005) {
2018-07-28 00:41:45 +02:00
+ BlockSapling.treeType = TreeType.BIRCH;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.SUPER_BIRCH_BEES_0002) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.TALL_BIRCH;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.SWAMP_TREE) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.SWAMP;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.FANCY_OAK || worldgentreeabstract == BiomeDecoratorGroups.FANCY_OAK_BEES_005) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.BIG_TREE;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.JUNGLE_BUSH) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.JUNGLE_BUSH;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.DARK_OAK) {
2018-07-28 00:41:45 +02:00
+ BlockSapling.treeType = TreeType.DARK_OAK;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.MEGA_SPRUCE) {
2018-07-28 00:41:45 +02:00
+ BlockSapling.treeType = TreeType.MEGA_REDWOOD;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.MEGA_PINE) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.MEGA_REDWOOD;
2020-08-12 00:54:53 +02:00
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.MEGA_JUNGLE_TREE) {
2019-12-10 23:00:00 +01:00
+ BlockSapling.treeType = TreeType.JUNGLE;
2018-07-28 00:41:45 +02:00
+ } else {
+ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract);
+ }
+ }
+ // CraftBukkit end
}