3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-24 15:20:19 +01:00

Fix 1.13->1.12 item cooldown

Fixes #450
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-05-29 15:51:02 +02:00
Ursprung dc9fe10779
Commit c2ae3df1db
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -91,21 +91,20 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
protocol.registerClientbound(ClientboundPackets1_13.COOLDOWN, new PacketRemapper() { protocol.registerClientbound(ClientboundPackets1_13.COOLDOWN, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(new PacketHandler() { handler(wrapper -> {
@Override int itemId = wrapper.read(Type.VAR_INT);
public void handle(PacketWrapper wrapper) throws Exception { int oldId = protocol.getMappingData().getItemMappings().get(itemId);
int itemId = wrapper.read(Type.VAR_INT); if (oldId == -1) {
int oldId = protocol.getMappingData().getItemMappings().get(itemId); wrapper.cancel();
if (oldId != -1) { return;
Optional<String> eggEntityId = SpawnEggRewriter.getEntityId(oldId);
if (eggEntityId.isPresent()) {
itemId = 383 << 16;
} else {
itemId = (oldId >> 4) << 16 | oldId & 0xF;
}
}
wrapper.write(Type.VAR_INT, itemId);
} }
if (SpawnEggRewriter.getEntityId(oldId).isPresent()) {
wrapper.write(Type.VAR_INT, 383 << 4);
return;
}
wrapper.write(Type.VAR_INT, oldId >> 4);
}); });
} }
}); });