public interface ITurtleAccess
ITurtleUpgrade
.Modifier and Type | Method and Description |
---|---|
void |
addFuel(int fuel)
Increase the turtle's fuel level by the given amount.
|
boolean |
consumeFuel(int fuel)
Removes some fuel from the turtles fuel supply.
|
java.lang.Object[] |
executeCommand(ILuaContext context,
ITurtleCommand command)
Adds a custom command to the turtles command queue.
|
int |
getColour()
Get the colour of this turtle as a RGB number.
|
EnumFacing |
getDirection()
Returns the world direction the turtle is currently facing.
|
int |
getFuelLevel()
Get the current fuel level of this turtle.
|
int |
getFuelLimit()
Get the maximum amount of fuel a turtle can hold.
|
IInventory |
getInventory()
Get the inventory of this turtle
|
IItemHandlerModifiable |
getItemHandler()
Get the inventory of this turtle as an
IItemHandlerModifiable . |
IPeripheral |
getPeripheral(TurtleSide side)
Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one.
|
BlockPos |
getPosition()
Returns a vector containing the integer co-ordinates at which the turtle resides.
|
int |
getSelectedSlot()
Get the currently selected slot in the turtle's inventory.
|
ITurtleUpgrade |
getUpgrade(TurtleSide side)
Returns the turtle on the specified side of the turtle, if there is one.
|
NBTTagCompound |
getUpgradeNBTData(TurtleSide side)
Get an upgrade-specific NBT compound, which can be used to store arbitrary data.
|
Vec3d |
getVisualPosition(float f)
Returns a vector containing the floating point co-ordinates at which the turtle is rendered.
|
float |
getVisualYaw(float f)
Returns the yaw the turtle is facing when it is rendered.
|
World |
getWorld()
Returns the world in which the turtle resides.
|
boolean |
isFuelNeeded()
Determine whether this turtle will require fuel when performing actions.
|
void |
playAnimation(TurtleAnimation animation)
Start playing a specific animation.
|
void |
setColour(int colour)
Set the colour of the turtle to a RGB number.
|
void |
setDirection(EnumFacing dir)
Set the direction the turtle is facing.
|
void |
setFuelLevel(int fuel)
Set the fuel level to a new value.
|
void |
setSelectedSlot(int slot)
Set the currently selected slot in the turtle's inventory.
|
void |
setUpgrade(TurtleSide side,
ITurtleUpgrade upgrade)
Set the upgrade for a given side, resetting peripherals and clearing upgrade specific data.
|
boolean |
teleportTo(World world,
BlockPos pos)
Attempt to move this turtle to a new position.
|
void |
updateUpgradeNBTData(TurtleSide side)
Mark the upgrade-specific data as dirty on a specific side.
|
World getWorld()
BlockPos getPosition()
boolean teleportTo(World world, BlockPos pos)
playAnimation(TurtleAnimation)
.world
- The new world to move it topos
- The new position to move it to.ITurtlePermissionProvider.isBlockEnterable(World, BlockPos)
.java.lang.UnsupportedOperationException
- When attempting to teleport on the client side.Vec3d getVisualPosition(float f)
f
- The subframe fraction.getVisualYaw(float)
float getVisualYaw(float f)
f
- The subframe fraction.getVisualPosition(float)
EnumFacing getDirection()
setDirection(EnumFacing)
void setDirection(EnumFacing dir)
playAnimation(TurtleAnimation)
to do so.dir
- The new direction to set. This should be on either the x or z axis (so north, south, east or west).getDirection()
int getSelectedSlot()
getInventory()
,
setSelectedSlot(int)
void setSelectedSlot(int slot)
slot
- The slot to set. This must be greater or equal to 0 and less than the inventory size. Otherwise no
action will be taken.java.lang.UnsupportedOperationException
- When attempting to change the slot on the client side.getInventory()
,
getSelectedSlot()
void setColour(int colour)
colour
- The colour this turtle should be changed to. This should be a RGB colour between 0x000000
and 0xFFFFFF
or -1 to reset to the default colour.getColour()
int getColour()
0x000000
and 0xFFFFFF
or
-1 if it has no colour.setColour(int)
IInventory getInventory()
getItemHandler()
IItemHandlerModifiable getItemHandler()
IItemHandlerModifiable
.getInventory()
,
IItemHandlerModifiable
,
net.minecraftforge.items.CapabilityItemHandler#ITEM_HANDLER_CAPABILITY
boolean isFuelNeeded()
getFuelLevel()
,
setFuelLevel(int)
int getFuelLevel()
isFuelNeeded()
,
setFuelLevel(int)
void setFuelLevel(int fuel)
consumeFuel(int)
} or addFuel(int)
instead.fuel
- The new amount of fuel. This must be between 0 and the fuel limit.getFuelLevel()
,
getFuelLimit()
,
addFuel(int)
,
consumeFuel(int)
int getFuelLimit()
boolean consumeFuel(int fuel)
fuel
- The amount of fuel to consume.false
is returned.java.lang.UnsupportedOperationException
- When attempting to consume fuel on the client side.void addFuel(int fuel)
fuel
- The amount to refuel with.java.lang.UnsupportedOperationException
- When attempting to refuel on the client side.java.lang.Object[] executeCommand(ILuaContext context, ITurtleCommand command) throws LuaException, java.lang.InterruptedException
context
- The Lua context to pull events from.command
- An object which will execute the custom command when its point in the queue is reachedjava.lang.UnsupportedOperationException
- When attempting to execute a command on the client side.LuaException
- If the user presses CTRL+T to terminate the current program while executeCommand()
is
waiting for an event, a "Terminated" exception will be thrown here.java.lang.InterruptedException
- If the user shuts down or reboots the computer while pullEvent() is waiting for an
event, InterruptedException will be thrown. This exception must not be caught or
intercepted, or the computer will leak memory and end up in a broken state.ITurtleCommand
,
ILuaContext.pullEvent(String)
void playAnimation(TurtleAnimation animation)
animation
- The animation to play.java.lang.UnsupportedOperationException
- When attempting to execute play an animation on the client side.TurtleAnimation
ITurtleUpgrade getUpgrade(TurtleSide side)
side
- The side to get the upgrade from.setUpgrade(TurtleSide, ITurtleUpgrade)
void setUpgrade(TurtleSide side, ITurtleUpgrade upgrade)
side
- The side to set the upgrade on.upgrade
- The upgrade to set, may be null
to clear.getUpgrade(TurtleSide)
IPeripheral getPeripheral(TurtleSide side)
side
- The side to get the peripheral from.null
if none exists.NBTTagCompound getUpgradeNBTData(TurtleSide side)
updateUpgradeNBTData(TurtleSide)
after modifying it.side
- The side to get the upgrade data for.updateUpgradeNBTData(TurtleSide)
void updateUpgradeNBTData(TurtleSide side)
side
- The side to mark dirty.updateUpgradeNBTData(TurtleSide)