3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 21:10:17 +01:00
Paper/nms-patches/WorldGenTreeProvider.patch

50 Zeilen
2.1 KiB
Diff

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 @@
2018-07-15 02:00:00 +02:00
if (worldgentreeabstract == null) {
return false;
} else {
2018-07-28 00:41:45 +02:00
+ setTreeType(worldgentreeabstract); // CraftBukkit
2018-07-15 02:00:00 +02:00
generatoraccess.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 4);
if (worldgentreeabstract.generate(generatoraccess, generatoraccess.getChunkProvider().getChunkGenerator(), random, blockposition, WorldGenFeatureConfiguration.e)) {
return true;
2018-07-28 00:41:45 +02:00
@@ -25,4 +27,30 @@
}
}
}
+
+ // CraftBukkit start
+ protected void setTreeType(WorldGenTreeAbstract worldgentreeabstract) {
+ if (worldgentreeabstract instanceof WorldGenAcaciaTree) {
+ BlockSapling.treeType = TreeType.ACACIA;
+ } else if (worldgentreeabstract instanceof WorldGenBigTree) {
+ BlockSapling.treeType = TreeType.BIG_TREE;
+ } else if (worldgentreeabstract instanceof WorldGenForest) {
+ BlockSapling.treeType = TreeType.BIRCH;
+ } else if (worldgentreeabstract instanceof WorldGenForestTree) {
+ BlockSapling.treeType = TreeType.DARK_OAK;
+ } else if (worldgentreeabstract instanceof WorldGenJungleTree) {
+ BlockSapling.treeType = TreeType.JUNGLE;
+ } else if (worldgentreeabstract instanceof WorldGenMegaTree) {
+ BlockSapling.treeType = TreeType.MEGA_REDWOOD;
+ } else if (worldgentreeabstract instanceof WorldGenTaiga1) {
+ BlockSapling.treeType = TreeType.REDWOOD;
+ } else if (worldgentreeabstract instanceof WorldGenTaiga2) {
+ BlockSapling.treeType = TreeType.REDWOOD;
+ } else if (worldgentreeabstract instanceof WorldGenTrees) {
+ BlockSapling.treeType = TreeType.TREE;
+ } else {
+ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract);
+ }
+ }
+ // CraftBukkit end
}