@@ -36,32 +36,32 @@ public WorldGenMulberryTree(boolean p_i45448_1_, int minTreeHeight, int maxTreeH
36
36
}
37
37
38
38
@ Override
39
- public boolean generate (World p_76484_1_ , Random p_76484_2_ , int p_76484_3_ , int p_76484_4_ , int p_76484_5_ ) {
40
- int l = p_76484_2_ .nextInt (this .maxTreeHeight - this .minTreeHeight ) + this .minTreeHeight ;
39
+ public boolean generate (World world , Random rand , int x , int y , int z ) {
40
+ int l = rand .nextInt (this .maxTreeHeight - this .minTreeHeight ) + this .minTreeHeight ;
41
41
boolean flag = true ;
42
42
43
- if (p_76484_4_ >= 1 && p_76484_4_ + l + 1 <= 256 ) {
43
+ if (y >= 1 && y + l + 1 <= 256 ) {
44
44
byte b0 ;
45
45
int k1 ;
46
46
Block block ;
47
47
48
- for (int i1 = p_76484_4_ ; i1 <= p_76484_4_ + 1 + l ; ++i1 ) {
48
+ for (int i1 = y ; i1 <= y + 1 + l ; ++i1 ) {
49
49
b0 = 1 ;
50
50
51
- if (i1 == p_76484_4_ ) {
51
+ if (i1 == y ) {
52
52
b0 = 0 ;
53
53
}
54
54
55
- if (i1 >= p_76484_4_ + 1 + l - 2 ) {
55
+ if (i1 >= y + 1 + l - 2 ) {
56
56
b0 = 2 ;
57
57
}
58
58
59
- for (int j1 = p_76484_3_ - b0 ; j1 <= p_76484_3_ + b0 && flag ; ++j1 ) {
60
- for (k1 = p_76484_5_ - b0 ; k1 <= p_76484_5_ + b0 && flag ; ++k1 ) {
59
+ for (int j1 = x - b0 ; j1 <= x + b0 && flag ; ++j1 ) {
60
+ for (k1 = z - b0 ; k1 <= z + b0 && flag ; ++k1 ) {
61
61
if (i1 >= 0 && i1 < 256 ) {
62
- block = p_76484_1_ .getBlock (j1 , i1 , k1 );
62
+ block = world .getBlock (j1 , i1 , k1 );
63
63
64
- if (!this .isReplaceable (p_76484_1_ , j1 , i1 , k1 )) {
64
+ if (!this .isReplaceable (world , j1 , i1 , k1 )) {
65
65
flag = false ;
66
66
}
67
67
} else {
@@ -74,48 +74,48 @@ public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int
74
74
if (!flag ) {
75
75
return false ;
76
76
} else {
77
- Block block2 = p_76484_1_ .getBlock (p_76484_3_ , p_76484_4_ - 1 , p_76484_5_ );
77
+ Block block2 = world .getBlock (x , y - 1 , z );
78
78
79
- boolean isSoil = block2 .canSustainPlant (p_76484_1_ , p_76484_3_ , p_76484_4_ - 1 , p_76484_5_ ,
79
+ boolean isSoil = block2 .canSustainPlant (world , x , y - 1 , z ,
80
80
ForgeDirection .UP , (IPlantable ) treeSapling );
81
- if (isSoil && p_76484_4_ < 256 - l - 1 ) {
82
- block2 .onPlantGrow (p_76484_1_ , p_76484_3_ , p_76484_4_ - 1 , p_76484_5_ , p_76484_3_ , p_76484_4_ ,
83
- p_76484_5_ );
81
+ if (isSoil && y < 256 - l - 1 ) {
82
+ block2 .onPlantGrow (world , x , y - 1 , z , x , y ,
83
+ z );
84
84
b0 = 3 ;
85
85
byte b1 = 0 ;
86
86
int l1 ;
87
87
int i2 ;
88
88
int j2 ;
89
89
int i3 ;
90
90
91
- for (k1 = p_76484_4_ - b0 + l ; k1 <= p_76484_4_ + l ; ++k1 ) {
92
- i3 = k1 - (p_76484_4_ + l );
91
+ for (k1 = y - b0 + l ; k1 <= y + l ; ++k1 ) {
92
+ i3 = k1 - (y + l );
93
93
l1 = b1 + 1 - i3 / 2 ;
94
94
95
- for (i2 = p_76484_3_ - l1 ; i2 <= p_76484_3_ + l1 ; ++i2 ) {
96
- j2 = i2 - p_76484_3_ ;
95
+ for (i2 = x - l1 ; i2 <= x + l1 ; ++i2 ) {
96
+ j2 = i2 - x ;
97
97
98
- for (int k2 = p_76484_5_ - l1 ; k2 <= p_76484_5_ + l1 ; ++k2 ) {
99
- int l2 = k2 - p_76484_5_ ;
98
+ for (int k2 = z - l1 ; k2 <= z + l1 ; ++k2 ) {
99
+ int l2 = k2 - z ;
100
100
101
- if (Math .abs (j2 ) != l1 || Math .abs (l2 ) != l1 || p_76484_2_ .nextInt (2 ) != 0 && i3 != 0 ) {
102
- Block block1 = p_76484_1_ .getBlock (i2 , k1 , k2 );
101
+ if (Math .abs (j2 ) != l1 || Math .abs (l2 ) != l1 || rand .nextInt (2 ) != 0 && i3 != 0 ) {
102
+ Block block1 = world .getBlock (i2 , k1 , k2 );
103
103
104
- if (block1 .isAir (p_76484_1_ , i2 , k1 , k2 )
105
- || block1 .isLeaves (p_76484_1_ , i2 , k1 , k2 )) {
106
- this .setBlockAndNotifyAdequately (p_76484_1_ , i2 , k1 , k2 , treeLeaf , 0 );
104
+ if (block1 .isAir (world , i2 , k1 , k2 )
105
+ || block1 .isLeaves (world , i2 , k1 , k2 )) {
106
+ this .setBlockAndNotifyAdequately (world , i2 , k1 , k2 , treeLeaf , 0 );
107
107
}
108
108
}
109
109
}
110
110
}
111
111
}
112
112
113
113
for (k1 = 0 ; k1 < l ; ++k1 ) {
114
- block = p_76484_1_ .getBlock (p_76484_3_ , p_76484_4_ + k1 , p_76484_5_ );
114
+ block = world .getBlock (x , y + k1 , z );
115
115
116
- if (block .isAir (p_76484_1_ , p_76484_3_ , p_76484_4_ + k1 , p_76484_5_ )
117
- || block .isLeaves (p_76484_1_ , p_76484_3_ , p_76484_4_ + k1 , p_76484_5_ )) {
118
- this .setBlockAndNotifyAdequately (p_76484_1_ , p_76484_3_ , p_76484_4_ + k1 , p_76484_5_ ,
116
+ if (block .isAir (world , x , y + k1 , z )
117
+ || block .isLeaves (world , x , y + k1 , z )) {
118
+ this .setBlockAndNotifyAdequately (world , x , y + k1 , z ,
119
119
treeBlock , 0 );
120
120
}
121
121
}
@@ -132,14 +132,18 @@ public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int
132
132
@ Override
133
133
public void generate (Random random , int chunkX , int chunkZ , World world , IChunkProvider chunkGenerator ,
134
134
IChunkProvider chunkProvider ) {
135
- int x = chunkX * 16 + random .nextInt (16 );
136
- int z = chunkZ * 16 + random .nextInt (16 );
137
- int biomeID = world .getBiomeGenForCoords (x , z ).biomeID ;
138
- if (biomeID == 4 ) {
139
- Block topBlock = world .getTopBlock (x , z );
140
- if (topBlock == Blocks .grass ) {
141
- this .generate (world , random , x , world .getTopSolidOrLiquidBlock (x , z ), z );
135
+ try {
136
+ int x = chunkX * 16 + random .nextInt (16 );
137
+ int z = chunkZ * 16 + random .nextInt (16 );
138
+ int biomeID = world .getBiomeGenForCoords (x , z ).biomeID ;
139
+ if (biomeID == 4 ) {
140
+ Block topBlock = world .getTopBlock (x , z );
141
+ if (topBlock == Blocks .grass ) {
142
+ this .generate (world , random , x , world .getTopSolidOrLiquidBlock (x , z ), z );
143
+ }
142
144
}
145
+ } catch (Exception e ) {
146
+ e .printStackTrace ();
143
147
}
144
148
}
145
149
0 commit comments