mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-24 03:25:17 +01:00
Merge branch 'mc/1.13' into mc/1.12
This commit is contained in:
commit
e9f5885790
@ -152,9 +152,9 @@ public Section(CompoundTag sectionData) {
|
|||||||
this.skyLight = sectionData.getByteArray("SkyLight");
|
this.skyLight = sectionData.getByteArray("SkyLight");
|
||||||
this.blocks = sectionData.getLongArray("BlockStates");
|
this.blocks = sectionData.getLongArray("BlockStates");
|
||||||
|
|
||||||
if (blocks.length < 256) blocks = Arrays.copyOf(blocks, 256);
|
if (blocks.length < 256 && blocks.length > 0) blocks = Arrays.copyOf(blocks, 256);
|
||||||
if (blockLight.length < 2048) blockLight = Arrays.copyOf(blockLight, 2048);
|
if (blockLight.length < 2048 && blockLight.length > 0) blockLight = Arrays.copyOf(blockLight, 2048);
|
||||||
if (skyLight.length < 2048) skyLight = Arrays.copyOf(skyLight, 2048);
|
if (skyLight.length < 2048 && skyLight.length > 0) skyLight = Arrays.copyOf(skyLight, 2048);
|
||||||
|
|
||||||
//read block palette
|
//read block palette
|
||||||
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
|
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
|
||||||
@ -221,6 +221,8 @@ public BlockState getBlockState(Vector3i pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LightData getLightData(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 x = pos.getX() & 0xF; // Math.floorMod(pos.getX(), 16)
|
||||||
int y = pos.getY() & 0xF;
|
int y = pos.getY() & 0xF;
|
||||||
int z = pos.getZ() & 0xF;
|
int z = pos.getZ() & 0xF;
|
||||||
@ -228,8 +230,8 @@ public LightData getLightData(Vector3i pos) {
|
|||||||
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
|
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
|
||||||
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
|
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
|
||||||
|
|
||||||
int blockLight = getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf);
|
int blockLight = this.blockLight.length > 0 ? getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf) : 0;
|
||||||
int skyLight = getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf);
|
int skyLight = this.skyLight.length > 0 ? getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf) : 0;
|
||||||
|
|
||||||
return new LightData(skyLight, blockLight);
|
return new LightData(skyLight, blockLight);
|
||||||
}
|
}
|
||||||
|
@ -153,9 +153,9 @@ public Section(CompoundTag sectionData) {
|
|||||||
this.skyLight = sectionData.getByteArray("SkyLight");
|
this.skyLight = sectionData.getByteArray("SkyLight");
|
||||||
this.blocks = sectionData.getLongArray("BlockStates");
|
this.blocks = sectionData.getLongArray("BlockStates");
|
||||||
|
|
||||||
if (blocks.length < 256) blocks = Arrays.copyOf(blocks, 256);
|
if (blocks.length < 256 && blocks.length > 0) blocks = Arrays.copyOf(blocks, 256);
|
||||||
if (blockLight.length < 2048) blockLight = Arrays.copyOf(blockLight, 2048);
|
if (blockLight.length < 2048 && blockLight.length > 0) blockLight = Arrays.copyOf(blockLight, 2048);
|
||||||
if (skyLight.length < 2048) skyLight = Arrays.copyOf(skyLight, 2048);
|
if (skyLight.length < 2048 && skyLight.length > 0) skyLight = Arrays.copyOf(skyLight, 2048);
|
||||||
|
|
||||||
//read block palette
|
//read block palette
|
||||||
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
|
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
|
||||||
@ -222,6 +222,8 @@ public BlockState getBlockState(Vector3i pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LightData getLightData(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 x = pos.getX() & 0xF; // Math.floorMod(pos.getX(), 16)
|
||||||
int y = pos.getY() & 0xF;
|
int y = pos.getY() & 0xF;
|
||||||
int z = pos.getZ() & 0xF;
|
int z = pos.getZ() & 0xF;
|
||||||
@ -229,8 +231,8 @@ public LightData getLightData(Vector3i pos) {
|
|||||||
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
|
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
|
||||||
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
|
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
|
||||||
|
|
||||||
int blockLight = getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf);
|
int blockLight = this.blockLight.length > 0 ? getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf) : 0;
|
||||||
int skyLight = getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf);
|
int skyLight = this.skyLight.length > 0 ? getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf) : 0;
|
||||||
|
|
||||||
return new LightData(skyLight, blockLight);
|
return new LightData(skyLight, blockLight);
|
||||||
}
|
}
|
||||||
|
@ -154,9 +154,9 @@ public Section(CompoundTag sectionData) {
|
|||||||
this.skyLight = sectionData.getByteArray("SkyLight");
|
this.skyLight = sectionData.getByteArray("SkyLight");
|
||||||
this.blocks = sectionData.getLongArray("BlockStates");
|
this.blocks = sectionData.getLongArray("BlockStates");
|
||||||
|
|
||||||
if (blocks.length < 256) blocks = Arrays.copyOf(blocks, 256);
|
if (blocks.length < 256 && blocks.length > 0) blocks = Arrays.copyOf(blocks, 256);
|
||||||
if (blockLight.length < 2048) blockLight = Arrays.copyOf(blockLight, 2048);
|
if (blockLight.length < 2048 && blockLight.length > 0) blockLight = Arrays.copyOf(blockLight, 2048);
|
||||||
if (skyLight.length < 2048) skyLight = Arrays.copyOf(skyLight, 2048);
|
if (skyLight.length < 2048 && skyLight.length > 0) skyLight = Arrays.copyOf(skyLight, 2048);
|
||||||
|
|
||||||
//read block palette
|
//read block palette
|
||||||
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
|
ListTag<CompoundTag> paletteTag = (ListTag<CompoundTag>) sectionData.getListTag("Palette");
|
||||||
@ -219,6 +219,8 @@ public BlockState getBlockState(Vector3i pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LightData getLightData(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 x = pos.getX() & 0xF; // Math.floorMod(pos.getX(), 16)
|
||||||
int y = pos.getY() & 0xF;
|
int y = pos.getY() & 0xF;
|
||||||
int z = pos.getZ() & 0xF;
|
int z = pos.getZ() & 0xF;
|
||||||
@ -226,8 +228,8 @@ public LightData getLightData(Vector3i pos) {
|
|||||||
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
|
int blockHalfByteIndex = blockByteIndex >> 1; // blockByteIndex / 2
|
||||||
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
|
boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0
|
||||||
|
|
||||||
int blockLight = getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf);
|
int blockLight = this.blockLight.length > 0 ? getByteHalf(this.blockLight[blockHalfByteIndex], largeHalf) : 0;
|
||||||
int skyLight = getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf);
|
int skyLight = this.skyLight.length > 0 ? getByteHalf(this.skyLight[blockHalfByteIndex], largeHalf) : 0;
|
||||||
|
|
||||||
return new LightData(skyLight, blockLight);
|
return new LightData(skyLight, blockLight);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
coreVersion=0.8.0
|
coreVersion=0.9.0
|
||||||
|
|
||||||
targetVersion=mc1.12
|
targetVersion=mc1.12
|
||||||
|
Loading…
Reference in New Issue
Block a user