mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 01:55:47 +01:00
Update ViaNBT
This commit is contained in:
parent
bd99b892db
commit
f6c49555bf
@ -22,12 +22,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.api.data;
|
package com.viaversion.viaversion.api.data;
|
||||||
|
|
||||||
import com.github.steveice10.opennbt.NBTIO;
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.IntArrayTag;
|
import com.github.steveice10.opennbt.tag.builtin.IntArrayTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.io.NBTIO;
|
||||||
|
import com.github.steveice10.opennbt.tag.io.TagReader;
|
||||||
import com.google.common.annotations.Beta;
|
import com.google.common.annotations.Beta;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
@ -51,11 +52,12 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
|
|
||||||
public final class MappingDataLoader {
|
public final class MappingDataLoader {
|
||||||
|
|
||||||
|
private static final Map<String, CompoundTag> MAPPINGS_CACHE = new HashMap<>();
|
||||||
|
private static final TagReader<CompoundTag> MAPPINGS_READER = NBTIO.reader(CompoundTag.class).named();
|
||||||
private static final byte DIRECT_ID = 0;
|
private static final byte DIRECT_ID = 0;
|
||||||
private static final byte SHIFTS_ID = 1;
|
private static final byte SHIFTS_ID = 1;
|
||||||
private static final byte CHANGES_ID = 2;
|
private static final byte CHANGES_ID = 2;
|
||||||
private static final byte IDENTITY_ID = 3;
|
private static final byte IDENTITY_ID = 3;
|
||||||
private static final Map<String, CompoundTag> MAPPINGS_CACHE = new HashMap<>();
|
|
||||||
private static boolean cacheValid = true;
|
private static boolean cacheValid = true;
|
||||||
|
|
||||||
@Deprecated/*(forRemoval = true)*/
|
@Deprecated/*(forRemoval = true)*/
|
||||||
@ -131,14 +133,14 @@ public final class MappingDataLoader {
|
|||||||
return loadNBT(name, false);
|
return loadNBT(name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static @Nullable CompoundTag loadNBTFromFile(final String name) {
|
public static @Nullable CompoundTag loadNBTFromFile(final String name) {
|
||||||
final InputStream resource = getResource(name);
|
final InputStream resource = getResource(name);
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (final InputStream stream = resource) {
|
try (final InputStream stream = resource) {
|
||||||
return NBTIO.readTag(stream);
|
return MAPPINGS_READER.read(stream);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
|||||||
import com.viaversion.viaversion.api.type.OptionalType;
|
import com.viaversion.viaversion.api.type.OptionalType;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,12 +42,12 @@ public class CompoundTagType extends Type<CompoundTag> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag read(final ByteBuf buffer) throws Exception {
|
public CompoundTag read(final ByteBuf buffer) throws IOException {
|
||||||
return NamedCompoundTagType.read(buffer, false);
|
return NamedCompoundTagType.read(buffer, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(final ByteBuf buffer, final CompoundTag object) throws Exception {
|
public void write(final ByteBuf buffer, final CompoundTag object) throws IOException {
|
||||||
NamedCompoundTagType.write(buffer, object, null);
|
NamedCompoundTagType.write(buffer, object, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,16 +42,16 @@ public class NamedCompoundTagType extends Type<CompoundTag> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag read(final ByteBuf buffer) throws Exception {
|
public CompoundTag read(final ByteBuf buffer) throws IOException {
|
||||||
return read(buffer, true);
|
return read(buffer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(final ByteBuf buffer, final CompoundTag object) throws Exception {
|
public void write(final ByteBuf buffer, final CompoundTag object) throws IOException {
|
||||||
write(buffer, object, "");
|
write(buffer, object, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompoundTag read(final ByteBuf buffer, final boolean readName) throws Exception {
|
public static CompoundTag read(final ByteBuf buffer, final boolean readName) throws IOException {
|
||||||
final byte id = buffer.readByte();
|
final byte id = buffer.readByte();
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
return null;
|
return null;
|
||||||
@ -65,12 +65,10 @@ public class NamedCompoundTagType extends Type<CompoundTag> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final TagLimiter tagLimiter = TagLimiter.create(MAX_NBT_BYTES, MAX_NESTING_LEVEL);
|
final TagLimiter tagLimiter = TagLimiter.create(MAX_NBT_BYTES, MAX_NESTING_LEVEL);
|
||||||
final CompoundTag tag = new CompoundTag();
|
return CompoundTag.read(new ByteBufInputStream(buffer), tagLimiter, 0);
|
||||||
tag.read(new ByteBufInputStream(buffer), tagLimiter);
|
|
||||||
return tag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(final ByteBuf buffer, final Tag tag, final @Nullable String name) throws Exception {
|
public static void write(final ByteBuf buffer, final Tag tag, final @Nullable String name) throws IOException {
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
buffer.writeByte(0);
|
buffer.writeByte(0);
|
||||||
return;
|
return;
|
||||||
|
@ -29,6 +29,7 @@ import com.viaversion.viaversion.api.type.OptionalType;
|
|||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufInputStream;
|
import io.netty.buffer.ByteBufInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class TagType extends Type<Tag> {
|
public class TagType extends Type<Tag> {
|
||||||
|
|
||||||
@ -37,20 +38,18 @@ public class TagType extends Type<Tag> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag read(final ByteBuf buffer) throws Exception {
|
public Tag read(final ByteBuf buffer) throws IOException {
|
||||||
final byte id = buffer.readByte();
|
final byte id = buffer.readByte();
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final TagLimiter tagLimiter = TagLimiter.create(NamedCompoundTagType.MAX_NBT_BYTES, NamedCompoundTagType.MAX_NESTING_LEVEL);
|
final TagLimiter tagLimiter = TagLimiter.create(NamedCompoundTagType.MAX_NBT_BYTES, NamedCompoundTagType.MAX_NESTING_LEVEL);
|
||||||
final Tag tag = TagRegistry.createInstance(id);
|
return TagRegistry.read(id, new ByteBufInputStream(buffer), tagLimiter, 0);
|
||||||
tag.read(new ByteBufInputStream(buffer), tagLimiter);
|
|
||||||
return tag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(final ByteBuf buffer, final Tag tag) throws Exception {
|
public void write(final ByteBuf buffer, final Tag tag) throws IOException {
|
||||||
NamedCompoundTagType.write(buffer, tag, null);
|
NamedCompoundTagType.write(buffer, tag, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ fun ShadowJar.configureExcludes() {
|
|||||||
exclude("it/unimi/dsi/fastutil/*/*Big*")
|
exclude("it/unimi/dsi/fastutil/*/*Big*")
|
||||||
exclude("it/unimi/dsi/fastutil/*/*Synchronized*")
|
exclude("it/unimi/dsi/fastutil/*/*Synchronized*")
|
||||||
exclude("it/unimi/dsi/fastutil/*/*Unmodifiable*")
|
exclude("it/unimi/dsi/fastutil/*/*Unmodifiable*")
|
||||||
exclude("it/unimi/dsi/fastutil/io/*")
|
|
||||||
// Flare - only need int maps
|
// Flare - only need int maps
|
||||||
exclude("space/vectrix/flare/fastutil/*Double*")
|
exclude("space/vectrix/flare/fastutil/*Double*")
|
||||||
exclude("space/vectrix/flare/fastutil/*Float*")
|
exclude("space/vectrix/flare/fastutil/*Float*")
|
||||||
|
@ -361,7 +361,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_12_1, Ser
|
|||||||
if (tag.get("CanPlaceOn") instanceof ListTag) {
|
if (tag.get("CanPlaceOn") instanceof ListTag) {
|
||||||
ListTag old = tag.get("CanPlaceOn");
|
ListTag old = tag.get("CanPlaceOn");
|
||||||
ListTag newCanPlaceOn = new ListTag(StringTag.class);
|
ListTag newCanPlaceOn = new ListTag(StringTag.class);
|
||||||
tag.put(NBT_TAG_NAME + "|CanPlaceOn", old.clone());
|
tag.put(NBT_TAG_NAME + "|CanPlaceOn", old.copy());
|
||||||
for (Tag oldTag : old) {
|
for (Tag oldTag : old) {
|
||||||
Object value = oldTag.getValue();
|
Object value = oldTag.getValue();
|
||||||
String oldId = Key.stripMinecraftNamespace(value.toString());
|
String oldId = Key.stripMinecraftNamespace(value.toString());
|
||||||
@ -383,7 +383,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_12_1, Ser
|
|||||||
if (tag.get("CanDestroy") instanceof ListTag) {
|
if (tag.get("CanDestroy") instanceof ListTag) {
|
||||||
ListTag old = tag.get("CanDestroy");
|
ListTag old = tag.get("CanDestroy");
|
||||||
ListTag newCanDestroy = new ListTag(StringTag.class);
|
ListTag newCanDestroy = new ListTag(StringTag.class);
|
||||||
tag.put(NBT_TAG_NAME + "|CanDestroy", old.clone());
|
tag.put(NBT_TAG_NAME + "|CanDestroy", old.copy());
|
||||||
for (Tag oldTag : old) {
|
for (Tag oldTag : old) {
|
||||||
Object value = oldTag.getValue();
|
Object value = oldTag.getValue();
|
||||||
String oldId = Key.stripMinecraftNamespace(value.toString());
|
String oldId = Key.stripMinecraftNamespace(value.toString());
|
||||||
|
@ -248,7 +248,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_13, Serve
|
|||||||
Tag loreTag = display.get("Lore");
|
Tag loreTag = display.get("Lore");
|
||||||
if (loreTag instanceof ListTag) {
|
if (loreTag instanceof ListTag) {
|
||||||
ListTag lore = (ListTag) loreTag;
|
ListTag lore = (ListTag) loreTag;
|
||||||
display.put(NBT_TAG_NAME + "|Lore", new ListTag(lore.clone().getValue())); // Save old lore
|
display.put(NBT_TAG_NAME + "|Lore", new ListTag(lore.copy().getValue())); // Save old lore
|
||||||
for (Tag loreEntry : lore) {
|
for (Tag loreEntry : lore) {
|
||||||
if (loreEntry instanceof StringTag) {
|
if (loreEntry instanceof StringTag) {
|
||||||
String jsonText = ComponentUtil.legacyToJsonString(((StringTag) loreEntry).getValue(), true);
|
String jsonText = ComponentUtil.legacyToJsonString(((StringTag) loreEntry).getValue(), true);
|
||||||
|
@ -17,18 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.data;
|
package com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.data;
|
||||||
|
|
||||||
import com.github.steveice10.opennbt.NBTIO;
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
import com.viaversion.viaversion.api.Via;
|
|
||||||
import com.viaversion.viaversion.api.data.MappingDataBase;
|
import com.viaversion.viaversion.api.data.MappingDataBase;
|
||||||
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class MappingData extends MappingDataBase {
|
public class MappingData extends MappingDataBase {
|
||||||
private final Map<String, CompoundTag> dimensionDataMap = new HashMap<>();
|
private final Map<String, CompoundTag> dimensionDataMap = new HashMap<>();
|
||||||
@ -40,11 +36,7 @@ public class MappingData extends MappingDataBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadExtras(final CompoundTag data) {
|
public void loadExtras(final CompoundTag data) {
|
||||||
try {
|
dimensionRegistry = MappingDataLoader.loadNBTFromFile("dimension-registry-1.16.2.nbt");
|
||||||
dimensionRegistry = NBTIO.readTag(MappingDataLoader.getResource("dimension-registry-1.16.2.nbt"));
|
|
||||||
} catch (final IOException e) {
|
|
||||||
Via.getPlatform().getLogger().log(Level.SEVERE, "Error loading dimension registry:", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data of each dimension
|
// Data of each dimension
|
||||||
final ListTag dimensions = ((CompoundTag) dimensionRegistry.get("minecraft:dimension_type")).get("value");
|
final ListTag dimensions = ((CompoundTag) dimensionRegistry.get("minecraft:dimension_type")).get("value");
|
||||||
@ -61,6 +53,6 @@ public class MappingData extends MappingDataBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag getDimensionRegistry() {
|
public CompoundTag getDimensionRegistry() {
|
||||||
return dimensionRegistry.clone();
|
return dimensionRegistry.copy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,6 @@ public class EntityPackets {
|
|||||||
Via.getPlatform().getLogger().severe("Could not get dimension data of " + dimensionType);
|
Via.getPlatform().getLogger().severe("Could not get dimension data of " + dimensionType);
|
||||||
throw new NullPointerException("Dimension data for " + dimensionType + " is null!");
|
throw new NullPointerException("Dimension data for " + dimensionType + " is null!");
|
||||||
}
|
}
|
||||||
return tag.clone();
|
return tag.copy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ public class EntityPackets {
|
|||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
wrapper.write(Type.BYTE, (byte) -1); // Previous gamemode, set to none
|
wrapper.write(Type.BYTE, (byte) -1); // Previous gamemode, set to none
|
||||||
wrapper.write(Type.STRING_ARRAY, Arrays.copyOf(WORLD_NAMES, WORLD_NAMES.length)); // World list - only used for command completion
|
wrapper.write(Type.STRING_ARRAY, Arrays.copyOf(WORLD_NAMES, WORLD_NAMES.length)); // World list - only used for command completion
|
||||||
wrapper.write(Type.NAMED_COMPOUND_TAG, DIMENSIONS_TAG.clone()); // Dimension registry
|
wrapper.write(Type.NAMED_COMPOUND_TAG, DIMENSIONS_TAG.copy()); // Dimension registry
|
||||||
});
|
});
|
||||||
handler(DIMENSION_HANDLER); // Dimension
|
handler(DIMENSION_HANDLER); // Dimension
|
||||||
map(Type.LONG); // Seed
|
map(Type.LONG); // Seed
|
||||||
|
@ -230,7 +230,7 @@ public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPack
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace chat types - they won't actually be used
|
// Replace chat types - they won't actually be used
|
||||||
registry.put("minecraft:chat_type", CHAT_REGISTRY.clone());
|
registry.put("minecraft:chat_type", CHAT_REGISTRY.copy());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -17,11 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.data;
|
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.data;
|
||||||
|
|
||||||
import com.github.steveice10.opennbt.NBTIO;
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.viaversion.viaversion.api.data.MappingDataBase;
|
import com.viaversion.viaversion.api.data.MappingDataBase;
|
||||||
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public final class MappingData extends MappingDataBase {
|
public final class MappingData extends MappingDataBase {
|
||||||
|
|
||||||
@ -33,14 +31,10 @@ public final class MappingData extends MappingDataBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadExtras(final CompoundTag data) {
|
protected void loadExtras(final CompoundTag data) {
|
||||||
try {
|
damageTypesRegistry = MappingDataLoader.loadNBTFromFile("damage-types-1.19.4.nbt");
|
||||||
damageTypesRegistry = NBTIO.readTag(MappingDataLoader.getResource("damage-types-1.19.4.nbt"));
|
|
||||||
} catch (final IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag damageTypesRegistry() {
|
public CompoundTag damageTypesRegistry() {
|
||||||
return damageTypesRegistry.clone();
|
return damageTypesRegistry.copy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.protocols.protocol1_19to1_18_2.data;
|
package com.viaversion.viaversion.protocols.protocol1_19to1_18_2.data;
|
||||||
|
|
||||||
import com.github.steveice10.opennbt.NBTIO;
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.NumberTag;
|
import com.github.steveice10.opennbt.tag.builtin.NumberTag;
|
||||||
@ -26,7 +25,6 @@ import com.viaversion.viaversion.api.data.MappingDataBase;
|
|||||||
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import java.io.IOException;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
public final class MappingData extends MappingDataBase {
|
public final class MappingData extends MappingDataBase {
|
||||||
@ -39,15 +37,11 @@ public final class MappingData extends MappingDataBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadExtras(final CompoundTag daata) {
|
protected void loadExtras(final CompoundTag daata) {
|
||||||
try {
|
final ListTag chatTypes = MappingDataLoader.loadNBTFromFile("chat-types-1.19.nbt").get("values");
|
||||||
final ListTag chatTypes = NBTIO.readTag(MappingDataLoader.getResource("chat-types-1.19.nbt")).get("values");
|
for (final Tag chatType : chatTypes) {
|
||||||
for (final Tag chatType : chatTypes) {
|
final CompoundTag chatTypeCompound = (CompoundTag) chatType;
|
||||||
final CompoundTag chatTypeCompound = (CompoundTag) chatType;
|
final NumberTag idTag = chatTypeCompound.get("id");
|
||||||
final NumberTag idTag = chatTypeCompound.get("id");
|
defaultChatTypes.put(idTag.asInt(), chatTypeCompound);
|
||||||
defaultChatTypes.put(idTag.asInt(), chatTypeCompound);
|
|
||||||
}
|
|
||||||
} catch (final IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_18,
|
|||||||
final CompoundTag tag = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
|
final CompoundTag tag = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
|
||||||
|
|
||||||
// Add necessary chat types
|
// Add necessary chat types
|
||||||
tag.put("minecraft:chat_type", CHAT_REGISTRY.clone());
|
tag.put("minecraft:chat_type", CHAT_REGISTRY.copy());
|
||||||
|
|
||||||
// Cache a whole lot of data
|
// Cache a whole lot of data
|
||||||
final ListTag dimensions = ((CompoundTag) tag.get("minecraft:dimension_type")).get("value");
|
final ListTag dimensions = ((CompoundTag) tag.get("minecraft:dimension_type")).get("value");
|
||||||
@ -216,7 +216,7 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_18,
|
|||||||
final String name = (String) dimensionCompound.get("name").getValue();
|
final String name = (String) dimensionCompound.get("name").getValue();
|
||||||
addMonsterSpawnData(element);
|
addMonsterSpawnData(element);
|
||||||
dimensionDataMap.put(name, new DimensionDataImpl(element));
|
dimensionDataMap.put(name, new DimensionDataImpl(element));
|
||||||
dimensionsMap.put(element.clone(), name);
|
dimensionsMap.put(element.copy(), name);
|
||||||
}
|
}
|
||||||
tracker(wrapper.user()).setDimensions(dimensionDataMap);
|
tracker(wrapper.user()).setDimensions(dimensionDataMap);
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class FakeTileEntity {
|
|||||||
public static CompoundTag createTileEntity(int x, int y, int z, int block) {
|
public static CompoundTag createTileEntity(int x, int y, int z, int block) {
|
||||||
CompoundTag originalTag = tileEntities.get(block);
|
CompoundTag originalTag = tileEntities.get(block);
|
||||||
if (originalTag != null) {
|
if (originalTag != null) {
|
||||||
CompoundTag tag = originalTag.clone();
|
CompoundTag tag = originalTag.copy();
|
||||||
tag.put("x", new IntTag(x));
|
tag.put("x", new IntTag(x));
|
||||||
tag.put("y", new IntTag(y));
|
tag.put("y", new IntTag(y));
|
||||||
tag.put("z", new IntTag(z));
|
tag.put("z", new IntTag(z));
|
||||||
|
@ -69,7 +69,7 @@ public class CommandBlockStorage implements StorableObject {
|
|||||||
if (tag == null)
|
if (tag == null)
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
|
||||||
tag = tag.clone();
|
tag = tag.copy();
|
||||||
tag.put("powered", new ByteTag((byte) 0));
|
tag.put("powered", new ByteTag((byte) 0));
|
||||||
tag.put("auto", new ByteTag((byte) 0));
|
tag.put("auto", new ByteTag((byte) 0));
|
||||||
tag.put("conditionMet", new ByteTag((byte) 0));
|
tag.put("conditionMet", new ByteTag((byte) 0));
|
||||||
|
@ -5,7 +5,7 @@ metadata.format.version = "1.1"
|
|||||||
gson = "2.10.1"
|
gson = "2.10.1"
|
||||||
fastutil = "8.5.12"
|
fastutil = "8.5.12"
|
||||||
flare = "2.0.1"
|
flare = "2.0.1"
|
||||||
vianbt = "3.5.0"
|
vianbt = "4.0.0"
|
||||||
mcstructs = "2.4.2-SNAPSHOT"
|
mcstructs = "2.4.2-SNAPSHOT"
|
||||||
|
|
||||||
# Common provided
|
# Common provided
|
||||||
|
Loading…
Reference in New Issue
Block a user