13
0
geforkt von Mirrors/Paper
Paper/nms-patches/WorldGenTreeProvider.patch
2020-08-12 08:54:53 +10:00

66 Zeilen
3.5 KiB
Diff

--- a/net/minecraft/server/WorldGenTreeProvider.java
+++ b/net/minecraft/server/WorldGenTreeProvider.java
@@ -3,6 +3,7 @@
import java.util.Iterator;
import java.util.Random;
import javax.annotation.Nullable;
+import org.bukkit.TreeType; // CraftBukkit
public abstract class WorldGenTreeProvider {
@@ -17,6 +18,7 @@
if (worldgenfeatureconfigured == null) {
return false;
} else {
+ setTreeType(worldgenfeatureconfigured); // CraftBukkit
worldserver.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 4);
((WorldGenFeatureTreeConfiguration) worldgenfeatureconfigured.f).b();
if (worldgenfeatureconfigured.a(worldserver, chunkgenerator, random, blockposition)) {
@@ -43,4 +45,46 @@
return true;
}
+
+ // CraftBukkit start
+ protected void setTreeType(WorldGenFeatureConfigured<?, ?> worldgentreeabstract) {
+ if (worldgentreeabstract == BiomeDecoratorGroups.OAK || worldgentreeabstract == BiomeDecoratorGroups.OAK_BEES_005) {
+ BlockSapling.treeType = TreeType.TREE;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.HUGE_RED_MUSHROOM) {
+ BlockSapling.treeType = TreeType.RED_MUSHROOM;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM) {
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.JUNGLE_TREE) {
+ BlockSapling.treeType = TreeType.COCOA_TREE;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.JUNGLE_TREE_NO_VINE) {
+ BlockSapling.treeType = TreeType.SMALL_JUNGLE;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.PINE) {
+ BlockSapling.treeType = TreeType.TALL_REDWOOD;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.SPRUCE) {
+ BlockSapling.treeType = TreeType.REDWOOD;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.ACACIA) {
+ BlockSapling.treeType = TreeType.ACACIA;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.BIRCH || worldgentreeabstract == BiomeDecoratorGroups.BIRCH_BEES_005) {
+ BlockSapling.treeType = TreeType.BIRCH;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.SUPER_BIRCH_BEES_0002) {
+ BlockSapling.treeType = TreeType.TALL_BIRCH;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.SWAMP_TREE) {
+ BlockSapling.treeType = TreeType.SWAMP;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.FANCY_OAK || worldgentreeabstract == BiomeDecoratorGroups.FANCY_OAK_BEES_005) {
+ BlockSapling.treeType = TreeType.BIG_TREE;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.JUNGLE_BUSH) {
+ BlockSapling.treeType = TreeType.JUNGLE_BUSH;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.DARK_OAK) {
+ BlockSapling.treeType = TreeType.DARK_OAK;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.MEGA_SPRUCE) {
+ BlockSapling.treeType = TreeType.MEGA_REDWOOD;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.MEGA_PINE) {
+ BlockSapling.treeType = TreeType.MEGA_REDWOOD;
+ } else if (worldgentreeabstract == BiomeDecoratorGroups.MEGA_JUNGLE_TREE) {
+ BlockSapling.treeType = TreeType.JUNGLE;
+ } else {
+ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract);
+ }
+ }
+ // CraftBukkit end
}