mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 03:16:41 +00:00
Implemented new Anvil saving format, fixed old chunk saving format.
- Added 'Chunk' Interface. - Moved old 'Chunk' to 'OldChunk' and replaced dynamic world height reference with '128. - Added 'AnvilChunk' implementing the new anvil chunk format. - Added temp fixes to FileMcRegionChunkStore.java, TrueZipMcRegionChunkStore.java and ZippedMcRegionChunkStore.java too allow them to read .mca files. - Added the new 'IntArrayTag' since the new heightmap tag wasn't recognized. - Moved 'getChildTag' to 'NBTUtils'.
This commit is contained in:
@ -150,7 +150,7 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
|
||||
throw new DataException("'Chest' tile entity expected");
|
||||
}
|
||||
|
||||
ListTag items = (ListTag) Chunk.getChildTag(values, "Items", ListTag.class);
|
||||
ListTag items = (ListTag) NBTUtils.getChildTag(values, "Items", ListTag.class);
|
||||
BaseItemStack[] newItems = new BaseItemStack[27];
|
||||
|
||||
for (Tag tag : items.getValue()) {
|
||||
@ -161,20 +161,20 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
|
||||
CompoundTag item = (CompoundTag) tag;
|
||||
Map<String, Tag> itemValues = item.getValue();
|
||||
|
||||
short id = Chunk.getChildTag(itemValues, "id", ShortTag.class).getValue();
|
||||
short damage = Chunk.getChildTag(itemValues, "Damage", ShortTag.class).getValue();
|
||||
byte count = Chunk.getChildTag(itemValues, "Count", ByteTag.class).getValue();
|
||||
byte slot = Chunk.getChildTag(itemValues, "Slot", ByteTag.class).getValue();
|
||||
short id = NBTUtils.getChildTag(itemValues, "id", ShortTag.class).getValue();
|
||||
short damage = NBTUtils.getChildTag(itemValues, "Damage", ShortTag.class).getValue();
|
||||
byte count = NBTUtils.getChildTag(itemValues, "Count", ByteTag.class).getValue();
|
||||
byte slot = NBTUtils.getChildTag(itemValues, "Slot", ByteTag.class).getValue();
|
||||
|
||||
if (slot >= 0 && slot <= 26) {
|
||||
BaseItemStack itemstack = new BaseItemStack(id, count, damage);
|
||||
|
||||
if(itemValues.containsKey("tag")) {
|
||||
ListTag ench = (ListTag) Chunk.getChildTag(itemValues, "tag", CompoundTag.class).getValue().get("ench");
|
||||
ListTag ench = (ListTag) NBTUtils.getChildTag(itemValues, "tag", CompoundTag.class).getValue().get("ench");
|
||||
for(Tag e : ench.getValue()) {
|
||||
Map<String, Tag> vars = ((CompoundTag) e).getValue();
|
||||
short enchid = Chunk.getChildTag(vars, "id", ShortTag.class).getValue();
|
||||
short enchlvl = Chunk.getChildTag(vars, "lvl", ShortTag.class).getValue();
|
||||
short enchid = NBTUtils.getChildTag(vars, "id", ShortTag.class).getValue();
|
||||
short enchlvl = NBTUtils.getChildTag(vars, "lvl", ShortTag.class).getValue();
|
||||
itemstack.getEnchantments().put((int) enchid, (int)enchlvl);
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
|
||||
throw new DataException("'Trap' tile entity expected");
|
||||
}
|
||||
|
||||
ListTag items = (ListTag) Chunk.getChildTag(values, "Items", ListTag.class);
|
||||
ListTag items = (ListTag) NBTUtils.getChildTag(values, "Items", ListTag.class);
|
||||
BaseItemStack[] newItems = new BaseItemStack[9];
|
||||
|
||||
for (Tag tag : items.getValue()) {
|
||||
@ -161,20 +161,20 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
|
||||
CompoundTag item = (CompoundTag) tag;
|
||||
Map<String, Tag> itemValues = item.getValue();
|
||||
|
||||
short id = Chunk.getChildTag(itemValues, "id", ShortTag.class).getValue();
|
||||
short damage = Chunk.getChildTag(itemValues, "Damage", ShortTag.class).getValue();
|
||||
byte count = Chunk.getChildTag(itemValues, "Count", ByteTag.class).getValue();
|
||||
byte slot = Chunk.getChildTag(itemValues, "Slot", ByteTag.class).getValue();
|
||||
short id = NBTUtils.getChildTag(itemValues, "id", ShortTag.class).getValue();
|
||||
short damage = NBTUtils.getChildTag(itemValues, "Damage", ShortTag.class).getValue();
|
||||
byte count = NBTUtils.getChildTag(itemValues, "Count", ByteTag.class).getValue();
|
||||
byte slot = NBTUtils.getChildTag(itemValues, "Slot", ByteTag.class).getValue();
|
||||
|
||||
if (slot >= 0 && slot <= 8) {
|
||||
BaseItemStack itemstack = new BaseItemStack(id, count, damage);
|
||||
|
||||
if(itemValues.containsKey("tag")) {
|
||||
ListTag ench = (ListTag) Chunk.getChildTag(itemValues, "tag", CompoundTag.class).getValue().get("ench");
|
||||
ListTag ench = (ListTag) NBTUtils.getChildTag(itemValues, "tag", CompoundTag.class).getValue().get("ench");
|
||||
for(Tag e : ench.getValue()) {
|
||||
Map<String, Tag> vars = ((CompoundTag) e).getValue();
|
||||
short enchid = Chunk.getChildTag(vars, "id", ShortTag.class).getValue();
|
||||
short enchlvl = Chunk.getChildTag(vars, "lvl", ShortTag.class).getValue();
|
||||
short enchid = NBTUtils.getChildTag(vars, "id", ShortTag.class).getValue();
|
||||
short enchlvl = NBTUtils.getChildTag(vars, "lvl", ShortTag.class).getValue();
|
||||
itemstack.getEnchantments().put((int) enchid, (int)enchlvl);
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public class FurnaceBlock extends BaseBlock implements TileEntityBlock, Containe
|
||||
throw new DataException("'Furnace' tile entity expected");
|
||||
}
|
||||
|
||||
ListTag items = (ListTag) Chunk.getChildTag(values, "Items", ListTag.class);
|
||||
ListTag items = (ListTag) NBTUtils.getChildTag(values, "Items", ListTag.class);
|
||||
BaseItemStack[] newItems = new BaseItemStack[3];
|
||||
|
||||
for (Tag tag : items.getValue()) {
|
||||
@ -205,20 +205,20 @@ public class FurnaceBlock extends BaseBlock implements TileEntityBlock, Containe
|
||||
CompoundTag item = (CompoundTag) tag;
|
||||
Map<String, Tag> itemValues = item.getValue();
|
||||
|
||||
short id = Chunk.getChildTag(itemValues, "id", ShortTag.class).getValue();
|
||||
short damage = Chunk.getChildTag(itemValues, "Damage", ShortTag.class).getValue();
|
||||
byte count = Chunk.getChildTag(itemValues, "Count", ByteTag.class).getValue();
|
||||
byte slot = Chunk.getChildTag(itemValues, "Slot", ByteTag.class).getValue();
|
||||
short id = NBTUtils.getChildTag(itemValues, "id", ShortTag.class).getValue();
|
||||
short damage = NBTUtils.getChildTag(itemValues, "Damage", ShortTag.class).getValue();
|
||||
byte count = NBTUtils.getChildTag(itemValues, "Count", ByteTag.class).getValue();
|
||||
byte slot = NBTUtils.getChildTag(itemValues, "Slot", ByteTag.class).getValue();
|
||||
|
||||
if (slot >= 0 && slot <= 2) {
|
||||
BaseItemStack itemstack = new BaseItemStack(id, count, damage);
|
||||
|
||||
if(itemValues.containsKey("tag")) {
|
||||
ListTag ench = (ListTag) Chunk.getChildTag(itemValues, "tag", CompoundTag.class).getValue().get("ench");
|
||||
ListTag ench = (ListTag) NBTUtils.getChildTag(itemValues, "tag", CompoundTag.class).getValue().get("ench");
|
||||
for(Tag e : ench.getValue()) {
|
||||
Map<String, Tag> vars = ((CompoundTag) e).getValue();
|
||||
short enchid = Chunk.getChildTag(vars, "id", ShortTag.class).getValue();
|
||||
short enchlvl = Chunk.getChildTag(vars, "lvl", ShortTag.class).getValue();
|
||||
short enchid = NBTUtils.getChildTag(vars, "id", ShortTag.class).getValue();
|
||||
short enchlvl = NBTUtils.getChildTag(vars, "lvl", ShortTag.class).getValue();
|
||||
itemstack.getEnchantments().put((int) enchid, (int)enchlvl);
|
||||
}
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
||||
throw new DataException("'MobSpawner' tile entity expected");
|
||||
}
|
||||
|
||||
StringTag mobTypeTag = (StringTag) Chunk.getChildTag(values, "EntityId", StringTag.class);
|
||||
ShortTag delayTag = (ShortTag) Chunk.getChildTag(values, "Delay", ShortTag.class);
|
||||
StringTag mobTypeTag = (StringTag) NBTUtils.getChildTag(values, "EntityId", StringTag.class);
|
||||
ShortTag delayTag = (ShortTag) NBTUtils.getChildTag(values, "Delay", ShortTag.class);
|
||||
|
||||
this.mobType = mobTypeTag.getValue();
|
||||
this.delay = delayTag.getValue();
|
||||
|
Reference in New Issue
Block a user