aboutsummaryrefslogtreecommitdiffhomepage
path: root/CraftBukkit-Patches/0136-Don-t-let-trees-replace-any-block.patch
blob: 87c3b1bdb7caaf222b4ae5ef45cedefcb0210e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From cd96be6bb68af25e5498e24a758c602d681b506f Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Mon, 20 Jan 2014 20:42:28 +0000
Subject: [PATCH] Don't let trees replace any block.


diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java
index c0d0ff9..6196163 100644
--- a/src/main/java/net/minecraft/server/WorldGenForestTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java
@@ -124,7 +124,12 @@ public class WorldGenForestTree extends WorldGenTreeAbstract {
                                 int k3;
 
                                 for (k3 = 0; k3 < j3; ++k3) {
-                                    this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1);
+                                    Block block = world.getType(i + l2, k2 - k3 - 1, k + i3);
+
+                                    if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES)
+                                    {
+                                        this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1);
+                                    }
                                 }
 
                                 int l3;
-- 
1.9.1