Update VV usage

This commit is contained in:
KennyTV 2021-05-26 12:57:48 +02:00
parent a789e2ff7b
commit 4a60f0f903
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
6 changed files with 16 additions and 26 deletions

View File

@ -27,6 +27,7 @@ subprojects {
}
withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
}
withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()

View File

@ -238,8 +238,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
bitmask |= 0x04;
}
meta.setMetaType(MetaType1_9.Byte);
meta.setValue((byte) bitmask);
meta.setTypeAndValue(MetaType1_9.Byte, (byte) bitmask);
});
// Handle skeleton swing
@ -270,8 +269,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
// Handle Evocation Illager
filter().type(Entity1_11Types.EntityType.EVOCATION_ILLAGER).index(12).handler((event, meta) -> {
event.setIndex(13);
meta.setMetaType(MetaType1_9.VarInt);
meta.setValue(((Byte) meta.getValue()).intValue()); // Change the profession for the states
meta.setTypeAndValue(MetaType1_9.VarInt, ((Byte) meta.getValue()).intValue()); // Change the profession for the states
});
// Handle Vex (Remove this field completely since the position is not updated correctly when idling for bats. Sad ):
@ -282,8 +280,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
// Handle VindicationIllager
filter().type(Entity1_11Types.EntityType.VINDICATION_ILLAGER).index(12).handler((event, meta) -> {
event.setIndex(13);
meta.setMetaType(MetaType1_9.VarInt);
meta.setValue(((Number) meta.getValue()).intValue() == 1 ? 2 : 4);
meta.setTypeAndValue(MetaType1_9.VarInt, ((Number) meta.getValue()).intValue() == 1 ? 2 : 4);
});
/*

View File

@ -304,25 +304,21 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
filter().handler((event, meta) -> {
int typeId = meta.metaType().typeId();
// Rewrite optional chat to chat
// Rewrite optional chat to string
if (typeId == 5) {
meta.setMetaType(MetaType1_12.String);
if (meta.getValue() == null) {
meta.setValue("");
}
// Json -> Legacy is done below
meta.setTypeAndValue(MetaType1_12.String, meta.getValue() != null ? meta.getValue().toString() : "");
}
// Rewrite items
else if (typeId == 6) {
meta.setMetaType(MetaType1_12.Slot);
Item item = (Item) meta.getValue();
meta.setValue(protocol.getBlockItemPackets().handleItemToClient(item));
meta.setTypeAndValue(MetaType1_12.Slot, protocol.getBlockItemPackets().handleItemToClient(item));
}
// Discontinue particles
else if (typeId == 15) {
meta.setMetaType(MetaType1_12.Discontinued);
event.cancel();
}
// Rewrite to 1.12 ids
@ -368,9 +364,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
// Handle new wolf colors
filter().type(Entity1_13Types.EntityType.WOLF).index(17).handler((event, meta) -> {
meta.setValue(15 - (int) meta.getValue());
});
// Rewrite AreaEffectCloud

View File

@ -410,7 +410,9 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
filter().type(Entity1_14Types.FIREWORK_ROCKET).index(8).handler((event, meta) -> {
meta.setMetaType(MetaType1_13_2.VarInt);
Integer value = (Integer) meta.getValue();
if (value == null) meta.setValue(0);
if (value == null) {
meta.setValue(0);
}
});
filter().filterFamily(Entity1_14Types.ABSTRACT_ARROW).removeIndex(9);
@ -419,8 +421,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
MetaHandler villagerDataHandler = (event, meta) -> {
VillagerData villagerData = (VillagerData) meta.getValue();
meta.setValue(villagerDataToProfession(villagerData));
meta.setMetaType(MetaType1_13_2.VarInt);
meta.setTypeAndValue(MetaType1_13_2.VarInt, villagerDataToProfession(villagerData));
if (meta.id() == 16) {
event.setIndex(15); // decreased by 2 again in one of the following handlers
}
@ -481,8 +482,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
filter().type(Entity1_14Types.OCELOT).index(13).handler((event, meta) -> {
event.setIndex(15);
meta.setMetaType(MetaType1_13_2.VarInt);
meta.setValue(0);
meta.setTypeAndValue(MetaType1_13_2.VarInt, 0);
});
filter().type(Entity1_14Types.CAT).handler((event, meta) -> {

View File

@ -276,8 +276,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
filter().type(Entity1_16Types.STRIDER).index(15).handler((event, meta) -> {
boolean baby = meta.value();
meta.setValue(baby ? 1 : 3);
meta.setMetaType(MetaType1_14.VarInt);
meta.setTypeAndValue(MetaType1_14.VarInt, baby ? 1 : 3);
});
filter().type(Entity1_16Types.STRIDER).cancel(16);
filter().type(Entity1_16Types.STRIDER).cancel(17);

View File

@ -163,8 +163,7 @@ public class EntityPackets1_10 extends LegacyEntityRewriter<Protocol1_9_4To1_10>
filter().type(Entity1_10Types.EntityType.POLAR_BEAR).index(13).handler((event, meta) -> {
boolean b = (boolean) meta.getValue();
meta.setMetaType(MetaType1_9.Byte);
meta.setValue(b ? (byte) (14 & 0x0F) : (byte) (0));
meta.setTypeAndValue(MetaType1_9.Byte, b ? (byte) (14 & 0x0F) : (byte) (0));
});