Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 16:12:43 +01:00
24w04a
Dieser Commit ist enthalten in:
Ursprung
a2ddcae076
Commit
3e89641448
@ -25,6 +25,7 @@ import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.provider.Tran
|
|||||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.BlockItemPacketRewriter1_20_5;
|
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.BlockItemPacketRewriter1_20_5;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.EntityPacketRewriter1_20_5;
|
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.EntityPacketRewriter1_20_5;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.CookieStorage;
|
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.CookieStorage;
|
||||||
|
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.RegistryDataStorage;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.SecureChatStorage;
|
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.SecureChatStorage;
|
||||||
import com.viaversion.viaversion.api.Via;
|
import com.viaversion.viaversion.api.Via;
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
@ -69,7 +70,16 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
|
|||||||
|
|
||||||
final TagRewriter<ClientboundPackets1_20_5> tagRewriter = new TagRewriter<>(this);
|
final TagRewriter<ClientboundPackets1_20_5> tagRewriter = new TagRewriter<>(this);
|
||||||
tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
|
tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
|
||||||
tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.UPDATE_TAGS);
|
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.UPDATE_TAGS, wrapper -> {
|
||||||
|
// Send off registry data first
|
||||||
|
final PacketWrapper registryDataPacket = wrapper.create(ClientboundConfigurationPackets1_20_3.REGISTRY_DATA);
|
||||||
|
registryDataPacket.write(Type.COMPOUND_TAG, wrapper.user().get(RegistryDataStorage.class).registryData().copy());
|
||||||
|
registryDataPacket.send(Protocol1_20_3To1_20_5.class);
|
||||||
|
|
||||||
|
tagRewriter.getGenericHandler().handle(wrapper);
|
||||||
|
});
|
||||||
|
|
||||||
|
registerClientbound(ClientboundPackets1_20_5.START_CONFIGURATION, wrapper -> wrapper.user().get(RegistryDataStorage.class).registryData().clear());
|
||||||
|
|
||||||
final SoundRewriter<ClientboundPackets1_20_5> soundRewriter = new SoundRewriter<>(this);
|
final SoundRewriter<ClientboundPackets1_20_5> soundRewriter = new SoundRewriter<>(this);
|
||||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND);
|
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND);
|
||||||
@ -151,6 +161,7 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
|
|||||||
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_20_5.PLAYER));
|
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_20_5.PLAYER));
|
||||||
user.put(new SecureChatStorage());
|
user.put(new SecureChatStorage());
|
||||||
user.put(new CookieStorage());
|
user.put(new CookieStorage());
|
||||||
|
user.put(new RegistryDataStorage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,7 +19,10 @@ package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter;
|
|||||||
|
|
||||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.Protocol1_20_3To1_20_5;
|
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.Protocol1_20_3To1_20_5;
|
||||||
|
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.RegistryDataStorage;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.SecureChatStorage;
|
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.SecureChatStorage;
|
||||||
|
import com.viaversion.viaversion.api.data.entity.DimensionData;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.RegistryEntry;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||||
@ -27,9 +30,15 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
|||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||||
|
import com.viaversion.viaversion.data.entity.DimensionDataImpl;
|
||||||
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.AttributeMappings;
|
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.AttributeMappings;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
|
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
|
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
|
||||||
|
import com.viaversion.viaversion.util.Key;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public final class EntityPacketRewriter1_20_5 extends EntityRewriter<ClientboundPackets1_20_5, Protocol1_20_3To1_20_5> {
|
public final class EntityPacketRewriter1_20_5 extends EntityRewriter<ClientboundPackets1_20_5, Protocol1_20_3To1_20_5> {
|
||||||
|
|
||||||
@ -46,9 +55,45 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
|||||||
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.REGISTRY_DATA, new PacketHandlers() {
|
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.REGISTRY_DATA, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
protected void register() {
|
protected void register() {
|
||||||
map(Type.COMPOUND_TAG); // Registry data
|
handler(wrapper -> {
|
||||||
handler(configurationDimensionDataHandler()); // Caches dimensions to access data like height later
|
final String registryKey = Key.stripMinecraftNamespace(wrapper.read(Type.STRING));
|
||||||
handler(configurationBiomeSizeTracker()); // Tracks the amount of biomes sent for chunk data
|
final RegistryEntry[] entries = wrapper.read(Type.REGISTRY_ENTRY_ARRAY);
|
||||||
|
|
||||||
|
// Track data
|
||||||
|
final RegistryDataStorage registryDataStorage = wrapper.user().get(RegistryDataStorage.class);
|
||||||
|
if (registryKey.equals("worldgen/biome")) {
|
||||||
|
tracker(wrapper.user()).setBiomesSent(entries.length);
|
||||||
|
} else if (registryKey.equals("dimension_type")) {
|
||||||
|
final Map<String, DimensionData> dimensionDataMap = new HashMap<>(entries.length);
|
||||||
|
final String[] keys = new String[entries.length];
|
||||||
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
final RegistryEntry entry = entries[i];
|
||||||
|
final String dimensionKey = Key.stripMinecraftNamespace(entry.key());
|
||||||
|
dimensionDataMap.put(dimensionKey, new DimensionDataImpl(i, (CompoundTag) entry.tag()));
|
||||||
|
keys[i] = dimensionKey;
|
||||||
|
}
|
||||||
|
registryDataStorage.setDimensionKeys(keys);
|
||||||
|
tracker(wrapper.user()).setDimensions(dimensionDataMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write to old format
|
||||||
|
final CompoundTag registryTag = new CompoundTag();
|
||||||
|
final ListTag entriesTag = new ListTag();
|
||||||
|
registryTag.putString("type", registryKey);
|
||||||
|
registryTag.put("value", entriesTag);
|
||||||
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
final RegistryEntry entry = entries[i];
|
||||||
|
final CompoundTag entryCompoundTag = new CompoundTag();
|
||||||
|
entryCompoundTag.putString("name", entry.key());
|
||||||
|
entryCompoundTag.putInt("id", i);
|
||||||
|
entryCompoundTag.put("element", entry.tag());
|
||||||
|
entriesTag.add(entryCompoundTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store and send together with the rest later
|
||||||
|
registryDataStorage.registryData().put(registryKey, registryTag);
|
||||||
|
wrapper.cancel();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -64,6 +109,11 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
|||||||
map(Type.BOOLEAN); // Reduced debug info
|
map(Type.BOOLEAN); // Reduced debug info
|
||||||
map(Type.BOOLEAN); // Show death screen
|
map(Type.BOOLEAN); // Show death screen
|
||||||
map(Type.BOOLEAN); // Limited crafting
|
map(Type.BOOLEAN); // Limited crafting
|
||||||
|
handler(wrapper -> {
|
||||||
|
final int dimensionId = wrapper.read(Type.VAR_INT);
|
||||||
|
final RegistryDataStorage storage = wrapper.user().get(RegistryDataStorage.class);
|
||||||
|
wrapper.write(Type.STRING, storage.dimensionKeys()[dimensionId]);
|
||||||
|
});
|
||||||
map(Type.STRING); // Dimension key
|
map(Type.STRING); // Dimension key
|
||||||
map(Type.STRING); // World
|
map(Type.STRING); // World
|
||||||
map(Type.LONG); // Seed
|
map(Type.LONG); // Seed
|
||||||
@ -84,7 +134,11 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
|||||||
protocol.registerClientbound(ClientboundPackets1_20_5.RESPAWN, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_20_5.RESPAWN, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
map(Type.STRING); // Dimension
|
handler(wrapper -> {
|
||||||
|
final int dimensionId = wrapper.read(Type.VAR_INT);
|
||||||
|
final RegistryDataStorage storage = wrapper.user().get(RegistryDataStorage.class);
|
||||||
|
wrapper.write(Type.STRING, storage.dimensionKeys()[dimensionId]);
|
||||||
|
});
|
||||||
map(Type.STRING); // World
|
map(Type.STRING); // World
|
||||||
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
|
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||||
|
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||||
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
public final class RegistryDataStorage implements StorableObject {
|
||||||
|
|
||||||
|
private final CompoundTag registryData = new CompoundTag();
|
||||||
|
private String[] dimensionKeys;
|
||||||
|
|
||||||
|
public CompoundTag registryData() {
|
||||||
|
return registryData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String @Nullable [] dimensionKeys() {
|
||||||
|
return dimensionKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDimensionKeys(final String[] dimensionKeys) {
|
||||||
|
this.dimensionKeys = dimensionKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
registryData.clear();
|
||||||
|
dimensionKeys = null;
|
||||||
|
}
|
||||||
|
}
|
Binäre Datei nicht angezeigt.
@ -1,4 +1,4 @@
|
|||||||
projectVersion=4.10.0-24w03a-SNAPSHOT
|
projectVersion=4.10.0-24w04a-SNAPSHOT
|
||||||
|
|
||||||
# Smile emoji
|
# Smile emoji
|
||||||
mcVersions=1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10
|
mcVersions=1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10
|
||||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
# ViaVersion
|
# ViaVersion
|
||||||
viaver = "4.10.0-24w03a-SNAPSHOT"
|
viaver = "4.10.0-24w04a-SNAPSHOT"
|
||||||
|
|
||||||
# Common provided
|
# Common provided
|
||||||
netty = "4.0.20.Final"
|
netty = "4.0.20.Final"
|
||||||
|
@ -4,6 +4,7 @@ rootProject.name = "viabackwards-parent"
|
|||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
maven("https://repo.viaversion.com")
|
maven("https://repo.viaversion.com")
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||||
|
@ -46,9 +46,9 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.REGISTRY_DATA, new PacketHandlers() {
|
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.REGISTRY_DATA, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
protected void register() {
|
protected void register() {
|
||||||
map(Type.COMPOUND_TAG); // Registry data
|
map(Type.STRING); // Registry
|
||||||
handler(configurationDimensionDataHandler()); // Caches dimensions to access data like height later
|
map(Type.REGISTRY_ENTRY_ARRAY); // Data
|
||||||
handler(configurationBiomeSizeTracker()); // Tracks the amount of biomes sent for chunk data
|
handler(registryDataHandler1_20_5()); // Caches dimensions to access data like height later and tracks the amount of biomes sent for chunk data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -64,18 +64,18 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
map(Type.BOOLEAN); // Reduced debug info
|
map(Type.BOOLEAN); // Reduced debug info
|
||||||
map(Type.BOOLEAN); // Show death screen
|
map(Type.BOOLEAN); // Show death screen
|
||||||
map(Type.BOOLEAN); // Limited crafting
|
map(Type.BOOLEAN); // Limited crafting
|
||||||
map(Type.STRING); // Dimension key
|
map(Type.VAR_INT); // Dimension key
|
||||||
map(Type.STRING); // World
|
map(Type.STRING); // World
|
||||||
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
|
handler(worldDataTrackerHandlerByKey1_20_5(3)); // Tracks world height and name for chunk data and entity (un)tracking
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_20_5.RESPAWN, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_20_5.RESPAWN, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
map(Type.STRING); // Dimension
|
map(Type.VAR_INT); // Dimension
|
||||||
map(Type.STRING); // World
|
map(Type.STRING); // World
|
||||||
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
|
handler(worldDataTrackerHandlerByKey1_20_5(0)); // Tracks world height and name for chunk data and entity (un)tracking
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren