mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-16 17:16:11 +00:00
parent
f7a0c14a1b
commit
39081e62c9
@ -8,7 +8,7 @@ public class ExtentHeightCacher extends PassthroughExtent {
|
|||||||
|
|
||||||
private transient int cacheBotX = Integer.MIN_VALUE;
|
private transient int cacheBotX = Integer.MIN_VALUE;
|
||||||
private transient int cacheBotZ = Integer.MIN_VALUE;
|
private transient int cacheBotZ = Integer.MIN_VALUE;
|
||||||
private transient byte[] cacheHeights;
|
private transient short[] cacheHeights;
|
||||||
private transient int lastY;
|
private transient int lastY;
|
||||||
|
|
||||||
public ExtentHeightCacher(Extent extent) {
|
public ExtentHeightCacher(Extent extent) {
|
||||||
@ -19,7 +19,7 @@ public class ExtentHeightCacher extends PassthroughExtent {
|
|||||||
cacheBotX = Integer.MIN_VALUE;
|
cacheBotX = Integer.MIN_VALUE;
|
||||||
cacheBotZ = Integer.MIN_VALUE;
|
cacheBotZ = Integer.MIN_VALUE;
|
||||||
if (cacheHeights != null) {
|
if (cacheHeights != null) {
|
||||||
Arrays.fill(cacheHeights, (byte) 0);
|
Arrays.fill(cacheHeights, (short) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,9 +36,10 @@ public class ExtentHeightCacher extends PassthroughExtent {
|
|||||||
rz = z - cacheBotZ + 16;
|
rz = z - cacheBotZ + 16;
|
||||||
index = rx + (rz << 8);
|
index = rx + (rz << 8);
|
||||||
if (cacheHeights == null) {
|
if (cacheHeights == null) {
|
||||||
cacheHeights = new byte[65536];
|
cacheHeights = new short[65536];
|
||||||
|
Arrays.fill(cacheHeights, (short) minY);
|
||||||
} else {
|
} else {
|
||||||
Arrays.fill(cacheHeights, (byte) 0);
|
Arrays.fill(cacheHeights, (short) minY);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
index = rx + (rz << 8);
|
index = rx + (rz << 8);
|
||||||
|
@ -24,7 +24,7 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask {
|
|||||||
protected final int distance;
|
protected final int distance;
|
||||||
protected transient int cacheBotX = Integer.MIN_VALUE;
|
protected transient int cacheBotX = Integer.MIN_VALUE;
|
||||||
protected transient int cacheBotZ = Integer.MIN_VALUE;
|
protected transient int cacheBotZ = Integer.MIN_VALUE;
|
||||||
protected transient byte[] cacheHeights;
|
protected transient short[] cacheHeights;
|
||||||
protected transient int lastY;
|
protected transient int lastY;
|
||||||
protected transient int lastX = Integer.MIN_VALUE;
|
protected transient int lastX = Integer.MIN_VALUE;
|
||||||
protected transient int lastZ = Integer.MIN_VALUE;
|
protected transient int lastZ = Integer.MIN_VALUE;
|
||||||
@ -65,14 +65,15 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask {
|
|||||||
rz = z - cacheBotZ + 16;
|
rz = z - cacheBotZ + 16;
|
||||||
index = rx + (rz << 8);
|
index = rx + (rz << 8);
|
||||||
if (cacheHeights == null) {
|
if (cacheHeights == null) {
|
||||||
cacheHeights = new byte[65536];
|
cacheHeights = new short[65536];
|
||||||
|
Arrays.fill(cacheHeights, (short) minY);
|
||||||
} else {
|
} else {
|
||||||
Arrays.fill(cacheHeights, (byte) 0);
|
Arrays.fill(cacheHeights, (short) minY);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
index = rx + (rz << 8);
|
index = rx + (rz << 8);
|
||||||
}
|
}
|
||||||
int result = cacheHeights[index] & 0xFF;
|
int result = cacheHeights[index];
|
||||||
if (y > result) {
|
if (y > result) {
|
||||||
cacheHeights[index] = (byte) (result = lastY = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY));
|
cacheHeights[index] = (byte) (result = lastY = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user