This commit is contained in:
Nassim Jahnke 2023-10-19 10:53:14 +10:00
parent fdfc528a9a
commit e7d0b01eee
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
15 changed files with 287 additions and 50 deletions

View File

@ -424,7 +424,7 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
Via.getPlatform().getLogger().warning("ERROR IN " + getClass().getSimpleName() + " IN REMAP OF " + packetType + " (" + toNiceHex(unmappedPacketId) + ")");
} else {
Via.getPlatform().getLogger().warning("ERROR IN " + getClass().getSimpleName()
+ " IN REMAP OF " + toNiceHex(unmappedPacketId) + "->" + toNiceHex(mappedPacketId));
+ " IN REMAP OF " + state + " " + toNiceHex(unmappedPacketId) + "->" + toNiceHex(mappedPacketId));
}
throw e;
}

View File

@ -85,7 +85,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_19_4 = register(762, "1.19.4");
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, 156, "1.20.3");
public static final ProtocolVersion v1_20_3 = register(765, 157, "1.20.3");
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
public static ProtocolVersion register(int version, String name) {

View File

@ -32,7 +32,7 @@ import java.util.List;
public final class Types1_20_3 {
public static final ParticleType PARTICLE = Types1_20.PARTICLE; // Only safe to use after protocol loading
public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading
public static final MetaTypes1_20_3 META_TYPES = new MetaTypes1_20_3(PARTICLE);
public static final Type<Metadata> METADATA = new MetadataType(META_TYPES);
public static final Type<List<Metadata>> METADATA_LIST = new MetaListType(METADATA);

View File

@ -49,13 +49,19 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.UUIDIntArrayType;
import com.viaversion.viaversion.api.type.types.misc.ParticleType;
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_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.ServerboundPackets1_20_2;
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.rewriter.SoundRewriter;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashSet;
@ -64,7 +70,7 @@ import java.util.Set;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPackets1_20_2, ClientboundPackets1_20_2, ServerboundPackets1_20_2, ServerboundPackets1_20_2> {
public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPackets1_20_2, ClientboundPackets1_20_2, ServerboundPackets1_20_2, ServerboundPackets1_20_3> {
public static final MappingData MAPPINGS = new MappingDataBase("1.20.2", "1.20.3");
private static final Set<String> BOOLEAN_TYPES = new HashSet<>(Arrays.asList(
@ -75,19 +81,27 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
"strikethrough",
"obfuscated"
));
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_2.class, ServerboundPackets1_20_2.class, ServerboundPackets1_20_2.class);
super(ClientboundPackets1_20_2.class, ClientboundPackets1_20_2.class, ServerboundPackets1_20_2.class, ServerboundPackets1_20_3.class);
}
@Override
protected void registerPackets() {
super.registerPackets();
cancelServerbound(ServerboundPackets1_20_3.CONTAINER_SLOT_STATE_CHANGED);
final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS);
final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND);
soundRewriter.registerEntitySound(ClientboundPackets1_20_2.ENTITY_SOUND);
soundRewriter.registerSound(ClientboundPackets1_20_2.ENTITY_SOUND);
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_2.STATISTICS);
// Components are now (mostly) written as nbt instead of json strings
registerClientbound(ClientboundPackets1_20_2.ADVANCEMENTS, wrapper -> {
@ -105,7 +119,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
if (wrapper.passthrough(Type.BOOLEAN)) {
convertComponent(wrapper); // Title
convertComponent(wrapper); // Description
wrapper.passthrough(Type.ITEM1_20_2); // Icon
itemRewriter.handleItemToClient(wrapper.passthrough(Type.ITEM1_20_2)); // Icon
wrapper.passthrough(Type.VAR_INT); // Frame type
final int flags = wrapper.passthrough(Type.INT);
if ((flags & 1) != 0) {
@ -215,13 +229,13 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
registerClientbound(ClientboundPackets1_20_2.TITLE_SUBTITLE, this::convertComponent);
registerClientbound(ClientboundPackets1_20_2.DISGUISED_CHAT, this::convertComponent);
registerClientbound(ClientboundPackets1_20_2.SYSTEM_CHAT, this::convertComponent);
registerClientbound(ClientboundPackets1_20_2.OPEN_WINDOW, new PacketHandlers() {
@Override
public void register() {
map(Type.VAR_INT); // Id
map(Type.VAR_INT); // Window Type
handler(wrapper -> convertComponent(wrapper));
}
registerClientbound(ClientboundPackets1_20_2.OPEN_WINDOW, wrapper -> {
wrapper.passthrough(Type.VAR_INT); // Container id
final int containerTypeId = wrapper.read(Type.VAR_INT);
wrapper.write(Type.VAR_INT, MAPPINGS.getMenuMappings().getNewId(containerTypeId));
convertComponent(wrapper);
});
registerClientbound(ClientboundPackets1_20_2.TAB_LIST, wrapper -> {
convertComponent(wrapper);
@ -480,6 +494,20 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
return UUIDIntArrayType.uuidFromIntArray(parts).toString();
}
@Override
protected void onMappingDataLoaded() {
Types1_20_3.PARTICLE.filler(this)
.reader("block", ParticleType.Readers.BLOCK)
.reader("block_marker", ParticleType.Readers.BLOCK)
.reader("dust", ParticleType.Readers.DUST)
.reader("falling_dust", ParticleType.Readers.BLOCK)
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
.reader("vibration", ParticleType.Readers.VIBRATION)
.reader("sculk_charge", ParticleType.Readers.SCULK_CHARGE)
.reader("shriek", ParticleType.Readers.SHRIEK);
}
@Override
public void init(final UserConnection connection) {
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_19_4.PLAYER));
@ -490,6 +518,16 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
return MAPPINGS;
}
@Override
public BlockItemPacketRewriter1_20_3 getItemRewriter() {
return itemRewriter;
}
@Override
public EntityPacketRewriter1_20_3 getEntityRewriter() {
return entityRewriter;
}
@Override
protected ServerboundPacketType serverboundFinishConfigurationPacket() {
return ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
@ -499,9 +537,4 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
protected ClientboundPacketType clientboundFinishConfigurationPacket() {
return ClientboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
}
@Override
public EntityPacketRewriter1_20_3 getEntityRewriter() {
return entityRewriter;
}
}

View File

@ -0,0 +1,89 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 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 enum ServerboundPackets1_20_3 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
PLUGIN_MESSAGE, // 0x10
EDIT_BOOK, // 0x11
ENTITY_NBT_REQUEST, // 0x12
INTERACT_ENTITY, // 0x13
GENERATE_JIGSAW, // 0x14
KEEP_ALIVE, // 0x15
LOCK_DIFFICULTY, // 0x16
PLAYER_POSITION, // 0x17
PLAYER_POSITION_AND_ROTATION, // 0x18
PLAYER_ROTATION, // 0x19
PLAYER_MOVEMENT, // 0x1A
VEHICLE_MOVE, // 0x1B
STEER_BOAT, // 0x1C
PICK_ITEM, // 0x1D
PING_REQUEST, // 0x1E
CRAFT_RECIPE_REQUEST, // 0x1F
PLAYER_ABILITIES, // 0x20
PLAYER_DIGGING, // 0x21
ENTITY_ACTION, // 0x22
STEER_VEHICLE, // 0x23
PONG, // 0x24
RECIPE_BOOK_DATA, // 0x25
SEEN_RECIPE, // 0x26
RENAME_ITEM, // 0x27
RESOURCE_PACK_STATUS, // 0x28
ADVANCEMENT_TAB, // 0x29
SELECT_TRADE, // 0x2A
SET_BEACON_EFFECT, // 0x2B
HELD_ITEM_CHANGE, // 0x2C
UPDATE_COMMAND_BLOCK, // 0x2D
UPDATE_COMMAND_BLOCK_MINECART, // 0x2E
CREATIVE_INVENTORY_ACTION, // 0x2F
UPDATE_JIGSAW_BLOCK, // 0x30
UPDATE_STRUCTURE_BLOCK, // 0x31
UPDATE_SIGN, // 0x32
ANIMATION, // 0x33
SPECTATE, // 0x34
PLAYER_BLOCK_PLACEMENT, // 0x35
USE_ITEM; // 0x36
@Override
public int getId() {
return ordinal();
}
@Override
public String getName() {
return name();
}
}

View File

@ -0,0 +1,57 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2023 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.rewriter;
import com.viaversion.viaversion.api.type.Type;
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_2to1_20.type.ChunkType1_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.ServerboundPackets1_20_3;
import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.rewriter.ItemRewriter;
public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<ClientboundPackets1_20_2, ServerboundPackets1_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);
}
@Override
public void registerPackets() {
final BlockRewriter<ClientboundPackets1_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);
blockRewriter.registerEffect(ClientboundPackets1_20_2.EFFECT, 1010, 2001);
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_2.CHUNK_DATA, ChunkType1_20_2::new);
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_2.BLOCK_ENTITY_DATA);
registerSetCooldown(ClientboundPackets1_20_2.COOLDOWN);
registerWindowItems1_17_1(ClientboundPackets1_20_2.WINDOW_ITEMS);
registerSetSlot1_17_1(ClientboundPackets1_20_2.SET_SLOT);
registerEntityEquipmentArray(ClientboundPackets1_20_2.ENTITY_EQUIPMENT);
registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW);
registerTradeList1_19(ClientboundPackets1_20_2.TRADE_LIST);
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION);
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_2.WINDOW_PROPERTY);
registerSpawnParticle1_19(ClientboundPackets1_20_2.SPAWN_PARTICLE);
new RecipeRewriter1_20_2<>(protocol).register(ClientboundPackets1_20_2.DECLARE_RECIPES);
}
}

View File

@ -17,13 +17,16 @@
*/
package com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
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.ClientboundPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2;
import com.viaversion.viaversion.rewriter.EntityRewriter;
@ -40,26 +43,54 @@ 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(ClientboundPackets1_20_2.JOIN_GAME, wrapper -> {
wrapper.send(Protocol1_20_3To1_20_2.class);
wrapper.cancel();
// Make sure the loading screen is closed, continues old client behavior
final PacketWrapper gameEventPacket = wrapper.create(ClientboundPackets1_20_2.GAME_EVENT);
gameEventPacket.write(Type.UNSIGNED_BYTE, (short) 13);
gameEventPacket.write(Type.FLOAT, 0F);
gameEventPacket.send(Protocol1_20_3To1_20_2.class);
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.REGISTRY_DATA, new PacketHandlers() {
@Override
protected void register() {
map(Type.COMPOUND_TAG); // Registry data
handler(configurationDimensionDataHandler());
handler(configurationBiomeSizeTracker());
}
});
protocol.registerClientbound(ClientboundPackets1_20_2.RESPAWN, wrapper -> {
wrapper.send(Protocol1_20_3To1_20_2.class);
wrapper.cancel();
// Make sure the loading screen is closed, continues old client behavior
final PacketWrapper gameEventPacket = wrapper.create(ClientboundPackets1_20_2.GAME_EVENT);
gameEventPacket.write(Type.UNSIGNED_BYTE, (short) 13);
gameEventPacket.write(Type.FLOAT, 0F);
gameEventPacket.send(Protocol1_20_3To1_20_2.class);
protocol.registerClientbound(ClientboundPackets1_20_2.JOIN_GAME, new PacketHandlers() {
@Override
public void register() {
map(Type.INT); // Entity id
map(Type.BOOLEAN); // Hardcore
map(Type.STRING_ARRAY); // World List
map(Type.VAR_INT); // Max players
map(Type.VAR_INT); // View distance
map(Type.VAR_INT); // Simulation distance
map(Type.BOOLEAN); // Reduced debug info
map(Type.BOOLEAN); // Show death screen
map(Type.BOOLEAN); // Limited crafting
map(Type.STRING); // Dimension key
map(Type.STRING); // World
handler(worldDataTrackerHandlerByKey());
handler(wrapper -> sendChunksSentGameEvent(wrapper));
}
});
protocol.registerClientbound(ClientboundPackets1_20_2.RESPAWN, new PacketHandlers() {
@Override
public void register() {
map(Type.STRING); // Dimension
map(Type.STRING); // World
handler(worldDataTrackerHandlerByKey());
handler(wrapper -> sendChunksSentGameEvent(wrapper));
}
});
}
private void sendChunksSentGameEvent(final PacketWrapper wrapper) throws Exception {
wrapper.send(Protocol1_20_3To1_20_2.class);
wrapper.cancel();
// Make sure the loading screen is closed, continues old client behavior
final PacketWrapper gameEventPacket = wrapper.create(ClientboundPackets1_20_2.GAME_EVENT);
gameEventPacket.write(Type.UNSIGNED_BYTE, (short) 13);
gameEventPacket.write(Type.FLOAT, 0F);
gameEventPacket.send(Protocol1_20_3To1_20_2.class);
}
@Override
@ -74,6 +105,20 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
meta.setMetaType(Types1_20_3.META_TYPES.byId(type.typeId()));
}
});
registerMetaTypeHandler(
Types1_20_3.META_TYPES.itemType,
Types1_20_3.META_TYPES.blockStateType,
Types1_20_3.META_TYPES.optionalBlockStateType,
Types1_20_3.META_TYPES.particleType
);
filter().filterFamily(EntityTypes1_19_4.MINECART_ABSTRACT).index(12).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
// TODO NEW ENTITY METADATA
}
@Override

View File

@ -474,6 +474,10 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
return wrapper -> trackBiomeSize(wrapper.user(), wrapper.get(Type.NAMED_COMPOUND_TAG, 0));
}
public PacketHandler configurationBiomeSizeTracker() {
return wrapper -> trackBiomeSize(wrapper.user(), wrapper.get(Type.COMPOUND_TAG, 0));
}
public void trackBiomeSize(final UserConnection connection, final CompoundTag registry) {
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
final ListTag biomes = biomeRegistry.get("value");
@ -484,6 +488,10 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
return wrapper -> cacheDimensionData(wrapper.user(), wrapper.get(Type.NAMED_COMPOUND_TAG, 0));
}
public PacketHandler configurationDimensionDataHandler() {
return wrapper -> cacheDimensionData(wrapper.user(), wrapper.get(Type.COMPOUND_TAG, 0));
}
/**
* Caches dimension data, later used to get height values and other important info.
*/

View File

@ -171,6 +171,10 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
});
}
public void registerCreativeInvAction(S packetType) {
registerCreativeInvAction(packetType, itemType);
}
public void registerCreativeInvAction(S packetType, Type<Item> type) {
protocol.registerServerbound(packetType, new PacketHandlers() {
@Override

View File

@ -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.9.0-23w41a-SNAPSHOT
projectVersion=4.9.0-23w42a-SNAPSHOT
# Smile emoji
mcVersions=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

View File

@ -28,7 +28,7 @@ import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_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.ServerboundPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
import com.viaversion.viaversion.rewriter.SoundRewriter;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
@ -38,12 +38,12 @@ import com.viaversion.viaversion.template.protocols.rewriter.BlockItemPacketRewr
// Placeholders to replace (in the entire package):
// Protocol1_99To_98, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99
// ClientboundPackets1_20_2
// ServerboundPackets1_20_2
// ServerboundPackets1_20_3
// ClientboundConfigurationPackets1_20_2
// ServerboundConfigurationPackets1_20_2
// Entity1_19_4Types (MAPPED type)
// 1.99, 1.98
public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets1_20_2, ClientboundPackets1_20_2, ServerboundPackets1_20_2, ServerboundPackets1_20_2> {
public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets1_20_2, ClientboundPackets1_20_2, ServerboundPackets1_20_3, ServerboundPackets1_20_3> {
public static final MappingData MAPPINGS = new MappingDataBase("1.98", "1.99");
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
@ -51,7 +51,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_2.class, ClientboundPackets1_20_2.class, ServerboundPackets1_20_2.class, ServerboundPackets1_20_2.class);
super(ClientboundPackets1_20_2.class, ClientboundPackets1_20_2.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_3.class);
}
@Override
@ -92,7 +92,7 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
// Entity1_19_4Types.initialize(this);
// Uncomment if a new particle was added = ids shifted; requires a new Types_ class copied from the last
/*Types1_19_4.PARTICLE.filler(this)
/*Types1_20_3.PARTICLE.filler(this)
.reader("block", ParticleType.Readers.BLOCK)
.reader("block_marker", ParticleType.Readers.BLOCK)
.reader("dust", ParticleType.Readers.DUST)

View File

@ -19,9 +19,9 @@ package com.viaversion.viaversion.template.protocols.rewriter;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.rewriter.RecipeRewriter1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.type.ChunkType1_20_2;
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.template.protocols.Protocol1_99To_98;
@ -29,7 +29,7 @@ import com.viaversion.viaversion.template.protocols.Protocol1_99To_98;
// To replace if needed:
// ChunkType1_20_2
// RecipeRewriter1_20_2
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_2, ServerboundPackets1_20_2, Protocol1_99To_98> {
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_2, ServerboundPackets1_20_3, Protocol1_99To_98> {
public BlockItemPacketRewriter1_99(final Protocol1_99To_98 protocol) {
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
@ -50,14 +50,15 @@ public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundP
// Registers item id changes
// Other places using item ids are: Entity metadata, tags, statistics, effect
// registerOpenWindow(ClientboundPackets1_20_2.OPEN_WINDOW); - If a new container type was added
registerSetCooldown(ClientboundPackets1_20_2.COOLDOWN);
registerWindowItems1_17_1(ClientboundPackets1_20_2.WINDOW_ITEMS);
registerSetSlot1_17_1(ClientboundPackets1_20_2.SET_SLOT);
registerAdvancements1_20_3(ClientboundPackets1_20_2.ADVANCEMENTS);
registerEntityEquipmentArray(ClientboundPackets1_20_2.ENTITY_EQUIPMENT);
registerClickWindow1_17_1(ServerboundPackets1_20_2.CLICK_WINDOW);
registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW);
registerTradeList1_19(ClientboundPackets1_20_2.TRADE_LIST);
registerCreativeInvAction(ServerboundPackets1_20_2.CREATIVE_INVENTORY_ACTION, Type.ITEM1_20_2);
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION);
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_2.WINDOW_PROPERTY);
registerSpawnParticle1_19(ClientboundPackets1_20_2.SPAWN_PARTICLE);

View File

@ -47,9 +47,9 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.REGISTRY_DATA, new PacketHandlers() {
@Override
protected void register() {
map(Type.NAMED_COMPOUND_TAG); // Registry data
handler(dimensionDataHandler()); // Caches dimensions to access data like height later
handler(biomeSizeTracker()); // Tracks the amount of biomes sent for chunk data
map(Type.COMPOUND_TAG); // Registry data
handler(configurationDimensionDataHandler()); // Caches dimensions to access data like height later
handler(configurationBiomeSizeTracker()); // Tracks the amount of biomes sent for chunk data
}
});