Update VV API usage (#776)

This commit is contained in:
EnZaXD 2024-06-06 11:09:39 +02:00 committed by GitHub
parent 993608b4b4
commit f86fdd1eb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 9 additions and 44 deletions

View File

@ -155,10 +155,7 @@ public class EntityPacketRewriter1_13_1 extends LegacyEntityRewriter<Clientbound
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().type(EntityTypes1_13.EntityType.ABSTRACT_MINECART).index(9).handler((event, meta) -> { registerBlockStateHandler(EntityTypes1_13.EntityType.ABSTRACT_MINECART, 9);
int data = (int) meta.getValue();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
});
} }
@Override @Override

View File

@ -240,6 +240,7 @@ public final class EntityPacketRewriter1_19_3 extends EntityRewriter<Clientbound
}); });
registerMetaTypeHandler(Types1_19.ENTITY_DATA_TYPES.itemType, null, Types1_19.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_19.ENTITY_DATA_TYPES.particleType, registerMetaTypeHandler(Types1_19.ENTITY_DATA_TYPES.itemType, null, Types1_19.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_19.ENTITY_DATA_TYPES.particleType,
Types1_19.ENTITY_DATA_TYPES.componentType, Types1_19.ENTITY_DATA_TYPES.optionalComponentType); Types1_19.ENTITY_DATA_TYPES.componentType, Types1_19.ENTITY_DATA_TYPES.optionalComponentType);
registerBlockStateHandler(EntityTypes1_19_3.ABSTRACT_MINECART, 11);
filter().dataType(Types1_19.ENTITY_DATA_TYPES.poseType).handler((event, meta) -> { filter().dataType(Types1_19.ENTITY_DATA_TYPES.poseType).handler((event, meta) -> {
// Sitting pose added // Sitting pose added
@ -250,10 +251,6 @@ public final class EntityPacketRewriter1_19_3 extends EntityRewriter<Clientbound
meta.setValue(pose - 1); meta.setValue(pose - 1);
} }
}); });
filter().type(EntityTypes1_19_3.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int data = (int) meta.getValue();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
});
filter().type(EntityTypes1_19_3.CAMEL).cancel(19); // Dashing filter().type(EntityTypes1_19_3.CAMEL).cancel(19); // Dashing
filter().type(EntityTypes1_19_3.CAMEL).cancel(20); // Last pose change time filter().type(EntityTypes1_19_3.CAMEL).cancel(20); // Last pose change time

View File

@ -143,11 +143,7 @@ public final class EntityPacketRewriter1_19_4 extends EntityRewriter<Clientbound
}); });
registerMetaTypeHandler(Types1_19_3.ENTITY_DATA_TYPES.itemType, null, Types1_19_3.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_19_3.ENTITY_DATA_TYPES.particleType, registerMetaTypeHandler(Types1_19_3.ENTITY_DATA_TYPES.itemType, null, Types1_19_3.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_19_3.ENTITY_DATA_TYPES.particleType,
Types1_19_3.ENTITY_DATA_TYPES.componentType, Types1_19_3.ENTITY_DATA_TYPES.optionalComponentType); Types1_19_3.ENTITY_DATA_TYPES.componentType, Types1_19_3.ENTITY_DATA_TYPES.optionalComponentType);
registerBlockStateHandler(EntityTypes1_19_4.ABSTRACT_MINECART, 11);
filter().type(EntityTypes1_19_4.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
filter().type(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();

View File

@ -282,11 +282,7 @@ public final class EntityPacketRewriter1_19 extends EntityRewriter<ClientboundPa
registerMetaTypeHandler(Types1_18.ENTITY_DATA_TYPES.itemType, null, Types1_18.ENTITY_DATA_TYPES.optionalBlockStateType, null, registerMetaTypeHandler(Types1_18.ENTITY_DATA_TYPES.itemType, null, Types1_18.ENTITY_DATA_TYPES.optionalBlockStateType, null,
Types1_18.ENTITY_DATA_TYPES.componentType, Types1_18.ENTITY_DATA_TYPES.optionalComponentType); Types1_18.ENTITY_DATA_TYPES.componentType, Types1_18.ENTITY_DATA_TYPES.optionalComponentType);
registerBlockStateHandler(EntityTypes1_19.ABSTRACT_MINECART, 11);
filter().type(EntityTypes1_19.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int data = (int) meta.getValue();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
});
filter().type(EntityTypes1_19.PAINTING).index(8).handler((event, meta) -> { filter().type(EntityTypes1_19.PAINTING).index(8).handler((event, meta) -> {
event.cancel(); event.cancel();

View File

@ -200,13 +200,9 @@ public final class EntityPacketRewriter1_20_2 extends EntityRewriter<Clientbound
protected void registerRewrites() { protected void registerRewrites() {
filter().handler((event, meta) -> meta.setDataType(Types1_20.ENTITY_DATA_TYPES.byId(meta.dataType().typeId()))); filter().handler((event, meta) -> meta.setDataType(Types1_20.ENTITY_DATA_TYPES.byId(meta.dataType().typeId())));
registerMetaTypeHandler(Types1_20.ENTITY_DATA_TYPES.itemType, Types1_20.ENTITY_DATA_TYPES.blockStateType, Types1_20.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_20.ENTITY_DATA_TYPES.particleType, null, null); registerMetaTypeHandler(Types1_20.ENTITY_DATA_TYPES.itemType, Types1_20.ENTITY_DATA_TYPES.blockStateType, Types1_20.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_20.ENTITY_DATA_TYPES.particleType, null, null);
registerBlockStateHandler(EntityTypes1_19_4.ABSTRACT_MINECART, 11);
filter().type(EntityTypes1_19_4.DISPLAY).removeIndex(10); filter().type(EntityTypes1_19_4.DISPLAY).removeIndex(10);
filter().type(EntityTypes1_19_4.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
} }
@Override @Override

View File

@ -135,11 +135,7 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
Types1_20_2.ENTITY_DATA_TYPES.componentType, Types1_20_2.ENTITY_DATA_TYPES.componentType,
Types1_20_2.ENTITY_DATA_TYPES.optionalComponentType Types1_20_2.ENTITY_DATA_TYPES.optionalComponentType
); );
registerBlockStateHandler(EntityTypes1_20_3.ABSTRACT_MINECART, 11);
filter().type(EntityTypes1_20_3.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
filter().type(EntityTypes1_20_3.TNT).removeIndex(9); // Block state filter().type(EntityTypes1_20_3.TNT).removeIndex(9); // Block state
} }

View File

@ -408,6 +408,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
Types1_20_3.ENTITY_DATA_TYPES.componentType, Types1_20_3.ENTITY_DATA_TYPES.componentType,
Types1_20_3.ENTITY_DATA_TYPES.optionalComponentType Types1_20_3.ENTITY_DATA_TYPES.optionalComponentType
); );
registerBlockStateHandler(EntityTypes1_20_5.ABSTRACT_MINECART, 11);
filter().type(EntityTypes1_20_5.LIVING_ENTITY).index(10).handler((event, meta) -> { filter().type(EntityTypes1_20_5.LIVING_ENTITY).index(10).handler((event, meta) -> {
final Particle[] particles = meta.value(); final Particle[] particles = meta.value();
@ -431,11 +432,6 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
} }
}); });
filter().type(EntityTypes1_20_5.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
filter().type(EntityTypes1_20_5.LLAMA).addIndex(20); // Carpet color filter().type(EntityTypes1_20_5.LLAMA).addIndex(20); // Carpet color
filter().type(EntityTypes1_20_5.ARMADILLO).removeIndex(17); // State filter().type(EntityTypes1_20_5.ARMADILLO).removeIndex(17); // State
filter().type(EntityTypes1_20_5.WOLF).removeIndex(22); // Wolf variant filter().type(EntityTypes1_20_5.WOLF).removeIndex(22); // Wolf variant

View File

@ -127,11 +127,7 @@ public final class EntityPacketRewriter1_20 extends EntityRewriter<ClientboundPa
filter().handler((event, meta) -> meta.setDataType(Types1_19_4.ENTITY_DATA_TYPES.byId(meta.dataType().typeId()))); filter().handler((event, meta) -> meta.setDataType(Types1_19_4.ENTITY_DATA_TYPES.byId(meta.dataType().typeId())));
registerMetaTypeHandler(Types1_19_4.ENTITY_DATA_TYPES.itemType, Types1_19_4.ENTITY_DATA_TYPES.blockStateType, Types1_19_4.ENTITY_DATA_TYPES.optionalBlockStateType, registerMetaTypeHandler(Types1_19_4.ENTITY_DATA_TYPES.itemType, Types1_19_4.ENTITY_DATA_TYPES.blockStateType, Types1_19_4.ENTITY_DATA_TYPES.optionalBlockStateType,
Types1_19_4.ENTITY_DATA_TYPES.particleType, Types1_19_4.ENTITY_DATA_TYPES.componentType, Types1_19_4.ENTITY_DATA_TYPES.optionalComponentType); Types1_19_4.ENTITY_DATA_TYPES.particleType, Types1_19_4.ENTITY_DATA_TYPES.componentType, Types1_19_4.ENTITY_DATA_TYPES.optionalComponentType);
registerBlockStateHandler(EntityTypes1_19_4.ABSTRACT_MINECART, 11);
filter().type(EntityTypes1_19_4.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int blockState = meta.value();
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().type(EntityTypes1_19_4.ITEM_DISPLAY).handler((event, meta) -> { filter().type(EntityTypes1_19_4.ITEM_DISPLAY).handler((event, meta) -> {

View File

@ -23,7 +23,6 @@ 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.packet.State; import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
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_20_5;
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.ClientboundConfigurationPackets1_20_5;
@ -104,11 +103,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
null, Types1_20_5.ENTITY_DATA_TYPES.componentType, null, Types1_20_5.ENTITY_DATA_TYPES.componentType,
Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType
); );
registerBlockStateHandler(EntityTypes1_20_5.ABSTRACT_MINECART, 11);
filter().type(EntityTypes1_20_5.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
// Remove metadata of new entity type // Remove metadata of new entity type
// filter().type(EntityTypes1_20_5.SNIFFER).removeIndex(newIndex); // filter().type(EntityTypes1_20_5.SNIFFER).removeIndex(newIndex);