This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
component:transposer:zh [2023/11/05 11:13] hfsr |
component:transposer:zh [2023/12/27 04:25] hfsr [组件:转运器] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | Component: Transposer | + | 组件:转运器 |
===================== | ===================== | ||
- | This component is provided by the [[block:transposer|Transposer]]. | + | 此组件由[[block:transposer|转运器]]提供。 |
+ | |||
+ | 组件名:`transposer`。 | ||
+ | |||
+ | 回调函数: | ||
- | Component name: `transposer`. | ||
- | |||
- | Callbacks: | ||
- `transferFluid(sourceSide:number, sinkSide:number, count:number):boolean, number` | - `transferFluid(sourceSide:number, sinkSide:number, count:number):boolean, number` | ||
- | Transfer some fluids between two fluid handlers (pipes or tanks, etc). `sourceSide` is the side pulled from and `sinkSide` is the side transferred to. The side value is a integral value representing the cardinal directions (east, west, south, north), up, and down. The `sides` library has these values for convenience. `count` is the number of millibuckets to transfers. Returns true and the number of millibuckets transfered on success, or false and an error message on failure. | + | 在两个可处理流体的设备(例如管道或储罐)之间转移一定量流体。`sourceSide`为抽取流体的方向,`sinkSide`为转移到的方向。上述方向值为整数,分别代表罗盘方向(东西南北)与上下。`sides`运行库中已经包含了这些方向,可以带来方便。`count`代表要传输的量,单位为毫桶(mb),默认值为1000。 |
+ | 若成功,函数返回`true`以及转移的流体量(毫桶),若失败返回`false`与报错信息。 | ||
+ | \\ | ||
- `store(side:number, slot:number, dbAddress:string, dbSlot:number):boolean` | - `store(side:number, slot:number, dbAddress:string, dbSlot:number):boolean` | ||
- | Store an item stack description in the specified slot of the database with the specified address. | + | 将某个物品堆的信息存储于指定数据库的指定槽位中。 |
+ | \\ | ||
- `compareStackToDatabase(side:number, slot:number, dbAddress:string, dbSlot:number, checkNBT:boolean=false):boolean` | - `compareStackToDatabase(side:number, slot:number, dbAddress:string, dbSlot:number, checkNBT:boolean=false):boolean` | ||
- | Compare an item in the specified slot in the inventory on the specified side with one in the database with the specified address. | + | 将在指定方向处物品容器指定槽位中的物品,与指定地址对应数据库的指定槽位中的物品信息进行比较。 |
+ | \\ | ||
- `getSlotStackSize(side:number, slot:number):number` | - `getSlotStackSize(side:number, slot:number):number` | ||
- | Get number of items in the specified slot of the inventory on the specified side of the device. | + | 获取设备指定方向处物品容器指定槽位中的物品数量。 |
+ | \\ | ||
- `getSlotMaxStackSize(side:number, slot:number):number` | - `getSlotMaxStackSize(side:number, slot:number):number` | ||
- | Get the maximum number of items in the specified slot of the inventory on the specified side of the device. | + | 获取设备指定方向处物品容器指定槽位中的物品堆叠数量最大值。 |
+ | \\ | ||
- `getInventoryName(side:number):string` | - `getInventoryName(side:number):string` | ||
- | Get the the name of the inventory on the specified side of the device. | + | 获取设备指定方向处物品容器的名称。 |
+ | \\ | ||
- `getInventorySize(side:number):number` | - `getInventorySize(side:number):number` | ||
- | Get the number of slots in the inventory on the specified side of the device. | + | 获取设备指定方向处物品容器的槽位数量。 |
+ | \\ | ||
- `getFluidInTank(side:number , tank:number):table` | - `getFluidInTank(side:number , tank:number):table` | ||
- | Get a description of the fluid in the the specified tank on the specified side. | + | 获取指定方向处储罐中所存储流体的信息。 |
+ | \\ | ||
- `getTankLevel(side:number , tank:number):number` | - `getTankLevel(side:number , tank:number):number` | ||
- | Get the amount of fluid in the specified tank on the specified side. | + | 获取指定方向处储罐中所存储流体的数量。 |
+ | \\ | ||
- `transferItem(sourceSide:number, sinkSide:number, count:number, sourceSlot:number, sinkSlot:number):number` | - `transferItem(sourceSide:number, sinkSide:number, count:number, sourceSlot:number, sinkSlot:number):number` | ||
- | Transfer some items between two inventories. | + | 在两个物品容器间转移一定量物品。 |
+ | \\ | ||
- `compareStacks(side:number, slotA:number, slotB:number, checkNBT:boolean=false):boolean` | - `compareStacks(side:number, slotA:number, slotB:number, checkNBT:boolean=false):boolean` | ||
- | Get whether the items in the two specified slots of the inventory on the specified side of the device are of the same type. | + | 获取设备指定方向处物品容器中,两个指定槽位中所存储物品是否类型相同。 |
+ | \\ | ||
- `areStacksEquivalent(side:number, slotA:number, slotB:number):boolean` | - `areStacksEquivalent(side:number, slotA:number, slotB:number):boolean` | ||
- | Get whether the items in the two specified slots of the inventory on the specified side of the device are equivalent (have shared OreDictionary IDs). | + | 获取设备指定方向处物品容器中,两个指定槽位中所存储物品是否等价(矿物词典ID相同)。 |
+ | \\ | ||
- `getTankCount(side:number):number` | - `getTankCount(side:number):number` | ||
- | Get the number of tanks available on the specified side. | + | 获取指定方向处可用的储罐数量。 |
+ | \\ | ||
- `getStackInSlot(side:number, slot:number):table` | - `getStackInSlot(side:number, slot:number):table` | ||
- | Get a description of the stack in the inventory on the specified side of the device. | + | 获取设备指定方向处物品容器指定槽位中物品的信息。 |
+ | \\ | ||
- `getTankCapacity(side:number , tank:number):number` | - `getTankCapacity(side:number , tank:number):number` | ||
- | Get the capacity of the specified tank on the specified side. | + | 获取指定方向处指定储罐的容量。 |
+ | \\ | ||
- `getAllStacks(side:number):userdata` | - `getAllStacks(side:number):userdata` | ||
- | Get a description of all stacks in the inventory on the specified side of the device. | + | 获取指定方向处物品容器中所有物品的信息。 |
- | The return value is callable. Calling it will return a table describing the stack in the inventory or nothing if the iterator reaches end. | + | 返回值可被调用。调用它则会返回描述物品栏中某个物品堆的表,若迭代器到达末尾,则什么都不会返回。 |
- | The return value provides the followings callbacks: | + | 此返回值提供以下回调: |
`getAll():table` | `getAll():table` | ||
- | Returns ALL the stack in the this.array. Memory intensive. | + | 返回this.array中的**所有**物品堆信息。需要大量内存。 |
`count():number` | `count():number` | ||
- | Returns the number of elements in the this.array. | + | 返回this.array中的元素数量。 |
`reset()` | `reset()` | ||
- | Reset the iterator index so that the next call will return the first element. | + | 重置迭代器索引号,这样下次调用时会从首个元素开始迭代。 |
目录 | 目录 |