mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Update parallax chunk meta to json
This commit is contained in:
parent
1028ebccbb
commit
233144eede
@ -1,8 +1,11 @@
|
||||
package com.volmit.iris.scaffold.parallax;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.object.IrisFeaturePositional;
|
||||
import com.volmit.iris.scaffold.hunk.io.HunkIOAdapter;
|
||||
import com.volmit.iris.scaffold.hunk.io.PaletteHunkIOAdapter;
|
||||
import com.volmit.iris.util.CompoundTag;
|
||||
import com.volmit.iris.util.KList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@ -17,42 +20,27 @@ public class ParallaxChunkMeta {
|
||||
public static final Function<CompoundTag, HunkIOAdapter<ParallaxChunkMeta>> adapter = (c) -> new PaletteHunkIOAdapter<ParallaxChunkMeta>() {
|
||||
@Override
|
||||
public void write(ParallaxChunkMeta parallaxChunkMeta, DataOutputStream dos) throws IOException {
|
||||
dos.writeBoolean(parallaxChunkMeta.isUpdates());
|
||||
dos.writeBoolean(parallaxChunkMeta.isGenerated());
|
||||
dos.writeBoolean(parallaxChunkMeta.isParallaxGenerated());
|
||||
dos.writeBoolean(parallaxChunkMeta.isObjects());
|
||||
|
||||
if(parallaxChunkMeta.isObjects())
|
||||
{
|
||||
dos.writeByte(parallaxChunkMeta.getMinObject() + Byte.MIN_VALUE);
|
||||
dos.writeByte(parallaxChunkMeta.getMaxObject() + Byte.MIN_VALUE);
|
||||
}
|
||||
|
||||
dos.writeInt(parallaxChunkMeta.count);
|
||||
dos.writeUTF(new Gson().toJson(parallaxChunkMeta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParallaxChunkMeta read(DataInputStream din) throws IOException {
|
||||
boolean bb = din.readBoolean();
|
||||
boolean g = din.readBoolean();
|
||||
boolean p = din.readBoolean();
|
||||
boolean o = din.readBoolean();
|
||||
int min = o ? din.readByte() - Byte.MIN_VALUE : -1;
|
||||
int max = o ? din.readByte() - Byte.MIN_VALUE : -1;
|
||||
return new ParallaxChunkMeta(bb, g, p, o, min, max, din.readInt());
|
||||
return new Gson().fromJson(din.readUTF(), ParallaxChunkMeta.class);
|
||||
}
|
||||
};
|
||||
|
||||
private boolean updates;
|
||||
private boolean generated;
|
||||
private boolean parallaxGenerated;
|
||||
private boolean featureGenerated;
|
||||
private boolean objects;
|
||||
private int maxObject = -1;
|
||||
private int minObject = -1;
|
||||
private int count;
|
||||
private KList<IrisFeaturePositional> zones;
|
||||
|
||||
public ParallaxChunkMeta()
|
||||
{
|
||||
this(false, false, false, false, -1, -1, 0);
|
||||
this(false, false, false, false, false, -1, -1, 0, new KList<>());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user