mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-29 11:59:17 +00:00
fix: fix bot use action(#596)
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
package org.leavesmc.leaves.entity.bot.action;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
/**
|
||||
* Represents an action for a bot to shoot a projectile, such as use bow to shoot an arrow.
|
||||
*/
|
||||
public interface ShootAction extends TimerBotAction<ShootAction> {
|
||||
|
||||
/**
|
||||
* Gets the drawing tick for the shoot action.
|
||||
* <p>
|
||||
* The drawing tick determines how long the bot will draw the bow before shooting.
|
||||
*
|
||||
* @return the drawing tick
|
||||
*/
|
||||
int getDrawingTick();
|
||||
|
||||
/**
|
||||
* Sets the drawing tick for the shoot action.
|
||||
* <p>
|
||||
* The drawing tick determines how long the bot will draw the bow before shooting.
|
||||
*
|
||||
* @param drawingTick the drawing tick to set
|
||||
* @return this action instance
|
||||
*/
|
||||
ShootAction setDrawingTick(int drawingTick);
|
||||
|
||||
static ShootAction create() {
|
||||
return Bukkit.getBotManager().newAction(ShootAction.class);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,23 @@ import org.bukkit.Bukkit;
|
||||
* Represents an action where a bot only uses an item, without using it on blocks or entities.
|
||||
*/
|
||||
public interface UseItemAction extends TimerBotAction<UseItemAction> {
|
||||
|
||||
/**
|
||||
* Gets the equivalent right-click hold duration in ticks.
|
||||
* Default is -1, which means will not be released.
|
||||
*
|
||||
* @return the equivalent right-click hold duration
|
||||
*/
|
||||
int getUseTick();
|
||||
|
||||
/**
|
||||
* Sets the equivalent right-click hold duration in ticks.
|
||||
*
|
||||
* @param useTick the equivalent right-click hold duration
|
||||
* @return this action instance
|
||||
*/
|
||||
UseItemAction setUseTick(int useTick);
|
||||
|
||||
static UseItemAction create() {
|
||||
return Bukkit.getBotManager().newAction(UseItemAction.class);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,23 @@ import org.bukkit.Bukkit;
|
||||
* Represents an action where a bot uses an item, fully simulating the effect of a player right-clicking.
|
||||
*/
|
||||
public interface UseItemAutoAction extends TimerBotAction<UseItemAutoAction> {
|
||||
|
||||
/**
|
||||
* Gets the equivalent right-click hold duration in ticks.
|
||||
* Default is -1, which means will not be released.
|
||||
*
|
||||
* @return the equivalent right-click hold duration
|
||||
*/
|
||||
int getUseTick();
|
||||
|
||||
/**
|
||||
* Sets the equivalent right-click hold duration in ticks.
|
||||
*
|
||||
* @param useTick the equivalent right-click hold duration
|
||||
* @return this action instance
|
||||
*/
|
||||
UseItemAutoAction setUseTick(int useTick);
|
||||
|
||||
static UseItemAutoAction create() {
|
||||
return Bukkit.getBotManager().newAction(UseItemAutoAction.class);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,23 @@ import org.bukkit.Bukkit;
|
||||
* Represents an action where a bot only uses the item in its offhand, without using it on blocks or entities.
|
||||
*/
|
||||
public interface UseItemOffhandAction extends TimerBotAction<UseItemOffhandAction> {
|
||||
|
||||
/**
|
||||
* Gets the equivalent right-click hold duration in ticks.
|
||||
* Default is -1, which means will not be released.
|
||||
*
|
||||
* @return the equivalent right-click hold duration
|
||||
*/
|
||||
int getUseTick();
|
||||
|
||||
/**
|
||||
* Sets the equivalent right-click hold duration in ticks.
|
||||
*
|
||||
* @param useTick the equivalent right-click hold duration
|
||||
* @return this action instance
|
||||
*/
|
||||
UseItemOffhandAction setUseTick(int useTick);
|
||||
|
||||
static UseItemOffhandAction create() {
|
||||
return Bukkit.getBotManager().newAction(UseItemOffhandAction.class);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,23 @@ import org.bukkit.Bukkit;
|
||||
* Represents an action where a bot uses an item on a block.
|
||||
*/
|
||||
public interface UseItemOnAction extends TimerBotAction<UseItemOnAction> {
|
||||
|
||||
/**
|
||||
* Gets the equivalent right-click hold duration in ticks.
|
||||
* Default is -1, which means will not be released.
|
||||
*
|
||||
* @return the equivalent right-click hold duration
|
||||
*/
|
||||
int getUseTick();
|
||||
|
||||
/**
|
||||
* Sets the equivalent right-click hold duration in ticks.
|
||||
*
|
||||
* @param useTick the equivalent right-click hold duration
|
||||
* @return this action instance
|
||||
*/
|
||||
UseItemOnAction setUseTick(int useTick);
|
||||
|
||||
static UseItemOnAction create() {
|
||||
return Bukkit.getBotManager().newAction(UseItemOnAction.class);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,23 @@ import org.bukkit.Bukkit;
|
||||
* Represents an action where a bot uses an item in its offhand on a block.
|
||||
*/
|
||||
public interface UseItemOnOffhandAction extends TimerBotAction<UseItemOnOffhandAction> {
|
||||
|
||||
/**
|
||||
* Gets the equivalent right-click hold duration in ticks.
|
||||
* Default is -1, which means will not be released.
|
||||
*
|
||||
* @return the equivalent right-click hold duration
|
||||
*/
|
||||
int getUseTick();
|
||||
|
||||
/**
|
||||
* Sets the equivalent right-click hold duration in ticks.
|
||||
*
|
||||
* @param useTick the equivalent right-click hold duration
|
||||
* @return this action instance
|
||||
*/
|
||||
UseItemOnOffhandAction setUseTick(int useTick);
|
||||
|
||||
static UseItemOnOffhandAction create() {
|
||||
return Bukkit.getBotManager().newAction(UseItemOnOffhandAction.class);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,23 @@ import org.bukkit.Bukkit;
|
||||
* Represents an action where a bot uses an item to an entity.
|
||||
*/
|
||||
public interface UseItemToAction extends TimerBotAction<UseItemToAction> {
|
||||
|
||||
/**
|
||||
* Gets the equivalent right-click hold duration in ticks.
|
||||
* Default is -1, which means will not be released.
|
||||
*
|
||||
* @return the equivalent right-click hold duration
|
||||
*/
|
||||
int getUseTick();
|
||||
|
||||
/**
|
||||
* Sets the equivalent right-click hold duration in ticks.
|
||||
*
|
||||
* @param useTick the equivalent right-click hold duration
|
||||
* @return this action instance
|
||||
*/
|
||||
UseItemToAction setUseTick(int useTick);
|
||||
|
||||
static UseItemToAction create() {
|
||||
return Bukkit.getBotManager().newAction(UseItemToAction.class);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,23 @@ import org.bukkit.Bukkit;
|
||||
* Represents an action where a bot uses an item in its offhand to an entity.
|
||||
*/
|
||||
public interface UseItemToOffhandAction extends TimerBotAction<UseItemToOffhandAction> {
|
||||
|
||||
/**
|
||||
* Gets the equivalent right-click hold duration in ticks.
|
||||
* Default is -1, which means will not be released.
|
||||
*
|
||||
* @return the equivalent right-click hold duration
|
||||
*/
|
||||
int getUseTick();
|
||||
|
||||
/**
|
||||
* Sets the equivalent right-click hold duration in ticks.
|
||||
*
|
||||
* @param useTick the equivalent right-click hold duration
|
||||
* @return this action instance
|
||||
*/
|
||||
UseItemToOffhandAction setUseTick(int useTick);
|
||||
|
||||
static UseItemToOffhandAction create() {
|
||||
return Bukkit.getBotManager().newAction(UseItemToOffhandAction.class);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class Actions {
|
||||
register(new ServerFishAction(), FishAction.class);
|
||||
register(new ServerSwimAction(), SwimAction.class);
|
||||
register(new ServerRotationAction(), RotationAction.class);
|
||||
register(new ServerShootAction(), ShootAction.class);
|
||||
register(new ServerMoveAction(), MoveAction.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
package org.leavesmc.leaves.bot.agent.actions;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.item.Items;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentResult;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
import org.leavesmc.leaves.entity.bot.actions.CraftShootAction;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ServerShootAction extends ServerTimerBotAction<ServerShootAction> {
|
||||
|
||||
private static final int DEFAULT_DRAWING_TICK = 20;
|
||||
private int drawingTick = DEFAULT_DRAWING_TICK;
|
||||
private int tickToRelease = -1;
|
||||
|
||||
public ServerShootAction() {
|
||||
super("shoot", CommandArgument.of(CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER), ServerShootAction::new);
|
||||
this.setSuggestion(3, Pair.of(Collections.singletonList("20"), "[DrawingTick]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
this.tickToRelease = drawingTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
if (!bot.getItemInHand(InteractionHand.MAIN_HAND).is(Items.BOW)) {
|
||||
return false;
|
||||
}
|
||||
tickToRelease--;
|
||||
if (tickToRelease >= 0) {
|
||||
bot.gameMode.useItem(bot, bot.level(), bot.getItemInHand(InteractionHand.MAIN_HAND), InteractionHand.MAIN_HAND).consumesAction();
|
||||
bot.updateItemInHand(InteractionHand.MAIN_HAND);
|
||||
return false;
|
||||
} else {
|
||||
bot.releaseUsingItem();
|
||||
tickToRelease = drawingTick;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommand(ServerPlayer player, @NotNull CommandArgumentResult result) {
|
||||
super.loadCommand(player, result);
|
||||
this.drawingTick = result.readInt(DEFAULT_DRAWING_TICK);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public CompoundTag save(@NotNull CompoundTag nbt) {
|
||||
super.save(nbt);
|
||||
nbt.putInt("drawingTick", this.drawingTick);
|
||||
nbt.putInt("tickToRelease", this.tickToRelease);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(@NotNull CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
this.drawingTick = nbt.getInt("drawingTick").orElseThrow();
|
||||
this.tickToRelease = nbt.getInt("tickToRelease").orElseThrow();
|
||||
}
|
||||
|
||||
public int getDrawingTick() {
|
||||
return drawingTick;
|
||||
}
|
||||
|
||||
public void setDrawingTick(int drawingTick) {
|
||||
this.drawingTick = drawingTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asCraft() {
|
||||
return new CraftShootAction(this);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,87 @@
|
||||
package org.leavesmc.leaves.bot.agent.actions;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentResult;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
import org.leavesmc.leaves.entity.bot.actions.CraftUseItemAction;
|
||||
import org.leavesmc.leaves.event.bot.BotActionStopEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ServerUseItemAction extends ServerTimerBotAction<ServerUseItemAction> {
|
||||
private int useTick = -1;
|
||||
private int tickToRelease = -1;
|
||||
|
||||
public ServerUseItemAction() {
|
||||
super("use", ServerUseItemAction::new);
|
||||
super("use", CommandArgument.of(CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER), ServerUseItemAction::new);
|
||||
this.setSuggestion(3, Pair.of(Collections.singletonList("-1"), "[UseTick]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
syncTickToRelease();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommand(ServerPlayer player, @NotNull CommandArgumentResult result) {
|
||||
super.loadCommand(player, result);
|
||||
this.useTick = result.readInt(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
return execute(bot);
|
||||
tickToRelease--;
|
||||
if (tickToRelease >= 0) {
|
||||
boolean result = execute(bot);
|
||||
if (useTick >=0) {
|
||||
return false;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
syncTickToRelease();
|
||||
bot.releaseUsingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void syncTickToRelease() {
|
||||
if (this.useTick >= 0) {
|
||||
this.tickToRelease = this.useTick;
|
||||
} else {
|
||||
this.tickToRelease = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public CompoundTag save(@NotNull CompoundTag nbt) {
|
||||
super.save(nbt);
|
||||
nbt.putInt("useTick", this.useTick);
|
||||
nbt.putInt("tickToRelease", this.tickToRelease);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(@NotNull CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
this.useTick = nbt.getInt("useTick").orElseThrow();
|
||||
this.tickToRelease = nbt.getInt("tickToRelease").orElseThrow();
|
||||
}
|
||||
|
||||
public int getUseTick() {
|
||||
return useTick;
|
||||
}
|
||||
|
||||
public void setUseTick(int useTick) {
|
||||
this.useTick = useTick;
|
||||
}
|
||||
|
||||
public static boolean execute(@NotNull ServerBot bot) {
|
||||
@@ -29,6 +97,12 @@ public class ServerUseItemAction extends ServerTimerBotAction<ServerUseItemActio
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(@NotNull ServerBot bot, BotActionStopEvent.Reason reason) {
|
||||
super.stop(bot, reason);
|
||||
bot.completeUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asCraft() {
|
||||
return new CraftUseItemAction(this);
|
||||
|
||||
@@ -1,20 +1,75 @@
|
||||
package org.leavesmc.leaves.bot.agent.actions;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentResult;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
import org.leavesmc.leaves.entity.bot.actions.CraftUseItemAutoAction;
|
||||
import org.leavesmc.leaves.event.bot.BotActionStopEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ServerUseItemAutoAction extends ServerTimerBotAction<ServerUseItemAutoAction> {
|
||||
private int useTick = -1;
|
||||
private int tickToRelease = -1;
|
||||
|
||||
public ServerUseItemAutoAction() {
|
||||
super("use_auto", ServerUseItemAutoAction::new);
|
||||
super("use_auto", CommandArgument.of(CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER), ServerUseItemAutoAction::new);
|
||||
this.setSuggestion(3, Pair.of(Collections.singletonList("-1"), "[UseTick]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
syncTickToRelease();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommand(ServerPlayer player, @NotNull CommandArgumentResult result) {
|
||||
super.loadCommand(player, result);
|
||||
this.useTick = result.readInt(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
tickToRelease--;
|
||||
if (tickToRelease >= 0) {
|
||||
boolean result = execute(bot);
|
||||
if (useTick >=0) {
|
||||
return false;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
syncTickToRelease();
|
||||
bot.releaseUsingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void syncTickToRelease() {
|
||||
if (this.useTick >= 0) {
|
||||
this.tickToRelease = this.useTick;
|
||||
} else {
|
||||
this.tickToRelease = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public int getUseTick() {
|
||||
return useTick;
|
||||
}
|
||||
|
||||
public void setUseTick(int useTick) {
|
||||
this.useTick = useTick;
|
||||
}
|
||||
|
||||
public boolean execute(@NotNull ServerBot bot) {
|
||||
if (bot.isUsingItem()) {
|
||||
return false;
|
||||
}
|
||||
@@ -41,6 +96,12 @@ public class ServerUseItemAutoAction extends ServerTimerBotAction<ServerUseItemA
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(@NotNull ServerBot bot, BotActionStopEvent.Reason reason) {
|
||||
super.stop(bot, reason);
|
||||
bot.completeUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asCraft() {
|
||||
return new CraftUseItemAutoAction(this);
|
||||
|
||||
@@ -1,19 +1,87 @@
|
||||
package org.leavesmc.leaves.bot.agent.actions;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentResult;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
import org.leavesmc.leaves.entity.bot.actions.CraftUseItemOffhandAction;
|
||||
import org.leavesmc.leaves.event.bot.BotActionStopEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ServerUseItemOffhandAction extends ServerTimerBotAction<ServerUseItemOffhandAction> {
|
||||
private int useTick = -1;
|
||||
private int tickToRelease = -1;
|
||||
|
||||
public ServerUseItemOffhandAction() {
|
||||
super("use_offhand", ServerUseItemOffhandAction::new);
|
||||
super("use_offhand", CommandArgument.of(CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER), ServerUseItemOffhandAction::new);
|
||||
this.setSuggestion(3, Pair.of(Collections.singletonList("-1"), "[UseTick]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
syncTickToRelease();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommand(ServerPlayer player, @NotNull CommandArgumentResult result) {
|
||||
super.loadCommand(player, result);
|
||||
this.useTick = result.readInt(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
return execute(bot);
|
||||
tickToRelease--;
|
||||
if (tickToRelease >= 0) {
|
||||
boolean result = execute(bot);
|
||||
if (useTick >=0) {
|
||||
return false;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
syncTickToRelease();
|
||||
bot.releaseUsingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void syncTickToRelease() {
|
||||
if (this.useTick >= 0) {
|
||||
this.tickToRelease = this.useTick;
|
||||
} else {
|
||||
this.tickToRelease = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public CompoundTag save(@NotNull CompoundTag nbt) {
|
||||
super.save(nbt);
|
||||
nbt.putInt("useTick", this.useTick);
|
||||
nbt.putInt("tickToRelease", this.tickToRelease);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(@NotNull CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
this.useTick = nbt.getInt("useTick").orElseThrow();
|
||||
this.tickToRelease = nbt.getInt("tickToRelease").orElseThrow();
|
||||
}
|
||||
|
||||
public int getUseTick() {
|
||||
return useTick;
|
||||
}
|
||||
|
||||
public void setUseTick(int useTick) {
|
||||
this.useTick = useTick;
|
||||
}
|
||||
|
||||
public static boolean execute(@NotNull ServerBot bot) {
|
||||
@@ -29,6 +97,12 @@ public class ServerUseItemOffhandAction extends ServerTimerBotAction<ServerUseIt
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(@NotNull ServerBot bot, BotActionStopEvent.Reason reason) {
|
||||
super.stop(bot, reason);
|
||||
bot.completeUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asCraft() {
|
||||
return new CraftUseItemOffhandAction(this);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.leavesmc.leaves.bot.agent.actions;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@@ -8,22 +10,88 @@ import net.minecraft.world.level.block.entity.TrappedChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentResult;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
import org.leavesmc.leaves.entity.bot.actions.CraftUseItemOnAction;
|
||||
import org.leavesmc.leaves.event.bot.BotActionStopEvent;
|
||||
import org.leavesmc.leaves.plugin.MinecraftInternalPlugin;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ServerUseItemOnAction extends ServerTimerBotAction<ServerUseItemOnAction> {
|
||||
private int useTick = -1;
|
||||
private int tickToRelease = -1;
|
||||
|
||||
public ServerUseItemOnAction() {
|
||||
super("use_on", ServerUseItemOnAction::new);
|
||||
super("use_on", CommandArgument.of(CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER), ServerUseItemOnAction::new);
|
||||
this.setSuggestion(3, Pair.of(Collections.singletonList("-1"), "[UseTick]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
syncTickToRelease();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommand(ServerPlayer player, @NotNull CommandArgumentResult result) {
|
||||
super.loadCommand(player, result);
|
||||
this.useTick = result.readInt(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
HitResult result = bot.getRayTrace(5, ClipContext.Fluid.NONE);
|
||||
return execute(bot, result);
|
||||
tickToRelease--;
|
||||
if (tickToRelease >= 0) {
|
||||
HitResult hitResult = bot.getRayTrace(5, ClipContext.Fluid.NONE);
|
||||
boolean result = execute(bot, hitResult);
|
||||
if (useTick >=0) {
|
||||
return false;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
syncTickToRelease();
|
||||
bot.releaseUsingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void syncTickToRelease() {
|
||||
if (this.useTick >= 0) {
|
||||
this.tickToRelease = this.useTick;
|
||||
} else {
|
||||
this.tickToRelease = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public CompoundTag save(@NotNull CompoundTag nbt) {
|
||||
super.save(nbt);
|
||||
nbt.putInt("useTick", this.useTick);
|
||||
nbt.putInt("tickToRelease", this.tickToRelease);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(@NotNull CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
this.useTick = nbt.getInt("useTick").orElseThrow();
|
||||
this.tickToRelease = nbt.getInt("tickToRelease").orElseThrow();
|
||||
}
|
||||
|
||||
public int getUseTick() {
|
||||
return useTick;
|
||||
}
|
||||
|
||||
public void setUseTick(int useTick) {
|
||||
this.useTick = useTick;
|
||||
}
|
||||
|
||||
public static boolean execute(@NotNull ServerBot bot, HitResult result) {
|
||||
@@ -52,6 +120,12 @@ public class ServerUseItemOnAction extends ServerTimerBotAction<ServerUseItemOnA
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(@NotNull ServerBot bot, BotActionStopEvent.Reason reason) {
|
||||
super.stop(bot, reason);
|
||||
bot.completeUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asCraft() {
|
||||
return new CraftUseItemOnAction(this);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.leavesmc.leaves.bot.agent.actions;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@@ -8,22 +10,88 @@ import net.minecraft.world.level.block.entity.TrappedChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentResult;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
import org.leavesmc.leaves.entity.bot.actions.CraftUseItemOnOffhandAction;
|
||||
import org.leavesmc.leaves.event.bot.BotActionStopEvent;
|
||||
import org.leavesmc.leaves.plugin.MinecraftInternalPlugin;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ServerUseItemOnOffhandAction extends ServerTimerBotAction<ServerUseItemOnOffhandAction> {
|
||||
private int useTick = -1;
|
||||
private int tickToRelease = -1;
|
||||
|
||||
public ServerUseItemOnOffhandAction() {
|
||||
super("use_on_offhand", ServerUseItemOnOffhandAction::new);
|
||||
super("use_on_offhand", CommandArgument.of(CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER), ServerUseItemOnOffhandAction::new);
|
||||
this.setSuggestion(3, Pair.of(Collections.singletonList("-1"), "[UseTick]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
syncTickToRelease();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommand(ServerPlayer player, @NotNull CommandArgumentResult result) {
|
||||
super.loadCommand(player, result);
|
||||
this.useTick = result.readInt(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
HitResult result = bot.getRayTrace(5, ClipContext.Fluid.NONE);
|
||||
return execute(bot, result);
|
||||
tickToRelease--;
|
||||
if (tickToRelease >= 0) {
|
||||
HitResult hitResult = bot.getRayTrace(5, ClipContext.Fluid.NONE);
|
||||
boolean result = execute(bot, hitResult);
|
||||
if (useTick >=0) {
|
||||
return false;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
syncTickToRelease();
|
||||
bot.releaseUsingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void syncTickToRelease() {
|
||||
if (this.useTick >= 0) {
|
||||
this.tickToRelease = this.useTick;
|
||||
} else {
|
||||
this.tickToRelease = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public CompoundTag save(@NotNull CompoundTag nbt) {
|
||||
super.save(nbt);
|
||||
nbt.putInt("useTick", this.useTick);
|
||||
nbt.putInt("tickToRelease", this.tickToRelease);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(@NotNull CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
this.useTick = nbt.getInt("useTick").orElseThrow();
|
||||
this.tickToRelease = nbt.getInt("tickToRelease").orElseThrow();
|
||||
}
|
||||
|
||||
public int getUseTick() {
|
||||
return useTick;
|
||||
}
|
||||
|
||||
public void setUseTick(int useTick) {
|
||||
this.useTick = useTick;
|
||||
}
|
||||
|
||||
public static boolean execute(ServerBot bot, HitResult result) {
|
||||
@@ -52,6 +120,12 @@ public class ServerUseItemOnOffhandAction extends ServerTimerBotAction<ServerUse
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(@NotNull ServerBot bot, BotActionStopEvent.Reason reason) {
|
||||
super.stop(bot, reason);
|
||||
bot.completeUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asCraft() {
|
||||
return new CraftUseItemOnOffhandAction(this);
|
||||
|
||||
@@ -1,21 +1,72 @@
|
||||
package org.leavesmc.leaves.bot.agent.actions;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentResult;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
import org.leavesmc.leaves.entity.bot.actions.CraftUseItemToAction;
|
||||
import org.leavesmc.leaves.event.bot.BotActionStopEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ServerUseItemToAction extends ServerTimerBotAction<ServerUseItemToAction> {
|
||||
private int useTick = -1;
|
||||
private int tickToRelease = -1;
|
||||
|
||||
public ServerUseItemToAction() {
|
||||
super("use_to", ServerUseItemToAction::new);
|
||||
super("use_to", CommandArgument.of(CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER), ServerUseItemToAction::new);
|
||||
this.setSuggestion(3, Pair.of(Collections.singletonList("-1"), "[UseTick]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
syncTickToRelease();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommand(ServerPlayer player, @NotNull CommandArgumentResult result) {
|
||||
super.loadCommand(player, result);
|
||||
this.useTick = result.readInt(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
Entity entity = bot.getTargetEntity(3, null);
|
||||
return execute(bot, entity);
|
||||
tickToRelease--;
|
||||
if (tickToRelease >= 0) {
|
||||
Entity entity = bot.getTargetEntity(3, null);
|
||||
boolean result = execute(bot, entity);
|
||||
if (useTick >=0) {
|
||||
return false;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
syncTickToRelease();
|
||||
bot.releaseUsingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void syncTickToRelease() {
|
||||
if (this.useTick >= 0) {
|
||||
this.tickToRelease = this.useTick;
|
||||
} else {
|
||||
this.tickToRelease = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public int getUseTick() {
|
||||
return useTick;
|
||||
}
|
||||
|
||||
public void setUseTick(int useTick) {
|
||||
this.useTick = useTick;
|
||||
}
|
||||
|
||||
public static boolean execute(ServerBot bot, Entity entity) {
|
||||
@@ -31,6 +82,12 @@ public class ServerUseItemToAction extends ServerTimerBotAction<ServerUseItemToA
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(@NotNull ServerBot bot, BotActionStopEvent.Reason reason) {
|
||||
super.stop(bot, reason);
|
||||
bot.completeUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asCraft() {
|
||||
return new CraftUseItemToAction(this);
|
||||
|
||||
@@ -1,21 +1,72 @@
|
||||
package org.leavesmc.leaves.bot.agent.actions;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.command.CommandArgument;
|
||||
import org.leavesmc.leaves.command.CommandArgumentResult;
|
||||
import org.leavesmc.leaves.command.CommandArgumentType;
|
||||
import org.leavesmc.leaves.entity.bot.actions.CraftUseItemToOffhandAction;
|
||||
import org.leavesmc.leaves.event.bot.BotActionStopEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ServerUseItemToOffhandAction extends ServerTimerBotAction<ServerUseItemToOffhandAction> {
|
||||
private int useTick = -1;
|
||||
private int tickToRelease = -1;
|
||||
|
||||
public ServerUseItemToOffhandAction() {
|
||||
super("use_to_offhand", ServerUseItemToOffhandAction::new);
|
||||
super("use_to_offhand", CommandArgument.of(CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER, CommandArgumentType.INTEGER), ServerUseItemToOffhandAction::new);
|
||||
this.setSuggestion(3, Pair.of(Collections.singletonList("-1"), "[UseTick]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
syncTickToRelease();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCommand(ServerPlayer player, @NotNull CommandArgumentResult result) {
|
||||
super.loadCommand(player, result);
|
||||
this.useTick = result.readInt(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
Entity entity = bot.getTargetEntity(3, null);
|
||||
return execute(bot, entity);
|
||||
tickToRelease--;
|
||||
if (tickToRelease >= 0) {
|
||||
Entity entity = bot.getTargetEntity(3, null);
|
||||
boolean result = execute(bot, entity);
|
||||
if (useTick >=0) {
|
||||
return false;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
syncTickToRelease();
|
||||
bot.releaseUsingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void syncTickToRelease() {
|
||||
if (this.useTick >= 0) {
|
||||
this.tickToRelease = this.useTick;
|
||||
} else {
|
||||
this.tickToRelease = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public int getUseTick() {
|
||||
return useTick;
|
||||
}
|
||||
|
||||
public void setUseTick(int useTick) {
|
||||
this.useTick = useTick;
|
||||
}
|
||||
|
||||
public static boolean execute(ServerBot bot, Entity entity) {
|
||||
@@ -31,6 +82,12 @@ public class ServerUseItemToOffhandAction extends ServerTimerBotAction<ServerUse
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(@NotNull ServerBot bot, BotActionStopEvent.Reason reason) {
|
||||
super.stop(bot, reason);
|
||||
bot.completeUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asCraft() {
|
||||
return new CraftUseItemToOffhandAction(this);
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
package org.leavesmc.leaves.entity.bot.actions;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.bot.ServerBot;
|
||||
import org.leavesmc.leaves.bot.agent.actions.*;
|
||||
import org.leavesmc.leaves.entity.bot.action.*;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class CraftShootAction extends CraftBotAction implements ShootAction {
|
||||
private final ServerShootAction serverAction;
|
||||
private Consumer<ShootAction> onFail = null;
|
||||
private Consumer<ShootAction> onSuccess = null;
|
||||
private Consumer<ShootAction> onStop = null;
|
||||
|
||||
public CraftShootAction(ServerShootAction serverAction) {
|
||||
this.serverAction = serverAction;
|
||||
}
|
||||
|
||||
public boolean doTick(@NotNull ServerBot bot) {
|
||||
return serverAction.doTick(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerBotAction<?> getHandle() {
|
||||
return serverAction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return serverAction.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return serverAction.getUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
serverAction.setCancelled(cancel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return serverAction.isCancelled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnFail(Consumer<ShootAction> onFail) {
|
||||
this.onFail = onFail;
|
||||
serverAction.setOnFail(it -> onFail.accept(new CraftShootAction(it)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Consumer<ShootAction> getOnFail() {
|
||||
return onFail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnSuccess(Consumer<ShootAction> onSuccess) {
|
||||
this.onSuccess = onSuccess;
|
||||
serverAction.setOnSuccess(it -> onSuccess.accept(new CraftShootAction(it)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Consumer<ShootAction> getOnSuccess() {
|
||||
return onSuccess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnStop(Consumer<ShootAction> onStop) {
|
||||
this.onStop = onStop;
|
||||
serverAction.setOnStop(it -> onStop.accept(new CraftShootAction(it)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Consumer<ShootAction> getOnStop() {
|
||||
return onStop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStartDelayTick(int delayTick) {
|
||||
serverAction.setStartDelayTick(delayTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartDelayTick() {
|
||||
return serverAction.getStartDelayTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDoIntervalTick(int intervalTick) {
|
||||
serverAction.setDoIntervalTick(intervalTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoIntervalTick() {
|
||||
return serverAction.getDoIntervalTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDoNumber(int doNumber) {
|
||||
serverAction.setDoNumber(doNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoNumber() {
|
||||
return serverAction.getDoNumber();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTickToNext() {
|
||||
return serverAction.getTickToNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoNumberRemaining() {
|
||||
return serverAction.getDoNumberRemaining();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrawingTick() {
|
||||
return serverAction.getDrawingTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShootAction setDrawingTick(int drawingTick) {
|
||||
serverAction.setDrawingTick(drawingTick);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,17 @@ public class CraftUseItemAction extends CraftBotAction implements UseItemAction
|
||||
return serverAction.doTick(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTick() {
|
||||
return serverAction.getUseTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftUseItemAction setUseTick(int useTick) {
|
||||
serverAction.setUseTick(useTick);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerBotAction<?> getHandle() {
|
||||
return serverAction;
|
||||
|
||||
@@ -22,6 +22,17 @@ public class CraftUseItemAutoAction extends CraftBotAction implements UseItemAut
|
||||
return serverAction.doTick(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTick() {
|
||||
return serverAction.getUseTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftUseItemAutoAction setUseTick(int useTick) {
|
||||
serverAction.setUseTick(useTick);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerBotAction<?> getHandle() {
|
||||
return serverAction;
|
||||
|
||||
@@ -22,6 +22,17 @@ public class CraftUseItemOffhandAction extends CraftBotAction implements UseItem
|
||||
return serverAction.doTick(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTick() {
|
||||
return serverAction.getUseTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftUseItemOffhandAction setUseTick(int useTick) {
|
||||
serverAction.setUseTick(useTick);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerBotAction<?> getHandle() {
|
||||
return serverAction;
|
||||
|
||||
@@ -22,6 +22,17 @@ public class CraftUseItemOnAction extends CraftBotAction implements UseItemOnAct
|
||||
return serverAction.doTick(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTick() {
|
||||
return serverAction.getUseTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftUseItemOnAction setUseTick(int useTick) {
|
||||
serverAction.setUseTick(useTick);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerBotAction<?> getHandle() {
|
||||
return serverAction;
|
||||
|
||||
@@ -22,6 +22,17 @@ public class CraftUseItemOnOffhandAction extends CraftBotAction implements UseIt
|
||||
return serverAction.doTick(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTick() {
|
||||
return serverAction.getUseTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftUseItemOnOffhandAction setUseTick(int useTick) {
|
||||
serverAction.setUseTick(useTick);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerBotAction<?> getHandle() {
|
||||
return serverAction;
|
||||
|
||||
@@ -22,6 +22,17 @@ public class CraftUseItemToAction extends CraftBotAction implements UseItemToAct
|
||||
return serverAction.doTick(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTick() {
|
||||
return serverAction.getUseTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftUseItemToAction setUseTick(int useTick) {
|
||||
serverAction.setUseTick(useTick);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerBotAction<?> getHandle() {
|
||||
return serverAction;
|
||||
|
||||
@@ -22,6 +22,17 @@ public class CraftUseItemToOffhandAction extends CraftBotAction implements UseIt
|
||||
return serverAction.doTick(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTick() {
|
||||
return serverAction.getUseTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftUseItemToOffhandAction setUseTick(int useTick) {
|
||||
serverAction.setUseTick(useTick);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerBotAction<?> getHandle() {
|
||||
return serverAction;
|
||||
|
||||
Reference in New Issue
Block a user