3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 08:30:10 +01:00

Update VV usage

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-02-13 19:03:56 +01:00
Ursprung bc03235f42
Commit 5a3a82a83d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
5 geänderte Dateien mit 12 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -25,9 +25,8 @@ import com.viaversion.viabackwards.listener.LecternInteractListener;
import com.viaversion.viabackwards.listener.PlayerItemDropListener; import com.viaversion.viabackwards.listener.PlayerItemDropListener;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File; import java.io.File;
import org.bukkit.plugin.java.JavaPlugin;
public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform { public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
@ -46,17 +45,17 @@ public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
} }
private void enable() { private void enable() {
int protocolVersion = Via.getAPI().getServerVersion().highestSupportedVersion(); ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().highestSupportedProtocolVersion();
if (protocolVersion >= ProtocolVersion.v1_17.getVersion()) { if (protocolVersion.higherThanOrEquals(ProtocolVersion.v1_17)) {
new PlayerItemDropListener(this).register(); new PlayerItemDropListener(this).register();
} }
if (protocolVersion >= ProtocolVersion.v1_16.getVersion()) { if (protocolVersion.higherThanOrEquals(ProtocolVersion.v1_16)) {
new FireExtinguishListener(this).register(); new FireExtinguishListener(this).register();
} }
if (protocolVersion >= ProtocolVersion.v1_14.getVersion()) { if (protocolVersion.higherThanOrEquals(ProtocolVersion.v1_14)) {
new LecternInteractListener(this).register(); new LecternInteractListener(this).register();
} }
if (protocolVersion >= ProtocolVersion.v1_12.getVersion()) { if (protocolVersion.higherThanOrEquals(ProtocolVersion.v1_12)) {
new FireDamageListener(this).register(); new FireDamageListener(this).register();
} }
} }

Datei anzeigen

@ -19,6 +19,7 @@ package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.AttributeMappings;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -32,7 +33,7 @@ public class BackwardsMappings extends com.viaversion.viabackwards.api.data.Back
@Override @Override
protected void loadExtras(final CompoundTag data) { protected void loadExtras(final CompoundTag data) {
super.loadExtras(data); super.loadExtras(data);
for (Map.Entry<String, String> entry : Protocol1_16To1_15_2.MAPPINGS.attributeIdentifierMappings().entrySet()) { for (Map.Entry<String, String> entry : AttributeMappings.attributeIdentifierMappings().entrySet()) {
attributeMappings.put(entry.getValue(), entry.getKey()); attributeMappings.put(entry.getValue(), entry.getKey());
} }
} }

Datei anzeigen

@ -119,7 +119,7 @@ public class EntityPackets1_16 extends EntityRewriter<ClientboundPackets1_16, Pr
// Send a dummy respawn with a different dimension if the world name was different and the same dimension was used // Send a dummy respawn with a different dimension if the world name was different and the same dimension was used
if (clientWorld.getEnvironment() != null && dimension == clientWorld.getEnvironment().id() if (clientWorld.getEnvironment() != null && dimension == clientWorld.getEnvironment().id()
&& (wrapper.user().isClientSide() || Via.getPlatform().isProxy() && (wrapper.user().isClientSide() || Via.getPlatform().isProxy()
|| wrapper.user().getProtocolInfo().getProtocolVersion() <= ProtocolVersion.v1_12_2.getVersion() // Hotfix for https://github.com/ViaVersion/ViaBackwards/issues/381 || wrapper.user().getProtocolInfo().protocolVersion().lowerThanOrEquals(ProtocolVersion.v1_12_2) // Hotfix for https://github.com/ViaVersion/ViaBackwards/issues/381
|| !nextWorldName.equals(worldNameTracker.getWorldName()))) { || !nextWorldName.equals(worldNameTracker.getWorldName()))) {
PacketWrapper packet = wrapper.create(ClientboundPackets1_15.RESPAWN); PacketWrapper packet = wrapper.create(ClientboundPackets1_15.RESPAWN);
packet.write(Type.INT, dimension == 0 ? -1 : 0); packet.write(Type.INT, dimension == 0 ? -1 : 0);

Datei anzeigen

@ -73,7 +73,7 @@ public class EntityPackets1_16_2 extends EntityRewriter<ClientboundPackets1_16_2
map(Type.STRING_ARRAY); // World List map(Type.STRING_ARRAY); // World List
handler(wrapper -> { handler(wrapper -> {
CompoundTag registry = wrapper.read(Type.NAMED_COMPOUND_TAG); CompoundTag registry = wrapper.read(Type.NAMED_COMPOUND_TAG);
if (wrapper.user().getProtocolInfo().getProtocolVersion() <= ProtocolVersion.v1_15_2.getVersion()) { if (wrapper.user().getProtocolInfo().protocolVersion().lowerThanOrEquals(ProtocolVersion.v1_15_2)) {
// Store biomes for <1.16 client handling // Store biomes for <1.16 client handling
CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome"); CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
ListTag biomes = biomeRegistry.get("value"); ListTag biomes = biomeRegistry.get("value");

Datei anzeigen

@ -22,6 +22,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap; import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.data.BlockEntities;
public final class BackwardsMappings extends com.viaversion.viabackwards.api.data.BackwardsMappings { public final class BackwardsMappings extends com.viaversion.viabackwards.api.data.BackwardsMappings {
@ -35,7 +36,7 @@ public final class BackwardsMappings extends com.viaversion.viabackwards.api.dat
protected void loadExtras(final CompoundTag data) { protected void loadExtras(final CompoundTag data) {
super.loadExtras(data); super.loadExtras(data);
for (final Object2IntMap.Entry<String> entry : Protocol1_18To1_17_1.MAPPINGS.blockEntityIds().object2IntEntrySet()) { for (final Object2IntMap.Entry<String> entry : BlockEntities.blockEntityIds().object2IntEntrySet()) {
blockEntities.put(entry.getIntValue(), entry.getKey()); blockEntities.put(entry.getIntValue(), entry.getKey());
} }
} }