Merge branch 'master' into dev

# Conflicts:
#	template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/EntityPacketRewriter1_99.java
This commit is contained in:
Nassim Jahnke 2024-01-12 10:33:40 +01:00
commit de42850dd1
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
18 changed files with 46 additions and 40 deletions

View File

@ -53,6 +53,7 @@ public class LecternInteractListener extends ViaBukkitListener {
// Open a book with the text of the lectern's writable book // Open a book with the text of the lectern's writable book
ItemStack newBook = new ItemStack(Material.WRITTEN_BOOK); ItemStack newBook = new ItemStack(Material.WRITTEN_BOOK);
BookMeta newBookMeta = (BookMeta) newBook.getItemMeta(); BookMeta newBookMeta = (BookMeta) newBook.getItemMeta();
//noinspection deprecation
newBookMeta.setPages(meta.getPages()); newBookMeta.setPages(meta.getPages());
newBookMeta.setAuthor("an upsidedown person"); newBookMeta.setAuthor("an upsidedown person");
newBookMeta.setTitle("buk"); newBookMeta.setTitle("buk");

View File

@ -230,7 +230,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
mapObjectType(EntityTypes1_11.ObjectType.EVOCATION_FANGS, EntityTypes1_11.ObjectType.FALLING_BLOCK, 198 | 1 << 12); mapObjectType(EntityTypes1_11.ObjectType.EVOCATION_FANGS, EntityTypes1_11.ObjectType.FALLING_BLOCK, 198 | 1 << 12);
// Handle ElderGuardian & target metadata // Handle ElderGuardian & target metadata
filter().filterFamily(EntityTypes1_11.EntityType.GUARDIAN).index(12).handler((event, meta) -> { filter().type(EntityTypes1_11.EntityType.GUARDIAN).index(12).handler((event, meta) -> {
boolean b = (boolean) meta.getValue(); boolean b = (boolean) meta.getValue();
int bitmask = b ? 0x02 : 0; int bitmask = b ? 0x02 : 0;
@ -242,12 +242,12 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
}); });
// Handle skeleton swing // Handle skeleton swing
filter().filterFamily(EntityTypes1_11.EntityType.ABSTRACT_SKELETON).index(12).toIndex(13); filter().type(EntityTypes1_11.EntityType.ABSTRACT_SKELETON).index(12).toIndex(13);
/* /*
ZOMBIE CHANGES ZOMBIE CHANGES
*/ */
filter().filterFamily(EntityTypes1_11.EntityType.ZOMBIE).handler((event, meta) -> { filter().type(EntityTypes1_11.EntityType.ZOMBIE).handler((event, meta) -> {
switch (meta.id()) { switch (meta.id()) {
case 13: case 13:
event.cancel(); event.cancel();
@ -288,7 +288,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
*/ */
// Handle horse flags // Handle horse flags
filter().filterFamily(EntityTypes1_11.EntityType.ABSTRACT_HORSE).index(13).handler((event, meta) -> { filter().type(EntityTypes1_11.EntityType.ABSTRACT_HORSE).index(13).handler((event, meta) -> {
StoredEntityData data = storedEntityData(event); StoredEntityData data = storedEntityData(event);
byte b = (byte) meta.getValue(); byte b = (byte) meta.getValue();
if (data.has(ChestedHorseStorage.class) && data.get(ChestedHorseStorage.class).isChested()) { if (data.has(ChestedHorseStorage.class) && data.get(ChestedHorseStorage.class).isChested()) {
@ -298,7 +298,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
}); });
// Create chested horse storage // Create chested horse storage
filter().filterFamily(EntityTypes1_11.EntityType.CHESTED_HORSE).handler((event, meta) -> { filter().type(EntityTypes1_11.EntityType.CHESTED_HORSE).handler((event, meta) -> {
StoredEntityData data = storedEntityData(event); StoredEntityData data = storedEntityData(event);
if (!data.has(ChestedHorseStorage.class)) { if (!data.has(ChestedHorseStorage.class)) {
data.put(new ChestedHorseStorage()); data.put(new ChestedHorseStorage());
@ -309,7 +309,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
filter().type(EntityTypes1_11.EntityType.HORSE).index(16).toIndex(17); filter().type(EntityTypes1_11.EntityType.HORSE).index(16).toIndex(17);
// Handle chested horse // Handle chested horse
filter().filterFamily(EntityTypes1_11.EntityType.CHESTED_HORSE).index(15).handler((event, meta) -> { filter().type(EntityTypes1_11.EntityType.CHESTED_HORSE).index(15).handler((event, meta) -> {
StoredEntityData data = storedEntityData(event); StoredEntityData data = storedEntityData(event);
ChestedHorseStorage storage = data.get(ChestedHorseStorage.class); ChestedHorseStorage storage = data.get(ChestedHorseStorage.class);
boolean b = (boolean) meta.getValue(); boolean b = (boolean) meta.getValue();
@ -341,7 +341,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
}); });
// Handle Horse (Correct owner) // Handle Horse (Correct owner)
filter().filterFamily(EntityTypes1_11.EntityType.ABSTRACT_HORSE).index(14).toIndex(16); filter().type(EntityTypes1_11.EntityType.ABSTRACT_HORSE).index(14).toIndex(16);
// Handle villager - Change non-existing profession // Handle villager - Change non-existing profession
filter().type(EntityTypes1_11.EntityType.VILLAGER).index(13).handler((event, meta) -> { filter().type(EntityTypes1_11.EntityType.VILLAGER).index(13).handler((event, meta) -> {

View File

@ -214,8 +214,8 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<ClientboundPackets1_
}); });
// Handle Illager // Handle Illager
filter().filterFamily(EntityTypes1_12.EntityType.EVOCATION_ILLAGER).cancel(12); filter().type(EntityTypes1_12.EntityType.EVOCATION_ILLAGER).cancel(12);
filter().filterFamily(EntityTypes1_12.EntityType.EVOCATION_ILLAGER).index(13).toIndex(12); filter().type(EntityTypes1_12.EntityType.EVOCATION_ILLAGER).index(13).toIndex(12);
filter().type(EntityTypes1_12.EntityType.ILLUSION_ILLAGER).index(0).handler((event, meta) -> { filter().type(EntityTypes1_12.EntityType.ILLUSION_ILLAGER).index(0).handler((event, meta) -> {
byte mask = (byte) meta.getValue(); byte mask = (byte) meta.getValue();
@ -228,7 +228,7 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<ClientboundPackets1_
}); });
// Create Parrot storage // Create Parrot storage
filter().filterFamily(EntityTypes1_12.EntityType.PARROT).handler((event, meta) -> { filter().type(EntityTypes1_12.EntityType.PARROT).handler((event, meta) -> {
StoredEntityData data = storedEntityData(event); StoredEntityData data = storedEntityData(event);
if (!data.has(ParrotStorage.class)) { if (!data.has(ParrotStorage.class)) {
data.put(new ParrotStorage()); data.put(new ParrotStorage());

View File

@ -297,7 +297,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<ClientboundPackets1_
}); });
// Handle zombie metadata // Handle zombie metadata
filter().filterFamily(EntityTypes1_13.EntityType.ZOMBIE).removeIndex(15); filter().type(EntityTypes1_13.EntityType.ZOMBIE).removeIndex(15);
// Handle turtle metadata (Remove them all for now) // Handle turtle metadata (Remove them all for now)
filter().type(EntityTypes1_13.EntityType.TURTLE).cancel(13); // Home pos filter().type(EntityTypes1_13.EntityType.TURTLE).cancel(13); // Home pos
@ -308,8 +308,8 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<ClientboundPackets1_
filter().type(EntityTypes1_13.EntityType.TURTLE).cancel(18); // Traveling filter().type(EntityTypes1_13.EntityType.TURTLE).cancel(18); // Traveling
// Remove additional fish meta // Remove additional fish meta
filter().filterFamily(EntityTypes1_13.EntityType.ABSTRACT_FISHES).cancel(12); filter().type(EntityTypes1_13.EntityType.ABSTRACT_FISHES).cancel(12);
filter().filterFamily(EntityTypes1_13.EntityType.ABSTRACT_FISHES).cancel(13); filter().type(EntityTypes1_13.EntityType.ABSTRACT_FISHES).cancel(13);
// Remove phantom size // Remove phantom size
filter().type(EntityTypes1_13.EntityType.PHANTOM).cancel(12); filter().type(EntityTypes1_13.EntityType.PHANTOM).cancel(12);

View File

@ -394,7 +394,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<ClientboundPackets1_
} }
}); });
filter().filterFamily(EntityTypes1_14.ABSTRACT_ARROW).removeIndex(9); filter().type(EntityTypes1_14.ABSTRACT_ARROW).removeIndex(9);
filter().type(EntityTypes1_14.VILLAGER).cancel(15); // Head shake timer filter().type(EntityTypes1_14.VILLAGER).cancel(15); // Head shake timer
@ -410,23 +410,23 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<ClientboundPackets1_
filter().type(EntityTypes1_14.VILLAGER).index(16).handler(villagerDataHandler); filter().type(EntityTypes1_14.VILLAGER).index(16).handler(villagerDataHandler);
// Holding arms up - from bitfield into own boolean // Holding arms up - from bitfield into own boolean
filter().filterFamily(EntityTypes1_14.ABSTRACT_SKELETON).index(13).handler((event, meta) -> { filter().type(EntityTypes1_14.ABSTRACT_SKELETON).index(13).handler((event, meta) -> {
byte value = (byte) meta.getValue(); byte value = (byte) meta.getValue();
if ((value & 4) != 0) { if ((value & 4) != 0) {
event.createExtraMeta(new Metadata(14, Types1_13_2.META_TYPES.booleanType, true)); event.createExtraMeta(new Metadata(14, Types1_13_2.META_TYPES.booleanType, true));
} }
}); });
filter().filterFamily(EntityTypes1_14.ZOMBIE).index(13).handler((event, meta) -> { filter().type(EntityTypes1_14.ZOMBIE).index(13).handler((event, meta) -> {
byte value = (byte) meta.getValue(); byte value = (byte) meta.getValue();
if ((value & 4) != 0) { if ((value & 4) != 0) {
event.createExtraMeta(new Metadata(16, Types1_13_2.META_TYPES.booleanType, true)); event.createExtraMeta(new Metadata(16, Types1_13_2.META_TYPES.booleanType, true));
} }
}); });
filter().filterFamily(EntityTypes1_14.ZOMBIE).addIndex(16); filter().type(EntityTypes1_14.ZOMBIE).addIndex(16);
// Remove bed location // Remove bed location
filter().filterFamily(EntityTypes1_14.LIVINGENTITY).handler((event, meta) -> { filter().type(EntityTypes1_14.LIVINGENTITY).handler((event, meta) -> {
int index = event.index(); int index = event.index();
if (index == 12) { if (index == 12) {
Position position = (Position) meta.getValue(); Position position = (Position) meta.getValue();

View File

@ -147,7 +147,7 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<ClientboundPackets
}); });
// Remove shooter UUID // Remove shooter UUID
filter().filterFamily(EntityTypes1_13.EntityType.ABSTRACT_ARROW).cancel(7); filter().type(EntityTypes1_13.EntityType.ABSTRACT_ARROW).cancel(7);
// Move colors to old position // Move colors to old position
filter().type(EntityTypes1_13.EntityType.SPECTRAL_ARROW).index(8).toIndex(7); filter().type(EntityTypes1_13.EntityType.SPECTRAL_ARROW).index(8).toIndex(7);
@ -156,7 +156,7 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<ClientboundPackets
filter().type(EntityTypes1_13.EntityType.TRIDENT).index(8).toIndex(7); filter().type(EntityTypes1_13.EntityType.TRIDENT).index(8).toIndex(7);
// Rewrite Minecart blocks // Rewrite Minecart blocks
filter().filterFamily(EntityTypes1_13.EntityType.MINECART_ABSTRACT).index(9).handler((event, meta) -> { filter().type(EntityTypes1_13.EntityType.MINECART_ABSTRACT).index(9).handler((event, meta) -> {
int data = (int) meta.getValue(); int data = (int) meta.getValue();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
}); });

View File

@ -195,7 +195,7 @@ public class EntityPackets1_15 extends EntityRewriter<ClientboundPackets1_15, Pr
registerMetaTypeHandler(Types1_14.META_TYPES.itemType, Types1_14.META_TYPES.blockStateType, null, Types1_14.META_TYPES.particleType, registerMetaTypeHandler(Types1_14.META_TYPES.itemType, Types1_14.META_TYPES.blockStateType, null, Types1_14.META_TYPES.particleType,
Types1_14.META_TYPES.componentType, Types1_14.META_TYPES.optionalComponentType); Types1_14.META_TYPES.componentType, Types1_14.META_TYPES.optionalComponentType);
filter().filterFamily(EntityTypes1_15.LIVINGENTITY).removeIndex(12); filter().type(EntityTypes1_15.LIVINGENTITY).removeIndex(12);
filter().type(EntityTypes1_15.BEE).cancel(15); filter().type(EntityTypes1_15.BEE).cancel(15);
filter().type(EntityTypes1_15.BEE).cancel(16); filter().type(EntityTypes1_15.BEE).cancel(16);

View File

@ -282,8 +282,8 @@ public class EntityPackets1_16 extends EntityRewriter<ClientboundPackets1_16, Pr
filter().type(EntityTypes1_16.FISHING_BOBBER).cancel(8); filter().type(EntityTypes1_16.FISHING_BOBBER).cancel(8);
filter().filterFamily(EntityTypes1_16.ABSTRACT_ARROW).cancel(8); filter().type(EntityTypes1_16.ABSTRACT_ARROW).cancel(8);
filter().filterFamily(EntityTypes1_16.ABSTRACT_ARROW).handler((event, meta) -> { filter().type(EntityTypes1_16.ABSTRACT_ARROW).handler((event, meta) -> {
if (event.index() >= 8) { if (event.index() >= 8) {
event.setIndex(event.index() + 1); event.setIndex(event.index() + 1);
} }

View File

@ -125,8 +125,8 @@ public class EntityPackets1_16_2 extends EntityRewriter<ClientboundPackets1_16_2
mapTypes(EntityTypes1_16_2.values(), EntityTypes1_16.class); mapTypes(EntityTypes1_16_2.values(), EntityTypes1_16.class);
mapEntityTypeWithData(EntityTypes1_16_2.PIGLIN_BRUTE, EntityTypes1_16_2.PIGLIN).jsonName(); mapEntityTypeWithData(EntityTypes1_16_2.PIGLIN_BRUTE, EntityTypes1_16_2.PIGLIN).jsonName();
filter().filterFamily(EntityTypes1_16_2.ABSTRACT_PIGLIN).index(15).toIndex(16); filter().type(EntityTypes1_16_2.ABSTRACT_PIGLIN).index(15).toIndex(16);
filter().filterFamily(EntityTypes1_16_2.ABSTRACT_PIGLIN).index(16).toIndex(15); filter().type(EntityTypes1_16_2.ABSTRACT_PIGLIN).index(16).toIndex(15);
} }
@Override @Override

View File

@ -268,7 +268,7 @@ public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_
registerMetaTypeHandler(Types1_18.META_TYPES.itemType, Types1_18.META_TYPES.blockStateType, null, null, registerMetaTypeHandler(Types1_18.META_TYPES.itemType, Types1_18.META_TYPES.blockStateType, null, null,
Types1_18.META_TYPES.componentType, Types1_18.META_TYPES.optionalComponentType); Types1_18.META_TYPES.componentType, Types1_18.META_TYPES.optionalComponentType);
filter().filterFamily(EntityTypes1_19.MINECART_ABSTRACT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_19.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int data = (int) meta.getValue(); final int data = (int) meta.getValue();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
}); });

View File

@ -177,7 +177,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
if (nodeType == 2) { // Argument node if (nodeType == 2) { // Argument node
final int argumentTypeId = wrapper.read(Type.VAR_INT); final int argumentTypeId = wrapper.read(Type.VAR_INT);
final int mappedArgumentTypeId = MAPPINGS.getArgumentTypeMappings().mappings().getNewId(argumentTypeId); final int mappedArgumentTypeId = MAPPINGS.getArgumentTypeMappings().getNewId(argumentTypeId);
Preconditions.checkArgument(mappedArgumentTypeId != -1, "Unknown command argument type id: " + argumentTypeId); Preconditions.checkArgument(mappedArgumentTypeId != -1, "Unknown command argument type id: " + argumentTypeId);
wrapper.write(Type.VAR_INT, mappedArgumentTypeId); wrapper.write(Type.VAR_INT, mappedArgumentTypeId);

View File

@ -255,7 +255,7 @@ public final class EntityPackets1_19_3 extends EntityRewriter<ClientboundPackets
meta.setValue(pose - 1); meta.setValue(pose - 1);
} }
}); });
filter().filterFamily(EntityTypes1_19_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_19_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int data = (int) meta.getValue(); final int data = (int) meta.getValue();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
}); });

View File

@ -142,12 +142,12 @@ public final class EntityPackets1_19_4 extends EntityRewriter<ClientboundPackets
registerMetaTypeHandler(Types1_19_3.META_TYPES.itemType, Types1_19_3.META_TYPES.blockStateType, null, Types1_19_3.META_TYPES.particleType, registerMetaTypeHandler(Types1_19_3.META_TYPES.itemType, Types1_19_3.META_TYPES.blockStateType, null, Types1_19_3.META_TYPES.particleType,
Types1_19_3.META_TYPES.componentType, Types1_19_3.META_TYPES.optionalComponentType); Types1_19_3.META_TYPES.componentType, Types1_19_3.META_TYPES.optionalComponentType);
filter().filterFamily(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value(); final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState)); meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
}); });
filter().filterFamily(EntityTypes1_19_4.BOAT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_19_4.BOAT).index(11).handler((event, meta) -> {
final int boatType = meta.value(); final int boatType = meta.value();
if (boatType > 4) { // Cherry if (boatType > 4) { // Cherry
meta.setValue(boatType - 1); meta.setValue(boatType - 1);
@ -163,7 +163,7 @@ public final class EntityPackets1_19_4 extends EntityRewriter<ClientboundPackets
final JsonElement element = meta.value(); final JsonElement element = meta.value();
protocol.getTranslatableRewriter().processText(element); protocol.getTranslatableRewriter().processText(element);
})); }));
filter().filterFamily(EntityTypes1_19_4.DISPLAY).handler((event, meta) -> { filter().type(EntityTypes1_19_4.DISPLAY).handler((event, meta) -> {
// TODO Maybe spawn an extra entity to ride the armor stand for blocks and items // TODO Maybe spawn an extra entity to ride the armor stand for blocks and items
// Remove a large heap of display metadata // Remove a large heap of display metadata
if (event.index() > 7) { if (event.index() > 7) {
@ -178,7 +178,7 @@ public final class EntityPackets1_19_4 extends EntityRewriter<ClientboundPackets
filter().type(EntityTypes1_19_4.SNIFFER).removeIndex(17); // State filter().type(EntityTypes1_19_4.SNIFFER).removeIndex(17); // State
filter().type(EntityTypes1_19_4.SNIFFER).removeIndex(18); // Drop seed at tick filter().type(EntityTypes1_19_4.SNIFFER).removeIndex(18); // Drop seed at tick
filter().filterFamily(EntityTypes1_19_4.ABSTRACT_HORSE).addIndex(18); // Owner UUID filter().type(EntityTypes1_19_4.ABSTRACT_HORSE).addIndex(18); // Owner UUID
} }
@Override @Override

View File

@ -126,13 +126,13 @@ public final class EntityPackets1_20 extends EntityRewriter<ClientboundPackets1_
registerMetaTypeHandler(Types1_19_4.META_TYPES.itemType, Types1_19_4.META_TYPES.blockStateType, Types1_19_4.META_TYPES.optionalBlockStateType, registerMetaTypeHandler(Types1_19_4.META_TYPES.itemType, Types1_19_4.META_TYPES.blockStateType, Types1_19_4.META_TYPES.optionalBlockStateType,
Types1_19_4.META_TYPES.particleType, Types1_19_4.META_TYPES.componentType, Types1_19_4.META_TYPES.optionalComponentType); Types1_19_4.META_TYPES.particleType, Types1_19_4.META_TYPES.componentType, Types1_19_4.META_TYPES.optionalComponentType);
filter().filterFamily(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value(); final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState)); meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
}); });
// Rotate item display by 180 degrees around the Y axis // Rotate item display by 180 degrees around the Y axis
filter().filterFamily(EntityTypes1_19_4.ITEM_DISPLAY).handler((event, meta) -> { filter().type(EntityTypes1_19_4.ITEM_DISPLAY).handler((event, meta) -> {
if (event.trackedEntity().hasSentMetadata() || event.hasExtraMeta()) { if (event.trackedEntity().hasSentMetadata() || event.hasExtraMeta()) {
return; return;
} }
@ -141,7 +141,7 @@ public final class EntityPackets1_20 extends EntityRewriter<ClientboundPackets1_
event.createExtraMeta(new Metadata(12, Types1_19_4.META_TYPES.quaternionType, Y_FLIPPED_ROTATION)); event.createExtraMeta(new Metadata(12, Types1_19_4.META_TYPES.quaternionType, Y_FLIPPED_ROTATION));
} }
}); });
filter().filterFamily(EntityTypes1_19_4.ITEM_DISPLAY).index(12).handler((event, meta) -> { filter().type(EntityTypes1_19_4.ITEM_DISPLAY).index(12).handler((event, meta) -> {
final Quaternion quaternion = meta.value(); final Quaternion quaternion = meta.value();
meta.setValue(rotateY180(quaternion)); meta.setValue(rotateY180(quaternion));
}); });

View File

@ -137,7 +137,7 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
Types1_20_2.META_TYPES.optionalComponentType Types1_20_2.META_TYPES.optionalComponentType
); );
filter().filterFamily(EntityTypes1_20_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_20_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value(); final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState)); meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
}); });

View File

@ -43,6 +43,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.Clientbou
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_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.ServerboundConfigurationPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
import com.viaversion.viaversion.rewriter.TagRewriter;
import java.util.UUID; import java.util.UUID;
public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPackets1_20_2, ClientboundPackets1_19_4, ServerboundPackets1_20_2, ServerboundPackets1_19_4> { public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPackets1_20_2, ClientboundPackets1_19_4, ServerboundPackets1_20_2, ServerboundPackets1_19_4> {
@ -59,6 +60,9 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
protected void registerPackets() { protected void registerPackets() {
super.registerPackets(); super.registerPackets();
final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS);
final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this); final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND);
soundRewriter.registerSound(ClientboundPackets1_20_2.ENTITY_SOUND); soundRewriter.registerSound(ClientboundPackets1_20_2.ENTITY_SOUND);
@ -148,6 +152,7 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
wrapper.cancel(); wrapper.cancel();
}); });
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_TAGS.getId(), -1, wrapper -> { registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_TAGS.getId(), -1, wrapper -> {
tagRewriter.getGenericHandler().handle(wrapper);
wrapper.user().get(ConfigurationPacketStorage.class).addRawPacket(wrapper, ClientboundPackets1_19_4.TAGS); wrapper.user().get(ConfigurationPacketStorage.class).addRawPacket(wrapper, ClientboundPackets1_19_4.TAGS);
wrapper.cancel(); wrapper.cancel();
}); });

View File

@ -200,9 +200,9 @@ public final class EntityPacketRewriter1_20_2 extends EntityRewriter<Clientbound
filter().handler((event, meta) -> meta.setMetaType(Types1_20.META_TYPES.byId(meta.metaType().typeId()))); filter().handler((event, meta) -> meta.setMetaType(Types1_20.META_TYPES.byId(meta.metaType().typeId())));
registerMetaTypeHandler(Types1_20.META_TYPES.itemType, Types1_20.META_TYPES.blockStateType, Types1_20.META_TYPES.optionalBlockStateType, Types1_20.META_TYPES.particleType, null, null); registerMetaTypeHandler(Types1_20.META_TYPES.itemType, Types1_20.META_TYPES.blockStateType, Types1_20.META_TYPES.optionalBlockStateType, Types1_20.META_TYPES.particleType, null, null);
filter().filterFamily(EntityTypes1_19_4.DISPLAY).removeIndex(10); filter().type(EntityTypes1_19_4.DISPLAY).removeIndex(10);
filter().filterFamily(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value(); final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState)); meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
}); });

View File

@ -90,7 +90,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
id--; id--;
} }
meta.setMetaType(Types1_20_3.META_TYPES.byId(id)); meta.setMetaType(Types1_20_5.META_TYPES.byId(id));
});*/ });*/
registerMetaTypeHandler1_20_3( registerMetaTypeHandler1_20_3(
@ -102,7 +102,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
Types1_20_5.META_TYPES.optionalComponentType Types1_20_5.META_TYPES.optionalComponentType
); );
filter().filterFamily(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value(); final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState)); meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
}); });