ocrsdriver
OpenComputers + Refined Storage = ❤️
允许 OpenComputers 通过适配器访问 Refined Storage 网格节点。此模组适用于 Minecraft 1.10.2。Refined Storage 在 1.11.2 版本中已默认包含此功能。
已知问题
- 目前该功能未受限制,即你可以仅使用线缆快速导出物品和流体。
可用命令
| 方法 |
描述 |
| isConnected() |
返回网格节点是否已连接到网络 |
| getEnergyUsage() |
返回整个网络的能量消耗(以 RS/tick 为单位) |
| getItems() |
返回网络中存储的所有物品栈列表 |
| getItem(itemstack, cmpMeta, cmpNbt, cmpOre) |
返回网络中与给定物品栈匹配的栈 |
| extractItem(itemstack, amount, side) |
将指定数量的物品栈提取到指定侧面,并返回传输的物品数量。 |
| getFluids() |
返回网络中存储的所有流体栈列表 |
| getFluid(fluidstack) |
返回网络中与给定流体栈匹配的栈 |
| extractFluid(fluidstack, amount, side) |
将指定数量的流体提取到指定侧面,并返回传输的毫桶数。 |
| getTasks() |
返回系统当前队列中的所有合成任务列表 |
| getPatterns() |
返回网络中的所有合成配方列表 |
| hasPattern(itemstack) |
如果系统拥有给定物品栈的配方,则返回 true |
| getMissingItems(itemstack, amount) |
返回合成指定数量给定物品栈所缺失的所有物品列表 |
| craftItem(itemstack, amount) |
请求合成指定数量的指定物品 |
| cancelCrafting(itemstack) |
取消给定物品栈的所有合成操作,并返回取消的任务数量 |
示例
丢弃所有超过 8192 个的物品
将一个垃圾桶放置在连接到 OpenComputers 适配器的接口下方。
local component = require("component")
local sides = require("sides")
local rs = component.block_refinedstorage_interface
local limit = 8192
local side = sides.down
for i,stack in ipairs(rs.getItems()) do
while(stack.size > limit) do
local dropped = rs.extractItem(stack, stack.size - limit, side)
stack.size = stack.size - dropped
if(dropped < 1) then
break
end
end
end
在合成系统中保留 64 个火把和杠杆
别忘了教合成器火把和杠杆的合成配方
local component = require("component")
local sides = require("sides")
local rs = component.block_refinedstorage_interface
local targetAmount = 64
local items = {
{name = "minecraft:torch"},
{name = "minecraft:lever"}
}
while(true) do
for i,stack in ipairs(items) do
if(rs.hasPattern(stack)) then
local rsStack = rs.getItem(stack)
<span>local</span> toCraft <span>=</span> targetAmount;
<span>if</span>(rsStack <span>~=</span> <span>nil</span>) <span>then</span>
toCraft <span>=</span> toCraft <span>-</span> rsStack.<span>size</span>
<span>end</span>
<span>if</span>(toCraft <span>></span> <span>0</span>) <span>then</span>
rs.<span>craftItem</span>(stack, toCraft)
<span>end</span>
<span>else</span>
<span>print</span>(<span><span>"</span>Missing pattern for: <span>"</span></span> <span>..</span> stack.<span>name</span>)
<span>end</span>
<span>end</span>
os.<span>sleep</span>(<span>5</span>)
end
ocrsdriver
OpenComputers + Refined Storage = ❤️
Allows OpenComputers to access Refined Storage grid nodes via Adapters. This is for Minecraft 1.10.2. Refined Storage for 1.11.2 has this functionality included by default.
Known Issues
- This is currently unrestricted, i.e. you can export items and fluids using just a cable - and fast.
Available Commands
| Method |
Description |
| isConnected() |
Returns whether the grid node is connected to a network |
| getEnergyUsage() |
Returns the energy usage of the whole network in RS/tick |
| getItems() |
Returns a list of all itemstacks stored in the network |
| getItem(itemstack, cmpMeta, cmpNbt, cmpOre) |
Returns a stack in the network matching the given itemstack |
| extractItem(itemstack, amount, side) |
Extracts the given amount of itemstack to the specified side and returns the number of transfered items. |
| getFluids() |
Returns a list of all fluid stacks stored in the network |
| getFluid(fluidstack) |
Returns a stack in the network matching the given fluidstack |
| extractFluid(fluidstack, amount, side) |
Extracts the given amount of fluid to the specified side and returns the amount of millibuckets transfered. |
| getTasks() |
Returns a list of crafting tasks the system has currently queued |
| getPatterns() |
Returns a list of all crafting patterns in the network |
| hasPattern(itemstack) |
Returns true if the system has a pattern for the given itemstack |
| getMissingItems(itemstack, amount) |
Returns a list of all items missing to craft the given itemstack in the given amount |
| craftItem(itemstack, amount) |
Requests crafting of the specified item in the specified quantity |
| cancelCrafting(itemstack) |
Cancels all crafting operations for the given itemstack and returns the number of cancelled tasks |
Examples
Drop all items you got more than 8192 of
Place a Trash Can below an interface connected to an OpenComputers Adapter.
local component = require("component")
local sides = require("sides")
local rs = component.block_refinedstorage_interface
local limit = 8192
local side = sides.down
for i,stack in ipairs(rs.getItems()) do
while(stack.size > limit) do
local dropped = rs.extractItem(stack, stack.size - limit, side)
stack.size = stack.size - dropped
if(dropped < 1) then
break
end
end
end
Keep 64 torches and levers in your crafting system
Don't forget to teach a crafter the recipe for torches and levers
local component = require("component")
local sides = require("sides")
local rs = component.block_refinedstorage_interface
local targetAmount = 64
local items = {
{name = "minecraft:torch"},
{name = "minecraft:lever"}
}
while(true) do
for i,stack in ipairs(items) do
if(rs.hasPattern(stack)) then
local rsStack = rs.getItem(stack)
<span>local</span> toCraft <span>=</span> targetAmount;
<span>if</span>(rsStack <span>~=</span> <span>nil</span>) <span>then</span>
toCraft <span>=</span> toCraft <span>-</span> rsStack.<span>size</span>
<span>end</span>
<span>if</span>(toCraft <span>></span> <span>0</span>) <span>then</span>
rs.<span>craftItem</span>(stack, toCraft)
<span>end</span>
<span>else</span>
<span>print</span>(<span><span>"</span>Missing pattern for: <span>"</span></span> <span>..</span> stack.<span>name</span>)
<span>end</span>
<span>end</span>
os.<span>sleep</span>(<span>5</span>)
end
评论 0
登录后参与评分
还没有评论,来抢沙发吧