Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-14 12:00:09 +01:00
Make 1.10->1.11 fishing hook position desync slightly less bad
Dieser Commit ist enthalten in:
Ursprung
1f221ea828
Commit
1ff3035bc0
@ -20,6 +20,7 @@ package com.viaversion.viaversion.protocols.v1_10to1_11.rewriter;
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.nbt.tag.StringTag;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.DataItem;
|
||||
@ -53,8 +54,20 @@ public class EntityPacketRewriter1_11 extends EntityRewriter<ClientboundPackets1
|
||||
map(Types.VAR_INT); // 0 - Entity id
|
||||
map(Types.UUID); // 1 - UUID
|
||||
map(Types.BYTE); // 2 - Type
|
||||
map(Types.DOUBLE); // 3 - X
|
||||
map(Types.DOUBLE); // 4 - Y
|
||||
map(Types.DOUBLE); // 5 - Z
|
||||
map(Types.BYTE); // 6 - Pitch
|
||||
map(Types.BYTE); // 7 - Yaw
|
||||
map(Types.INT); // 8 - Data
|
||||
|
||||
// Track Entity
|
||||
handler(wrapper -> {
|
||||
byte type = wrapper.get(Types.BYTE, 0);
|
||||
if (type == EntityTypes1_10.ObjectType.FISHIHNG_HOOK.getId()) {
|
||||
tryFixFishingHookVelocity(wrapper);
|
||||
}
|
||||
});
|
||||
handler(objectTrackerHandler());
|
||||
}
|
||||
});
|
||||
@ -132,6 +145,11 @@ public class EntityPacketRewriter1_11 extends EntityRewriter<ClientboundPackets1
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_9_3.SET_ENTITY_MOTION, wrapper -> {
|
||||
wrapper.passthrough(Types.VAR_INT); // Entity id
|
||||
tryFixFishingHookVelocity(wrapper);
|
||||
});
|
||||
|
||||
registerRemoveEntities(ClientboundPackets1_9_3.REMOVE_ENTITIES);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||
@ -243,6 +261,17 @@ public class EntityPacketRewriter1_11 extends EntityRewriter<ClientboundPackets1
|
||||
});
|
||||
}
|
||||
|
||||
private void tryFixFishingHookVelocity(final PacketWrapper wrapper) {
|
||||
// TODO Fix properly
|
||||
// Velocity handling of this changed on the client, this code still isn't entirely correct
|
||||
final short x = wrapper.read(Types.SHORT);
|
||||
final short y = wrapper.read(Types.SHORT);
|
||||
final short z = wrapper.read(Types.SHORT);
|
||||
wrapper.write(Types.SHORT, (short) (x * 1.33));
|
||||
wrapper.write(Types.SHORT, (short) (y * 1.2));
|
||||
wrapper.write(Types.SHORT, (short) (z * 1.33));
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.viaversion.viaversion.api.minecraft.entities.EntityType typeFromId(int type) {
|
||||
return EntityTypes1_11.getTypeFromId(type, false);
|
||||
|
@ -105,7 +105,7 @@ public class EntityPacketRewriter1_14 extends EntityRewriter<ClientboundPackets1
|
||||
wrapper.set(Types.INT, 0, data - 1);
|
||||
}
|
||||
// send velocity in separate packet, 1.14 is now ignoring the velocity
|
||||
PacketWrapper velocity = wrapper.create(0x45);
|
||||
PacketWrapper velocity = wrapper.create(ClientboundPackets1_14.SET_ENTITY_MOTION);
|
||||
velocity.write(Types.VAR_INT, entityId);
|
||||
velocity.write(Types.SHORT, wrapper.get(Types.SHORT, 0));
|
||||
velocity.write(Types.SHORT, wrapper.get(Types.SHORT, 1));
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren