PacketSetCooldown

This commit is contained in:
Bixilon 2020-07-03 14:14:20 +02:00
parent 598925ba5b
commit a69bb91f64
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,57 @@
/*
* Codename Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.protocol.packets.clientbound.play;
import de.bixilon.minosoft.game.datatypes.entities.Items;
import de.bixilon.minosoft.logging.Log;
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
import de.bixilon.minosoft.protocol.protocol.InPacketBuffer;
import de.bixilon.minosoft.protocol.protocol.PacketHandler;
public class PacketSetCooldown implements ClientboundPacket {
Items item;
int cooldownTicks;
@Override
public boolean read(InPacketBuffer buffer) {
switch (buffer.getVersion()) {
case VERSION_1_9_4:
item = Items.byLegacy(buffer.readVarInt());
cooldownTicks = buffer.readVarInt();
return true;
}
return false;
}
@Override
public void log() {
Log.protocol(String.format("Receiving item cooldown (item=%s, coolDown=%dt)", item.name(), cooldownTicks));
}
@Override
public void handle(PacketHandler h) {
h.handle(this);
}
public Items getItem() {
return item;
}
public int getCooldownTicks() {
return cooldownTicks;
}
}

View File

@ -549,4 +549,7 @@ public class PacketHandler {
public void handle(PacketSetPassenger pkg) { public void handle(PacketSetPassenger pkg) {
//ToDo //ToDo
} }
public void handle(PacketSetCooldown pkg) {
}
} }