Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 16:40:10 +01:00
[ci skip] Move template protocol into common module
Had to move the rewriter classes into the flattened package to make them package private, but this is nicer than having a separate module just for those
Dieser Commit ist enthalten in:
Ursprung
cbd26ce9d9
Commit
bda4ea9fd0
@ -15,23 +15,22 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.template.protocols.rewriter;
|
package com.viaversion.viaversion.protocols.template;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.rewriter.RecipeRewriter1_20_3;
|
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.rewriter.RecipeRewriter1_20_3;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
|
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
|
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPackets1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPackets1_20_5;
|
||||||
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacket1_21;
|
||||||
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPackets1_21;
|
||||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.StructuredItemRewriter;
|
import com.viaversion.viaversion.rewriter.StructuredItemRewriter;
|
||||||
import com.viaversion.viaversion.template.protocols.Protocol1_99To_98;
|
|
||||||
|
|
||||||
// To replace if needed:
|
// To replace if needed:
|
||||||
// ChunkType1_20_2
|
// ChunkType1_20_2
|
||||||
// RecipeRewriter1_20_3
|
// RecipeRewriter1_20_3
|
||||||
public final class BlockItemPacketRewriter1_99 extends StructuredItemRewriter<ClientboundPacket1_20_5, ServerboundPacket1_20_5, Protocol1_99To_98> {
|
final class BlockItemPacketRewriter1_99 extends StructuredItemRewriter<ClientboundPacket1_21, ServerboundPacket1_20_5, Protocol1_99To_98> {
|
||||||
|
|
||||||
public BlockItemPacketRewriter1_99(final Protocol1_99To_98 protocol) {
|
public BlockItemPacketRewriter1_99(final Protocol1_99To_98 protocol) {
|
||||||
super(protocol, /*TypesOLD.ITEM, TypesOLD.ITEM_ARRAY, */Types1_20_5.ITEM, Types1_20_5.ITEM_ARRAY);
|
super(protocol, /*TypesOLD.ITEM, TypesOLD.ITEM_ARRAY, */Types1_20_5.ITEM, Types1_20_5.ITEM_ARRAY);
|
||||||
@ -42,31 +41,31 @@ public final class BlockItemPacketRewriter1_99 extends StructuredItemRewriter<Cl
|
|||||||
// Register block and block state id changes
|
// Register block and block state id changes
|
||||||
// Other places using block state id mappings: Spawn particle, entity data, entity spawn (falling blocks)
|
// Other places using block state id mappings: Spawn particle, entity data, entity spawn (falling blocks)
|
||||||
// Tags and statistics use block (!) ids
|
// Tags and statistics use block (!) ids
|
||||||
final BlockRewriter<ClientboundPacket1_20_5> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
final BlockRewriter<ClientboundPacket1_21> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
||||||
blockRewriter.registerBlockEvent(ClientboundPackets1_20_5.BLOCK_EVENT);
|
blockRewriter.registerBlockEvent(ClientboundPackets1_21.BLOCK_EVENT);
|
||||||
blockRewriter.registerBlockUpdate(ClientboundPackets1_20_5.BLOCK_UPDATE);
|
blockRewriter.registerBlockUpdate(ClientboundPackets1_21.BLOCK_UPDATE);
|
||||||
blockRewriter.registerSectionBlocksUpdate1_20(ClientboundPackets1_20_5.SECTION_BLOCKS_UPDATE);
|
blockRewriter.registerSectionBlocksUpdate1_20(ClientboundPackets1_21.SECTION_BLOCKS_UPDATE);
|
||||||
blockRewriter.registerLevelEvent1_21(ClientboundPackets1_20_5.LEVEL_EVENT, 2001);
|
blockRewriter.registerLevelEvent1_21(ClientboundPackets1_21.LEVEL_EVENT, 2001);
|
||||||
blockRewriter.registerLevelChunk1_19(ClientboundPackets1_20_5.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_20_2::new);
|
blockRewriter.registerLevelChunk1_19(ClientboundPackets1_21.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_20_2::new);
|
||||||
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_5.BLOCK_ENTITY_DATA);
|
blockRewriter.registerBlockEntityData(ClientboundPackets1_21.BLOCK_ENTITY_DATA);
|
||||||
|
|
||||||
// Registers item id changes
|
// Registers item id changes
|
||||||
// Other places using item ids are: Entity data, tags, statistics, effect
|
// Other places using item ids are: Entity data, tags, statistics, effect
|
||||||
// registerOpenWindow(ClientboundPackets1_20_5.OPEN_WINDOW); - If a new container type was added
|
// registerOpenWindow(ClientboundPackets1_21.OPEN_WINDOW); - If a new container type was added
|
||||||
registerCooldown(ClientboundPackets1_20_5.COOLDOWN);
|
registerCooldown(ClientboundPackets1_21.COOLDOWN);
|
||||||
registerSetContent1_17_1(ClientboundPackets1_20_5.CONTAINER_SET_CONTENT);
|
registerSetContent1_17_1(ClientboundPackets1_21.CONTAINER_SET_CONTENT);
|
||||||
registerSetSlot1_17_1(ClientboundPackets1_20_5.CONTAINER_SET_SLOT);
|
registerSetSlot1_17_1(ClientboundPackets1_21.CONTAINER_SET_SLOT);
|
||||||
registerAdvancements1_20_3(ClientboundPackets1_20_5.UPDATE_ADVANCEMENTS);
|
registerAdvancements1_20_3(ClientboundPackets1_21.UPDATE_ADVANCEMENTS);
|
||||||
registerSetEquipment(ClientboundPackets1_20_5.SET_EQUIPMENT);
|
registerSetEquipment(ClientboundPackets1_21.SET_EQUIPMENT);
|
||||||
registerContainerClick1_17_1(ServerboundPackets1_20_5.CONTAINER_CLICK);
|
registerContainerClick1_17_1(ServerboundPackets1_20_5.CONTAINER_CLICK);
|
||||||
registerMerchantOffers1_20_5(ClientboundPackets1_20_5.MERCHANT_OFFERS, Types1_20_5.ITEM_COST, Types1_20_5.ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST);
|
registerMerchantOffers1_20_5(ClientboundPackets1_21.MERCHANT_OFFERS, Types1_20_5.ITEM_COST, Types1_20_5.ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST);
|
||||||
registerSetCreativeModeSlot(ServerboundPackets1_20_5.SET_CREATIVE_MODE_SLOT);
|
registerSetCreativeModeSlot(ServerboundPackets1_20_5.SET_CREATIVE_MODE_SLOT);
|
||||||
registerLevelParticles1_20_5(ClientboundPackets1_20_5.LEVEL_PARTICLES, Types1_20_5.PARTICLE, Types1_20_5.PARTICLE);
|
registerLevelParticles1_20_5(ClientboundPackets1_21.LEVEL_PARTICLES, Types1_20_5.PARTICLE, Types1_20_5.PARTICLE);
|
||||||
registerExplosion(ClientboundPackets1_20_5.EXPLODE, Types1_20_5.PARTICLE, Types1_20_5.PARTICLE); // Rewrites the included sound and particles
|
registerExplosion(ClientboundPackets1_21.EXPLODE, Types1_20_5.PARTICLE, Types1_20_5.PARTICLE); // Rewrites the included sound and particles
|
||||||
|
|
||||||
new RecipeRewriter1_20_3<>(protocol).register1_20_5(ClientboundPackets1_20_5.UPDATE_RECIPES);
|
new RecipeRewriter1_20_3<>(protocol).register1_20_5(ClientboundPackets1_21.UPDATE_RECIPES);
|
||||||
// OR do this if serialization of recipes changed and override the relevant method
|
// 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
|
// Add new serializers to RecipeRewriter, or extend the last one for changes
|
||||||
// new RecipeRewriter1_20_3<ClientboundPackets1_20_5>(this) {}.register1_20_5(ClientboundPackets1_20_5.DECLARE_RECIPES);
|
// new RecipeRewriter1_20_3<ClientboundPacket1_21>(this) {}.register1_20_5(ClientboundPackets1_21.DECLARE_RECIPES);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,25 +15,24 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.template.protocols.rewriter;
|
package com.viaversion.viaversion.protocols.template;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.minecraft.RegistryEntry;
|
import com.viaversion.viaversion.api.minecraft.RegistryEntry;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
import com.viaversion.viaversion.api.type.Types;
|
import com.viaversion.viaversion.api.type.Types;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
import com.viaversion.viaversion.api.type.types.version.Types1_21;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundConfigurationPackets1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundConfigurationPackets1_21;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacket1_21;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPackets1_21;
|
||||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||||
import com.viaversion.viaversion.template.protocols.Protocol1_99To_98;
|
|
||||||
import com.viaversion.viaversion.util.Key;
|
import com.viaversion.viaversion.util.Key;
|
||||||
|
|
||||||
// Replace if needed
|
// Replace if needed
|
||||||
// Types1_OLD
|
// Types1_OLD
|
||||||
// Types1_20_5
|
// Types1_21
|
||||||
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPacket1_20_5, Protocol1_99To_98> {
|
final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPacket1_21, Protocol1_99To_98> {
|
||||||
|
|
||||||
public EntityPacketRewriter1_99(final Protocol1_99To_98 protocol) {
|
public EntityPacketRewriter1_99(final Protocol1_99To_98 protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
@ -42,17 +41,17 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
@Override
|
@Override
|
||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
// Tracks entities, applies entity data rewrites registered below, untracks entities
|
// Tracks entities, applies entity data rewrites registered below, untracks entities
|
||||||
registerTrackerWithData1_19(ClientboundPackets1_20_5.ADD_ENTITY, EntityTypes1_20_5.FALLING_BLOCK);
|
registerTrackerWithData1_19(ClientboundPackets1_21.ADD_ENTITY, EntityTypes1_20_5.FALLING_BLOCK);
|
||||||
registerSetEntityData(ClientboundPackets1_20_5.SET_ENTITY_DATA, /*Types1_OLD_ENTITY_DATA_LIST, */Types1_20_5.ENTITY_DATA_LIST); // Specify old and new entity data list if changed
|
registerSetEntityData(ClientboundPackets1_21.SET_ENTITY_DATA, /*Types1_OLD_ENTITY_DATA_LIST, */Types1_21.ENTITY_DATA_LIST); // Specify old and new entity data list if changed
|
||||||
registerRemoveEntities(ClientboundPackets1_20_5.REMOVE_ENTITIES);
|
registerRemoveEntities(ClientboundPackets1_21.REMOVE_ENTITIES);
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundConfigurationPackets1_20_5.REGISTRY_DATA, wrapper -> {
|
protocol.registerClientbound(ClientboundConfigurationPackets1_21.REGISTRY_DATA, wrapper -> {
|
||||||
final String registryKey = Key.stripMinecraftNamespace(wrapper.passthrough(Types.STRING));
|
final String registryKey = Key.stripMinecraftNamespace(wrapper.passthrough(Types.STRING));
|
||||||
final RegistryEntry[] entries = wrapper.passthrough(Types.REGISTRY_ENTRY_ARRAY);
|
final RegistryEntry[] entries = wrapper.passthrough(Types.REGISTRY_ENTRY_ARRAY);
|
||||||
handleRegistryData1_20_5(wrapper.user(), registryKey, entries); // Caches dimensions to access data like height later and tracks the amount of biomes sent for chunk data
|
handleRegistryData1_20_5(wrapper.user(), registryKey, entries); // Caches dimensions to access data like height later and tracks the amount of biomes sent for chunk data
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_20_5.LOGIN, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_21.LOGIN, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
map(Types.INT); // Entity id
|
map(Types.INT); // Entity id
|
||||||
@ -71,7 +70,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_20_5.RESPAWN, wrapper -> {
|
protocol.registerClientbound(ClientboundPackets1_21.RESPAWN, wrapper -> {
|
||||||
final int dimensionId = wrapper.passthrough(Types.VAR_INT);
|
final int dimensionId = wrapper.passthrough(Types.VAR_INT);
|
||||||
final String world = wrapper.passthrough(Types.STRING);
|
final String world = wrapper.passthrough(Types.STRING);
|
||||||
trackWorldDataByKey1_20_5(wrapper.user(), dimensionId, world); // Tracks world height and name for chunk data and entity (un)tracking
|
trackWorldDataByKey1_20_5(wrapper.user(), dimensionId, world); // Tracks world height and name for chunk data and entity (un)tracking
|
||||||
@ -82,24 +81,23 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
protected void registerRewrites() {
|
protected void registerRewrites() {
|
||||||
/* Uncomment if entity data classes changed
|
/* Uncomment if entity data classes changed
|
||||||
filter().mapDataType(typeId -> {
|
filter().mapDataType(typeId -> {
|
||||||
final int id = typeId;
|
int id = typeId;
|
||||||
if (id >= SomeAddedIndex) {
|
if (id >= SomeAddedIndex) {
|
||||||
id++;
|
id++;
|
||||||
}
|
}
|
||||||
return Types1_20_5.ENTITY_DATA_TYPES.byId(id);
|
return Types1_21.ENTITY_DATA_TYPES.byId(id);
|
||||||
});*/
|
});*/
|
||||||
|
|
||||||
// Registers registry type id changes
|
// Registers registry type id changes
|
||||||
registerEntityDataTypeHandler(
|
registerEntityDataTypeHandler(
|
||||||
Types1_20_5.ENTITY_DATA_TYPES.itemType,
|
Types1_21.ENTITY_DATA_TYPES.itemType,
|
||||||
Types1_20_5.ENTITY_DATA_TYPES.blockStateType,
|
Types1_21.ENTITY_DATA_TYPES.blockStateType,
|
||||||
Types1_20_5.ENTITY_DATA_TYPES.optionalBlockStateType,
|
Types1_21.ENTITY_DATA_TYPES.optionalBlockStateType,
|
||||||
Types1_20_5.ENTITY_DATA_TYPES.particleType,
|
Types1_21.ENTITY_DATA_TYPES.particleType,
|
||||||
Types1_20_5.ENTITY_DATA_TYPES.particlesType,
|
Types1_21.ENTITY_DATA_TYPES.particlesType,
|
||||||
Types1_20_5.ENTITY_DATA_TYPES.componentType,
|
Types1_21.ENTITY_DATA_TYPES.componentType,
|
||||||
Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType
|
Types1_21.ENTITY_DATA_TYPES.optionalComponentType
|
||||||
);
|
);
|
||||||
// Minecarts are special
|
|
||||||
registerBlockStateHandler(EntityTypes1_20_5.ABSTRACT_MINECART, 11);
|
registerBlockStateHandler(EntityTypes1_20_5.ABSTRACT_MINECART, 11);
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.template.protocols;
|
package com.viaversion.viaversion.protocols.template;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
import com.viaversion.viaversion.api.data.MappingData;
|
import com.viaversion.viaversion.api.data.MappingData;
|
||||||
@ -25,65 +25,63 @@ import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
|||||||
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
||||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundConfigurationPackets1_20_5;
|
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
|
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
|
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundConfigurationPackets1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundConfigurationPackets1_20_5;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPackets1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPackets1_20_5;
|
||||||
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundConfigurationPackets1_21;
|
||||||
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacket1_21;
|
||||||
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPackets1_21;
|
||||||
import com.viaversion.viaversion.rewriter.AttributeRewriter;
|
import com.viaversion.viaversion.rewriter.AttributeRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||||
import com.viaversion.viaversion.template.protocols.rewriter.BlockItemPacketRewriter1_99;
|
|
||||||
import com.viaversion.viaversion.template.protocols.rewriter.EntityPacketRewriter1_99;
|
|
||||||
|
|
||||||
import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap;
|
import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap;
|
||||||
|
|
||||||
// Placeholders to replace (in the entire package):
|
// Placeholders to replace (in the entire package):
|
||||||
// Protocol1_99To_98, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99
|
// Protocol1_99To_98, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99 - move the latter two to a rewriter package
|
||||||
// ClientboundPacket1_20_5
|
// ClientboundPacket1_21
|
||||||
// ServerboundPacket1_20_5
|
// ServerboundPacket1_20_5
|
||||||
// EntityTypes1_20_5 (MAPPED type)
|
// EntityTypes1_20_5 (MAPPED type)
|
||||||
// 1.99, 1.98
|
// 1.99, 1.98
|
||||||
public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPacket1_20_5, ClientboundPacket1_20_5, ServerboundPacket1_20_5, ServerboundPacket1_20_5> {
|
final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPacket1_21, ClientboundPacket1_21, ServerboundPacket1_20_5, ServerboundPacket1_20_5> {
|
||||||
|
|
||||||
public static final MappingData MAPPINGS = new MappingDataBase("1.98", "1.99");
|
public static final MappingData MAPPINGS = new MappingDataBase("1.98", "1.99");
|
||||||
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
|
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
|
||||||
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
|
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
|
||||||
private final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
|
private final TagRewriter<ClientboundPacket1_21> tagRewriter = new TagRewriter<>(this);
|
||||||
|
|
||||||
public Protocol1_99To_98() {
|
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
|
// Passing the class types into the super constructor is needed for automatic packet type id remapping, but can otherwise be omitted
|
||||||
super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class);
|
super(ClientboundPacket1_21.class, ClientboundPacket1_21.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
super.registerPackets();
|
super.registerPackets();
|
||||||
|
|
||||||
tagRewriter.registerGeneric(ClientboundPackets1_20_5.UPDATE_TAGS);
|
tagRewriter.registerGeneric(ClientboundPackets1_21.UPDATE_TAGS);
|
||||||
tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS);
|
tagRewriter.registerGeneric(ClientboundConfigurationPackets1_21.UPDATE_TAGS);
|
||||||
|
|
||||||
final SoundRewriter<ClientboundPacket1_20_5> soundRewriter = new SoundRewriter<>(this);
|
final SoundRewriter<ClientboundPacket1_21> soundRewriter = new SoundRewriter<>(this);
|
||||||
soundRewriter.registerSound1_19_3(ClientboundPackets1_20_5.SOUND);
|
soundRewriter.registerSound1_19_3(ClientboundPackets1_21.SOUND);
|
||||||
soundRewriter.registerSound1_19_3(ClientboundPackets1_20_5.SOUND_ENTITY);
|
soundRewriter.registerSound1_19_3(ClientboundPackets1_21.SOUND_ENTITY);
|
||||||
|
|
||||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_5.AWARD_STATS);
|
new StatisticsRewriter<>(this).register(ClientboundPackets1_21.AWARD_STATS);
|
||||||
new AttributeRewriter<>(this).register1_21(ClientboundPackets1_20_5.UPDATE_ATTRIBUTES);
|
new AttributeRewriter<>(this).register1_21(ClientboundPackets1_21.UPDATE_ATTRIBUTES);
|
||||||
|
|
||||||
// Uncomment if an existing type changed serialization format. Mappings for argument type keys can also be defined in mapping files
|
// 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_5> commandRewriter = new CommandRewriter1_19_4<ClientboundPackets1_20_5>(this) {
|
/*new CommandRewriter1_19_4<>(this) {
|
||||||
@Override
|
@Override
|
||||||
public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception {
|
public void handleArgument(final PacketWrapper wrapper, final String argumentType) {
|
||||||
if (argumentType.equals("minecraft:abc")) {
|
if (argumentType.equals("minecraft:abc")) {
|
||||||
// New argument
|
// New argument
|
||||||
wrapper.write(Type.INT, 0);
|
wrapper.write(Types.INT, 0);
|
||||||
} else {
|
} else {
|
||||||
super.handleArgument(wrapper, argumentType);
|
super.handleArgument(wrapper, argumentType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.registerDeclareCommands1_19(ClientboundPackets1_20_5.DECLARE_COMMANDS);*/
|
}.registerDeclareCommands1_19(ClientboundPackets1_21.COMMANDS);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -130,15 +128,15 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPacket1
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TagRewriter<ClientboundPacket1_20_5> getTagRewriter() {
|
public TagRewriter<ClientboundPacket1_21> getTagRewriter() {
|
||||||
return tagRewriter;
|
return tagRewriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PacketTypesProvider<ClientboundPacket1_20_5, ClientboundPacket1_20_5, ServerboundPacket1_20_5, ServerboundPacket1_20_5> createPacketTypesProvider() {
|
protected PacketTypesProvider<ClientboundPacket1_21, ClientboundPacket1_21, ServerboundPacket1_20_5, ServerboundPacket1_20_5> createPacketTypesProvider() {
|
||||||
return new SimplePacketTypesProvider<>(
|
return new SimplePacketTypesProvider<>(
|
||||||
packetTypeMap(unmappedClientboundPacketType, ClientboundPackets1_20_5.class, ClientboundConfigurationPackets1_20_5.class),
|
packetTypeMap(unmappedClientboundPacketType, ClientboundPackets1_21.class, ClientboundConfigurationPackets1_21.class),
|
||||||
packetTypeMap(mappedClientboundPacketType, ClientboundPackets1_20_5.class, ClientboundConfigurationPackets1_20_5.class),
|
packetTypeMap(mappedClientboundPacketType, ClientboundPackets1_21.class, ClientboundConfigurationPackets1_21.class),
|
||||||
packetTypeMap(mappedServerboundPacketType, ServerboundPackets1_20_5.class, ServerboundConfigurationPackets1_20_5.class),
|
packetTypeMap(mappedServerboundPacketType, ServerboundPackets1_20_5.class, ServerboundConfigurationPackets1_20_5.class),
|
||||||
packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_5.class, ServerboundConfigurationPackets1_20_5.class)
|
packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_5.class, ServerboundConfigurationPackets1_20_5.class)
|
||||||
);
|
);
|
@ -30,7 +30,6 @@ setupViaSubproject("bukkit")
|
|||||||
setupViaSubproject("bukkit-legacy")
|
setupViaSubproject("bukkit-legacy")
|
||||||
setupViaSubproject("velocity")
|
setupViaSubproject("velocity")
|
||||||
setupViaSubproject("fabric")
|
setupViaSubproject("fabric")
|
||||||
setupViaSubproject("template")
|
|
||||||
|
|
||||||
setupSubproject("viaversion") {
|
setupSubproject("viaversion") {
|
||||||
projectDir = file("universal")
|
projectDir = file("universal")
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
compileOnly(projects.viaversionCommon)
|
|
||||||
}
|
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren