Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-17 05:20:10 +01:00
Update VV usage
Dieser Commit ist enthalten in:
Ursprung
6c2d43d7f9
Commit
88df61605b
@ -53,6 +53,7 @@ public class LecternInteractListener extends ViaBukkitListener {
|
||||
// Open a book with the text of the lectern's writable book
|
||||
ItemStack newBook = new ItemStack(Material.WRITTEN_BOOK);
|
||||
BookMeta newBookMeta = (BookMeta) newBook.getItemMeta();
|
||||
//noinspection deprecation
|
||||
newBookMeta.setPages(meta.getPages());
|
||||
newBookMeta.setAuthor("an upsidedown person");
|
||||
newBookMeta.setTitle("buk");
|
||||
|
@ -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);
|
||||
|
||||
// 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();
|
||||
int bitmask = b ? 0x02 : 0;
|
||||
|
||||
@ -242,12 +242,12 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
});
|
||||
|
||||
// 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
|
||||
*/
|
||||
filter().filterFamily(EntityTypes1_11.EntityType.ZOMBIE).handler((event, meta) -> {
|
||||
filter().type(EntityTypes1_11.EntityType.ZOMBIE).handler((event, meta) -> {
|
||||
switch (meta.id()) {
|
||||
case 13:
|
||||
event.cancel();
|
||||
@ -288,7 +288,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
*/
|
||||
|
||||
// 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);
|
||||
byte b = (byte) meta.getValue();
|
||||
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
|
||||
filter().filterFamily(EntityTypes1_11.EntityType.CHESTED_HORSE).handler((event, meta) -> {
|
||||
filter().type(EntityTypes1_11.EntityType.CHESTED_HORSE).handler((event, meta) -> {
|
||||
StoredEntityData data = storedEntityData(event);
|
||||
if (!data.has(ChestedHorseStorage.class)) {
|
||||
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);
|
||||
|
||||
// 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);
|
||||
ChestedHorseStorage storage = data.get(ChestedHorseStorage.class);
|
||||
boolean b = (boolean) meta.getValue();
|
||||
@ -341,7 +341,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
});
|
||||
|
||||
// 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
|
||||
filter().type(EntityTypes1_11.EntityType.VILLAGER).index(13).handler((event, meta) -> {
|
||||
|
@ -214,8 +214,8 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
});
|
||||
|
||||
// Handle Illager
|
||||
filter().filterFamily(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).cancel(12);
|
||||
filter().type(EntityTypes1_12.EntityType.EVOCATION_ILLAGER).index(13).toIndex(12);
|
||||
|
||||
filter().type(EntityTypes1_12.EntityType.ILLUSION_ILLAGER).index(0).handler((event, meta) -> {
|
||||
byte mask = (byte) meta.getValue();
|
||||
@ -228,7 +228,7 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
});
|
||||
|
||||
// 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);
|
||||
if (!data.has(ParrotStorage.class)) {
|
||||
data.put(new ParrotStorage());
|
||||
|
@ -297,7 +297,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
});
|
||||
|
||||
// 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)
|
||||
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
|
||||
|
||||
// Remove additional fish meta
|
||||
filter().filterFamily(EntityTypes1_13.EntityType.ABSTRACT_FISHES).cancel(12);
|
||||
filter().filterFamily(EntityTypes1_13.EntityType.ABSTRACT_FISHES).cancel(13);
|
||||
filter().type(EntityTypes1_13.EntityType.ABSTRACT_FISHES).cancel(12);
|
||||
filter().type(EntityTypes1_13.EntityType.ABSTRACT_FISHES).cancel(13);
|
||||
|
||||
// Remove phantom size
|
||||
filter().type(EntityTypes1_13.EntityType.PHANTOM).cancel(12);
|
||||
|
@ -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
|
||||
|
||||
@ -410,23 +410,23 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
filter().type(EntityTypes1_14.VILLAGER).index(16).handler(villagerDataHandler);
|
||||
|
||||
// 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();
|
||||
if ((value & 4) != 0) {
|
||||
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();
|
||||
if ((value & 4) != 0) {
|
||||
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
|
||||
filter().filterFamily(EntityTypes1_14.LIVINGENTITY).handler((event, meta) -> {
|
||||
filter().type(EntityTypes1_14.LIVINGENTITY).handler((event, meta) -> {
|
||||
int index = event.index();
|
||||
if (index == 12) {
|
||||
Position position = (Position) meta.getValue();
|
||||
|
@ -147,7 +147,7 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<ClientboundPackets
|
||||
});
|
||||
|
||||
// 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
|
||||
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);
|
||||
|
||||
// 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();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
});
|
||||
|
@ -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,
|
||||
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(16);
|
||||
|
@ -282,8 +282,8 @@ public class EntityPackets1_16 extends EntityRewriter<ClientboundPackets1_16, Pr
|
||||
|
||||
filter().type(EntityTypes1_16.FISHING_BOBBER).cancel(8);
|
||||
|
||||
filter().filterFamily(EntityTypes1_16.ABSTRACT_ARROW).cancel(8);
|
||||
filter().filterFamily(EntityTypes1_16.ABSTRACT_ARROW).handler((event, meta) -> {
|
||||
filter().type(EntityTypes1_16.ABSTRACT_ARROW).cancel(8);
|
||||
filter().type(EntityTypes1_16.ABSTRACT_ARROW).handler((event, meta) -> {
|
||||
if (event.index() >= 8) {
|
||||
event.setIndex(event.index() + 1);
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ public class EntityPackets1_16_2 extends EntityRewriter<ClientboundPackets1_16_2
|
||||
mapTypes(EntityTypes1_16_2.values(), EntityTypes1_16.class);
|
||||
mapEntityTypeWithData(EntityTypes1_16_2.PIGLIN_BRUTE, EntityTypes1_16_2.PIGLIN).jsonName();
|
||||
|
||||
filter().filterFamily(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(15).toIndex(16);
|
||||
filter().type(EntityTypes1_16_2.ABSTRACT_PIGLIN).index(16).toIndex(15);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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,
|
||||
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();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
});
|
||||
|
@ -177,7 +177,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
|
||||
|
||||
if (nodeType == 2) { // Argument node
|
||||
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);
|
||||
wrapper.write(Type.VAR_INT, mappedArgumentTypeId);
|
||||
|
||||
|
@ -255,7 +255,7 @@ public final class EntityPackets1_19_3 extends EntityRewriter<ClientboundPackets
|
||||
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();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
});
|
||||
|
@ -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,
|
||||
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();
|
||||
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();
|
||||
if (boatType > 4) { // Cherry
|
||||
meta.setValue(boatType - 1);
|
||||
@ -163,7 +163,7 @@ public final class EntityPackets1_19_4 extends EntityRewriter<ClientboundPackets
|
||||
final JsonElement element = meta.value();
|
||||
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
|
||||
// Remove a large heap of display metadata
|
||||
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(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
|
||||
|
@ -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,
|
||||
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();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
});
|
||||
|
||||
// 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()) {
|
||||
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));
|
||||
}
|
||||
});
|
||||
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();
|
||||
meta.setValue(rotateY180(quaternion));
|
||||
});
|
||||
|
@ -137,7 +137,7 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
|
||||
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();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
});
|
||||
|
@ -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())));
|
||||
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();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
});
|
||||
|
@ -103,7 +103,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
Types1_20_3.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();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
});
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren