change compressed data tree ids and clean up
This commit is contained in:
parent
6c55d59f1f
commit
f76d3c8b89
33 changed files with 633 additions and 682 deletions
|
@ -80,8 +80,6 @@ import common.packet.SPacketSkin;
|
|||
import common.packet.SPacketTimeUpdate;
|
||||
import common.packet.SPacketWorld;
|
||||
import common.potion.PotionEffect;
|
||||
import common.tags.TagDoubleList;
|
||||
import common.tags.TagFloatList;
|
||||
import common.tags.TagLoader;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
|
@ -329,13 +327,11 @@ public final class Server implements IThreadListener {
|
|||
TagObject tag = this.loadPlayerData(user);
|
||||
if(tag == null)
|
||||
return null;
|
||||
TagDoubleList pos = tag.getDoubleList("Pos");
|
||||
TagFloatList rot = tag.getFloatList("Rotation");
|
||||
double posX = pos.get(0);
|
||||
double posY = pos.get(1);
|
||||
double posZ = pos.get(2);
|
||||
float rotYaw = rot.get(0);
|
||||
float rotPitch = rot.get(1);
|
||||
double posX = tag.getDouble("PosX");
|
||||
double posY = tag.getDouble("PosY");
|
||||
double posZ = tag.getDouble("PosZ");
|
||||
float rotYaw = tag.getFloat("Yaw");
|
||||
float rotPitch = tag.getFloat("Pitch");
|
||||
int dimension = tag.getInt("Dimension");
|
||||
return new Position(posX, posY, posZ, rotYaw, rotPitch, dimension);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,6 @@ import common.packet.CPacketAction.Action;
|
|||
import common.packet.SPacketMessage.Type;
|
||||
import common.potion.Potion;
|
||||
import common.potion.PotionEffect;
|
||||
import common.tags.TagDoubleList;
|
||||
import common.tags.TagObject;
|
||||
import common.tags.TagObjectList;
|
||||
import common.tileentity.IInteractionObject;
|
||||
|
@ -1636,10 +1635,9 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
if(info != null && info.isEmpty())
|
||||
info = null;
|
||||
Alignment align = Alignment.getByName(tag.getString("Align"));
|
||||
TagDoubleList position = tag.getDoubleList("Pos");
|
||||
Dimension dimension = UniverseRegistry.getDimension(tag.getInt("Dimension"));
|
||||
String dim = dimension == null ? "???" : dimension.getFormattedName(false);
|
||||
BlockPos pos = new BlockPos(position.get(0), position.get(1), position.get(2));
|
||||
BlockPos pos = new BlockPos(tag.getDouble("PosX"), tag.getDouble("PosY"), tag.getDouble("PosZ"));
|
||||
String type = EntityRegistry.getEntityName(tag.getString("id"));
|
||||
int level = tag.getInt("XpLevel");
|
||||
return new PlayerCharacter(name, info, align, dim, pos, type, level);
|
||||
|
|
|
@ -68,8 +68,6 @@ import common.init.TileRegistry;
|
|||
import common.init.UniverseRegistry;
|
||||
import common.log.Log;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagDoubleList;
|
||||
import common.tags.TagFloatList;
|
||||
import common.tags.TagLoader;
|
||||
import common.tags.TagObject;
|
||||
import common.tags.TagObjectList;
|
||||
|
@ -997,22 +995,6 @@ public abstract class Converter {
|
|||
return idx >= 0 ? name.substring(idx + 1) : name; // save compat
|
||||
}
|
||||
|
||||
private static TagFloatList getList(float[] values) {
|
||||
TagFloatList nlist = new TagFloatList();
|
||||
for(int z = 0; z < values.length; z++) {
|
||||
nlist.add(values[z]);
|
||||
}
|
||||
return nlist;
|
||||
}
|
||||
|
||||
private static TagDoubleList getList(double[] values) {
|
||||
TagDoubleList nlist = new TagDoubleList();
|
||||
for(int z = 0; z < values.length; z++) {
|
||||
nlist.add(values[z]);
|
||||
}
|
||||
return nlist;
|
||||
}
|
||||
|
||||
private static TagObject convertChunkData(NbtTag tag, boolean legacy) {
|
||||
TagObject ntag = new TagObject();
|
||||
tag = tag.getTag("Level");
|
||||
|
@ -1092,9 +1074,14 @@ public abstract class Converter {
|
|||
if(pos.length != 3 || motion.length != 3 || rotation.length != 2)
|
||||
continue;
|
||||
boolean ground = ent.getByte("OnGround") != 0;
|
||||
nent.setDoubleList("Pos", getList(pos));
|
||||
nent.setDoubleList("Motion", getList(motion));
|
||||
nent.setFloatList("Rotation", getList(rotation));
|
||||
nent.setDouble("PosX", pos[0]);
|
||||
nent.setDouble("PosY", pos[1]);
|
||||
nent.setDouble("PosZ", pos[2]);
|
||||
nent.setDouble("MotionX", motion[0]);
|
||||
nent.setDouble("MotionY", motion[1]);
|
||||
nent.setDouble("MotionZ", motion[2]);
|
||||
nent.setFloat("Yaw", rotation[0]);
|
||||
nent.setFloat("Pitch", rotation[1]);
|
||||
nent.setBool("OnGround", ground);
|
||||
nent.setInt("Dimension", 1);
|
||||
nent.setString("id", mapped);
|
||||
|
@ -1123,6 +1110,7 @@ public abstract class Converter {
|
|||
entities = new TagObjectList();
|
||||
for(NbtTag sect : sects) {
|
||||
TagObject nsect = new TagObject();
|
||||
nsect.setInt("Y", sect.getByte("Y"));
|
||||
byte[] blocks = sect.getByteArray("Blocks");
|
||||
NibbleArray data = new NibbleArray(sect.getByteArray("Data"));
|
||||
byte[] add = sect.getByteArray("Add");
|
||||
|
|
|
@ -41,6 +41,16 @@ public class StructureBoundingBox
|
|||
}
|
||||
}
|
||||
|
||||
public StructureBoundingBox(int[] coords, int offset)
|
||||
{
|
||||
this.minX = coords[offset + 0];
|
||||
this.minY = coords[offset + 1];
|
||||
this.minZ = coords[offset + 2];
|
||||
this.maxX = coords[offset + 3];
|
||||
this.maxY = coords[offset + 4];
|
||||
this.maxZ = coords[offset + 5];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a new StructureBoundingBox with MAX values
|
||||
*/
|
||||
|
@ -212,4 +222,14 @@ public class StructureBoundingBox
|
|||
{
|
||||
return new int[] {this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ};
|
||||
}
|
||||
|
||||
public void toIntArray(int[] data, int offset)
|
||||
{
|
||||
data[offset + 0] = this.minX;
|
||||
data[offset + 1] = this.minY;
|
||||
data[offset + 2] = this.minZ;
|
||||
data[offset + 3] = this.maxX;
|
||||
data[offset + 4] = this.maxY;
|
||||
data[offset + 5] = this.maxZ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import common.init.Items;
|
|||
import common.item.RngLoot;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.tags.TagIntArrayList;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityMobSpawner;
|
||||
|
@ -712,23 +711,23 @@ public class StructureMineshaft
|
|||
|
||||
protected void writeTags(TagObject tag)
|
||||
{
|
||||
TagIntArrayList list = new TagIntArrayList();
|
||||
int[] rooms = new int[this.roomsLinkedToTheRoom.size() * 6];
|
||||
|
||||
for (StructureBoundingBox bb : this.roomsLinkedToTheRoom)
|
||||
for (int z = 0; z < rooms.length / 6; z++)
|
||||
{
|
||||
list.add(bb.toIntArray());
|
||||
this.roomsLinkedToTheRoom.get(z).toIntArray(rooms, z * 6);
|
||||
}
|
||||
|
||||
tag.setIntArrayList("Entrances", list);
|
||||
tag.setIntArray("Entrances", rooms);
|
||||
}
|
||||
|
||||
protected void readTags(TagObject tag)
|
||||
{
|
||||
TagIntArrayList list = tag.getIntArrayList("Entrances");
|
||||
int[] rooms = tag.getIntArray("Entrances");
|
||||
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
for (int z = 0; z < rooms.length / 6; z++)
|
||||
{
|
||||
this.roomsLinkedToTheRoom.add(new StructureBoundingBox(list.get(i)));
|
||||
this.roomsLinkedToTheRoom.add(new StructureBoundingBox(rooms, z * 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue