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