Remove 1.12 flyingspeed attribute

This commit is contained in:
KennyTV 2020-01-18 10:29:53 +01:00
parent e809c117c4
commit 4680c0f3d2
3 changed files with 46 additions and 3 deletions

View File

@ -61,7 +61,6 @@ public class ChangedPacketIds1_12 extends Rewriter<Protocol1_11_1To1_12> {
protocol.cancelOutgoing(State.PLAY, 0x4C); // Advancements protocol.cancelOutgoing(State.PLAY, 0x4C); // Advancements
protocol.registerOutgoing(State.PLAY, 0x4D, 0x4A); // Entity Properties
protocol.registerOutgoing(State.PLAY, 0x4E, 0x4B); // Entity Effect protocol.registerOutgoing(State.PLAY, 0x4E, 0x4B); // Entity Effect
// New incoming packet 0x01 - Prepare Crafting Grid // New incoming packet 0x01 - Prepare Crafting Grid

View File

@ -202,6 +202,46 @@ public class EntityPackets1_12 extends EntityRewriter<Protocol1_11_1To1_12> {
// Metadata packet // Metadata packet
registerMetadataRewriter(0x3B, 0x39, Types1_12.METADATA_LIST); registerMetadataRewriter(0x3B, 0x39, Types1_12.METADATA_LIST);
// Entity Properties
protocol.registerOutgoing(State.PLAY, 0x4D, 0x4A, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
map(Type.INT);
handler(wrapper -> {
int size = wrapper.get(Type.INT, 0);
int newSize = size;
for (int i = 0; i < size; i++) {
String key = wrapper.read(Type.STRING);
// Remove new attribute
if (key.equals("generic.flyingSpeed")) {
newSize--;
wrapper.read(Type.DOUBLE);
int modSize = wrapper.read(Type.VAR_INT);
for (int j = 0; j < modSize; j++) {
wrapper.read(Type.UUID);
wrapper.read(Type.DOUBLE);
wrapper.read(Type.BYTE);
}
} else {
wrapper.write(Type.STRING, key);
wrapper.passthrough(Type.DOUBLE);
int modSize = wrapper.passthrough(Type.VAR_INT);
for (int j = 0; j < modSize; j++) {
wrapper.passthrough(Type.UUID);
wrapper.passthrough(Type.DOUBLE);
wrapper.passthrough(Type.BYTE);
}
}
}
if (newSize != size) {
wrapper.set(Type.INT, 0, newSize);
}
});
}
});
} }
@Override @Override

View File

@ -234,10 +234,11 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
if (entityType != Entity1_15Types.EntityType.BEE) return; if (entityType != Entity1_15Types.EntityType.BEE) return;
int size = wrapper.get(Type.INT, 0); int size = wrapper.get(Type.INT, 0);
int newSize = size;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
String key = wrapper.read(Type.STRING); String key = wrapper.read(Type.STRING);
if (key.equals("generic.flyingSpeed")) { if (key.equals("generic.flyingSpeed")) {
size--; newSize--;
wrapper.read(Type.DOUBLE); wrapper.read(Type.DOUBLE);
int modSize = wrapper.read(Type.VAR_INT); int modSize = wrapper.read(Type.VAR_INT);
for (int j = 0; j < modSize; j++) { for (int j = 0; j < modSize; j++) {
@ -256,7 +257,10 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
} }
} }
} }
wrapper.set(Type.INT, 0, size);
if (newSize != size) {
wrapper.set(Type.INT, 0, newSize);
}
} }
}); });
} }