3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 00:22:51 +01:00

Merge pull request #1078 from creeper123123321/master

fix set cooldown
Dieser Commit ist enthalten in:
Myles 2018-11-10 10:44:34 +00:00 committet von GitHub
Commit 25463a929a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 55 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -90,6 +90,22 @@ public class Protocol1_13_1To1_13 extends Protocol {
} }
}); });
// Set cooldown
registerOutgoing(State.PLAY, 0x18, 0x18, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Item
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
wrapper.set(Type.VAR_INT, 0,
InventoryPackets.getNewItemId(wrapper.get(Type.VAR_INT, 0))
);
}
});
}
});
// Boss bar // Boss bar
registerOutgoing(State.PLAY, 0x0C, 0x0C, new PacketRemapper() { registerOutgoing(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
@Override @Override

Datei anzeigen

@ -223,7 +223,45 @@ public class Protocol1_13To1_12_2 extends Protocol {
// InventoryPackets 0x14 -> 0x15 // InventoryPackets 0x14 -> 0x15
// InventoryPackets 0x15 -> 0x16 // InventoryPackets 0x15 -> 0x16
// InventoryPackets 0x16 -> 0x17 // InventoryPackets 0x16 -> 0x17
registerOutgoing(State.PLAY, 0x17, 0x18); // Set cooldown
registerOutgoing(State.PLAY, 0x17, 0x18, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
int item = wrapper.read(Type.VAR_INT);
int ticks = wrapper.read(Type.VAR_INT);
wrapper.cancel();
if (item == 383) { // Spawn egg
for (int i = 0; i < 44; i++) {
Integer newItem = MappingData.oldToNewItems.get(item << 16 | i);
if (newItem != null) {
PacketWrapper packet = wrapper.create(0x18);
packet.write(Type.VAR_INT, newItem);
packet.write(Type.VAR_INT, ticks);
packet.send(Protocol1_13To1_12_2.class);
} else {
break;
}
}
} else {
for (int i = 0; i < 16; i++) {
Integer newItem = MappingData.oldToNewItems.get(item << 4 | i);
if (newItem != null) {
PacketWrapper packet = wrapper.create(0x18);
packet.write(Type.VAR_INT, newItem);
packet.write(Type.VAR_INT, ticks);
packet.send(Protocol1_13To1_12_2.class);
} else {
break;
}
}
}
}
});
}
});
// WorldPackets 0x18 -> 0x19 // WorldPackets 0x18 -> 0x19
registerOutgoing(State.PLAY, 0x1A, 0x1B); registerOutgoing(State.PLAY, 0x1A, 0x1B);
registerOutgoing(State.PLAY, 0x1B, 0x1C); registerOutgoing(State.PLAY, 0x1B, 0x1C);