From 0c6fde1912292bfb283ce8e9babdf2d455a72167 Mon Sep 17 00:00:00 2001 From: Brian Ricketts Date: Mon, 21 Jan 2013 15:53:02 -0600 Subject: [PATCH] Added FIRE command (throws things and fires arrows!) Also fixed a manipulator bug (NULL CHECKS, CAL. NULL CHECKS!) --- buildnumber.txt | 2 +- recommendedversion.txt | 2 +- .../assemblyline/api/IArmbotUseable.java | 50 +++++----- .../common/machine/TileEntityManipulator.java | 34 +++---- .../machine/armbot/TileEntityArmbot.java | 45 ++++----- .../common/machine/command/Command.java | 1 + .../common/machine/command/CommandDrop.java | 6 +- .../common/machine/command/CommandFire.java | 98 +++++++++++++++++++ .../common/machine/command/CommandGrab.java | 8 +- .../machine/command/CommandManager.java | 36 +++---- .../common/machine/command/CommandRepeat.java | 32 ++++-- .../common/machine/command/CommandUse.java | 98 +++++++++---------- 12 files changed, 262 insertions(+), 150 deletions(-) create mode 100644 src/minecraft/assemblyline/common/machine/command/CommandFire.java diff --git a/buildnumber.txt b/buildnumber.txt index a9549d33..d7f1b860 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -59 +59 diff --git a/recommendedversion.txt b/recommendedversion.txt index 60cd00d1..c1ce816c 100644 --- a/recommendedversion.txt +++ b/recommendedversion.txt @@ -1 +1 @@ -0.2.4 +0.2.4 diff --git a/src/minecraft/assemblyline/api/IArmbotUseable.java b/src/minecraft/assemblyline/api/IArmbotUseable.java index cd3daa41..24c868e7 100644 --- a/src/minecraft/assemblyline/api/IArmbotUseable.java +++ b/src/minecraft/assemblyline/api/IArmbotUseable.java @@ -1,25 +1,25 @@ -package assemblyline.api; - -import assemblyline.common.machine.armbot.TileEntityArmbot; -import net.minecraft.entity.Entity; - -/** - * The IUseable inteface is used by the ArmBot so that it may interact with Tile Entities. - * onUse will be called on the block an ArmBot is touching whenver the USE command is run - * on it. - * @author Briman0094 - * - */ -public interface IArmbotUseable -{ - - /** - * Called when the ArmBot command "USE" is run. This is called on any IUseable the - * ArmBot is touching. - * @param tileEntity the TileEntityArmbot that is using this IUseable - * @param heldEntity the Entity being held by the ArmBot, or null if there is none - * @return whether or not the "use" did anything - */ - public boolean onUse(TileEntityArmbot tileEntity, Entity heldEntity); - -} +package assemblyline.api; + +import assemblyline.common.machine.armbot.TileEntityArmbot; +import net.minecraft.entity.Entity; + +/** + * The IUseable inteface is used by the ArmBot so that it may interact with Tile Entities. + * onUse will be called on the block an ArmBot is touching whenver the USE command is run + * on it. + * @author Briman0094 + * + */ +public interface IArmbotUseable +{ + + /** + * Called when the ArmBot command "USE" is run. This is called on any IUseable the + * ArmBot is touching. + * @param tileEntity the TileEntityArmbot that is using this IUseable + * @param heldEntity the Entity being held by the ArmBot, or null if there is none + * @return whether or not the "use" did anything + */ + public boolean onUse(TileEntityArmbot tileEntity, Entity heldEntity); + +} diff --git a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java index a2477483..32859066 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java @@ -21,14 +21,14 @@ import cpw.mods.fml.common.network.PacketDispatcher; public class TileEntityManipulator extends TileEntityFilterable implements IRotatable, IRedstoneReceptor, IManipulator { - public boolean selfPulse = false; + public boolean selfPulse = false; /** * Is the manipulator wrenched to turn into output mode? */ - private boolean isOutput = false; + private boolean isOutput = false; - private boolean isRedstonePowered = false; + private boolean isRedstonePowered = false; public boolean isOutput() { @@ -86,8 +86,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota } /** - * Find items going into the manipulator and input them into an inventory behind this - * manipulator. + * Find items going into the manipulator and input them into an inventory behind this manipulator. */ @Override public void inject() @@ -111,8 +110,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota if (entity.isDead) continue; /** - * Try top first, then bottom, then the sides to see if it is possible to insert the - * item into a inventory. + * Try top first, then bottom, then the sides to see if it is possible to insert the item into a inventory. */ ItemStack remainingStack = entity.func_92014_d().copy(); @@ -182,16 +180,9 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota } /* - * @Override public ArrayList getPacketData() { ArrayList list = super.getPacketData(); - * list.add(this.isOutput); list.add(this.wattsReceived); return list; } + * @Override public ArrayList getPacketData() { ArrayList list = super.getPacketData(); list.add(this.isOutput); list.add(this.wattsReceived); return list; } * - * @Override public void handlePacketData(INetworkManager network, int packetType, - * Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) { if - * (worldObj.isRemote) { ByteArrayInputStream bis = new ByteArrayInputStream(packet.data); - * DataInputStream dis = new DataInputStream(bis); int id, x, y, z; try { id = dis.readInt(); x - * = dis.readInt(); y = dis.readInt(); z = dis.readInt(); NBTTagCompound tag = - * Packet.readNBTTagCompound(dis); readFromNBT(tag); this.wattsReceived = dis.readDouble(); - * this.isOutput = dis.readBoolean(); } catch (IOException e) { e.printStackTrace(); } } } + * @Override public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) { if (worldObj.isRemote) { ByteArrayInputStream bis = new ByteArrayInputStream(packet.data); DataInputStream dis = new DataInputStream(bis); int id, x, y, z; try { id = dis.readInt(); x = dis.readInt(); y = dis.readInt(); z = dis.readInt(); NBTTagCompound tag = Packet.readNBTTagCompound(dis); readFromNBT(tag); this.wattsReceived = dis.readDouble(); this.isOutput = dis.readBoolean(); } catch (IOException e) { e.printStackTrace(); } } } */ /** @@ -249,11 +240,14 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota for (TileEntityChest chest : chests) { - for (int i = 0; i < chest.getSizeInventory(); i++) + if (chest != null) { - itemStack = this.addStackToInventory(i, chest, itemStack); - if (itemStack == null) - return null; + for (int i = 0; i < chest.getSizeInventory(); i++) + { + itemStack = this.addStackToInventory(i, chest, itemStack); + if (itemStack == null) + return null; + } } } } diff --git a/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java b/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java index 5b72dbb1..e8ba3f6d 100644 --- a/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java +++ b/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java @@ -52,32 +52,32 @@ import dan200.computer.api.IPeripheral; public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMultiBlock, IInventory, IPacketReceiver, IJouleStorage, IPeripheral { - private final CommandManager commandManager = new CommandManager(); - private static final int PACKET_COMMANDS = 128; + private final CommandManager commandManager = new CommandManager(); + private static final int PACKET_COMMANDS = 128; /** * The items this container contains. */ - protected ItemStack disk = null; - public final double WATT_REQUEST = 20; - public double wattsReceived = 0; - private int playerUsing = 0; - private int computersAttached = 0; - private List connectedComputers = new ArrayList(); + protected ItemStack disk = null; + public final double WATT_REQUEST = 20; + public double wattsReceived = 0; + private int playerUsing = 0; + private int computersAttached = 0; + private List connectedComputers = new ArrayList(); /** * The rotation of the arms. In Degrees. */ - public float rotationPitch = 0; - public float rotationYaw = 0; - public float renderPitch = 0; - public float renderYaw = 0; - private int ticksSincePower = 0; - public final float ROTATION_SPEED = 1.3f; + public float rotationPitch = 0; + public float rotationYaw = 0; + public float renderPitch = 0; + public float renderYaw = 0; + private int ticksSincePower = 0; + public final float ROTATION_SPEED = 1.3f; /** * An entity that the armbot is grabbed onto. */ - public final List grabbedEntities = new ArrayList(); + public final List grabbedEntities = new ArrayList(); @Override public void initiate() @@ -131,7 +131,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult { if (!this.commandManager.hasTasks()) { - if (Math.abs(this.rotationYaw - CommandReturn.IDLE_ROTATION_YAW) > 0.01) + if (Math.abs(this.rotationYaw - CommandReturn.IDLE_ROTATION_YAW) > 0.01 || Math.abs(this.rotationPitch - CommandReturn.IDLE_ROTATION_PITCH) > 0.01) { this.commandManager.addCommand(this, CommandReturn.class); } @@ -140,16 +140,15 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult this.commandManager.setCurrentTask(0); } - - if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) - this.commandManager.onUpdate(); - } + this.commandManager.onUpdate(); this.ticksSincePower = 0; } else { this.ticksSincePower++; + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && ticksSincePower < 20) + this.commandManager.onUpdate(); } for (Entity entity : this.grabbedEntities) @@ -282,7 +281,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult double distance = 1f; Vector3 delta = new Vector3(); // The delta Y of the hand. - delta.y = Math.sin(Math.toRadians(this.renderPitch)) * distance; + delta.y = Math.sin(Math.toRadians(this.renderPitch)) * distance * 2; //arm bend up in a taller-than-wide arc // The horizontal delta of the hand. double dH = Math.cos(Math.toRadians(this.renderPitch)) * distance; // The delta X and Z. @@ -674,9 +673,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult for (int i = 0; i < found.size(); i++) { if (found.get(i) != null && !(found.get(i) instanceof EntityPlayer) && found.get(i).ridingEntity == null) // isn't null, isn't a player, and isn't riding anything - { - return new Object[] { true }; - } + { return new Object[] { true }; } } } diff --git a/src/minecraft/assemblyline/common/machine/command/Command.java b/src/minecraft/assemblyline/common/machine/command/Command.java index e3920056..ad978cbb 100644 --- a/src/minecraft/assemblyline/common/machine/command/Command.java +++ b/src/minecraft/assemblyline/common/machine/command/Command.java @@ -33,6 +33,7 @@ public abstract class Command registerCommand("return", CommandReturn.class); registerCommand("repeat", CommandRepeat.class); registerCommand("use", CommandUse.class); + registerCommand("fire", CommandFire.class); } public static void registerCommand(String command, Class commandClass) diff --git a/src/minecraft/assemblyline/common/machine/command/CommandDrop.java b/src/minecraft/assemblyline/common/machine/command/CommandDrop.java index 96fc9c01..913d3974 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandDrop.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandDrop.java @@ -10,6 +10,9 @@ public class CommandDrop extends Command protected boolean doTask() { super.doTask(); + + if (this.tileEntity.grabbedEntities.size() == 0) + return false; // TODO: Animate Armbot to move down and drop all items. for (Entity entity : this.tileEntity.grabbedEntities) @@ -19,7 +22,8 @@ public class CommandDrop extends Command entity.isDead = false; entity.worldObj = this.tileEntity.worldObj; if (entity instanceof EntityItem) - world.spawnEntityInWorld(entity); //items don't move right, so we render them manually + if (!world.isRemote) + world.spawnEntityInWorld(entity); // items don't move right, so we render them manually this.world.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.pop", 0.2F, ((this.tileEntity.worldObj.rand.nextFloat() - this.tileEntity.worldObj.rand.nextFloat()) * 0.7F + 1.0F) * 1.0F, true); } } diff --git a/src/minecraft/assemblyline/common/machine/command/CommandFire.java b/src/minecraft/assemblyline/common/machine/command/CommandFire.java new file mode 100644 index 00000000..6553d200 --- /dev/null +++ b/src/minecraft/assemblyline/common/machine/command/CommandFire.java @@ -0,0 +1,98 @@ +package assemblyline.common.machine.command; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.Item; +import universalelectricity.core.vector.Vector3; + +public class CommandFire extends Command +{ + private static final float MIN_ACTUAL_PITCH = 0; + private static final float MAX_ACTUAL_PITCH = 100; + private static final float VELOCITY = 2f; + + private float actualYaw; + private float actualPitch; + private Vector3 finalVelocity; + + @Override + public void onTaskStart() + { + super.onTaskStart(); + this.actualYaw = this.tileEntity.rotationYaw; + this.actualPitch = ((MAX_ACTUAL_PITCH - MIN_ACTUAL_PITCH) * (this.tileEntity.rotationPitch / 60f)) + MIN_ACTUAL_PITCH; + + double x, y, z; + double yaw, pitch; + yaw = Math.toRadians(actualYaw); + pitch = Math.toRadians(actualPitch); + // yaw = actualYaw; + // pitch = actualPitch; + + x = Math.sin(yaw) * Math.cos(pitch); + y = Math.sin(pitch); + z = Math.cos(yaw) * Math.cos(pitch); + + this.finalVelocity = new Vector3(x, y, z); + + this.finalVelocity.multiply(VELOCITY); + } + + @Override + protected boolean doTask() + { + if (this.finalVelocity == null) // something went wrong + { + this.finalVelocity = new Vector3(0, 0, 0); + } + if (this.tileEntity.grabbedEntities.size() > 0) + { + Entity held = this.tileEntity.grabbedEntities.get(0); + if (held != null) + { + if (held instanceof EntityItem) + { + EntityItem item = (EntityItem) held; + if (item.func_92014_d().stackSize > 1) + { + item.func_92014_d().stackSize--; + } + else + { + this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[] {}).doTask(); + if (!this.world.isRemote) + this.world.removeEntity(held); + } + if (item.func_92014_d().itemID == Item.arrow.itemID) + { + EntityArrow arrow = new EntityArrow(world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z); + arrow.motionX = this.finalVelocity.x; + arrow.motionY = this.finalVelocity.y; + arrow.motionZ = this.finalVelocity.z; + if (!this.world.isRemote) + this.world.spawnEntityInWorld(arrow); + } + else + { + EntityItem item2 = new EntityItem(world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z, item.func_92014_d()); + item2.motionX = this.finalVelocity.x; + item2.motionY = this.finalVelocity.y; + item2.motionZ = this.finalVelocity.z; + if (!this.world.isRemote) + this.world.spawnEntityInWorld(item2); + } + } + else + { + this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[] {}).doTask(); + held.motionX = this.finalVelocity.x; + held.motionY = this.finalVelocity.y; + held.motionZ = this.finalVelocity.z; + } + } + } + + return false; + } +} diff --git a/src/minecraft/assemblyline/common/machine/command/CommandGrab.java b/src/minecraft/assemblyline/common/machine/command/CommandGrab.java index 792b843c..8dc0031c 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandGrab.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandGrab.java @@ -2,10 +2,10 @@ package assemblyline.common.machine.command; import java.util.List; -import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.util.AxisAlignedBB; import universalelectricity.core.vector.Vector3; @@ -34,6 +34,10 @@ public class CommandGrab extends Command protected boolean doTask() { super.doTask(); + + if (this.tileEntity.grabbedEntities.size() > 0) + return false; + Vector3 serachPosition = this.tileEntity.getHandPosition(); List found = this.world.getEntitiesWithinAABB(this.entityToInclude, AxisAlignedBB.getBoundingBox(serachPosition.x - radius, serachPosition.y - radius, serachPosition.z - radius, serachPosition.x + radius, serachPosition.y + radius, serachPosition.z + radius)); @@ -41,7 +45,7 @@ public class CommandGrab extends Command { for (int i = 0; i < found.size(); i++) { - if (found.get(i) != null && !(found.get(i) instanceof EntityPlayer) && found.get(i).ridingEntity == null) // isn't null, isn't a player, and isn't riding anything + if (found.get(i) != null && !(found.get(i) instanceof EntityPlayer) && !(found.get(i) instanceof EntityArrow) && found.get(i).ridingEntity == null) // isn't null, isn't a player, and isn't riding anything { this.tileEntity.grabbedEntities.add(found.get(i)); if (found.get(i) instanceof EntityItem) diff --git a/src/minecraft/assemblyline/common/machine/command/CommandManager.java b/src/minecraft/assemblyline/common/machine/command/CommandManager.java index 2c687785..0e4d448e 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandManager.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandManager.java @@ -6,15 +6,17 @@ import java.util.List; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import assemblyline.common.machine.armbot.TileEntityArmbot; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.relauncher.Side; public class CommandManager { - private final List tasks = new ArrayList(); + private final List tasks = new ArrayList(); - private int ticks = 0; - private int currentTask = 0; - private int lastTask = -1; + private int ticks = 0; + private int currentTask = 0; + private int lastTask = -1; /** * Must be called every tick by a tileEntity. @@ -44,24 +46,19 @@ public class CommandManager task.onTaskStart(); } - //System.out.print(Command.getCommandName(task.getClass()) + "|"); - + //System.out.println("curTask: " + currentTask); + if (!task.doTask()) { - // End the task and reinitiate it into a new class to make sure it is fresh. int tempCurrentTask = this.currentTask; - this.currentTask++; task.onTaskEnd(); - this.tasks.set(tempCurrentTask, this.getNewCommand(task.tileEntity, task.getClass(), task.getArgs())); + this.currentTask++; + if (!(task instanceof CommandRepeat)) //repeat needs to be persistent + { + // End the task and reinitialize it into a new class to make sure it is fresh. + this.tasks.set(tempCurrentTask, this.getNewCommand(task.tileEntity, task.getClass(), task.getArgs())); + } } - - /*for (Command command : this.tasks) - { - System.out.print(Command.getCommandName(command.getClass())); - System.out.print("; "); - } - - System.out.println(this.currentTask);*/ } else { @@ -99,8 +96,7 @@ public class CommandManager } /** - * Used to register Tasks for a TileEntity, executes onTaskStart for the Task after registering - * it + * Used to register Tasks for a TileEntity, executes onTaskStart for the Task after registering it * * @param tileEntity TE instance to register the task for * @param newCommand Task instance to register @@ -146,7 +142,7 @@ public class CommandManager public void setCurrentTask(int i) { - this.currentTask = Math.max(Math.min(i, this.tasks.size()), 0); + this.currentTask = Math.min(i, this.tasks.size()); } public int getCurrentTask() diff --git a/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java b/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java index 51a5f7fd..39cf84ce 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java @@ -11,23 +11,41 @@ public class CommandRepeat extends Command /** * The amount of tasks above this task to repeat. */ - private int tasksToRepeat; + private int tasksToRepeat; + private int numReps; + private int curReps; + private boolean initialized = false; public void onTaskStart() { this.tasksToRepeat = Math.max(this.getIntArg(0), 0); + this.numReps = this.getIntArg(1); + if (numReps == 0) + numReps = -1; // infinite + if (!this.initialized) + { + this.initialized = true; + this.curReps = 0; + } } @Override public void onTaskEnd() { - if (this.tasksToRepeat > 0) + if (this.curReps < this.numReps || this.numReps == -1) { - this.commandManager.setCurrentTask(this.commandManager.getCurrentTask() - this.tasksToRepeat); - } - else - { - this.commandManager.setCurrentTask(0); + this.curReps++; + if (this.tasksToRepeat > 0) + { + this.commandManager.setCurrentTask(this.commandManager.getCurrentTask() - this.tasksToRepeat - 1); + return; + } + else + { + this.commandManager.setCurrentTask(-1); + return; + } } + this.initialized = false; } } diff --git a/src/minecraft/assemblyline/common/machine/command/CommandUse.java b/src/minecraft/assemblyline/common/machine/command/CommandUse.java index 80b88f9f..f47a2c66 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandUse.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandUse.java @@ -1,49 +1,49 @@ -package assemblyline.common.machine.command; - -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import assemblyline.api.IArmbotUseable; - -public class CommandUse extends Command -{ - private int times; - private int curTimes; - - @Override - public void onTaskStart() - { - times = 0; - curTimes = 0; - - if (this.getArgs().length > 0) - { - times = this.getIntArg(0); - } - - if (times <= 0) - times = 1; - } - - @Override - protected boolean doTask() - { - TileEntity handTile = this.tileEntity.getHandPosition().getTileEntity(this.world); - Entity handEntity = null; - if (this.tileEntity.grabbedEntities.size() > 0) - handEntity = this.tileEntity.grabbedEntities.get(0); - if (handTile != null) - { - if (handTile instanceof IArmbotUseable) - { - ((IArmbotUseable) handTile).onUse(this.tileEntity, handEntity); - } - } - - curTimes++; - - if (curTimes >= times) - return false; - - return true; - } -} +package assemblyline.common.machine.command; + +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; +import assemblyline.api.IArmbotUseable; + +public class CommandUse extends Command +{ + private int times; + private int curTimes; + + @Override + public void onTaskStart() + { + times = 0; + curTimes = 0; + + if (this.getArgs().length > 0) + { + times = this.getIntArg(0); + } + + if (times <= 0) + times = 1; + } + + @Override + protected boolean doTask() + { + TileEntity handTile = this.tileEntity.getHandPosition().getTileEntity(this.world); + Entity handEntity = null; + if (this.tileEntity.grabbedEntities.size() > 0) + handEntity = this.tileEntity.grabbedEntities.get(0); + if (handTile != null) + { + if (handTile instanceof IArmbotUseable) + { + ((IArmbotUseable) handTile).onUse(this.tileEntity, handEntity); + } + } + + curTimes++; + + if (curTimes >= times) + return false; + + return true; + } +}