mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Fix palettes
This commit is contained in:
parent
1dce68212f
commit
ca228ca23e
@ -27,7 +27,7 @@ import com.volmit.iris.util.nbt.tag.LongArrayTag;
|
|||||||
|
|
||||||
public class Section {
|
public class Section {
|
||||||
private CompoundTag data;
|
private CompoundTag data;
|
||||||
private DataPaletteBlock<CompoundTag> palette;
|
private DataPaletteBlock palette;
|
||||||
private byte[] blockLight;
|
private byte[] blockLight;
|
||||||
private byte[] skyLight;
|
private byte[] skyLight;
|
||||||
private int dataVersion;
|
private int dataVersion;
|
||||||
@ -43,7 +43,7 @@ public class Section {
|
|||||||
if (rawPalette == null) {
|
if (rawPalette == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
palette = new DataPaletteBlock<>();
|
palette = new DataPaletteBlock();
|
||||||
LongArrayTag blockStates = sectionRoot.getLongArrayTag("BlockStates");
|
LongArrayTag blockStates = sectionRoot.getLongArrayTag("BlockStates");
|
||||||
palette.load((ListTag<CompoundTag>) rawPalette, blockStates.getValue());
|
palette.load((ListTag<CompoundTag>) rawPalette, blockStates.getValue());
|
||||||
ByteArrayTag blockLight = sectionRoot.getByteArrayTag("BlockLight");
|
ByteArrayTag blockLight = sectionRoot.getByteArrayTag("BlockLight");
|
||||||
@ -74,7 +74,10 @@ public class Section {
|
|||||||
* @return The block state data of this block.
|
* @return The block state data of this block.
|
||||||
*/
|
*/
|
||||||
public synchronized CompoundTag getBlockStateAt(int blockX, int blockY, int blockZ) {
|
public synchronized CompoundTag getBlockStateAt(int blockX, int blockY, int blockZ) {
|
||||||
return palette.getBlock(blockX&15, blockY&15, blockZ&15);
|
synchronized (palette)
|
||||||
|
{
|
||||||
|
return palette.getBlock(blockX&15, blockY&15, blockZ&15);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +89,10 @@ public class Section {
|
|||||||
* @param state The block state to be set
|
* @param state The block state to be set
|
||||||
*/
|
*/
|
||||||
public synchronized void setBlockStateAt(int blockX, int blockY, int blockZ, CompoundTag state, boolean cleanup) {
|
public synchronized void setBlockStateAt(int blockX, int blockY, int blockZ, CompoundTag state, boolean cleanup) {
|
||||||
palette.setBlock(blockX&15, blockY&15, blockZ&15, state);
|
synchronized (palette)
|
||||||
|
{
|
||||||
|
palette.setBlock(blockX&15, blockY&15, blockZ&15, state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +151,7 @@ public class Section {
|
|||||||
*/
|
*/
|
||||||
public static Section newSection() {
|
public static Section newSection() {
|
||||||
Section s = new Section();
|
Section s = new Section();
|
||||||
s.palette = new DataPaletteBlock<>();
|
s.palette = new DataPaletteBlock();
|
||||||
s.data = new CompoundTag();
|
s.data = new CompoundTag();
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -162,7 +168,10 @@ public class Section {
|
|||||||
data.putByte("Y", (byte) y);
|
data.putByte("Y", (byte) y);
|
||||||
|
|
||||||
if (palette != null) {
|
if (palette != null) {
|
||||||
palette.save(data, "Palette", "BlockStates");
|
synchronized (palette)
|
||||||
|
{
|
||||||
|
palette.save(data, "Palette", "BlockStates");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (blockLight != null) {
|
if (blockLight != null) {
|
||||||
data.putByteArray("BlockLight", blockLight);
|
data.putByteArray("BlockLight", blockLight);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user