Fix play record, remove unused 1.18 code

This commit is contained in:
Nassim Jahnke 2021-11-12 13:18:02 +01:00
parent 1ab93c4021
commit 95bc340b06
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
4 changed files with 19 additions and 24 deletions

View File

@ -5,7 +5,7 @@ plugins {
allprojects { allprojects {
group = "com.viaversion" group = "com.viaversion"
version = "4.1.0-21w44a-SNAPSHOT" version = "4.1.0-1.18-pre1-SNAPSHOT"
description = "Allow older clients to join newer server versions." description = "Allow older clients to join newer server versions."
} }

View File

@ -78,7 +78,7 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
@Override @Override
public void init(final UserConnection connection) { public void init(final UserConnection connection) {
addEntityTracker(connection, new EntityTrackerBase(connection, Entity1_17Types.PLAYER)); //TODO addEntityTracker(connection, new EntityTrackerBase(connection, Entity1_17Types.PLAYER));
} }
@Override @Override

View File

@ -55,8 +55,6 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
@Override @Override
protected void registerPackets() { protected void registerPackets() {
//final BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES); new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES);
registerSetCooldown(ClientboundPackets1_18.COOLDOWN); registerSetCooldown(ClientboundPackets1_18.COOLDOWN);
@ -67,11 +65,21 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
registerAdvancements(ClientboundPackets1_18.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM); registerAdvancements(ClientboundPackets1_18.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM); registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
/*blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_18.ACKNOWLEDGE_PLAYER_DIGGING); protocol.registerClientbound(ClientboundPackets1_18.EFFECT, new PacketRemapper() {
blockRewriter.registerBlockAction(ClientboundPackets1_18.BLOCK_ACTION); @Override
blockRewriter.registerEffect(ClientboundPackets1_18.EFFECT, 1010, 2001); public void registerMap() {
blockRewriter.registerBlockChange(ClientboundPackets1_18.BLOCK_CHANGE); map(Type.INT); // Effect id
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_18.MULTI_BLOCK_CHANGE);*/ map(Type.POSITION1_14); // Location
map(Type.INT); // Data
handler(wrapper -> {
int id = wrapper.get(Type.INT, 0);
int data = wrapper.get(Type.INT, 1);
if (id == 1010) { // Play record
wrapper.set(Type.INT, 1, protocol.getMappingData().getNewItemId(data));
}
});
}
});
registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM); registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
@ -162,12 +170,6 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
for (int i = 0; i < ChunkSection.BIOME_SIZE; i++) { for (int i = 0; i < ChunkSection.BIOME_SIZE; i++) {
biomeData[biomeIndex++] = biomePalette.idAt(i); biomeData[biomeIndex++] = biomePalette.idAt(i);
} }
// Rewrite ids
/*for (int i = 0; i < section.getPaletteSize(); i++) {
int old = section.getPaletteEntry(i);
section.setPaletteEntry(i, protocol.getMappingData().getNewBlockStateId(old));
}*/
} }
final List<CompoundTag> blockEntityTags = new ArrayList<>(oldChunk.blockEntities().size()); final List<CompoundTag> blockEntityTags = new ArrayList<>(oldChunk.blockEntities().size());

View File

@ -44,12 +44,6 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
@Override @Override
protected void registerPackets() { protected void registerPackets() {
/*registerTrackerWithData(ClientboundPackets1_18.SPAWN_ENTITY, Entity1_18Types.FALLING_BLOCK);
registerSpawnTracker(ClientboundPackets1_18.SPAWN_MOB);
registerTracker(ClientboundPackets1_18.SPAWN_EXPERIENCE_ORB, Entity1_18Types.EXPERIENCE_ORB);
registerTracker(ClientboundPackets1_18.SPAWN_PAINTING, Entity1_18Types.PAINTING);
registerTracker(ClientboundPackets1_18.SPAWN_PLAYER, Entity1_18Types.PLAYER);
registerRemoveEntities(ClientboundPackets1_18.REMOVE_ENTITIES);*/
registerMetadataRewriter(ClientboundPackets1_18.ENTITY_METADATA, Types1_18.METADATA_LIST, Types1_17.METADATA_LIST); registerMetadataRewriter(ClientboundPackets1_18.ENTITY_METADATA, Types1_18.METADATA_LIST, Types1_17.METADATA_LIST);
protocol.registerClientbound(ClientboundPackets1_18.JOIN_GAME, new PacketRemapper() { protocol.registerClientbound(ClientboundPackets1_18.JOIN_GAME, new PacketRemapper() {
@ -67,7 +61,6 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
map(Type.VAR_INT); // Max players map(Type.VAR_INT); // Max players
map(Type.VAR_INT); // Chunk radius map(Type.VAR_INT); // Chunk radius
read(Type.VAR_INT); // Read simulation distance read(Type.VAR_INT); // Read simulation distance
//handler(getTrackerHandler(Entity1_17Types.PLAYER, Type.INT)); //TODO
handler(worldDataTrackerHandler(1)); handler(worldDataTrackerHandler(1));
handler(wrapper -> { handler(wrapper -> {
final CompoundTag registry = wrapper.get(Type.NBT, 0); final CompoundTag registry = wrapper.get(Type.NBT, 0);
@ -127,11 +120,11 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
}); });
// Particles have already been handled // Particles have already been handled
registerMetaTypeHandler(Types1_17.META_TYPES.itemType, null, null, null); //TODO registerMetaTypeHandler(Types1_17.META_TYPES.itemType, null, null, null);
} }
@Override @Override
public EntityType typeFromId(final int typeId) { public EntityType typeFromId(final int typeId) {
return Entity1_17Types.getTypeFromId(typeId); //TODO return Entity1_17Types.getTypeFromId(typeId);
} }
} }