mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Fixes
This commit is contained in:
parent
8aa9ecffc5
commit
a335050332
@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util.nbt.mca;
|
||||
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.util.nbt.mca.nmspalettes.PaletteAccess;
|
||||
import com.volmit.iris.util.nbt.mca.palettes.DataPaletteBlock;
|
||||
import com.volmit.iris.util.nbt.tag.ByteArrayTag;
|
||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||
@ -27,7 +29,7 @@ import com.volmit.iris.util.nbt.tag.LongArrayTag;
|
||||
|
||||
public class Section {
|
||||
private CompoundTag data;
|
||||
private DataPaletteBlock palette;
|
||||
private PaletteAccess palette;
|
||||
private byte[] blockLight;
|
||||
private byte[] skyLight;
|
||||
private int dataVersion;
|
||||
@ -43,9 +45,8 @@ public class Section {
|
||||
if (rawPalette == null) {
|
||||
return;
|
||||
}
|
||||
palette = new DataPaletteBlock();
|
||||
LongArrayTag blockStates = sectionRoot.getLongArrayTag("BlockStates");
|
||||
palette.load((ListTag<CompoundTag>) rawPalette, blockStates.getValue());
|
||||
palette = INMS.get().createPalette();
|
||||
palette.readFromSection(sectionRoot);
|
||||
ByteArrayTag blockLight = sectionRoot.getByteArrayTag("BlockLight");
|
||||
ByteArrayTag skyLight = sectionRoot.getByteArrayTag("SkyLight");
|
||||
this.blockLight = blockLight != null ? blockLight.getValue() : null;
|
||||
@ -151,8 +152,8 @@ public class Section {
|
||||
*/
|
||||
public static Section newSection() {
|
||||
Section s = new Section();
|
||||
s.palette = new DataPaletteBlock();
|
||||
s.data = new CompoundTag();
|
||||
s.palette = INMS.get().createPalette();
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -170,7 +171,7 @@ public class Section {
|
||||
if (palette != null) {
|
||||
synchronized (palette)
|
||||
{
|
||||
palette.save(data, "Palette", "BlockStates");
|
||||
palette.writeToSection(data);
|
||||
}
|
||||
}
|
||||
if (blockLight != null) {
|
||||
|
@ -33,6 +33,7 @@ import lombok.Getter;
|
||||
import net.minecraft.world.level.chunk.ChunkSection;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import javax.management.RuntimeErrorException;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@ -90,8 +91,10 @@ public class DataPaletteBlock implements DataPaletteExpandable {
|
||||
currentPalette = new DataPaletteLinear(bits, this);
|
||||
} else if (bits < HASH_BITS) {
|
||||
currentPalette = new DataPaletteHash(bits, this);
|
||||
Iris.info("Upgraded to hash bits");
|
||||
} else {
|
||||
currentPalette = globalPalette;
|
||||
Iris.info("Upgraded to global bits because " + bits + " >= " + HASH_BITS);
|
||||
bits = MathHelper.e(stolenRegistry.size());
|
||||
}
|
||||
|
||||
@ -103,6 +106,7 @@ public class DataPaletteBlock implements DataPaletteExpandable {
|
||||
public int onResize(int newBits, CompoundTag newData) {
|
||||
DataBits oldBits = dataBits;
|
||||
DataPalette oldPalette = currentPalette;
|
||||
|
||||
changeBitsTo(newBits);
|
||||
|
||||
for (int i = 0; i < oldBits.b(); ++i) {
|
||||
|
@ -19,8 +19,10 @@
|
||||
package com.volmit.iris.util.nbt.mca.palettes;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.math.MathHelper;
|
||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||
import net.minecraft.world.level.chunk.DataPaletteBlock;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
@ -69,6 +71,7 @@ public class RegistryID implements Registry {
|
||||
return var1;
|
||||
}
|
||||
|
||||
|
||||
private int c() {
|
||||
while (this.g < this.f.length && this.f[this.g] != null) {
|
||||
++this.g;
|
||||
@ -121,6 +124,7 @@ public class RegistryID implements Registry {
|
||||
int var2;
|
||||
for (var2 = var1; var2 < this.d.length; ++var2) {
|
||||
if (this.d[var2] == null) {
|
||||
Iris.error("-1 because null!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -131,6 +135,7 @@ public class RegistryID implements Registry {
|
||||
|
||||
for (var2 = 0; var2 < var1; ++var2) {
|
||||
if (this.d[var2] == null) {
|
||||
Iris.error("-1 because null!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user