Merge branch 'mc/1.13' into mc/1.12

This commit is contained in:
Blue (Lukas Rieger) 2020-07-29 21:19:24 +02:00
commit e9f5885790
4 changed files with 22 additions and 16 deletions

View File

@ -152,9 +152,9 @@ public Section(CompoundTag sectionData) {
this.skyLight = sectionData.getByteArray("SkyLight");
this.blocks = sectionData.getLongArray("BlockStates");
if (blocks.length < 256) blocks = Arrays.copyOf(blocks, 256);
if (blockLight.length < 2048) blockLight = Arrays.copyOf(blockLight, 2048);
if (skyLight.length < 2048) skyLight = Arrays.copyOf(skyLight, 2048);
if (blocks.length < 256 && blocks.length > 0) blocks = Arrays.copyOf(blocks, 256);
if (blockLight.length < 2048 && blockLight.length > 0) blockLight = Arrays.copyOf(blockLight, 2048);
if (skyLight.length < 2048 && skyLight.length > 0) skyLight = Arrays.copyOf(skyLight, 2048);
//read block palette
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
@ -221,6 +221,8 @@ public BlockState getBlockState(Vector3i pos) {
}
public LightData getLightData(Vector3i pos) {
if (blockLight.length == 0 && skyLight.length == 0) return LightData.ZERO;
int x = pos.getX() & 0xF; // Math.floorMod(pos.getX(), 16)
int y = pos.getY() & 0xF;
int z = pos.getZ() & 0xF;
@ -228,8 +230,8 @@ public LightData getLightData(Vector3i pos) {
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
int blockLight = getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf);
int skyLight = getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf);
int blockLight = this.blockLight.length > 0 ? getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf) : 0;
int skyLight = this.skyLight.length > 0 ? getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf) : 0;
return new LightData(skyLight, blockLight);
}

View File

@ -153,9 +153,9 @@ public Section(CompoundTag sectionData) {
this.skyLight = sectionData.getByteArray("SkyLight");
this.blocks = sectionData.getLongArray("BlockStates");
if (blocks.length < 256) blocks = Arrays.copyOf(blocks, 256);
if (blockLight.length < 2048) blockLight = Arrays.copyOf(blockLight, 2048);
if (skyLight.length < 2048) skyLight = Arrays.copyOf(skyLight, 2048);
if (blocks.length < 256 && blocks.length > 0) blocks = Arrays.copyOf(blocks, 256);
if (blockLight.length < 2048 && blockLight.length > 0) blockLight = Arrays.copyOf(blockLight, 2048);
if (skyLight.length < 2048 && skyLight.length > 0) skyLight = Arrays.copyOf(skyLight, 2048);
//read block palette
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
@ -222,6 +222,8 @@ public BlockState getBlockState(Vector3i pos) {
}
public LightData getLightData(Vector3i pos) {
if (blockLight.length == 0 && skyLight.length == 0) return LightData.ZERO;
int x = pos.getX() & 0xF; // Math.floorMod(pos.getX(), 16)
int y = pos.getY() & 0xF;
int z = pos.getZ() & 0xF;
@ -229,8 +231,8 @@ public LightData getLightData(Vector3i pos) {
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
int blockLight = getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf);
int skyLight = getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf);
int blockLight = this.blockLight.length > 0 ? getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf) : 0;
int skyLight = this.skyLight.length > 0 ? getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf) : 0;
return new LightData(skyLight, blockLight);
}

View File

@ -154,9 +154,9 @@ public Section(CompoundTag sectionData) {
this.skyLight = sectionData.getByteArray("SkyLight");
this.blocks = sectionData.getLongArray("BlockStates");
if (blocks.length < 256) blocks = Arrays.copyOf(blocks, 256);
if (blockLight.length < 2048) blockLight = Arrays.copyOf(blockLight, 2048);
if (skyLight.length < 2048) skyLight = Arrays.copyOf(skyLight, 2048);
if (blocks.length < 256 && blocks.length > 0) blocks = Arrays.copyOf(blocks, 256);
if (blockLight.length < 2048 && blockLight.length > 0) blockLight = Arrays.copyOf(blockLight, 2048);
if (skyLight.length < 2048 && skyLight.length > 0) skyLight = Arrays.copyOf(skyLight, 2048);
//read block palette
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
@ -219,6 +219,8 @@ public BlockState getBlockState(Vector3i pos) {
}
public LightData getLightData(Vector3i pos) {
if (blockLight.length == 0 && skyLight.length == 0) return LightData.ZERO;
int x = pos.getX() & 0xF; // Math.floorMod(pos.getX(), 16)
int y = pos.getY() & 0xF;
int z = pos.getZ() & 0xF;
@ -226,8 +228,8 @@ public LightData getLightData(Vector3i pos) {
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
int blockLight = getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf);
int skyLight = getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf);
int blockLight = this.blockLight.length > 0 ? getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf) : 0;
int skyLight = this.skyLight.length > 0 ? getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf) : 0;
return new LightData(skyLight, blockLight);
}

View File

@ -1,6 +1,6 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
coreVersion=0.8.0
coreVersion=0.9.0
targetVersion=mc1.12