blob: 68cf3fd7771902d4ac3643eff12bb07519278e02 [file] [log] [blame] [raw]
Florian Nücke61f53b92013-08-20 21:03:38 +02001/**
2 * This file is part of the public ComputerCraft API - http://www.computercraft.info
3 * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only.
4 * For help using the API, and posting your mods, visit the forums at computercraft.info.
5 */
6
7package dan200.computer.api;
8import dan200.computer.api.IPeripheral;
9
10/**
11 * A subclass of IPeripheral specifically for peripherals
12 * created by ITurtleUpgrade's of type Peripheral. When an
13 * IHostedPeripheral is created, its IPeripheral methods will be called
14 * just as if the peripheral was a seperate adjacent block in the world,
15 * and update() will be called once per tick.
16 * @see ITurtleUpgrade
17 */
18public interface IHostedPeripheral extends IPeripheral
19{
20 /**
21 * A method called on each hosted peripheral once per tick, on the main thread
22 * over the lifetime of the turtle or block. May be used to update the state
23 * of the peripheral, and may interact with IComputerAccess or ITurtleAccess
24 * however it likes at this time.
25 */
26 public void update();
27
28 /**
29 * A method called whenever data is read from the Turtle's NBTTag,
30 * over the lifetime of the turtle. You should only use this for
31 * reading data you want to stay with the peripheral.
32 * @param nbttagcompound The peripheral's NBTTag
33 */
34 public void readFromNBT( net.minecraft.nbt.NBTTagCompound nbttagcompound );
35
36 /**
37 * A method called whenever data is written to the Turtle's NBTTag,
38 * over the lifetime of the turtle. You should only use this for
39 * writing data you want to stay with the peripheral.
40 * @param nbttagcompound The peripheral's NBTTag.
41 * @param ID The turtle's ID.
42 */
43 public void writeToNBT( net.minecraft.nbt.NBTTagCompound nbttagcompound );
44}