Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Cleanup config packet registration in newer protocols
Dieser Commit ist enthalten in:
Ursprung
ce8fab7c44
Commit
1dafa7d273
@ -133,43 +133,33 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
appendClientbound(startConfigurationPacket, setServerStateHandler(State.CONFIGURATION));
|
||||
}
|
||||
|
||||
final ServerboundPacketType finishConfigurationPacket = serverboundFinishConfigurationPacket();
|
||||
final SU finishConfigurationPacket = serverboundFinishConfigurationPacket();
|
||||
if (finishConfigurationPacket != null) {
|
||||
appendServerbound(finishConfigurationPacket, setClientStateHandler(State.PLAY));
|
||||
}
|
||||
|
||||
final ClientboundPacketType clientboundFinishConfigurationPacket = clientboundFinishConfigurationPacket();
|
||||
final CU clientboundFinishConfigurationPacket = clientboundFinishConfigurationPacket();
|
||||
if (clientboundFinishConfigurationPacket != null) {
|
||||
appendClientbound(clientboundFinishConfigurationPacket, setServerStateHandler(State.PLAY));
|
||||
}
|
||||
}
|
||||
|
||||
private void appendClientbound(final ClientboundPacketType type, final PacketHandler handler) {
|
||||
final PacketMapping mapping = clientboundMappings.mappedPacket(type.state(), type.getId()); // Use existing handler if present
|
||||
final PacketHandler newHandler;
|
||||
final int mappedPacketId;
|
||||
public void appendClientbound(final CU type, final PacketHandler handler) {
|
||||
final PacketMapping mapping = clientboundMappings.mappedPacket(type.state(), type.getId());
|
||||
if (mapping != null) {
|
||||
newHandler = mapping.handler().append(handler);
|
||||
mappedPacketId = mapping.mappedPacketId() != null ? mapping.mappedPacketId() : type.getId();
|
||||
mapping.appendHandler(handler);
|
||||
} else {
|
||||
newHandler = handler;
|
||||
mappedPacketId = type.getId();
|
||||
registerClientbound(type, handler);
|
||||
}
|
||||
registerClientbound(type.state(), type.getId(), mappedPacketId, newHandler, true);
|
||||
}
|
||||
|
||||
private void appendServerbound(final ServerboundPacketType type, final PacketHandler handler) {
|
||||
final PacketMapping mapping = serverboundMappings.mappedPacket(type.state(), type.getId()); // Use existing handler if present
|
||||
final PacketHandler newHandler;
|
||||
final int mappedPacketId;
|
||||
public void appendServerbound(final SU type, final PacketHandler handler) {
|
||||
final PacketMapping mapping = serverboundMappings.mappedPacket(type.state(), type.getId());
|
||||
if (mapping != null) {
|
||||
newHandler = mapping.handler().append(handler);
|
||||
mappedPacketId = mapping.mappedPacketId() != null ? mapping.mappedPacketId() : type.getId();
|
||||
mapping.appendHandler(handler);
|
||||
} else {
|
||||
newHandler = handler;
|
||||
mappedPacketId = type.getId();
|
||||
registerServerbound(type, handler);
|
||||
}
|
||||
registerServerbound(type.state(), type.getId(), mappedPacketId, newHandler, true);
|
||||
}
|
||||
|
||||
private <U extends PacketType, M extends PacketType> void registerPacketIdChanges(
|
||||
@ -181,17 +171,16 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
for (Map.Entry<State, PacketTypeMap<M>> entry : mappedPacketTypes.entrySet()) {
|
||||
PacketTypeMap<M> mappedTypes = entry.getValue();
|
||||
PacketTypeMap<U> unmappedTypes = unmappedPacketTypes.get(entry.getKey());
|
||||
registerPacketIdChanges(unmappedTypes, mappedTypes, registeredPredicate, registerConsumer, true);
|
||||
registerPacketIdChanges(unmappedTypes, mappedTypes, registeredPredicate, registerConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
protected <U extends PacketType, M extends PacketType> void registerPacketIdChanges(PacketTypeMap<U> unmappedTypes, PacketTypeMap<M> mappedTypes, Predicate<U> registeredPredicate, BiConsumer<U, M> registerConsumer, boolean errorOnMissing) {
|
||||
protected <U extends PacketType, M extends PacketType> void registerPacketIdChanges(PacketTypeMap<U> unmappedTypes, PacketTypeMap<M> mappedTypes, Predicate<U> registeredPredicate, BiConsumer<U, M> registerConsumer) {
|
||||
for (U unmappedType : unmappedTypes.types()) {
|
||||
M mappedType = mappedTypes.typeByName(unmappedType.getName());
|
||||
if (mappedType == null) {
|
||||
// No mapped packet of the same name exists
|
||||
Preconditions.checkArgument(registeredPredicate.test(unmappedType) || !errorOnMissing,
|
||||
"Packet %s in %s has no mapping - it needs to be manually cancelled or remapped", unmappedType, getClass());
|
||||
Preconditions.checkArgument(registeredPredicate.test(unmappedType), "Packet %s in %s has no mapping - it needs to be manually cancelled or remapped", unmappedType, getClass());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -202,40 +191,6 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated // TODO Should instead be done automatically/properly via the packet types provider
|
||||
protected void registerClientboundPacketIdChanges(State state, Class<? extends ClientboundPacketType> unmappedPacketTypesClass, Class<? extends ClientboundPacketType> mappedPacketTypesClass) {
|
||||
registerPacketIdChanges(
|
||||
PacketTypeMap.of(unmappedPacketTypesClass),
|
||||
PacketTypeMap.of(mappedPacketTypesClass),
|
||||
type -> false,
|
||||
(unmappedType, mappedType) -> {
|
||||
final PacketMapping mapping = clientboundMappings.mappedPacket(state, unmappedType.getId());
|
||||
this.registerClientbound(state, unmappedType.getId(), mappedType.getId(), wrapper -> {
|
||||
if (mapping != null && mapping.handler() != null) {
|
||||
mapping.handler().handle(wrapper);
|
||||
}
|
||||
}, true);
|
||||
}, false
|
||||
);
|
||||
}
|
||||
|
||||
@Deprecated // TODO Should instead be done automatically/properly via the packet types provider
|
||||
protected void registerServerboundPacketIdChanges(State state, Class<? extends ServerboundPacketType> unmappedPacketTypesClass, Class<? extends ServerboundPacketType> mappedPacketTypesClass) {
|
||||
registerPacketIdChanges(
|
||||
PacketTypeMap.of(unmappedPacketTypesClass),
|
||||
PacketTypeMap.of(mappedPacketTypesClass),
|
||||
type -> false,
|
||||
(unmappedType, mappedType) -> {
|
||||
final PacketMapping mapping = serverboundMappings.mappedPacket(state, unmappedType.getId());
|
||||
this.registerServerbound(state, unmappedType.getId(), mappedType.getId(), wrapper -> {
|
||||
if (mapping != null && mapping.handler() != null) {
|
||||
mapping.handler().handle(wrapper);
|
||||
}
|
||||
}, true);
|
||||
}, false
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void loadMappingData() {
|
||||
getMappingData().load();
|
||||
@ -278,10 +233,10 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
|
||||
protected PacketTypesProvider<CU, CM, SM, SU> createPacketTypesProvider() {
|
||||
return new SimplePacketTypesProvider<>(
|
||||
packetTypeMap(unmappedClientboundPacketType),
|
||||
packetTypeMap(mappedClientboundPacketType),
|
||||
packetTypeMap(mappedServerboundPacketType),
|
||||
packetTypeMap(unmappedServerboundPacketType)
|
||||
packetTypeMap(unmappedClientboundPacketType, unmappedClientboundPacketType),
|
||||
packetTypeMap(mappedClientboundPacketType, mappedClientboundPacketType),
|
||||
packetTypeMap(mappedServerboundPacketType, mappedServerboundPacketType),
|
||||
packetTypeMap(unmappedServerboundPacketType, unmappedServerboundPacketType)
|
||||
);
|
||||
}
|
||||
|
||||
@ -293,35 +248,50 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
return PacketMappings.arrayMappings();
|
||||
}
|
||||
|
||||
protected <P extends PacketType> Map<State, PacketTypeMap<P>> packetTypeMap(@Nullable Class<P> packetTypeClass) {
|
||||
if (packetTypeClass != null) {
|
||||
Map<State, PacketTypeMap<P>> map = new EnumMap<>(State.class);
|
||||
map.put(State.PLAY, PacketTypeMap.of(packetTypeClass));
|
||||
return map;
|
||||
/**
|
||||
* Returns a map of packet types by state.
|
||||
*
|
||||
* @param parent parent packet type class as given by the Protocol generics
|
||||
* @param packetTypeClasses packet type enum classes belonging to the parent type
|
||||
* @param <P> packet type class
|
||||
* @return map of packet types by state
|
||||
*/
|
||||
@SafeVarargs
|
||||
protected final <P extends PacketType> Map<State, PacketTypeMap<P>> packetTypeMap(@Nullable Class<P> parent, Class<? extends P>... packetTypeClasses) {
|
||||
if (parent == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
|
||||
final Map<State, PacketTypeMap<P>> map = new EnumMap<>(State.class);
|
||||
for (final Class<? extends P> packetTypeClass : packetTypeClasses) {
|
||||
// Get state from first enum type
|
||||
final P[] types = packetTypeClass.getEnumConstants();
|
||||
Preconditions.checkArgument(types != null, "%s not an enum", packetTypeClass);
|
||||
Preconditions.checkArgument(types.length > 0, "Enum %s has no types", packetTypeClass);
|
||||
final State state = types[0].state();
|
||||
map.put(state, PacketTypeMap.of(packetTypeClass));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
protected @Nullable SU configurationAcknowledgedPacket() {
|
||||
final Map<State, PacketTypeMap<SU>> packetTypes = packetTypesProvider.unmappedServerboundPacketTypes();
|
||||
final PacketTypeMap<SU> packetTypeMap = packetTypes.get(State.PLAY);
|
||||
final PacketTypeMap<SU> packetTypeMap = packetTypesProvider.unmappedServerboundPacketTypes().get(State.PLAY);
|
||||
return packetTypeMap != null ? packetTypeMap.typeByName("CONFIGURATION_ACKNOWLEDGED") : null;
|
||||
}
|
||||
|
||||
protected @Nullable CU startConfigurationPacket() {
|
||||
final Map<State, PacketTypeMap<CU>> packetTypes = packetTypesProvider.unmappedClientboundPacketTypes();
|
||||
final PacketTypeMap<CU> packetTypeMap = packetTypes.get(State.PLAY);
|
||||
final PacketTypeMap<CU> packetTypeMap = packetTypesProvider.unmappedClientboundPacketTypes().get(State.PLAY);
|
||||
return packetTypeMap != null ? packetTypeMap.typeByName("START_CONFIGURATION") : null;
|
||||
}
|
||||
|
||||
protected @Nullable ServerboundPacketType serverboundFinishConfigurationPacket() {
|
||||
// To be overridden
|
||||
return null;
|
||||
protected @Nullable SU serverboundFinishConfigurationPacket() {
|
||||
final PacketTypeMap<SU> packetTypeMap = packetTypesProvider.unmappedServerboundPacketTypes().get(State.CONFIGURATION);
|
||||
return packetTypeMap != null ? packetTypeMap.typeByName("FINISH_CONFIGURATION") : null;
|
||||
}
|
||||
|
||||
protected @Nullable ClientboundPacketType clientboundFinishConfigurationPacket() {
|
||||
// To be overridden
|
||||
return null;
|
||||
protected @Nullable CU clientboundFinishConfigurationPacket() {
|
||||
final PacketTypeMap<CU> packetTypeMap = packetTypesProvider.unmappedClientboundPacketTypes().get(State.CONFIGURATION);
|
||||
return packetTypeMap != null ? packetTypeMap.typeByName("FINISH_CONFIGURATION") : null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
@ -529,7 +499,7 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketTypesProvider<CU, CM, SM, SU> getPacketTypesProvider() {
|
||||
public final PacketTypesProvider<CU, CM, SM, SU> getPacketTypesProvider() {
|
||||
return packetTypesProvider;
|
||||
}
|
||||
|
||||
@ -544,10 +514,6 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
storedObjects.put(object.getClass(), object);
|
||||
}
|
||||
|
||||
public PacketTypesProvider<CU, CM, SM, SU> packetTypesProvider() {
|
||||
return packetTypesProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Protocol:" + getClass().getSimpleName();
|
||||
|
@ -28,7 +28,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
final class PacketIdMapping implements PacketMapping {
|
||||
private final int mappedPacketId;
|
||||
private final PacketHandler handler;
|
||||
private PacketHandler handler;
|
||||
|
||||
PacketIdMapping(int mappedPacketId, @Nullable PacketHandler handler) {
|
||||
this.mappedPacketId = mappedPacketId;
|
||||
@ -42,8 +42,12 @@ final class PacketIdMapping implements PacketMapping {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer mappedPacketId() {
|
||||
return mappedPacketId;
|
||||
public void appendHandler(final PacketHandler handler) {
|
||||
if (this.handler == null) {
|
||||
this.handler = handler;
|
||||
} else {
|
||||
this.handler = this.handler.then(handler);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,13 +39,6 @@ public interface PacketMapping {
|
||||
*/
|
||||
void applyType(PacketWrapper wrapper);
|
||||
|
||||
/**
|
||||
* Returns the mapped packet id if present.
|
||||
*
|
||||
* @return mapped packet type, or null if no action has to be taken
|
||||
*/
|
||||
@Nullable Integer mappedPacketId();
|
||||
|
||||
/**
|
||||
* Returns a packet transformer to transform a packet from one protocol version to another.
|
||||
*
|
||||
@ -53,6 +46,13 @@ public interface PacketMapping {
|
||||
*/
|
||||
@Nullable PacketHandler handler();
|
||||
|
||||
/**
|
||||
* Appends a packet transformer to the current packet transformer.
|
||||
*
|
||||
* @param handler packet transformer
|
||||
*/
|
||||
void appendHandler(PacketHandler handler);
|
||||
|
||||
static PacketMapping of(final int mappedPacketId, @Nullable final PacketHandler handler) {
|
||||
return new PacketIdMapping(mappedPacketId, handler);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
final class PacketTypeMapping implements PacketMapping {
|
||||
private final PacketType mappedPacketType;
|
||||
private final PacketHandler handler;
|
||||
private PacketHandler handler;
|
||||
|
||||
PacketTypeMapping(@Nullable PacketType mappedPacketType, @Nullable PacketHandler handler) {
|
||||
this.mappedPacketType = mappedPacketType;
|
||||
@ -44,8 +44,12 @@ final class PacketTypeMapping implements PacketMapping {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Integer mappedPacketId() {
|
||||
return mappedPacketType != null ? mappedPacketType.getId() : null;
|
||||
public void appendHandler(final PacketHandler handler) {
|
||||
if (this.handler == null) {
|
||||
this.handler = handler;
|
||||
} else {
|
||||
this.handler = this.handler.then(handler);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.api.protocol.packet.provider;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketType;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import java.util.Collection;
|
||||
@ -54,14 +55,11 @@ public interface PacketTypeMap<P extends PacketType> {
|
||||
*/
|
||||
Collection<P> types();
|
||||
|
||||
static <S extends PacketType, T extends S> PacketTypeMap<S> of(final Class<T> enumClass) {
|
||||
if (!enumClass.isEnum()) {
|
||||
throw new IllegalArgumentException("Given class is not an enum");
|
||||
}
|
||||
|
||||
final S[] types = enumClass.getEnumConstants();
|
||||
final Map<String, S> byName = new HashMap<>(types.length);
|
||||
for (final S type : types) {
|
||||
static <T extends PacketType, E extends T> PacketTypeMap<T> of(final Class<E> enumClass) {
|
||||
final T[] types = enumClass.getEnumConstants();
|
||||
Preconditions.checkArgument(types != null, "%s is not an enum", enumClass);
|
||||
final Map<String, T> byName = new HashMap<>(types.length);
|
||||
for (final T type : types) {
|
||||
byName.put(type.getName(), type);
|
||||
}
|
||||
return of(byName, types);
|
||||
|
@ -35,7 +35,13 @@ public interface PacketHandler {
|
||||
*/
|
||||
void handle(PacketWrapper wrapper) throws Exception;
|
||||
|
||||
default PacketHandler append(final PacketHandler handler) {
|
||||
/**
|
||||
* Returns a new packet handler that runs the provided handler after this one.
|
||||
*
|
||||
* @param handler packet handler to run aftet this one
|
||||
* @return a new packet handler that runs the provided handler after this one
|
||||
*/
|
||||
default PacketHandler then(final PacketHandler handler) {
|
||||
return wrapper -> {
|
||||
this.handle(wrapper);
|
||||
handler.handle(wrapper);
|
||||
|
@ -58,32 +58,32 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPackets1_19, ClientboundPackets1_19_1, ServerboundPackets1_19, ServerboundPackets1_19_1> {
|
||||
|
||||
private static final String CHAT_REGISTRY_SNBT = "{\n" +
|
||||
" \"minecraft:chat_type\": {\n" +
|
||||
" \"type\": \"minecraft:chat_type\",\n" +
|
||||
" \"value\": [\n" +
|
||||
" {\n" +
|
||||
" \"name\":\"minecraft:chat\",\n" +
|
||||
" \"id\":1,\n" +
|
||||
" \"element\":{\n" +
|
||||
" \"chat\":{\n" +
|
||||
" \"translation_key\":\"chat.type.text\",\n" +
|
||||
" \"parameters\":[\n" +
|
||||
" \"sender\",\n" +
|
||||
" \"content\"\n" +
|
||||
" ]\n" +
|
||||
" },\n" +
|
||||
" \"narration\":{\n" +
|
||||
" \"translation_key\":\"chat.type.text.narrate\",\n" +
|
||||
" \"parameters\":[\n" +
|
||||
" \"sender\",\n" +
|
||||
" \"content\"\n" +
|
||||
" ]\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
private static final String CHAT_REGISTRY_SNBT = "{" +
|
||||
" \"minecraft:chat_type\": {" +
|
||||
" \"type\": \"minecraft:chat_type\"," +
|
||||
" \"value\": [" +
|
||||
" {" +
|
||||
" \"name\":\"minecraft:chat\"," +
|
||||
" \"id\":1," +
|
||||
" \"element\":{" +
|
||||
" \"chat\":{" +
|
||||
" \"translation_key\":\"chat.type.text\"," +
|
||||
" \"parameters\":[" +
|
||||
" \"sender\"," +
|
||||
" \"content\"" +
|
||||
" ]" +
|
||||
" }," +
|
||||
" \"narration\":{" +
|
||||
" \"translation_key\":\"chat.type.text.narrate\"," +
|
||||
" \"parameters\":[" +
|
||||
" \"sender\"," +
|
||||
" \"content\"" +
|
||||
" ]" +
|
||||
" }" +
|
||||
" }" +
|
||||
" }" +
|
||||
" ]\n" +
|
||||
" }\n" +
|
||||
" ]" +
|
||||
" }" +
|
||||
"}";
|
||||
private static final CompoundTag CHAT_REGISTRY;
|
||||
|
||||
|
@ -17,10 +17,9 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
|
||||
public enum ClientboundConfigurationPackets1_20_2 implements ClientboundPacketType {
|
||||
public enum ClientboundConfigurationPackets1_20_2 implements ClientboundPacket1_20_2 {
|
||||
|
||||
CUSTOM_PAYLOAD, // 0x00
|
||||
DISCONNECT, // 0x01
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* 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.viaversion.protocols.protocol1_20_2to1_20.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
|
||||
public interface ClientboundPacket1_20_2 extends ClientboundPacketType {
|
||||
}
|
@ -17,9 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
|
||||
public enum ClientboundPackets1_20_2 implements ClientboundPacketType {
|
||||
public enum ClientboundPackets1_20_2 implements ClientboundPacket1_20_2 {
|
||||
|
||||
BUNDLE, // 0x00
|
||||
SPAWN_ENTITY, // 0x01
|
||||
|
@ -17,10 +17,10 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3;
|
||||
|
||||
public enum ServerboundConfigurationPackets1_20_2 implements ServerboundPacketType {
|
||||
public enum ServerboundConfigurationPackets1_20_2 implements ServerboundPacket1_20_2, ServerboundPacket1_20_3 {
|
||||
|
||||
CLIENT_INFORMATION, // 0x00
|
||||
CUSTOM_PAYLOAD, // 0x01
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* 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.viaversion.protocols.protocol1_20_2to1_20.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
|
||||
public interface ServerboundPacket1_20_2 extends ServerboundPacketType {
|
||||
}
|
@ -17,9 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
|
||||
public enum ServerboundPackets1_20_2 implements ServerboundPacketType {
|
||||
public enum ServerboundPackets1_20_2 implements ServerboundPacket1_20_2 {
|
||||
|
||||
TELEPORT_CONFIRM, // 0x00
|
||||
QUERY_BLOCK_NBT, // 0x01
|
||||
|
@ -24,8 +24,8 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
||||
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
@ -34,15 +34,18 @@ import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter.CommandRewriter1_19_4;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPacket1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPacket1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.BlockItemPacketRewriter1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.EntityPacketRewriter1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
|
||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
@ -51,14 +54,14 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.BitSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPackets1_20_2, ClientboundPackets1_20_3, ServerboundPackets1_20_2, ServerboundPackets1_20_3> {
|
||||
public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPacket1_20_2, ClientboundPacket1_20_3, ServerboundPacket1_20_2, ServerboundPacket1_20_3> {
|
||||
|
||||
public static final MappingData MAPPINGS = new MappingDataBase("1.20.2", "1.20.3");
|
||||
private final BlockItemPacketRewriter1_20_3 itemRewriter = new BlockItemPacketRewriter1_20_3(this);
|
||||
private final EntityPacketRewriter1_20_3 entityRewriter = new EntityPacketRewriter1_20_3(this);
|
||||
|
||||
public Protocol1_20_3To1_20_2() {
|
||||
super(ClientboundPackets1_20_2.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_2.class, ServerboundPackets1_20_3.class);
|
||||
super(ClientboundPacket1_20_2.class, ClientboundPacket1_20_3.class, ServerboundPacket1_20_2.class, ServerboundPacket1_20_3.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,10 +70,10 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
|
||||
|
||||
cancelServerbound(ServerboundPackets1_20_3.CONTAINER_SLOT_STATE_CHANGED);
|
||||
|
||||
final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
|
||||
final TagRewriter<ClientboundPacket1_20_2> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS);
|
||||
|
||||
final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this);
|
||||
final SoundRewriter<ClientboundPacket1_20_2> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_20_2.ENTITY_SOUND);
|
||||
|
||||
@ -226,7 +229,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
|
||||
}
|
||||
});
|
||||
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.DISCONNECT.getId(), ClientboundConfigurationPackets1_20_2.DISCONNECT.getId(), this::convertComponent);
|
||||
registerClientbound(ClientboundConfigurationPackets1_20_2.DISCONNECT, this::convertComponent);
|
||||
registerClientbound(ClientboundPackets1_20_2.DISCONNECT, this::convertComponent);
|
||||
registerClientbound(ClientboundPackets1_20_2.RESOURCE_PACK, ClientboundPackets1_20_3.RESOURCE_PACK_PUSH, resourcePackHandler(ClientboundPackets1_20_3.RESOURCE_PACK_POP));
|
||||
registerClientbound(ClientboundPackets1_20_2.SERVER_DATA, this::convertComponent);
|
||||
@ -296,10 +299,9 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
|
||||
|
||||
registerServerbound(ServerboundPackets1_20_3.RESOURCE_PACK_STATUS, resourcePackStatusHandler());
|
||||
|
||||
registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.RESOURCE_PACK, resourcePackStatusHandler());
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.RESOURCE_PACK.getId(), ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_PUSH.getId(), resourcePackHandler(ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_POP));
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_TAGS.getId(), ClientboundConfigurationPackets1_20_3.UPDATE_TAGS.getId(), tagRewriter.getGenericHandler());
|
||||
registerClientboundPacketIdChanges(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.class, ClientboundConfigurationPackets1_20_3.class);
|
||||
registerServerbound(ServerboundConfigurationPackets1_20_2.RESOURCE_PACK, resourcePackStatusHandler());
|
||||
registerClientbound(ClientboundConfigurationPackets1_20_2.RESOURCE_PACK, ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_PUSH, resourcePackHandler(ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_POP));
|
||||
registerClientbound(ClientboundConfigurationPackets1_20_2.UPDATE_TAGS, tagRewriter.getGenericHandler());
|
||||
}
|
||||
|
||||
private PacketHandler resourcePackStatusHandler() {
|
||||
@ -380,12 +382,12 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ServerboundPacketType serverboundFinishConfigurationPacket() {
|
||||
return ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientboundPacketType clientboundFinishConfigurationPacket() {
|
||||
return ClientboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
|
||||
protected PacketTypesProvider<ClientboundPacket1_20_2, ClientboundPacket1_20_3, ServerboundPacket1_20_2, ServerboundPacket1_20_3> createPacketTypesProvider() {
|
||||
return new SimplePacketTypesProvider<>(
|
||||
packetTypeMap(unmappedClientboundPacketType, ClientboundPackets1_20_2.class, ClientboundConfigurationPackets1_20_2.class),
|
||||
packetTypeMap(mappedClientboundPacketType, ClientboundPackets1_20_3.class, ClientboundConfigurationPackets1_20_3.class),
|
||||
packetTypeMap(mappedServerboundPacketType, ServerboundPackets1_20_2.class, ServerboundConfigurationPackets1_20_2.class),
|
||||
packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_3.class, ServerboundConfigurationPackets1_20_2.class)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,9 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
|
||||
public enum ClientboundConfigurationPackets1_20_3 implements ClientboundPacketType {
|
||||
public enum ClientboundConfigurationPackets1_20_3 implements ClientboundPacket1_20_3 {
|
||||
|
||||
CUSTOM_PAYLOAD, // 0x00
|
||||
DISCONNECT, // 0x01
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* 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.viaversion.protocols.protocol1_20_3to1_20_2.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
|
||||
public interface ClientboundPacket1_20_3 extends ClientboundPacketType {
|
||||
}
|
@ -17,9 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
|
||||
public enum ClientboundPackets1_20_3 implements ClientboundPacketType {
|
||||
public enum ClientboundPackets1_20_3 implements ClientboundPacket1_20_3 {
|
||||
|
||||
BUNDLE, // 0x00
|
||||
SPAWN_ENTITY, // 0x01
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* 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.viaversion.protocols.protocol1_20_3to1_20_2.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
|
||||
public interface ServerboundPacket1_20_3 extends ServerboundPacketType {
|
||||
}
|
@ -17,9 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
|
||||
public enum ServerboundPackets1_20_3 implements ServerboundPacketType {
|
||||
public enum ServerboundPackets1_20_3 implements ServerboundPacket1_20_3 {
|
||||
|
||||
TELEPORT_CONFIRM, // 0x00
|
||||
QUERY_BLOCK_NBT, // 0x01
|
||||
|
@ -24,15 +24,17 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPacket1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.rewriter.RecipeRewriter1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<ClientboundPackets1_20_2, ServerboundPackets1_20_3, Protocol1_20_3To1_20_2> {
|
||||
public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<ClientboundPacket1_20_2, ServerboundPacket1_20_3, Protocol1_20_3To1_20_2> {
|
||||
|
||||
public BlockItemPacketRewriter1_20_3(final Protocol1_20_3To1_20_2 protocol) {
|
||||
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
|
||||
@ -40,7 +42,7 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<Clientboun
|
||||
|
||||
@Override
|
||||
public void registerPackets() {
|
||||
final BlockRewriter<ClientboundPackets1_20_2> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
||||
final BlockRewriter<ClientboundPacket1_20_2> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
||||
blockRewriter.registerBlockAction(ClientboundPackets1_20_2.BLOCK_ACTION);
|
||||
blockRewriter.registerBlockChange(ClientboundPackets1_20_2.BLOCK_CHANGE);
|
||||
blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_2.MULTI_BLOCK_CHANGE);
|
||||
@ -82,7 +84,7 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<Clientboun
|
||||
}
|
||||
});
|
||||
|
||||
new RecipeRewriter1_20_2<ClientboundPackets1_20_2>(protocol) {
|
||||
new RecipeRewriter1_20_2<ClientboundPacket1_20_2>(protocol) {
|
||||
@Override
|
||||
public void handleCraftingShaped(final PacketWrapper wrapper) throws Exception {
|
||||
// Move width and height down
|
||||
|
@ -23,12 +23,12 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_2;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPacket1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||
@ -36,7 +36,7 @@ import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.util.ComponentUtil;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
public final class EntityPacketRewriter1_20_3 extends EntityRewriter<ClientboundPackets1_20_2, Protocol1_20_3To1_20_2> {
|
||||
public final class EntityPacketRewriter1_20_3 extends EntityRewriter<ClientboundPacket1_20_2, Protocol1_20_3To1_20_2> {
|
||||
|
||||
public EntityPacketRewriter1_20_3(final Protocol1_20_3To1_20_2 protocol) {
|
||||
super(protocol);
|
||||
@ -48,7 +48,7 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
|
||||
registerMetadataRewriter(ClientboundPackets1_20_2.ENTITY_METADATA, Types1_20_2.METADATA_LIST, Types1_20_3.METADATA_LIST);
|
||||
registerRemoveEntities(ClientboundPackets1_20_2.REMOVE_ENTITIES);
|
||||
|
||||
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.REGISTRY_DATA, new PacketHandlers() {
|
||||
protocol.registerClientbound(ClientboundConfigurationPackets1_20_2.REGISTRY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Type.COMPOUND_TAG); // Registry data
|
||||
|
@ -22,20 +22,24 @@ import com.viaversion.viaversion.api.data.MappingData;
|
||||
import com.viaversion.viaversion.api.data.MappingDataBase;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
||||
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
|
||||
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.ClientboundPacket1_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.ServerboundConfigurationPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.rewriter.BlockItemPacketRewriter1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.rewriter.EntityPacketRewriter1_20_5;
|
||||
@ -43,25 +47,25 @@ import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
|
||||
public final class Protocol1_20_5To1_20_3 extends AbstractProtocol<ClientboundPackets1_20_3, ClientboundPackets1_20_5, ServerboundPackets1_20_3, ServerboundPackets1_20_5> {
|
||||
public final class Protocol1_20_5To1_20_3 extends AbstractProtocol<ClientboundPacket1_20_3, ClientboundPacket1_20_5, ServerboundPacket1_20_3, ServerboundPacket1_20_5> {
|
||||
|
||||
public static final MappingData MAPPINGS = new MappingDataBase("1.20.3", "1.20.5");
|
||||
private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this);
|
||||
private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this);
|
||||
|
||||
public Protocol1_20_5To1_20_3() {
|
||||
super(ClientboundPackets1_20_3.class, ClientboundPackets1_20_5.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_5.class);
|
||||
super(ClientboundPacket1_20_3.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_3.class, ServerboundPacket1_20_5.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
super.registerPackets();
|
||||
|
||||
final TagRewriter<ClientboundPackets1_20_3> tagRewriter = new TagRewriter<>(this);
|
||||
final TagRewriter<ClientboundPacket1_20_3> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS);
|
||||
tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS);
|
||||
tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_3.UPDATE_TAGS);
|
||||
|
||||
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
|
||||
final SoundRewriter<ClientboundPacket1_20_3> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.ENTITY_SOUND);
|
||||
|
||||
@ -81,11 +85,8 @@ public final class Protocol1_20_5To1_20_3 extends AbstractProtocol<ClientboundPa
|
||||
});
|
||||
|
||||
cancelServerbound(State.LOGIN, ServerboundLoginPackets.COOKIE_RESPONSE.getId());
|
||||
cancelServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_5.COOKIE_RESPONSE.getId());
|
||||
cancelServerbound(ServerboundConfigurationPackets1_20_5.COOKIE_RESPONSE);
|
||||
cancelServerbound(ServerboundPackets1_20_5.COOKIE_RESPONSE);
|
||||
|
||||
registerClientboundPacketIdChanges(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.class, ClientboundConfigurationPackets1_20_5.class);
|
||||
registerServerboundPacketIdChanges(State.CONFIGURATION, ServerboundConfigurationPackets1_20_5.class, ServerboundConfigurationPackets1_20_2.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,12 +117,12 @@ public final class Protocol1_20_5To1_20_3 extends AbstractProtocol<ClientboundPa
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientboundPacketType clientboundFinishConfigurationPacket() {
|
||||
return ClientboundConfigurationPackets1_20_3.FINISH_CONFIGURATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ServerboundPacketType serverboundFinishConfigurationPacket() {
|
||||
return ServerboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
|
||||
protected PacketTypesProvider<ClientboundPacket1_20_3, ClientboundPacket1_20_5, ServerboundPacket1_20_3, ServerboundPacket1_20_5> createPacketTypesProvider() {
|
||||
return new SimplePacketTypesProvider<>(
|
||||
packetTypeMap(unmappedClientboundPacketType, ClientboundPackets1_20_3.class, ClientboundConfigurationPackets1_20_3.class),
|
||||
packetTypeMap(mappedClientboundPacketType, ClientboundPackets1_20_5.class, ClientboundConfigurationPackets1_20_5.class),
|
||||
packetTypeMap(mappedServerboundPacketType, ServerboundPackets1_20_3.class, ServerboundConfigurationPackets1_20_2.class),
|
||||
packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_5.class, ServerboundConfigurationPackets1_20_5.class)
|
||||
);
|
||||
}
|
||||
}
|
@ -17,10 +17,9 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
|
||||
public enum ClientboundConfigurationPackets1_20_5 implements ClientboundPacketType {
|
||||
public enum ClientboundConfigurationPackets1_20_5 implements ClientboundPacket1_20_5 {
|
||||
|
||||
COOKIE_REQUEST, // 0x00
|
||||
CUSTOM_PAYLOAD, // 0x01
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* 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.viaversion.protocols.protocol1_20_5to1_20_3.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
|
||||
public interface ClientboundPacket1_20_5 extends ClientboundPacketType {
|
||||
}
|
@ -17,9 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
|
||||
public enum ClientboundPackets1_20_5 implements ClientboundPacketType {
|
||||
public enum ClientboundPackets1_20_5 implements ClientboundPacket1_20_5 {
|
||||
|
||||
BUNDLE, // 0x00
|
||||
SPAWN_ENTITY, // 0x01
|
||||
|
@ -17,10 +17,9 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
|
||||
public enum ServerboundConfigurationPackets1_20_5 implements ServerboundPacketType {
|
||||
public enum ServerboundConfigurationPackets1_20_5 implements ServerboundPacket1_20_5 {
|
||||
|
||||
CLIENT_INFORMATION, // 0x00
|
||||
COOKIE_RESPONSE, // 0x01
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* 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.viaversion.protocols.protocol1_20_5to1_20_3.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
|
||||
public interface ServerboundPacket1_20_5 extends ServerboundPacketType {
|
||||
}
|
@ -17,9 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
|
||||
public enum ServerboundPackets1_20_5 implements ServerboundPacketType {
|
||||
public enum ServerboundPackets1_20_5 implements ServerboundPacket1_20_5 {
|
||||
|
||||
TELEPORT_CONFIRM, // 0x00
|
||||
QUERY_BLOCK_NBT, // 0x01
|
||||
|
@ -24,15 +24,17 @@ import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_5, Protocol1_20_5To1_20_3> {
|
||||
public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<ClientboundPacket1_20_3, ServerboundPacket1_20_5, Protocol1_20_5To1_20_3> {
|
||||
|
||||
public BlockItemPacketRewriter1_20_5(final Protocol1_20_5To1_20_3 protocol) {
|
||||
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
|
||||
@ -40,7 +42,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||
|
||||
@Override
|
||||
public void registerPackets() {
|
||||
final BlockRewriter<ClientboundPackets1_20_3> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
||||
final BlockRewriter<ClientboundPacket1_20_3> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
||||
blockRewriter.registerBlockAction(ClientboundPackets1_20_3.BLOCK_ACTION);
|
||||
blockRewriter.registerBlockChange(ClientboundPackets1_20_3.BLOCK_CHANGE);
|
||||
blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_3.MULTI_BLOCK_CHANGE);
|
||||
@ -134,7 +136,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||
}
|
||||
});
|
||||
|
||||
final RecipeRewriter1_20_3<ClientboundPackets1_20_3> recipeRewriter = new RecipeRewriter1_20_3<>(protocol);
|
||||
final RecipeRewriter1_20_3<ClientboundPacket1_20_3> recipeRewriter = new RecipeRewriter1_20_3<>(protocol);
|
||||
protocol.registerClientbound(ClientboundPackets1_20_3.DECLARE_RECIPES, wrapper -> {
|
||||
final int size = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
@ -22,17 +22,18 @@ import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.NumberTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
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.EntityTypes1_20_5;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
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_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.AttributeMappings;
|
||||
@ -41,7 +42,7 @@ import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
import java.util.Map;
|
||||
|
||||
public final class EntityPacketRewriter1_20_5 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_20_5To1_20_3> {
|
||||
public final class EntityPacketRewriter1_20_5 extends EntityRewriter<ClientboundPacket1_20_3, Protocol1_20_5To1_20_3> {
|
||||
|
||||
public EntityPacketRewriter1_20_5(final Protocol1_20_5To1_20_3 protocol) {
|
||||
super(protocol);
|
||||
@ -53,7 +54,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
registerMetadataRewriter(ClientboundPackets1_20_3.ENTITY_METADATA, Types1_20_3.METADATA_LIST, Types1_20_5.METADATA_LIST);
|
||||
registerRemoveEntities(ClientboundPackets1_20_3.REMOVE_ENTITIES);
|
||||
|
||||
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, new PacketHandlers() {
|
||||
protocol.registerClientbound(ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
handler(wrapper -> {
|
||||
|
@ -24,7 +24,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
@ -150,10 +149,6 @@ public class TagRewriter<C extends ClientboundPacketType> {
|
||||
protocol.registerClientbound(packetType, getGenericHandler());
|
||||
}
|
||||
|
||||
public void registerGeneric(State state, ClientboundPacketType packetType) {
|
||||
protocol.registerClientbound(state, packetType, getGenericHandler());
|
||||
}
|
||||
|
||||
public PacketHandler getHandler(@Nullable RegistryType readUntilType) {
|
||||
return wrapper -> {
|
||||
for (RegistryType type : RegistryType.getValues()) {
|
||||
|
@ -22,15 +22,11 @@ import com.viaversion.viaversion.api.data.MappingData;
|
||||
import com.viaversion.viaversion.api.data.MappingDataBase;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
|
||||
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.ClientboundPacket1_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.ServerboundConfigurationPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
@ -39,13 +35,13 @@ import com.viaversion.viaversion.template.protocols.rewriter.EntityPacketRewrite
|
||||
|
||||
// Placeholders to replace (in the entire package):
|
||||
// Protocol1_99To_98, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99
|
||||
// ClientboundPackets1_20_5
|
||||
// ServerboundPackets1_20_5
|
||||
// ClientboundPacket1_20_5
|
||||
// ServerboundPacket1_20_5
|
||||
// ClientboundConfigurationPackets1_20_3
|
||||
// ServerboundConfigurationPackets1_20_2
|
||||
// Entity1_19_4Types (MAPPED type)
|
||||
// 1.99, 1.98
|
||||
public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets1_20_5, ClientboundPackets1_20_5, ServerboundPackets1_20_5, ServerboundPackets1_20_5> {
|
||||
public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPacket1_20_5, ClientboundPacket1_20_5, ServerboundPacket1_20_5, ServerboundPacket1_20_5> {
|
||||
|
||||
public static final MappingData MAPPINGS = new MappingDataBase("1.98", "1.99");
|
||||
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
|
||||
@ -53,7 +49,7 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
|
||||
|
||||
public Protocol1_99To_98() {
|
||||
// Passing the class types into the super constructor is needed for automatic packet type id remapping, but can otherwise be omitted
|
||||
super(ClientboundPackets1_20_5.class, ClientboundPackets1_20_5.class, ServerboundPackets1_20_5.class, ServerboundPackets1_20_5.class);
|
||||
super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,12 +57,12 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
|
||||
super.registerPackets();
|
||||
|
||||
// Registers renames etc. as well as registry type id changes
|
||||
final TagRewriter<ClientboundPackets1_20_5> tagRewriter = new TagRewriter<>(this);
|
||||
final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
|
||||
tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS);
|
||||
tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS);
|
||||
|
||||
// Registers sound id changes
|
||||
final SoundRewriter<ClientboundPackets1_20_5> soundRewriter = new SoundRewriter<>(this);
|
||||
final SoundRewriter<ClientboundPacket1_20_5> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.ENTITY_SOUND);
|
||||
|
||||
@ -130,14 +126,4 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
|
||||
public BlockItemPacketRewriter1_99 getItemRewriter() {
|
||||
return itemRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientboundPacketType clientboundFinishConfigurationPacket() {
|
||||
return ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ServerboundPacketType serverboundFinishConfigurationPacket() {
|
||||
return ServerboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
|
||||
}
|
||||
}
|
@ -21,7 +21,9 @@ import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPacket1_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.ServerboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
@ -30,7 +32,7 @@ import com.viaversion.viaversion.template.protocols.Protocol1_99To_98;
|
||||
// To replace if needed:
|
||||
// ChunkType1_20_2
|
||||
// RecipeRewriter1_20_3
|
||||
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_5, ServerboundPackets1_20_5, Protocol1_99To_98> {
|
||||
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPacket1_20_5, ServerboundPacket1_20_5, Protocol1_99To_98> {
|
||||
|
||||
public BlockItemPacketRewriter1_99(final Protocol1_99To_98 protocol) {
|
||||
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
|
||||
@ -41,7 +43,7 @@ public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundP
|
||||
// Register block and block state id changes
|
||||
// Other places using block state id mappings: Spawn particle, entity metadata, entity spawn (falling blocks)
|
||||
// Tags and statistics use block (!) ids
|
||||
final BlockRewriter<ClientboundPackets1_20_5> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
||||
final BlockRewriter<ClientboundPacket1_20_5> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
||||
blockRewriter.registerBlockAction(ClientboundPackets1_20_5.BLOCK_ACTION);
|
||||
blockRewriter.registerBlockChange(ClientboundPackets1_20_5.BLOCK_CHANGE);
|
||||
blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_5.MULTI_BLOCK_CHANGE);
|
||||
|
@ -19,11 +19,11 @@ package com.viaversion.viaversion.template.protocols.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
|
||||
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.ClientboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.template.protocols.Protocol1_99To_98;
|
||||
@ -31,7 +31,7 @@ import com.viaversion.viaversion.template.protocols.Protocol1_99To_98;
|
||||
// Replace if needed
|
||||
// Types1_OLD
|
||||
// Types1_20_5
|
||||
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_5, Protocol1_99To_98> {
|
||||
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPacket1_20_5, Protocol1_99To_98> {
|
||||
|
||||
public EntityPacketRewriter1_99(final Protocol1_99To_98 protocol) {
|
||||
super(protocol);
|
||||
@ -44,7 +44,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
registerMetadataRewriter(ClientboundPackets1_20_5.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_5.METADATA_LIST); // Specify old and new metadata list if changed
|
||||
registerRemoveEntities(ClientboundPackets1_20_5.REMOVE_ENTITIES);
|
||||
|
||||
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, new PacketHandlers() {
|
||||
protocol.registerClientbound(ClientboundConfigurationPackets1_20_5.REGISTRY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Type.STRING); // Registry
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren