Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 08:30:09 +01:00
24w03a (maybe, and it's a bit ugly)
Dieser Commit ist enthalten in:
Ursprung
0946c72bdc
Commit
5d5c98acc6
@ -113,5 +113,7 @@ public interface MappingData {
|
||||
|
||||
@Nullable FullMappings getArgumentTypeMappings();
|
||||
|
||||
@Nullable FullMappings getRecipeSerializerMappings();
|
||||
|
||||
@Nullable Mappings getPaintingMappings();
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class MappingDataBase implements MappingData {
|
||||
protected BiMappings itemMappings;
|
||||
protected FullMappings argumentTypeMappings;
|
||||
protected FullMappings entityMappings;
|
||||
protected FullMappings recipeSerializerMappings;
|
||||
protected ParticleMappings particleMappings;
|
||||
protected Mappings blockMappings;
|
||||
protected Mappings blockStateMappings;
|
||||
@ -84,6 +85,7 @@ public class MappingDataBase implements MappingData {
|
||||
if (unmappedIdentifierData != null && mappedIdentifierData != null) {
|
||||
entityMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "entities");
|
||||
argumentTypeMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "argumenttypes");
|
||||
recipeSerializerMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "recipe_serializers");
|
||||
|
||||
final ListTag unmappedParticles = unmappedIdentifierData.get("particles");
|
||||
final ListTag mappedParticles = mappedIdentifierData.get("particles");
|
||||
@ -241,6 +243,11 @@ public class MappingDataBase implements MappingData {
|
||||
return paintingMappings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable FullMappings getRecipeSerializerMappings() {
|
||||
return recipeSerializerMappings;
|
||||
}
|
||||
|
||||
protected Logger getLogger() {
|
||||
return Via.getPlatform().getLogger();
|
||||
}
|
||||
|
@ -136,13 +136,31 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
final ServerboundPacketType finishConfigurationPacket = serverboundFinishConfigurationPacket();
|
||||
if (finishConfigurationPacket != null) {
|
||||
final int id = finishConfigurationPacket.getId();
|
||||
registerServerbound(State.CONFIGURATION, id, id, setClientStateHandler(State.PLAY));
|
||||
final PacketMapping mapping = serverboundMappings.mappedPacket(State.CONFIGURATION, id); // Use existing handler if present
|
||||
registerServerbound(State.CONFIGURATION, id, id, wrapper -> {
|
||||
if (mapping != null) {
|
||||
mapping.applyType(wrapper);
|
||||
if (mapping.handler() != null) {
|
||||
mapping.handler().handle(wrapper);
|
||||
}
|
||||
}
|
||||
setClientStateHandler(State.PLAY).handle(wrapper);
|
||||
}, true);
|
||||
}
|
||||
|
||||
final ClientboundPacketType clientboundFinishConfigurationPacket = clientboundFinishConfigurationPacket();
|
||||
if (clientboundFinishConfigurationPacket != null) {
|
||||
final int id = clientboundFinishConfigurationPacket.getId();
|
||||
registerClientbound(State.CONFIGURATION, id, id, setServerStateHandler(State.PLAY));
|
||||
final PacketMapping mapping = clientboundMappings.mappedPacket(State.CONFIGURATION, id); // Use existing handler if present
|
||||
registerClientbound(State.CONFIGURATION, id, id, wrapper -> {
|
||||
if (mapping != null) {
|
||||
mapping.applyType(wrapper);
|
||||
if (mapping.handler() != null) {
|
||||
mapping.handler().handle(wrapper);
|
||||
}
|
||||
}
|
||||
setServerStateHandler(State.PLAY).handle(wrapper);
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,11 +172,17 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
) {
|
||||
for (Map.Entry<State, PacketTypeMap<M>> entry : mappedPacketTypes.entrySet()) {
|
||||
PacketTypeMap<M> mappedTypes = entry.getValue();
|
||||
for (U unmappedType : unmappedPacketTypes.get(entry.getKey()).types()) {
|
||||
PacketTypeMap<U> unmappedTypes = unmappedPacketTypes.get(entry.getKey());
|
||||
registerPacketIdChanges(unmappedTypes, mappedTypes, registeredPredicate, registerConsumer, true);
|
||||
}
|
||||
}
|
||||
|
||||
protected <U extends PacketType, M extends PacketType> void registerPacketIdChanges(PacketTypeMap<U> unmappedTypes, PacketTypeMap<M> mappedTypes, Predicate<U> registeredPredicate, BiConsumer<U, M> registerConsumer, boolean errorOnMissing) {
|
||||
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),
|
||||
Preconditions.checkArgument(registeredPredicate.test(unmappedType) || !errorOnMissing,
|
||||
"Packet %s in %s has no mapping - it needs to be manually cancelled or remapped", unmappedType, getClass());
|
||||
continue;
|
||||
}
|
||||
@ -169,6 +193,39 @@ 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
|
||||
@ -228,7 +285,7 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
return PacketMappings.arrayMappings();
|
||||
}
|
||||
|
||||
private <P extends PacketType> Map<State, PacketTypeMap<P>> packetTypeMap(Class<P> packetTypeClass) {
|
||||
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));
|
||||
|
@ -86,7 +86,7 @@ public class ProtocolVersion {
|
||||
public static final ProtocolVersion v1_20 = register(763, "1.20/1.20.1", new VersionRange("1.20", 0, 1));
|
||||
public static final ProtocolVersion v1_20_2 = register(764, "1.20.2");
|
||||
public static final ProtocolVersion v1_20_3 = register(765, "1.20.3/1.20.4", new VersionRange("1.20", 3, 4));
|
||||
public static final ProtocolVersion v1_20_5 = register(766, 170, "1.20.5");
|
||||
public static final ProtocolVersion v1_20_5 = register(766, 171, "1.20.5");
|
||||
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
||||
|
||||
public static ProtocolVersion register(int version, String name) {
|
||||
|
@ -24,10 +24,10 @@ package com.viaversion.viaversion.api.type.types.misc;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||
import com.viaversion.viaversion.api.minecraft.Particle;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.minecraft.Particle;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
@ -66,12 +66,15 @@ public class ParticleType extends Type<Particle> {
|
||||
public Particle read(final ByteBuf buffer) throws Exception {
|
||||
final int type = Type.VAR_INT.readPrimitive(buffer);
|
||||
final Particle particle = new Particle(type);
|
||||
readData(buffer, particle);
|
||||
return particle;
|
||||
}
|
||||
|
||||
final ParticleReader reader = readers.get(type);
|
||||
public void readData(final ByteBuf buffer, final Particle particle) throws Exception {
|
||||
final ParticleReader reader = readers.get(particle.getId());
|
||||
if (reader != null) {
|
||||
reader.read(buffer, particle);
|
||||
}
|
||||
return particle;
|
||||
}
|
||||
|
||||
public static ParticleReader itemHandler(final Type<Item> itemType) {
|
||||
|
@ -25,7 +25,8 @@ public enum ClientboundLoginPackets implements ClientboundPacketType {
|
||||
HELLO, // 0x01
|
||||
GAME_PROFILE, // 0x02
|
||||
LOGIN_COMPRESSION, // 0x03
|
||||
CUSTOM_QUERY; // 0x04
|
||||
CUSTOM_QUERY, // 0x04
|
||||
COOKIE_REQUEST; // 0x05
|
||||
|
||||
@Override
|
||||
public final int getId() {
|
||||
|
@ -24,7 +24,8 @@ public enum ServerboundLoginPackets implements ServerboundPacketType {
|
||||
HELLO, // 0x00
|
||||
ENCRYPTION_KEY, // 0x01
|
||||
CUSTOM_QUERY_ANSWER, // 0x02
|
||||
LOGIN_ACKNOWLEDGED; // 0x03
|
||||
LOGIN_ACKNOWLEDGED, // 0x03
|
||||
COOKIE_RESPONSE; // 0x04
|
||||
|
||||
@Override
|
||||
public final int getId() {
|
||||
|
@ -42,6 +42,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.Clientb
|
||||
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;
|
||||
@ -297,9 +298,8 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
|
||||
|
||||
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));
|
||||
// TODO Auto map via packet types provider
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_ENABLED_FEATURES.getId(), ClientboundConfigurationPackets1_20_3.UPDATE_ENABLED_FEATURES.getId());
|
||||
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);
|
||||
}
|
||||
|
||||
private PacketHandler resourcePackStatusHandler() {
|
||||
|
@ -25,25 +25,32 @@ 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.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.ClientboundPackets1_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.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.rewriter.BlockItemPacketRewriter1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.rewriter.EntityPacketRewriter1_20_5;
|
||||
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_3, ServerboundPackets1_20_3, ServerboundPackets1_20_3> {
|
||||
public final class Protocol1_20_5To1_20_3 extends AbstractProtocol<ClientboundPackets1_20_3, ClientboundPackets1_20_5, ServerboundPackets1_20_3, ServerboundPackets1_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_3.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_3.class);
|
||||
super(ClientboundPackets1_20_3.class, ClientboundPackets1_20_5.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_5.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,9 +63,33 @@ public final class Protocol1_20_5To1_20_3 extends AbstractProtocol<ClientboundPa
|
||||
|
||||
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_20_3.ENTITY_SOUND);
|
||||
registerClientbound(ClientboundPackets1_20_3.ENTITY_SOUND, wrapper -> {
|
||||
// Now also written as a sound event with 0 marking a following resource location string
|
||||
final int soundId = wrapper.read(Type.VAR_INT);
|
||||
wrapper.write(Type.VAR_INT, MAPPINGS.getSoundMappings().getNewId(soundId) + 1);
|
||||
});
|
||||
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS);
|
||||
|
||||
registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO, wrapper -> {
|
||||
wrapper.passthrough(Type.STRING); // Server ID
|
||||
wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE); // Public key
|
||||
wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE); // Challenge
|
||||
wrapper.write(Type.BOOLEAN, true); // Authenticate
|
||||
});
|
||||
|
||||
registerClientbound(ClientboundPackets1_20_3.SERVER_DATA, wrapper -> {
|
||||
wrapper.passthrough(Type.TAG); // MOTD
|
||||
wrapper.passthrough(Type.OPTIONAL_BYTE_ARRAY_PRIMITIVE); // Icon
|
||||
wrapper.read(Type.BOOLEAN); // Enforces secure chat - moved to join game
|
||||
});
|
||||
|
||||
cancelServerbound(State.LOGIN, ServerboundLoginPackets.COOKIE_RESPONSE.getId());
|
||||
cancelServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_5.COOKIE_RESPONSE.getId());
|
||||
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
|
||||
@ -95,6 +126,6 @@ public final class Protocol1_20_5To1_20_3 extends AbstractProtocol<ClientboundPa
|
||||
|
||||
@Override
|
||||
protected ServerboundPacketType serverboundFinishConfigurationPacket() {
|
||||
return ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
|
||||
return ServerboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
|
||||
public enum ClientboundConfigurationPackets1_20_5 implements ClientboundPacketType {
|
||||
|
||||
COOKIE_REQUEST, // 0x00
|
||||
CUSTOM_PAYLOAD, // 0x01
|
||||
DISCONNECT, // 0x02
|
||||
FINISH_CONFIGURATION, // 0x03
|
||||
KEEP_ALIVE, // 0x04
|
||||
PING, // 0x05
|
||||
REGISTRY_DATA, // 0x06
|
||||
RESOURCE_PACK_POP, // 0x07
|
||||
RESOURCE_PACK_PUSH, // 0x08
|
||||
STORE_COOKIE, // 0x09
|
||||
TRANSFER, // 0x0A
|
||||
UPDATE_ENABLED_FEATURES, // 0x0B
|
||||
UPDATE_TAGS; // 0x0C
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public State state() {
|
||||
return State.CONFIGURATION;
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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 enum ClientboundPackets1_20_5 implements ClientboundPacketType {
|
||||
|
||||
BUNDLE, // 0x00
|
||||
SPAWN_ENTITY, // 0x01
|
||||
SPAWN_EXPERIENCE_ORB, // 0x02
|
||||
ENTITY_ANIMATION, // 0x03
|
||||
STATISTICS, // 0x04
|
||||
BLOCK_CHANGED_ACK, // 0x05
|
||||
BLOCK_BREAK_ANIMATION, // 0x06
|
||||
BLOCK_ENTITY_DATA, // 0x07
|
||||
BLOCK_ACTION, // 0x08
|
||||
BLOCK_CHANGE, // 0x09
|
||||
BOSSBAR, // 0x0A
|
||||
SERVER_DIFFICULTY, // 0x0B
|
||||
CHUNK_BATCH_FINISHED, // 0x0C
|
||||
CHUNK_BATCH_START, // 0x0D
|
||||
CHUNK_BIOMES, // 0x0E
|
||||
CLEAR_TITLES, // 0x0F
|
||||
TAB_COMPLETE, // 0x10
|
||||
DECLARE_COMMANDS, // 0x11
|
||||
CLOSE_WINDOW, // 0x12
|
||||
WINDOW_ITEMS, // 0x13
|
||||
WINDOW_PROPERTY, // 0x14
|
||||
SET_SLOT, // 0x15
|
||||
COOKIE_REQUEST, // 0x16
|
||||
COOLDOWN, // 0x17
|
||||
CUSTOM_CHAT_COMPLETIONS, // 0x18
|
||||
PLUGIN_MESSAGE, // 0x19
|
||||
DAMAGE_EVENT, // 0x1A
|
||||
DELETE_CHAT_MESSAGE, // 0x1B
|
||||
DISCONNECT, // 0x1C
|
||||
DISGUISED_CHAT, // 0x1D
|
||||
ENTITY_STATUS, // 0x1E
|
||||
EXPLOSION, // 0x1F
|
||||
UNLOAD_CHUNK, // 0x20
|
||||
GAME_EVENT, // 0x21
|
||||
OPEN_HORSE_WINDOW, // 0x22
|
||||
HIT_ANIMATION, // 0x23
|
||||
WORLD_BORDER_INIT, // 0x24
|
||||
KEEP_ALIVE, // 0x25
|
||||
CHUNK_DATA, // 0x26
|
||||
EFFECT, // 0x27
|
||||
SPAWN_PARTICLE, // 0x28
|
||||
UPDATE_LIGHT, // 0x29
|
||||
JOIN_GAME, // 0x2A
|
||||
MAP_DATA, // 0x2B
|
||||
TRADE_LIST, // 0x2C
|
||||
ENTITY_POSITION, // 0x2D
|
||||
ENTITY_POSITION_AND_ROTATION, // 0x2E
|
||||
ENTITY_ROTATION, // 0x2F
|
||||
VEHICLE_MOVE, // 0x30
|
||||
OPEN_BOOK, // 0x31
|
||||
OPEN_WINDOW, // 0x32
|
||||
OPEN_SIGN_EDITOR, // 0x33
|
||||
PING, // 0x34
|
||||
PONG_RESPONSE, // 0x35
|
||||
CRAFT_RECIPE_RESPONSE, // 0x36
|
||||
PLAYER_ABILITIES, // 0x37
|
||||
PLAYER_CHAT, // 0x38
|
||||
COMBAT_END, // 0x39
|
||||
COMBAT_ENTER, // 0x3A
|
||||
COMBAT_KILL, // 0x3B
|
||||
PLAYER_INFO_REMOVE, // 0x3C
|
||||
PLAYER_INFO_UPDATE, // 0x3D
|
||||
FACE_PLAYER, // 0x3E
|
||||
PLAYER_POSITION, // 0x3F
|
||||
UNLOCK_RECIPES, // 0x40
|
||||
REMOVE_ENTITIES, // 0x41
|
||||
REMOVE_ENTITY_EFFECT, // 0x42
|
||||
RESET_SCORE, // 0x43
|
||||
RESOURCE_PACK_POP, // 0x44
|
||||
RESOURCE_PACK_PUSH, // 0x45
|
||||
RESPAWN, // 0x46
|
||||
ENTITY_HEAD_LOOK, // 0x47
|
||||
MULTI_BLOCK_CHANGE, // 0x48
|
||||
SELECT_ADVANCEMENTS_TAB, // 0x49
|
||||
SERVER_DATA, // 0x4A
|
||||
ACTIONBAR, // 0x4B
|
||||
WORLD_BORDER_CENTER, // 0x4C
|
||||
WORLD_BORDER_LERP_SIZE, // 0x4D
|
||||
WORLD_BORDER_SIZE, // 0x4E
|
||||
WORLD_BORDER_WARNING_DELAY, // 0x4F
|
||||
WORLD_BORDER_WARNING_DISTANCE, // 0x50
|
||||
CAMERA, // 0x51
|
||||
HELD_ITEM_CHANGE, // 0x52
|
||||
UPDATE_VIEW_POSITION, // 0x53
|
||||
UPDATE_VIEW_DISTANCE, // 0x54
|
||||
SPAWN_POSITION, // 0x55
|
||||
DISPLAY_SCOREBOARD, // 0x56
|
||||
ENTITY_METADATA, // 0x57
|
||||
ATTACH_ENTITY, // 0x58
|
||||
ENTITY_VELOCITY, // 0x59
|
||||
ENTITY_EQUIPMENT, // 0x5A
|
||||
SET_EXPERIENCE, // 0x5B
|
||||
UPDATE_HEALTH, // 0x5C
|
||||
SCOREBOARD_OBJECTIVE, // 0x5D
|
||||
SET_PASSENGERS, // 0x5E
|
||||
TEAMS, // 0x5F
|
||||
UPDATE_SCORE, // 0x60
|
||||
SET_SIMULATION_DISTANCE, // 0x61
|
||||
TITLE_SUBTITLE, // 0x62
|
||||
TIME_UPDATE, // 0x63
|
||||
TITLE_TEXT, // 0x64
|
||||
TITLE_TIMES, // 0x65
|
||||
ENTITY_SOUND, // 0x66
|
||||
SOUND, // 0x67
|
||||
START_CONFIGURATION, // 0x68
|
||||
STOP_SOUND, // 0x69
|
||||
STORE_COOKIE, // 0x6A
|
||||
SYSTEM_CHAT, // 0x6B
|
||||
TAB_LIST, // 0x6C
|
||||
NBT_QUERY, // 0x6D
|
||||
COLLECT_ITEM, // 0x6E
|
||||
ENTITY_TELEPORT, // 0x6F
|
||||
TICKING_STATE, // 0x70
|
||||
TICKING_STEP, // 0x71
|
||||
TRANSFER, // 0x72
|
||||
ADVANCEMENTS, // 0x73
|
||||
ENTITY_PROPERTIES, // 0x74
|
||||
ENTITY_EFFECT, // 0x75
|
||||
DECLARE_RECIPES, // 0x76
|
||||
TAGS; // 0x77
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
|
||||
public enum ServerboundConfigurationPackets1_20_5 implements ServerboundPacketType {
|
||||
|
||||
CLIENT_INFORMATION, // 0x00
|
||||
COOKIE_RESPONSE, // 0x01
|
||||
CUSTOM_PAYLOAD, // 0x02
|
||||
FINISH_CONFIGURATION, // 0x03
|
||||
KEEP_ALIVE, // 0x04
|
||||
PONG, // 0x05
|
||||
RESOURCE_PACK; // 0x06
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public State state() {
|
||||
return State.CONFIGURATION;
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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 enum ServerboundPackets1_20_5 implements ServerboundPacketType {
|
||||
|
||||
TELEPORT_CONFIRM, // 0x00
|
||||
QUERY_BLOCK_NBT, // 0x01
|
||||
SET_DIFFICULTY, // 0x02
|
||||
CHAT_ACK, // 0x03
|
||||
CHAT_COMMAND, // 0x04
|
||||
CHAT_MESSAGE, // 0x05
|
||||
CHAT_SESSION_UPDATE, // 0x06
|
||||
CHUNK_BATCH_RECEIVED, // 0x07
|
||||
CLIENT_STATUS, // 0x08
|
||||
CLIENT_SETTINGS, // 0x09
|
||||
TAB_COMPLETE, // 0x0A
|
||||
CONFIGURATION_ACKNOWLEDGED, // 0x0B
|
||||
CLICK_WINDOW_BUTTON, // 0x0C
|
||||
CLICK_WINDOW, // 0x0D
|
||||
CLOSE_WINDOW, // 0x0E
|
||||
CONTAINER_SLOT_STATE_CHANGED, // 0x0F
|
||||
COOKIE_RESPONSE, // 0x10
|
||||
PLUGIN_MESSAGE, // 0x11
|
||||
EDIT_BOOK, // 0x12
|
||||
ENTITY_NBT_REQUEST, // 0x13
|
||||
INTERACT_ENTITY, // 0x14
|
||||
GENERATE_JIGSAW, // 0x15
|
||||
KEEP_ALIVE, // 0x16
|
||||
LOCK_DIFFICULTY, // 0x17
|
||||
PLAYER_POSITION, // 0x18
|
||||
PLAYER_POSITION_AND_ROTATION, // 0x19
|
||||
PLAYER_ROTATION, // 0x1A
|
||||
PLAYER_MOVEMENT, // 0x1B
|
||||
VEHICLE_MOVE, // 0x1C
|
||||
STEER_BOAT, // 0x1D
|
||||
PICK_ITEM, // 0x1E
|
||||
PING_REQUEST, // 0x1F
|
||||
CRAFT_RECIPE_REQUEST, // 0x20
|
||||
PLAYER_ABILITIES, // 0x21
|
||||
PLAYER_DIGGING, // 0x22
|
||||
ENTITY_ACTION, // 0x23
|
||||
STEER_VEHICLE, // 0x24
|
||||
PONG, // 0x25
|
||||
RECIPE_BOOK_DATA, // 0x26
|
||||
SEEN_RECIPE, // 0x27
|
||||
RENAME_ITEM, // 0x28
|
||||
RESOURCE_PACK_STATUS, // 0x29
|
||||
ADVANCEMENT_TAB, // 0x2A
|
||||
SELECT_TRADE, // 0x2B
|
||||
SET_BEACON_EFFECT, // 0x2C
|
||||
HELD_ITEM_CHANGE, // 0x2D
|
||||
UPDATE_COMMAND_BLOCK, // 0x2E
|
||||
UPDATE_COMMAND_BLOCK_MINECART, // 0x2F
|
||||
CREATIVE_INVENTORY_ACTION, // 0x30
|
||||
UPDATE_JIGSAW_BLOCK, // 0x31
|
||||
UPDATE_STRUCTURE_BLOCK, // 0x32
|
||||
UPDATE_SIGN, // 0x33
|
||||
ANIMATION, // 0x34
|
||||
SPECTATE, // 0x35
|
||||
PLAYER_BLOCK_PLACEMENT, // 0x36
|
||||
USE_ITEM; // 0x37
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
@ -17,16 +17,20 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.Particle;
|
||||
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.ClientboundPackets1_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.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.ServerboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_3, Protocol1_20_5To1_20_3> {
|
||||
public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_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);
|
||||
@ -42,20 +46,113 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_3.CHUNK_DATA, ChunkType1_20_2::new);
|
||||
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_3.BLOCK_ENTITY_DATA);
|
||||
|
||||
// registerOpenWindow(ClientboundPackets1_20_3.OPEN_WINDOW);
|
||||
registerSetCooldown(ClientboundPackets1_20_3.COOLDOWN);
|
||||
registerWindowItems1_17_1(ClientboundPackets1_20_3.WINDOW_ITEMS);
|
||||
registerSetSlot1_17_1(ClientboundPackets1_20_3.SET_SLOT);
|
||||
registerAdvancements1_20_3(ClientboundPackets1_20_3.ADVANCEMENTS);
|
||||
registerEntityEquipmentArray(ClientboundPackets1_20_3.ENTITY_EQUIPMENT);
|
||||
registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW);
|
||||
registerTradeList1_19(ClientboundPackets1_20_3.TRADE_LIST);
|
||||
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION);
|
||||
registerClickWindow1_17_1(ServerboundPackets1_20_5.CLICK_WINDOW);
|
||||
registerCreativeInvAction(ServerboundPackets1_20_5.CREATIVE_INVENTORY_ACTION);
|
||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_3.WINDOW_PROPERTY);
|
||||
registerSpawnParticle1_19(ClientboundPackets1_20_3.SPAWN_PARTICLE);
|
||||
|
||||
// TODO Explosion contains particles now
|
||||
;
|
||||
|
||||
new RecipeRewriter1_20_3<>(protocol).register(ClientboundPackets1_20_3.DECLARE_RECIPES);
|
||||
protocol.registerClientbound(ClientboundPackets1_20_3.SPAWN_PARTICLE, wrapper -> {
|
||||
final int particleId = wrapper.read(Type.VAR_INT);
|
||||
|
||||
wrapper.passthrough(Type.BOOLEAN); // Long Distance
|
||||
wrapper.passthrough(Type.DOUBLE); // X
|
||||
wrapper.passthrough(Type.DOUBLE); // Y
|
||||
wrapper.passthrough(Type.DOUBLE); // Z
|
||||
wrapper.passthrough(Type.FLOAT); // Offset X
|
||||
wrapper.passthrough(Type.FLOAT); // Offset Y
|
||||
wrapper.passthrough(Type.FLOAT); // Offset Z
|
||||
wrapper.passthrough(Type.FLOAT); // Particle Data
|
||||
wrapper.passthrough(Type.INT); // Particle Count
|
||||
|
||||
final Particle particle = new Particle(particleId);
|
||||
wrapper.read(new ParticleDataReader(particle));
|
||||
|
||||
rewriteParticle(particle);
|
||||
wrapper.write(Types1_20_3.PARTICLE, particle);
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_20_3.EXPLOSION, wrapper -> {
|
||||
wrapper.passthrough(Type.DOUBLE); // X
|
||||
wrapper.passthrough(Type.DOUBLE); // Y
|
||||
wrapper.passthrough(Type.DOUBLE); // Z
|
||||
wrapper.passthrough(Type.FLOAT); // Power
|
||||
final int blocks = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < blocks; i++) {
|
||||
wrapper.passthrough(Type.BYTE); // Relative X
|
||||
wrapper.passthrough(Type.BYTE); // Relative Y
|
||||
wrapper.passthrough(Type.BYTE); // Relative Z
|
||||
}
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback X
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback Y
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback Z
|
||||
wrapper.passthrough(Type.VAR_INT); // Block interaction type
|
||||
|
||||
final Particle smallExplosionParticle = wrapper.passthrough(Types1_20_3.PARTICLE);
|
||||
final Particle largeExplosionParticle = wrapper.passthrough(Types1_20_3.PARTICLE);
|
||||
protocol.getEntityRewriter().rewriteParticle(smallExplosionParticle);
|
||||
protocol.getEntityRewriter().rewriteParticle(largeExplosionParticle);
|
||||
|
||||
wrapper.write(Type.VAR_INT, 0); // "Empty" registry id to instead use the resource location that follows after
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_20_3.TRADE_LIST, wrapper -> {
|
||||
wrapper.passthrough(Type.VAR_INT); // Container id
|
||||
final int size = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < size; i++) {
|
||||
handleItemToClient(wrapper.passthrough(Type.ITEM1_20_2)); // Input
|
||||
handleItemToClient(wrapper.passthrough(Type.ITEM1_20_2)); // Output
|
||||
handleItemToClient(wrapper.passthrough(Type.ITEM1_20_2)); // Second Item
|
||||
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
||||
wrapper.passthrough(Type.INT); // Number of tools uses
|
||||
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
||||
wrapper.passthrough(Type.INT); // XP
|
||||
wrapper.passthrough(Type.INT); // Special price
|
||||
wrapper.passthrough(Type.FLOAT); // Price multiplier
|
||||
wrapper.passthrough(Type.INT); // Demand
|
||||
|
||||
wrapper.write(Type.BOOLEAN, false); // Ignore tags
|
||||
}
|
||||
});
|
||||
|
||||
final RecipeRewriter1_20_3<ClientboundPackets1_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++) {
|
||||
// Change order and write the type as an int
|
||||
final String type = wrapper.read(Type.STRING);
|
||||
wrapper.passthrough(Type.STRING); // Recipe Identifier
|
||||
|
||||
wrapper.write(Type.VAR_INT, protocol.getMappingData().getRecipeSerializerMappings().mappedId(type));
|
||||
recipeRewriter.handleRecipeType(wrapper, Key.stripMinecraftNamespace(type));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static final class ParticleDataReader extends Type<Void> {
|
||||
|
||||
private final Particle particle;
|
||||
|
||||
private ParticleDataReader(Particle particle) {
|
||||
super(Void.class);
|
||||
this.particle = particle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(final ByteBuf buffer, final Void value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void read(final ByteBuf buffer) throws Exception {
|
||||
// Extract the particle data to put into a particle
|
||||
Types1_20_3.PARTICLE.readData(buffer, particle);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -66,6 +66,13 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
map(Type.BOOLEAN); // Limited crafting
|
||||
map(Type.STRING); // Dimension key
|
||||
map(Type.STRING); // World
|
||||
map(Type.LONG); // Seed
|
||||
map(Type.BYTE); // Gamemode
|
||||
map(Type.BYTE); // Previous gamemode
|
||||
map(Type.BOOLEAN); // Debug
|
||||
map(Type.BOOLEAN); // Flat
|
||||
map(Type.OPTIONAL_GLOBAL_POSITION); // Last death location
|
||||
create(Type.BOOLEAN, false); // Enforces secure chat - moved from server data (which is unfortunately sent a while after this)
|
||||
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
|
||||
}
|
||||
});
|
||||
|
@ -536,7 +536,7 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
protected void rewriteParticle(Particle particle) {
|
||||
public void rewriteParticle(Particle particle) {
|
||||
ParticleMappings mappings = protocol.getMappingData().getParticleMappings();
|
||||
int id = particle.getId();
|
||||
if (mappings.isBlockParticle(id)) {
|
||||
|
@ -19,6 +19,7 @@ package com.viaversion.viaversion.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.data.Mappings;
|
||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||
import com.viaversion.viaversion.api.minecraft.Particle;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
@ -281,6 +282,28 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
||||
});
|
||||
}
|
||||
|
||||
public void registerTradeList1_20_5(C packetType) {
|
||||
protocol.registerClientbound(packetType, wrapper -> {
|
||||
wrapper.passthrough(Type.VAR_INT); // Container id
|
||||
int size = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < size; i++) {
|
||||
handleItemToClient(wrapper.passthrough(itemType)); // Input
|
||||
handleItemToClient(wrapper.passthrough(itemType)); // Output
|
||||
handleItemToClient(wrapper.passthrough(itemType)); // Second Item
|
||||
|
||||
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
||||
wrapper.passthrough(Type.INT); // Number of tools uses
|
||||
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
||||
|
||||
wrapper.passthrough(Type.INT); // XP
|
||||
wrapper.passthrough(Type.INT); // Special price
|
||||
wrapper.passthrough(Type.FLOAT); // Price multiplier
|
||||
wrapper.passthrough(Type.INT); // Demand
|
||||
wrapper.passthrough(Type.BOOLEAN); // Ignore tags
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void registerAdvancements(C packetType, Type<Item> type) {
|
||||
protocol.registerClientbound(packetType, wrapper -> {
|
||||
wrapper.passthrough(Type.BOOLEAN); // Reset/clear
|
||||
@ -420,6 +443,57 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
||||
});
|
||||
}
|
||||
|
||||
public void registerSpawnParticle1_20_5(C packetType, Type<Particle> unmappedParticleType, Type<Particle> mappedParticleType) {
|
||||
protocol.registerClientbound(packetType, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.BOOLEAN); // Long Distance
|
||||
map(Type.DOUBLE); // X
|
||||
map(Type.DOUBLE); // Y
|
||||
map(Type.DOUBLE); // Z
|
||||
map(Type.FLOAT); // Offset X
|
||||
map(Type.FLOAT); // Offset Y
|
||||
map(Type.FLOAT); // Offset Z
|
||||
map(Type.FLOAT); // Particle Data
|
||||
map(Type.INT); // Particle Count
|
||||
handler(wrapper -> {
|
||||
final Particle particle = wrapper.read(unmappedParticleType);
|
||||
rewriteParticle(particle);
|
||||
wrapper.write(mappedParticleType, particle);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void registerExplosion(C packetType, Type<Particle> unmappedParticleType, Type<Particle> mappedParticleType) {
|
||||
final SoundRewriter<C> cSoundRewriter = new SoundRewriter<>(protocol);
|
||||
protocol.registerClientbound(packetType, wrapper -> {
|
||||
wrapper.passthrough(Type.DOUBLE); // X
|
||||
wrapper.passthrough(Type.DOUBLE); // Y
|
||||
wrapper.passthrough(Type.DOUBLE); // Z
|
||||
wrapper.passthrough(Type.FLOAT); // Power
|
||||
final int blocks = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < blocks; i++) {
|
||||
wrapper.passthrough(Type.BYTE); // Relative X
|
||||
wrapper.passthrough(Type.BYTE); // Relative Y
|
||||
wrapper.passthrough(Type.BYTE); // Relative Z
|
||||
}
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback X
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback Y
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback Z
|
||||
wrapper.passthrough(Type.VAR_INT); // Block interaction type
|
||||
|
||||
final Particle smallExplosionParticle = wrapper.read(unmappedParticleType);
|
||||
final Particle largeExplosionParticle = wrapper.read(unmappedParticleType);
|
||||
wrapper.write(mappedParticleType, smallExplosionParticle);
|
||||
wrapper.write(mappedParticleType, largeExplosionParticle);
|
||||
rewriteParticle(smallExplosionParticle);
|
||||
rewriteParticle(largeExplosionParticle);
|
||||
|
||||
cSoundRewriter.soundHolderHandler().handle(wrapper);
|
||||
});
|
||||
}
|
||||
|
||||
public PacketHandler getSpawnParticleHandler() {
|
||||
return getSpawnParticleHandler(Type.INT);
|
||||
}
|
||||
@ -462,4 +536,20 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
||||
public PacketHandler itemToServerHandler(Type<Item> type) {
|
||||
return wrapper -> handleItemToServer(wrapper.get(type, 0));
|
||||
}
|
||||
|
||||
protected void rewriteParticle(Particle particle) {
|
||||
ParticleMappings mappings = protocol.getMappingData().getParticleMappings();
|
||||
int id = particle.getId();
|
||||
if (mappings.isBlockParticle(id)) {
|
||||
Particle.ParticleData<Integer> data = particle.getArgument(0);
|
||||
data.setValue(protocol.getMappingData().getNewBlockStateId(data.getValue()));
|
||||
} else if (mappings.isItemParticle(id)) {
|
||||
Particle.ParticleData<Item> data = particle.getArgument(0);
|
||||
Item item = data.getValue();
|
||||
handleItemToClient(item);
|
||||
}
|
||||
|
||||
particle.setId(protocol.getMappingData().getNewParticleId(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,6 +76,19 @@ public class RecipeRewriter<C extends ClientboundPacketType> {
|
||||
});
|
||||
}
|
||||
|
||||
public void register1_20_5(C packetType) {
|
||||
protocol.registerClientbound(packetType, wrapper -> {
|
||||
int size = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < size; i++) {
|
||||
wrapper.passthrough(Type.STRING);// Recipe Identifier
|
||||
|
||||
final int typeId = wrapper.passthrough(Type.VAR_INT);
|
||||
final String type = protocol.getMappingData().getRecipeSerializerMappings().identifier(typeId);
|
||||
handleRecipeType(wrapper, type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void handleCraftingShaped(PacketWrapper wrapper) throws Exception {
|
||||
int ingredientsNo = wrapper.passthrough(Type.VAR_INT) * wrapper.passthrough(Type.VAR_INT);
|
||||
wrapper.passthrough(Type.STRING); // Group
|
||||
|
@ -51,9 +51,13 @@ public class SoundRewriter<C extends ClientboundPacketType> {
|
||||
this.registerSound(packetType);
|
||||
}
|
||||
|
||||
// Not for entity sounds
|
||||
// Also for entity sounds starting with 1.20.5
|
||||
public void register1_19_3Sound(C packetType) {
|
||||
protocol.registerClientbound(packetType, wrapper -> {
|
||||
protocol.registerClientbound(packetType, soundHolderHandler());
|
||||
}
|
||||
|
||||
public PacketHandler soundHolderHandler() {
|
||||
return wrapper -> {
|
||||
final int soundId = wrapper.read(Type.VAR_INT);
|
||||
if (soundId == 0) {
|
||||
// Is followed by the resource loation
|
||||
@ -68,7 +72,7 @@ public class SoundRewriter<C extends ClientboundPacketType> {
|
||||
}
|
||||
|
||||
wrapper.write(Type.VAR_INT, mappedId + 1);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
public PacketHandler getSoundHandler() {
|
||||
|
Binäre Datei nicht angezeigt.
Binäre Datei nicht angezeigt.
@ -1,5 +1,5 @@
|
||||
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
||||
projectVersion=4.10.0-23w51b-SNAPSHOT
|
||||
projectVersion=4.10.0-24w03a-SNAPSHOT
|
||||
|
||||
# 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, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9
|
||||
|
@ -26,10 +26,11 @@ 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_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.ClientboundPackets1_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.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.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
@ -38,13 +39,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_3
|
||||
// ServerboundPackets1_20_3
|
||||
// ClientboundPackets1_20_5
|
||||
// ServerboundPackets1_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_3, ClientboundPackets1_20_3, ServerboundPackets1_20_3, ServerboundPackets1_20_3> {
|
||||
public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets1_20_5, ClientboundPackets1_20_5, ServerboundPackets1_20_5, ServerboundPackets1_20_5> {
|
||||
|
||||
public static final MappingData MAPPINGS = new MappingDataBase("1.98", "1.99");
|
||||
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
|
||||
@ -52,7 +53,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_3.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_3.class);
|
||||
super(ClientboundPackets1_20_5.class, ClientboundPackets1_20_5.class, ServerboundPackets1_20_5.class, ServerboundPackets1_20_5.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,20 +61,20 @@ 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_3> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS);
|
||||
final TagRewriter<ClientboundPackets1_20_5> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
|
||||
tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS);
|
||||
|
||||
// Registers sound id changes
|
||||
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_20_3.ENTITY_SOUND);
|
||||
final SoundRewriter<ClientboundPackets1_20_5> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.ENTITY_SOUND);
|
||||
|
||||
// Registers registry type id changes as well as stat id changes if also included in the json mappings
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_5.STATISTICS);
|
||||
|
||||
// Uncomment if an existing type changed serialization format. Mappings for argument type keys can also be defined in mapping files
|
||||
/*final CommandRewriter1_19_4<ClientboundPackets1_20_3> commandRewriter = new CommandRewriter1_19_4<ClientboundPackets1_20_3>(this) {
|
||||
/*final CommandRewriter1_19_4<ClientboundPackets1_20_5> commandRewriter = new CommandRewriter1_19_4<ClientboundPackets1_20_5>(this) {
|
||||
@Override
|
||||
public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception {
|
||||
if (argumentType.equals("minecraft:abc")) {
|
||||
@ -83,7 +84,7 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
|
||||
super.handleArgument(wrapper, argumentType);
|
||||
}
|
||||
}
|
||||
}.registerDeclareCommands1_19(ClientboundPackets1_20_3.DECLARE_COMMANDS);*/
|
||||
}.registerDeclareCommands1_19(ClientboundPackets1_20_5.DECLARE_COMMANDS);*/
|
||||
|
||||
// TODO Attributes
|
||||
}
|
||||
@ -132,11 +133,11 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
|
||||
|
||||
@Override
|
||||
protected ClientboundPacketType clientboundFinishConfigurationPacket() {
|
||||
return ClientboundConfigurationPackets1_20_3.FINISH_CONFIGURATION;
|
||||
return ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ServerboundPacketType serverboundFinishConfigurationPacket() {
|
||||
return ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
|
||||
return ServerboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
|
||||
}
|
||||
}
|
@ -19,9 +19,10 @@ package com.viaversion.viaversion.template.protocols.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
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.ServerboundPackets1_20_3;
|
||||
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.ClientboundPackets1_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.template.protocols.Protocol1_99To_98;
|
||||
@ -29,7 +30,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_3, ServerboundPackets1_20_3, Protocol1_99To_98> {
|
||||
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_5, ServerboundPackets1_20_5, Protocol1_99To_98> {
|
||||
|
||||
public BlockItemPacketRewriter1_99(final Protocol1_99To_98 protocol) {
|
||||
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
|
||||
@ -40,33 +41,32 @@ 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_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);
|
||||
blockRewriter.registerEffect(ClientboundPackets1_20_3.EFFECT, 1010, 2001);
|
||||
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_3.CHUNK_DATA, ChunkType1_20_2::new);
|
||||
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_3.BLOCK_ENTITY_DATA);
|
||||
final BlockRewriter<ClientboundPackets1_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);
|
||||
blockRewriter.registerEffect(ClientboundPackets1_20_5.EFFECT, 1010, 2001);
|
||||
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_5.CHUNK_DATA, ChunkType1_20_2::new);
|
||||
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_5.BLOCK_ENTITY_DATA);
|
||||
|
||||
// Registers item id changes
|
||||
// Other places using item ids are: Entity metadata, tags, statistics, effect
|
||||
// registerOpenWindow(ClientboundPackets1_20_3.OPEN_WINDOW); - If a new container type was added
|
||||
registerSetCooldown(ClientboundPackets1_20_3.COOLDOWN);
|
||||
registerWindowItems1_17_1(ClientboundPackets1_20_3.WINDOW_ITEMS);
|
||||
registerSetSlot1_17_1(ClientboundPackets1_20_3.SET_SLOT);
|
||||
registerAdvancements1_20_3(ClientboundPackets1_20_3.ADVANCEMENTS);
|
||||
registerEntityEquipmentArray(ClientboundPackets1_20_3.ENTITY_EQUIPMENT);
|
||||
registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW);
|
||||
registerTradeList1_19(ClientboundPackets1_20_3.TRADE_LIST);
|
||||
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION);
|
||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_3.WINDOW_PROPERTY);
|
||||
registerSpawnParticle1_19(ClientboundPackets1_20_3.SPAWN_PARTICLE);
|
||||
// registerOpenWindow(ClientboundPackets1_20_5.OPEN_WINDOW); - If a new container type was added
|
||||
registerSetCooldown(ClientboundPackets1_20_5.COOLDOWN);
|
||||
registerWindowItems1_17_1(ClientboundPackets1_20_5.WINDOW_ITEMS);
|
||||
registerSetSlot1_17_1(ClientboundPackets1_20_5.SET_SLOT);
|
||||
registerAdvancements1_20_3(ClientboundPackets1_20_5.ADVANCEMENTS);
|
||||
registerEntityEquipmentArray(ClientboundPackets1_20_5.ENTITY_EQUIPMENT);
|
||||
registerClickWindow1_17_1(ServerboundPackets1_20_5.CLICK_WINDOW);
|
||||
registerTradeList1_20_5(ClientboundPackets1_20_5.TRADE_LIST);
|
||||
registerCreativeInvAction(ServerboundPackets1_20_5.CREATIVE_INVENTORY_ACTION);
|
||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_5.WINDOW_PROPERTY);
|
||||
registerSpawnParticle1_20_5(ClientboundPackets1_20_5.SPAWN_PARTICLE, Types1_20_3.PARTICLE, Types1_20_3.PARTICLE);
|
||||
registerExplosion(ClientboundPackets1_20_5.EXPLOSION, Types1_20_3.PARTICLE, Types1_20_3.PARTICLE); // Rewrites the included sound and particles
|
||||
|
||||
// TODO Explosion contains particles now
|
||||
|
||||
new RecipeRewriter1_20_3<>(protocol).register(ClientboundPackets1_20_3.DECLARE_RECIPES);
|
||||
new RecipeRewriter1_20_3<>(protocol).register(ClientboundPackets1_20_5.DECLARE_RECIPES);
|
||||
// OR do this if serialization of recipes changed and override the relevant method
|
||||
// Add new serializers to RecipeRewriter, or extend the last one for changes
|
||||
// new RecipeRewriter1_20_3<ClientboundPackets1_20_3>(this) {}.register(ClientboundPackets1_20_3.DECLARE_RECIPES);
|
||||
// new RecipeRewriter1_20_3<ClientboundPackets1_20_5>(this) {}.register1_20_5(ClientboundPackets1_20_5.DECLARE_RECIPES);
|
||||
}
|
||||
}
|
@ -24,14 +24,14 @@ 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_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||
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;
|
||||
|
||||
// Replace if needed
|
||||
// Types1_OLD
|
||||
// Types1_20_5
|
||||
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_99To_98> {
|
||||
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_5, Protocol1_99To_98> {
|
||||
|
||||
public EntityPacketRewriter1_99(final Protocol1_99To_98 protocol) {
|
||||
super(protocol);
|
||||
@ -40,9 +40,9 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
@Override
|
||||
public void registerPackets() {
|
||||
// Tracks entities, applies metadata rewrites registered below, untracks entities
|
||||
registerTrackerWithData1_19(ClientboundPackets1_20_3.SPAWN_ENTITY, EntityTypes1_20_5.FALLING_BLOCK);
|
||||
registerMetadataRewriter(ClientboundPackets1_20_3.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_5.METADATA_LIST); // Specify old and new metadata list if changed
|
||||
registerRemoveEntities(ClientboundPackets1_20_3.REMOVE_ENTITIES);
|
||||
registerTrackerWithData1_19(ClientboundPackets1_20_5.SPAWN_ENTITY, EntityTypes1_20_5.FALLING_BLOCK);
|
||||
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() {
|
||||
@Override
|
||||
@ -53,7 +53,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_20_3.JOIN_GAME, new PacketHandlers() {
|
||||
protocol.registerClientbound(ClientboundPackets1_20_5.JOIN_GAME, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.INT); // Entity id
|
||||
@ -71,7 +71,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_20_3.RESPAWN, new PacketHandlers() {
|
||||
protocol.registerClientbound(ClientboundPackets1_20_5.RESPAWN, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.STRING); // Dimension
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren