3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-10-08 11:10:06 +02:00

More primitive tag calls

Dieser Commit ist enthalten in:
KennyTV 2021-03-15 10:28:29 +01:00 committet von Nassim
Ursprung 388eb73782
Commit b589561932
5 geänderte Dateien mit 13 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -479,7 +479,7 @@ public class InventoryPackets {
if (tag != null) {
// Check for valid tag
if (tag.get(NBT_TAG_NAME) instanceof IntTag) {
rawId = (Integer) tag.get(NBT_TAG_NAME).getValue();
rawId = ((NumberTag) tag.get(NBT_TAG_NAME)).asInt();
// Remove the tag
tag.remove(NBT_TAG_NAME);
gotRawIdFromTag = true;

Datei anzeigen

@ -1,6 +1,7 @@
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.NumberTag;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import us.myles.ViaVersion.api.PacketWrapper;
@ -426,9 +427,9 @@ public class WorldPackets {
for (CompoundTag tag : chunk.getBlockEntities()) {
int newId = provider.transform(wrapper.user(), null, tag, false);
if (newId != -1) {
int x = (int) tag.get("x").getValue();
int y = (int) tag.get("y").getValue();
int z = (int) tag.get("z").getValue();
int x = ((NumberTag) tag.get("x")).asInt();
int y = ((NumberTag) tag.get("y")).asInt();
int z = ((NumberTag) tag.get("z")).asInt();
Position position = new Position(x, (short) y, z);
// Store the replacement blocks for blockupdates

Datei anzeigen

@ -61,7 +61,7 @@ public class BannerHandler implements BlockEntityProvider.BlockEntityHandler {
return blockId;
}
private long getLong(Tag tag) {
return ((Integer) tag.getValue()).longValue();
private long getLong(NumberTag tag) {
return tag.asLong();
}
}

Datei anzeigen

@ -40,7 +40,7 @@ public class SkullHandler implements BlockEntityProvider.BlockEntityHandler {
return id;
}
private long getLong(Tag tag) {
return ((Integer) tag.getValue()).longValue();
private long getLong(NumberTag tag) {
return tag.asLong();
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.chunks;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.NumberTag;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
@ -41,9 +42,9 @@ public class BlockEntity {
if (newId == -1)
continue;
int x = (int) tag.get("x").getValue();
int y = (int) tag.get("y").getValue();
int z = (int) tag.get("z").getValue();
int x = ((NumberTag) tag.get("x")).asInt();
int y = ((NumberTag) tag.get("y")).asInt();
int z = ((NumberTag) tag.get("z")).asInt();
Position pos = new Position(x, (short) y, z);