mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-25 03:55:35 +01:00
Fix passthrough cache
This commit is contained in:
parent
f37520cae1
commit
cdbe396ae6
@ -135,6 +135,34 @@ public class FaweCache {
|
||||
}
|
||||
|
||||
static {
|
||||
for (int i = 0; i < Character.MAX_VALUE; i++) {
|
||||
int id = i >> 4;
|
||||
int data = i & 0xf;
|
||||
if (FaweCache.hasNBT(id)) {
|
||||
CACHE_BLOCK[i] = new ImmutableNBTBlock(id, data);
|
||||
} else if (FaweCache.hasData(id)) {
|
||||
CACHE_BLOCK[i] = new ImmutableBlock(id, data);
|
||||
} else {
|
||||
CACHE_BLOCK[i] = new ImmutableDatalessBlock(id);
|
||||
}
|
||||
CACHE_ITEM[i] = new BaseItem(id, (short) data) {
|
||||
|
||||
@Override
|
||||
public void setData(short data) {
|
||||
throw new IllegalStateException("Cannot set data");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(short data) {
|
||||
throw new IllegalStateException("Cannot set data");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(int id) {
|
||||
throw new IllegalStateException("Cannot set id");
|
||||
}
|
||||
};
|
||||
}
|
||||
for (int i = 0; i < 256; i++) {
|
||||
CACHE_BIOME[i] = new BaseBiome(i) {
|
||||
@Override
|
||||
@ -173,36 +201,9 @@ public class FaweCache {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable ignore) {}
|
||||
for (int i = 0; i < Character.MAX_VALUE; i++) {
|
||||
int id = i >> 4;
|
||||
int data = i & 0xf;
|
||||
if (FaweCache.hasNBT(id)) {
|
||||
CACHE_BLOCK[i] = new ImmutableNBTBlock(id, data);
|
||||
} else if (FaweCache.hasData(id)) {
|
||||
CACHE_BLOCK[i] = new ImmutableBlock(id, data);
|
||||
} else {
|
||||
CACHE_BLOCK[i] = new ImmutableDatalessBlock(id);
|
||||
}
|
||||
CACHE_ITEM[i] = new BaseItem(id, (short) data) {
|
||||
|
||||
@Override
|
||||
public void setData(short data) {
|
||||
throw new IllegalStateException("Cannot set data");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(short data) {
|
||||
throw new IllegalStateException("Cannot set data");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(int id) {
|
||||
throw new IllegalStateException("Cannot set id");
|
||||
}
|
||||
};
|
||||
} catch (Throwable ignore) {
|
||||
ignore.printStackTrace();
|
||||
}
|
||||
|
||||
CACHE_COLOR[getCombined(0, 0)] = new Color(128, 128, 128); //Air
|
||||
CACHE_COLOR[getCombined(1, 0)] = new Color(180, 180, 180); //stone
|
||||
CACHE_COLOR[getCombined(2, 0)] = new Color(0, 225, 0); //grass
|
||||
|
@ -116,6 +116,7 @@ public interface HeightMap {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int height = pos.getBlockY();
|
||||
for (int x = -size; x <= size; x++) {
|
||||
int xx = centerX + x;
|
||||
mutablePos.mutX(xx);
|
||||
@ -137,11 +138,10 @@ public interface HeightMap {
|
||||
raise = getHeight(-z, -x);
|
||||
break;
|
||||
}
|
||||
int height;
|
||||
if (layers) {
|
||||
height = session.getNearestSurfaceLayer(xx, zz, pos.getBlockY(), 0, maxY);
|
||||
height = session.getNearestSurfaceLayer(xx, zz, height, 0, maxY);
|
||||
} else {
|
||||
height = session.getNearestSurfaceTerrainBlock(xx, zz, pos.getBlockY(), 0, 255);
|
||||
height = session.getNearestSurfaceTerrainBlock(xx, zz, height, 0, 255);
|
||||
}
|
||||
oldData[index] = height;
|
||||
if (height == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user