handleCooldown
This commit is contained in:
@@ -33,12 +33,12 @@ public interface IBaritoneUser {
|
||||
/**
|
||||
* @return The network manager that is responsible for the current connection.
|
||||
*/
|
||||
@Nullable NetworkManager getNetworkManager();
|
||||
NetworkManager getNetworkManager();
|
||||
|
||||
/**
|
||||
* @return The locally managed entity for this bot.
|
||||
*/
|
||||
@Nullable EntityBot getLocalEntity();
|
||||
EntityBot getLocalEntity();
|
||||
|
||||
/**
|
||||
* Returns the remote entity reported by the server that represents this bot connection. This is only
|
||||
@@ -46,12 +46,5 @@ public interface IBaritoneUser {
|
||||
*
|
||||
* @return The remote entity for this bot
|
||||
*/
|
||||
@Nullable EntityOtherPlayerMP getRemoteEntity();
|
||||
|
||||
/**
|
||||
* Returns the world that this entity is in. Equivalent to calling {@link #getLocalEntity().world}
|
||||
*
|
||||
* @return The world that this entity is in.
|
||||
*/
|
||||
@Nullable World getWorld();
|
||||
EntityOtherPlayerMP getRemoteEntity();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.util.IThreadListener;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// Notes:
|
||||
// - All methods have been given a checkThreadAndEnqueue call, before implementing the handler, verify that it is in the actual NetHandlerPlayClient method
|
||||
@@ -381,6 +382,12 @@ public class BotNetHandlerPlayClient implements INetHandlerPlayClient {
|
||||
@Override
|
||||
public void handleCooldown(@Nonnull SPacketCooldown packetIn) {
|
||||
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.client);
|
||||
|
||||
if (packetIn.getTicks() == 0) { // There is no cooldown
|
||||
this.user.getLocalEntity().getCooldownTracker().removeCooldown(packetIn.getItem());
|
||||
} else {
|
||||
this.user.getLocalEntity().getCooldownTracker().setCooldown(packetIn.getItem(), packetIn.getTicks());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user