3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 00:00:33 +01:00
Dieser Commit ist enthalten in:
KennyTV 2020-08-06 20:23:22 +02:00
Ursprung 6e01a0affd
Commit 9f9d05d3c6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 35 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -90,6 +90,8 @@ public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters.
handler(wrapper -> { handler(wrapper -> {
wrapper.cancel(); wrapper.cancel();
long chunkPosition = wrapper.read(Type.LONG); long chunkPosition = wrapper.read(Type.LONG);
wrapper.read(Type.BOOLEAN); // Ignore old light data
int chunkX = (int) (chunkPosition >> 42); int chunkX = (int) (chunkPosition >> 42);
int chunkY = (int) (chunkPosition << 44 >> 44); int chunkY = (int) (chunkPosition << 44 >> 44);
int chunkZ = (int) (chunkPosition << 22 >> 42); int chunkZ = (int) (chunkPosition << 22 >> 42);

Datei anzeigen

@ -16,6 +16,8 @@ import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.EntityPackets; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.EntityPackets;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import us.myles.viaversion.libs.gson.JsonElement; import us.myles.viaversion.libs.gson.JsonElement;
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.StringTag;
public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2> { public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2> {
@ -51,8 +53,10 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
// Just screw the registry and write the defaults for 1.16 and 1.16.1 clients // Just screw the registry and write the defaults for 1.16 and 1.16.1 clients
wrapper.read(Type.NBT); wrapper.read(Type.NBT);
wrapper.write(Type.NBT, EntityPackets.DIMENSIONS_TAG); wrapper.write(Type.NBT, EntityPackets.DIMENSIONS_TAG);
CompoundTag dimensionData = wrapper.read(Type.NBT);
wrapper.write(Type.STRING, dimensionFromData(dimensionData));
}); });
map(Type.STRING); // Dimension Type
map(Type.STRING); // Dimension map(Type.STRING); // Dimension
map(Type.LONG); // Seed map(Type.LONG); // Seed
handler(wrapper -> { handler(wrapper -> {
@ -68,6 +72,34 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
}); });
} }
}); });
protocol.registerOutgoing(ClientboundPackets1_16_2.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
CompoundTag dimensionData = wrapper.read(Type.NBT);
wrapper.write(Type.STRING, dimensionFromData(dimensionData));
});
}
});
}
private String dimensionFromData(CompoundTag dimensionData) {
StringTag infiniburn = dimensionData.get("infiniburn");
if (infiniburn == null) return "minecraft:overworld";
// Not much we can do aside from guessing, since the data doesn't actually contain the dimension key
switch (infiniburn.getValue()) {
case "minecraft:infiniburn_nether":
return "minecraft:the_nether";
case "minecraft:infiniburn_end":
return "minecraft:the_end";
case "minecraft:infiniburn_overworld":
default:
return "minecraft:overworld";
}
} }
@Override @Override