Skip to content

Commit d14b4f1

Browse files
committed
FIXED: in some cases, arraycopy throws an ArrayIndexOutOfBoundsException
1 parent 807b3e5 commit d14b4f1

1 file changed

Lines changed: 33 additions & 7 deletions

File tree

patches/minecraft/net/minecraft/world/gen/layer/GenLayerVoronoiZoom.java.patch

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,48 @@
11
--- before/net/minecraft/world/gen/layer/GenLayerVoronoiZoom.java
22
+++ after/net/minecraft/world/gen/layer/GenLayerVoronoiZoom.java
3-
@@ -22,12 +22,12 @@
3+
@@ -11,25 +11,28 @@
4+
@Override
5+
public int[] func_75904_a(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_)
6+
{
7+
- p_75904_1_ -= 2;
8+
- p_75904_2_ -= 2;
9+
+ // CREF start - FIXED: in some cases, arraycopy throws an ArrayIndexOutOfBoundsException
10+
+ //areaX -= 2;
11+
+ //areaY -= 2;
12+
int i = p_75904_1_ >> 2;
13+
int j = p_75904_2_ >> 2;
14+
- int k = (p_75904_3_ >> 2) + 2;
15+
- int l = (p_75904_4_ >> 2) + 2;
16+
+ //int k = (areaWidth >> 2) + 2;
17+
+ //int l = (areaHeight >> 2) + 2;
18+
+ int k = (p_75904_3_ >> 2) + 3;
19+
+ int l = (p_75904_4_ >> 2) + 3;
20+
+ // CREF end
21+
int[] aint = this.field_75909_a.func_75904_a(i, j, k, l);
22+
int i1 = k - 1 << 2;
423
int j1 = l - 1 << 2;
524
int[] aint1 = IntCache.func_76445_a(i1 * j1);
625

726
- for (int k1 = 0; k1 < l - 1; k1++)
827
+ for (int k1 = 0; k1 < l - 1; ++k1)
928
{
1029
int l1 = 0;
11-
int i2 = aint[l1 + 0 + (k1 + 0) * k];
30+
- int i2 = aint[l1 + 0 + (k1 + 0) * k];
31+
+ int i2 = aint[l1 + k1 * k];
1232

1333
- for (int j2 = aint[l1 + 0 + (k1 + 1) * k]; l1 < k - 1; l1++)
14-
+ for (int j2 = aint[l1 + 0 + (k1 + 1) * k]; l1 < k - 1; ++l1)
34+
+ for (int j2 = aint[l1 + (k1 + 1) * k]; l1 < k - 1; ++l1)
1535
{
16-
double d0 = 3.6;
36+
- double d0 = 3.6;
1737
this.func_75903_a((long)(l1 + i << 2), (long)(k1 + j << 2));
18-
@@ -45,11 +45,11 @@
19-
int k2 = aint[l1 + 1 + (k1 + 0) * k] & 0xFF;
38+
double d1 = ((double)this.func_75902_a(1024) / 1024.0 - 0.5) * 3.6;
39+
double d2 = ((double)this.func_75902_a(1024) / 1024.0 - 0.5) * 3.6;
40+
@@ -42,14 +45,14 @@
41+
this.func_75903_a((long)(l1 + i + 1 << 2), (long)(k1 + j + 1 << 2));
42+
double d7 = ((double)this.func_75902_a(1024) / 1024.0 - 0.5) * 3.6 + 4.0;
43+
double d8 = ((double)this.func_75902_a(1024) / 1024.0 - 0.5) * 3.6 + 4.0;
44+
- int k2 = aint[l1 + 1 + (k1 + 0) * k] & 0xFF;
45+
+ int k2 = aint[l1 + 1 + k1 * k] & 0xFF;
2046
int l2 = aint[l1 + 1 + (k1 + 1) * k] & 0xFF;
2147

2248
- for (int i3 = 0; i3 < 4; i3++)
@@ -29,7 +55,7 @@
2955
{
3056
double d9 = ((double)i3 - d2) * ((double)i3 - d2) + ((double)k3 - d1) * ((double)k3 - d1);
3157
double d10 = ((double)i3 - d4) * ((double)i3 - d4) + ((double)k3 - d3) * ((double)k3 - d3);
32-
@@ -82,7 +82,7 @@
58+
@@ -82,7 +85,7 @@
3359

3460
int[] aint2 = IntCache.func_76445_a(p_75904_3_ * p_75904_4_);
3561

0 commit comments

Comments
 (0)