Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into OC1.6-MC1.7.10

This commit is contained in:
Florian Nücke 2016-04-16 16:17:45 +02:00
commit b9869d5b92
144 changed files with 1660 additions and 627 deletions

View File

@ -222,6 +222,10 @@ dependencies {
compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs.
embedded files('libs/OpenComputers-JNLua.jar', 'libs/OpenComputers-LuaJ.jar')
testCompile "org.mockito:mockito-all:1.10.19"
testCompile "org.scalactic:scalactic_2.11:2.2.6"
testCompile "org.scalatest:scalatest_2.11:2.2.6"
}
idea.module.scopes.PROVIDED.plus += [configurations.provided]

Binary file not shown.

View File

@ -17,7 +17,8 @@ public interface Memory extends Item {
* This factor has to be interpreted by each individual architecture to fit
* its own memory needs. The actual values returned here should roughly be
* equivalent to the item's tier. For example, the built-in memory modules
* provide 1 for tier one, 2 for tier 1.5, 3 for tier 2, etc.
* provide defaults of 192 for tier one, 256 for tier 1.5, 384 for tier 2, etc.
* Mind that those values may be changed in the config file.
*
* @param stack the item to get the provided memory for.
* @return the amount of memory the specified component provides.

View File

@ -19,7 +19,9 @@ import net.minecraftforge.oredict.OreDictionary;
* any.
*
* @see li.cil.oc.api.network.ManagedEnvironment
* @deprecated Use {@link DriverSidedBlock} instead.
*/
@Deprecated // TODO Remove in OC 1.7
@SuppressWarnings("UnusedDeclaration")
public abstract class DriverBlock implements li.cil.oc.api.driver.Block {
protected final ItemStack[] blocks;

View File

@ -0,0 +1,53 @@
package li.cil.oc.api.prefab;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
/**
* If you wish to create a block component for a third-party block, i.e. a block
* for which you do not control the tile entity, such as vanilla blocks, you
* will need a block driver.
* <p/>
* This prefab allows creating a driver that works for a specified list of item
* stacks (to support different blocks with the same id but different metadata
* values).
* <p/>
* You still have to provide the implementation for creating its environment, if
* any.
* <p/>
* To limit sidedness, I recommend overriding {@link #worksWith(World, int, int, int, ForgeDirection)}
* and calling <code>super.worksWith</code> in addition to the side check.
*
* @see li.cil.oc.api.network.ManagedEnvironment
*/
@SuppressWarnings("UnusedDeclaration")
public abstract class DriverSidedBlock implements li.cil.oc.api.driver.SidedBlock {
protected final ItemStack[] blocks;
protected DriverSidedBlock(final ItemStack... blocks) {
this.blocks = blocks.clone();
}
@Override
public boolean worksWith(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return worksWith(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
}
protected boolean worksWith(final Block referenceBlock, final int referenceMetadata) {
for (ItemStack stack : blocks) {
if (stack != null && stack.getItem() instanceof ItemBlock) {
final ItemBlock item = (ItemBlock) stack.getItem();
final Block supportedBlock = item.field_150939_a;
final int supportedMetadata = item.getMetadata(stack.getItemDamage());
if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) {
return true;
}
}
}
return false;
}
}

View File

@ -0,0 +1,25 @@
package li.cil.oc.api.prefab;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* To limit sidedness, I recommend overriding {@link #worksWith(World, int, int, int, ForgeDirection)}
* and calling <code>super.worksWith</code> in addition to the side check.
*/
public abstract class DriverSidedTileEntity implements li.cil.oc.api.driver.SidedBlock {
public abstract Class<?> getTileEntityClass();
@Override
public boolean worksWith(final World world, final int x, final int y, final int z, final ForgeDirection side) {
final Class<?> filter = getTileEntityClass();
if (filter == null) {
// This can happen if filter classes are deduced by reflection and
// the class in question is not present.
return false;
}
final TileEntity tileEntity = world.getTileEntity(x, y, z);
return tileEntity != null && filter.isAssignableFrom(tileEntity.getClass());
}
}

View File

@ -3,6 +3,10 @@ package li.cil.oc.api.prefab;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
/**
* @deprecated Use {@link DriverSidedTileEntity} instead.
*/
@Deprecated // TODO Remove in OC 1.7
public abstract class DriverTileEntity implements li.cil.oc.api.driver.Block {
public abstract Class<?> getTileEntityClass();

View File

@ -72,10 +72,10 @@ opencomputers {
# Defaults to white, feel free to make it some other color, tho!
monochromeColor: 0xFFFFFF
# Which font renderer to use. Defaults to `unifont` if invalid.
# Which font renderer to use. Defaults to `hexfont` if invalid.
# Possible values:
# - unifont: the (since 1.3.2) default font renderer. Based on the
# Unifont and capable of rendering many unicode glyphs.
# - hexfont: the (since 1.3.2) default font renderer. Font in .hex format
# capable of rendering many unicode glyphs.
# The used font data can be swapped out using resource packs,
# but is harder to work with, since it involves binary data.
# - texture: the old, font-texture based font renderer that was used
@ -84,7 +84,7 @@ opencomputers {
# is slightly less efficient than the new one, and more
# importantly, can only render code page 437 (as opposed to...
# a *lot* of unicode).
fontRenderer: "unifont"
fontRenderer=hexfont
# The sample rate used for generating beeps of computers' internal
# speakers. Use custom values at your own responsibility here; if it
@ -106,6 +106,12 @@ opencomputers {
# treated as relative positions, values in [1, inf) will be treated as
# absolute positions.
nanomachineHudPos: [-1, -1]
# Whether to emit particle effects around players via nanomachines. This
# includes the basic particles giving a rough indication of the current
# power level of the nanomachines as well as particles emitted by the
# particle effect behaviors.
enableNanomachinePfx: true
}
# Computer related settings, concerns server performance and security.
@ -248,6 +254,14 @@ opencomputers {
# scaled up to 96KB, `computer.totalMemory` will return 64KB, and if there
# are really 45KB free, `computer.freeMemory` will return 32KB.
ramScaleFor64Bit: 1.8
# The total maximum amount of memory a Lua machine may use for user
# programs. The total amount made available by components cannot
# exceed this. The default is 64*1024*1024. Keep in mind that this does
# not include memory reserved for built-in code such as `machine.lua`.
# IMPORTANT: DO NOT MESS WITH THIS UNLESS YOU KNOW WHAT YOU'RE DOING.
# IN PARTICULAR, DO NOT REPORT ISSUES AFTER MESSING WITH THIS!
maxTotalRam: 67108864
}
}
@ -822,6 +836,7 @@ opencomputers {
IndustrialCraft2: 400.0
Mekanism: 1333.33
RedstoneFlux: 100.0
RotaryCraft: 200.0 # / 11256, same as AE2
}
}
@ -1465,7 +1480,7 @@ opencomputers {
# Logs information about malformed glyphs (i.e. glyphs that deviate in
# width from what wcwidth says).
logUnifontErrors: false
logHexFontErrors: false
# Extract the native library with Lua into the system's temporary
# directory instead of the game directory (e.g. /tmp on Linux). The

View File

@ -1,9 +1,7 @@
# Server Rack
# Rack
![Free housing.](oredict:oc:serverRack)
![Free housing.](oredict:oc:rack)
A server rack houses up to four [servers](../item/server1.md). A [server](../item/server1.md) is a higher tier [computer](../general/computer.md), which can only run when inside a server rack. [Servers](../item/server1.md) can be remote controlled using a [remote terminal](../item/terminal.md). The number of [remote terminals](../item/terminal.md) that can be connected to a single [server](../item/server1.md) at a time depends on the tier of the [server](../item/server1.md). The distance up to which the [remote terminal](../item/terminal.md) work can be configured in the rack's GUI. Higher values have require more energy.
A rack houses up to four rack mountables such as [servers](../item/server1.md), [terminal servers](../item/terminalServer.md) and [mountable disk drives](../item/diskDriveMountable.md). Connectivity of mountables in a rack can be configured in detail via the GUI. In particular, if [servers](../item/server1.md) contain components that support it, such as [network cards](../item/lanCard.md), network-only connections can be defined for those components. These connections will serve purely for passing along network messages, components will not be visible through them. Such network-only connections are differentiated by the lines being slimmer than the "main" connections, which also allow component access. Each internal connection must be between a mountable / component in a mountable and a bus connected to a side of the rack. To connect multiple mountables to each other, connect them to the same bus.
Each [server](../item/server1.md) in a server rack can only communicate with one "face" of the server rack at a time - or none at all. Which side each [server](../item/server1.md) is connected to can be configured in the server rack's GUI. Beware that the sides are from the point of view of the server rack, i.e. if you are looking at the front of the server rack, `sides.right` will be to your left and vice versa.
Server racks act as [relay](relay.md) and [power distributor](powerDistributor.md) in one. The switch mode of the server rack can be configured in its GUI, with the two options being internal and external. In external mode the server rack will behave like a normal [relay](relay.md). In internal mode, messages are only passed to the [servers](../item/server1.md) in the rack, and will not be automatically relayed to the other faces of the rack. [Servers](../item/server1.md) will still be able to send messages to each other. This allows using server racks as advanced [relays](relay.md) that can perform filter and mapping operations, for example.
Racks also act as [relay](relay.md) and [power distributor](powerDistributor.md) in one. Whether it acts as a relay or not can be configured in the rack's GUI, it being enabled being indicated by a connector line between the side buses.

View File

@ -0,0 +1,5 @@
# Mountable Disk Drive
![Snuggly](oredict:oc:diskDriveMountable)
This device is functionally equivalent to a regular [disk drive](../block/diskDrive.md), except that it is installed in a [rack](../block/rack.md).

View File

@ -53,6 +53,11 @@ Keep in mind that some of these may not be available, depending on the recipe se
* [Trading Upgrade](tradingUpgrade.md)
* [Upgrade Container](upgradeContainer1.md)
### Rack Mountables
* [Disk Drive](diskDriveMountable.md)
* [Server](server1.md)
* [Terminal Server](terminalServer.md)
### Other
* [APU](apu1.md)
* [Component Bus](componentBus1.md)

View File

@ -2,7 +2,7 @@
![Serves u right.](oredict:oc:server1)
Servers are a form of higher tier [computer](../general/computer.md). They can be configured by holding them in the hand and using them - like opening a backpack or Ender pouch, for example. After inserting a [CPU](cpu1.md), [memory](ram1.md) and Expansion cards, the server has to be placed inside a [rack](../block/rack.md). For more information see the [rack](../block/rack.md) entry.
Servers are a form of higher tier [computer](../general/computer.md). They can be configured by holding them in the hand and using them - like opening a backpack or Ender pouch, for example. The can also be configured after having been installed into a [rack](../block/rack.md) by activating them (aiming at the corresponding position on the front face on the [rack](../block/rack.md)). To operate, the server has to be placed inside a [rack](../block/rack.md). For more information see the [rack](../block/rack.md) entry.
The tier 1 server is capable of taking the following components:
- 1x tier 2 [CPU](cpu2.md)

View File

@ -2,8 +2,8 @@
![Remote access.](oredict:oc:terminal)
The remote terminal can be used to remotely control [servers](server1.md). To use it, sneak-activate a server that is installed in a [rack](../block/rack.md) (click on the [rack](../block/rack.md) block in the world, targeting the [server](server1.md) to bind the terminal to).
The remote terminal can be used to remotely control computers via [terminal servers](terminalServer.md). To use it, activate a [terminal server](terminalServer.md) that is installed in a [rack](../block/rack.md) (click on the [rack](../block/rack.md) block in the world, targeting the [terminal server](terminalServer.md) to bind the terminal to).
When a terminal is bound to a [server](server1.md), a virtual [screen](../block/screen1.md) and [keyboard](../block/keyboard.md) get connected to the server. This can lead to unexpected behavior if another real screen and/or keyboard is connected to the server, so this should be avoided. When using the terminal in hand after binding it, a GUI will open in the same manner as a [keyboard](../block/keyboard.md) attached to a [screen](../block/screen1.md).
A [terminal server](terminalServer.md) provides a virtual [screen](../block/screen1.md) and [keyboard](../block/keyboard.md) which can be controlled via the terminal. This can lead to unexpected behavior if another real screen and/or keyboard is connected to the same subnetwork as the [terminal server](terminalServer.md), so this should usually be avoided. When using the terminal in hand after binding it, a GUI will open in the same manner as a [keyboard](../block/keyboard.md) attached to a [screen](../block/screen1.md).
Multiple terminals can be bound to one [server](server1.md), but they will all display the same information, as they will share the virtual [screen](../block/screen1.md) and [keyboard](../block/keyboard.md). The number of terminals that can be bound to a [server](server1.md) depends on the [server](server1.md)'s tier. The range in which the terminals work can be configured in the [rack](../block/rack.md)'s GUI.
Multiple terminals can be bound to one [terminal server](terminalServer.md), but they will all display the same information, as they will share the virtual [screen](../block/screen1.md) and [keyboard](../block/keyboard.md). The number of terminals that can be bound to a [terminal server](terminalServer.md) is limited. When the number of bound terminals is at the limit, binding another one will unbind the first bound one.

View File

@ -0,0 +1,5 @@
# Terminal Server
![Remote Viewing](oredict:oc:terminalServer)
Terminal servers provides a virtual [screen](../block/screen1.md) and [keyboard](../block/keyboard.md) which can be controlled via [remote terminals](terminal.md). See the [remote terminal](terminal.md) manual entry for more information. Terminal servers must be installed in a [rack](../block/rack.md) to function.

View File

@ -1,9 +1,7 @@
# Серверная стойка
# Стойка
![Бесплатное жилье.](oredict:oc:serverRack)
![Бесплатное жилье.](oredict:oc:rack)
Серверная стойка может содержать до 4 [серверов](../item/server1.md). [Сервер](../item/server1.md) это высокоуровневый [компьютер](../general/computer.md), который может работать только внутри серверной стойки. [Серверы](../item/server1.md) могут удаленно контролироваться, с помощью [терминала](../item/terminal.md). Количество [удаленных терминалов](../item/terminal.md), которое может быть подключено к одному [серверу](../item/server1.md) одновременно, зависит от уровня [сервера](../item/server1.md). Дистанция, на которой можно будет использовать [терминал](../item/terminal.md) настраивается в интерфейсе стойки. Большие значения требуют больше энергии.
Стойка может содержать до 4 подключемых устройств, таких как: [серверы](../item/server1.md), [терминальные серверы](../item/terminalServer.md) и [подключаемые дисководы](../item/diskDriveMountable.md). Соединение между подключаемыми устройствами в стойку может быть настроено с помощью интерфейса стойки. В частности, если [серверы](../item/server1.md) содержат компоненты, которые поддерживают работу с сетью, такие как [сетевые карты](../item/lanCard.md), то будут установлены только сетевые соединения. Эти соединения будут служить только для передачи сетевых сообщений, компоненты не будут видны через них. Такие подключения отличаются более тонкой линией от "главных", которые имеют доступ к компонентам. Каждое внутреннее соединение должно быть между подключаемым устройством/компонентом и шиной, соединенной со стороной стойки. Для соеднинения нескольких подключаемых устройств вместе, подключите их на одну общую шину.
Каждый [сервер](../item/server1.md) в серверной стойке может взаимодействовать только с одной "стороной" стойки или ни с какой. К какой стороне, какой [сервер](../item/server1.md) подключен, настраивается в интерфейсе стойки. Будьте внимательны, стороны считаются относительно самой стойки, например, если вы смотрите на стойку спереди, то `правая сторона` стойки для вас будет слева.
Серверные стойки взаимодействуют с [ретрансляторами](relay.md) и [распределителями энергии](powerDistributor.md). Переключатель режимов работы стойки, может быть настроен в интерфейсе самой стойки, он имеет 2 режима: внешний и внутренний. Во внешнем режиме сервер будет работать как обычный [ретранслятор](relay.md). Во внутреннем режиме, сообщения будут передаваться только к [серверам](../item/server1.md) в стойке и не будут автоматически связаны со сторонами стойки. [Серверы](../item/server1.md) все также будут иметь возможность передачи сообщений друг другу. Это позволяет использовать серверные стойки как продвинутые [ретрансляторы](relay.md) для операций фильтрации и направления данных, например.
Стойки также могут выступать в роли [ретранслятора](relay.md) или [распределителя энергии](powerDistributor.md). Будет ли стойка работать как ретранслятор или нет, можно настроить через интерфейс стойки.

View File

@ -0,0 +1,5 @@
# Подключаемый дисковод
![Snuggly](oredict:oc:diskDriveMountable)
Это полноценный эквивалент обычному [дисководу](../block/diskDrive.md), за исключением того, что он может быть установлен в [стойку](../block/rack.md).

View File

@ -53,6 +53,11 @@
* [Торговля](tradingUpgrade.md)
* [Улучшение](upgradeContainer1.md)
### Для монтажа в стойку
* [Подключаемый дисковод](diskDriveMountable.md)
* [Сервер](server1.md)
* [Терминальный сервер](terminalServer.md)
### Другое
* [Процессор с видеркартой (APU)](apu1.md)
* [Компонентная шина](componentBus1.md)

View File

@ -2,7 +2,7 @@
![Так тебе и надо.](oredict:oc:server1)
Серверы это форма самых продвинутых [компьютеров](../general/computer.md). Они могут быть сконфигурированы где угодно. После вставки [процессора](cpu1.md), [памяти](ram1.md) и платы расширения, сервер должен быть помещен в [серверную стойку](../block/rack.md). Подробнее читайте в статье про [серверную стойку](../block/rack.md).
Серверы это форма самых продвинутых [компьютеров](../general/computer.md). Они могут быть настроено после установки в [стойку](../block/rack.md) и активации (направив соответствующей стороной к передней стороне [стойки](../block/rack.md)). Для работы, сервер должен быть помещен в [стойку](../block/rack.md). Подробнее читайте в разделе о [стойке](../block/rack.md).
Сервер уровня 1 может содержать следующие компоненты:
- 1x [процессор](cpu2.md) уровня 2

View File

@ -2,8 +2,8 @@
![Удаленный доступ.](oredict:oc:terminal)
Терминал может быть использован для контроля [серверов](server1.md). Для использования терминала, кликните им по серверу в [серверной стойке](../block/rack.md) (кликните по блоку [серверной стойки](../block/rack.md), в нужный [сервер](server1.md) для привязки терминала к нему).
Терминал может быть использован для контроля компьютеров через [терминальный сервер](terminalServer.md). Для использования, активируйте [терминальный сервер](terminalServer.md), установленный в [стойку](../block/rack.md) (кликнув по блоку [стойки](../block/rack.md) в мире, направив курсор на [терминальный сервер](terminalServer.md). В результате терминал будет соединен с терминальным сервером).
Когда терминал привязан к [серверу](server1.md),к серверу будут подключены виртуальный [монитор](../block/screen1.md) и [клавиатура](../block/keyboard.md). Это может привести к неожиданному поведению реального монитора и клавиатуры, подключенных к серверу. При использовании терминала вы сможете печатать, как будто к серверу подключена обычная [клавиатура](../block/keyboard.md) и [монитор](../block/screen1.md).
[Терминальный сервер](terminalServer.md) предоставляет виртуальный [монитор](../block/screen1.md) и [клавиатуру](../block/keyboard.md), которыми можно управлять через терминал. Это может привести к неожиданному поведению, если реальный монитор и/или клавиатура подключены к этой же сети, что и [терминальный сервер](terminalServer.md), этого лучше избегать. При использовании терминала вы сможете печатать, как будто вы работаете с обычной [клавиатурой](../block/keyboard.md) подключенной к [монитору](../block/screen1.md).
К одному [серверу](server1.md) могут быть подключены несколько терминалов, однако все они будут показывать одинаковую информацию. Максимальное количество терминалов, которое может быть подключено к [серверу](server1.md) зависит от уровня [сервера](server1.md). Дальность действия терминалов, относительно [серверной стойки](../block/rack.md) настраивается в файле конфигурации.
К одному [терминальному серверу](terminalServer.md) могут быть подключены несколько терминалов, однако все они будут показывать одинаковую информацию. Максимальное количество терминалов, которое может быть подключено к [терминальному серверу](terminalServer.md) ограничено. Если достигнут лимит подключенных терминалов, подключение нового терминала отключит самый первый.

View File

@ -0,0 +1,5 @@
# Терминальный сервер
![Удаленное управление](oredict:oc:terminalServer)
Терминальные серверы предоставляют виртуальный [монитор](../block/screen1.md) и [клавиатуру](../block/keyboard.md), которыми можно управлять через [терминал](terminal.md). Подробнее читайте в разделе о [терминале](terminal.md). Для работы, установите терминальный сервер в [стойку](../block/rack.md).

View File

@ -67,6 +67,7 @@ item.oc.DataCard1.name=Data Card (Tier 2)
item.oc.DataCard2.name=Data Card (Tier 3)
item.oc.DebugCard.name=Debug Card
item.oc.Debugger.name=Network Debugger
item.oc.DiamondChip.name=Diamond Chip
item.oc.Disk.name=Disk Platter
item.oc.DiskDriveMountable.name=Disk Drive
item.oc.Drone.name=Drone
@ -277,6 +278,7 @@ oc:tooltip.DataCard1=Provides a couple of advanced algorithms such as hashing, A
oc:tooltip.DataCard2=Provides a couple of advanced algorithms such as hashing, AES encryption, elliptic curve cryptography and deflate/inflate.
oc:tooltip.DebugCard=Creative mode item, allows manipulating the world to make testing easier. Use at your own peril.
oc:tooltip.Debugger=Can be used to output debug information on OC's internal network grid. Only use if so instructed by a dev.
oc:tooltip.DiamondChip=A small piece of a once radiant diamond. It will never be the same again.
oc:tooltip.Disassembler=Separates items into their original components. §lWarning§7: returned items have a %s%% chance of breaking in the process!
oc:tooltip.Disk=Primitive medium that can be used to build persistent storage devices.
oc:tooltip.DiskDrive.CC=ComputerCraft floppies are §asupported§7.

View File

@ -63,6 +63,7 @@ item.oc.CPU2.name=Центральный процессор (ЦП) (3-ий ур
item.oc.CuttingWire.name=Проволока
item.oc.DebugCard.name=Отладочная карта
item.oc.Debugger.name=Сетевой отладчик
item.oc.DiamondChip.name=Алмазный обломок
item.oc.Disk.name=Металлический диск
item.oc.DiskDriveMountable.name=Дисковод (для серверной стойки)
item.oc.Drone.name=Дрон
@ -270,6 +271,7 @@ oc:tooltip.DataCard1=Обеспечивает поддержку шифрова
oc:tooltip.DataCard2=Обеспечивает поддержку шифрования и эллиптической криптографии, нескольких алгоритмов хеширования, а также сжатия.
oc:tooltip.DebugCard=Креативный предмет, позволяет манипулировать игровым миром. Используйте на свой страх и риск.
oc:tooltip.Debugger=Может быть использован для вывода отладочной информации о внутренней сети.
oc:tooltip.DiamondChip=Небольшой кусочек некогда сияющего алмаза. Он никогда не будет таким как прежде.
oc:tooltip.Disassembler=Разделяет предметы на исходные компоненты. §lВнимание§7: возвращённые предметы имеют шанс %s%% сломаться!
oc:tooltip.Disk=Примитивный носитель, который может быть использован для создания постоянных запоминающих устройств.
oc:tooltip.DiskDrive.CC=§aПоддерживаются§7 дискеты из ComputerCraft.

View File

@ -1,9 +1,9 @@
# OpenComputer
# This is the simplified Chinese file for localizations.
# Use [nl] to for a line break.
# This is the Simplified Chinese file for localizations.
# Use [nl] to for a line break. 使用[nl]作为换行标志
# Blocks
tile.oc.accessPoint.name=桥接器
tile.oc.accessPoint.name=§c桥接器§7
tile.oc.adapter.name=适配器
tile.oc.assembler.name=机器人装配器
tile.oc.cable.name=线缆
@ -12,67 +12,101 @@ tile.oc.case1.name=基础机箱
tile.oc.case2.name=高级机箱
tile.oc.case3.name=超级机箱
tile.oc.caseCreative.name=创造模式机箱
tile.oc.chameliumBlock.name=变色块
tile.oc.charger.name=充电器
tile.oc.disassembler.name=分解器
tile.oc.diskDrive.name=磁盘驱动器
tile.oc.geolyzer.name=地质透析器
tile.oc.keyboard.name=键盘
tile.oc.endstone.name=末地石
tile.oc.geolyzer.name=地质分析仪
tile.oc.hologram1.name=基础全息地图投影仪
tile.oc.hologram2.name=高级全息地图投影仪
tile.oc.keyboard.name=键盘
tile.oc.microcontroller.name=微控制器
tile.oc.motionSensor.name=运动传感器
tile.oc.netSplitter.name=网络分配器
tile.oc.powerConverter.name=能量转换器
tile.oc.powerDistributor.name=能量分配器
tile.oc.print.name=3D打印
tile.oc.printer.name=3D打印机
tile.oc.raid.name=Raid磁盘阵列
tile.oc.redstone.name=红石I/O端口
tile.oc.relay.name=中继器
tile.oc.robot.name=机器人
tile.oc.robotAfterimage.name=机器人余像
tile.oc.screen1.name=基础显示屏
tile.oc.screen2.name=高级显示屏
tile.oc.screen3.name=超级显示屏
tile.oc.rack.name=服务器机架
tile.oc.rack.name=机架
tile.oc.switch.name=§c开关§7
tile.oc.switch.name=交换机
tile.oc.waypoint.name=路径点
# Items
item.oc.AbstractBusCard.name=抽象类总线卡
item.oc.Acid.name=蚀刻药水
item.oc.ALU.name=算逻运算单元(ALU)
item.oc.Analyzer.name=分析器
item.oc.APU0.name=基础加速运算单元(APU)
item.oc.APU1.name=高级加速运算单元(APU)
item.oc.APU2.name=创造加速运算单元(APU)
item.oc.ArrowKeys.name=方向键
item.oc.ButtonGroup.name=按钮组
item.oc.CardBase.name=主板
item.oc.CardBase.name=基板
item.oc.Chamelium.name=变色材料
item.oc.CircuitBoard.name=电路板
item.oc.ControlUnit.name=控制单元(CU)
item.oc.ComponentBus0.name=基础组件总线
item.oc.ComponentBus1.name=高级组件总线
item.oc.ComponentBus2.name=超级组件总线
item.oc.ControlUnit.name=控制单元(CU)
item.oc.CPU0.name=基础中央处理器(CPU)
item.oc.CPU1.name=高级中央处理器(CPU)
item.oc.CPU2.name=超级中央处理器(CPU)
item.oc.CuttingWire.name=切割线
item.oc.DataCard0.name=基础数据卡
item.oc.DataCard1.name=高级数据卡
item.oc.DataCard2.name=超级数据卡
item.oc.DebugCard.name=调试卡
item.oc.Disk.name=磁盘
item.oc.Debugger.name=网络调试器
item.oc.DiamondChip.name=钻石芯片
item.oc.Disk.name=磁碟
item.oc.DiskDriveMountable.name=磁盘
item.oc.Drone.name=无人机
item.oc.DroneCase0.name=基础机器人外壳
item.oc.DroneCase1.name=高级机器人外壳
item.oc.DroneCase3.name=创造机器人外壳
item.oc.eeprom.name=EEPROM
item.oc.FloppyDisk.name=软盘
item.oc.GraphicsCard0.name=基础显卡
item.oc.GraphicsCard1.name=高级显卡
item.oc.GraphicsCard2.name=GeForce GTX Titan Z
item.oc.HardDiskDrive0.name=基础硬盘驱动
item.oc.HardDiskDrive1.name=高级硬盘驱动
item.oc.HardDiskDrive2.name=超级硬盘驱动
item.oc.GraphicsCard2.name=超级显卡
item.oc.HardDiskDrive0.name=基础磁盘驱动器
item.oc.HardDiskDrive1.name=高级磁盘驱动器
item.oc.HardDiskDrive2.name=超级磁盘驱动器
item.oc.hoverBoots.name=悬浮靴
item.oc.InkCartridge.name=墨盒
item.oc.InkCartridgeEmpty.name=墨盒(空)
item.oc.InternetCard.name=因特网卡
item.oc.Interweb.name=因特网
item.oc.IronNugget.name=铁粒
item.oc.LinkedCard.name=连接卡
item.oc.Memory0.name=1级存储器
item.oc.Memory1.name=1.5级存储器
item.oc.Memory2.name=2级存储器
item.oc.Memory3.name=2.5级存储器
item.oc.Memory4.name=3级存储器
item.oc.Memory5.name=3.5级存储器
item.oc.Manual.name=开放式电脑使用手册
item.oc.Memory0.name=存储器-T1
item.oc.Memory1.name=存储器-T1.5
item.oc.Memory2.name=存储器-T2
item.oc.Memory3.name=存储器-T2.5
item.oc.Memory4.name=存储器-T3
item.oc.Memory5.name=存储器-T3.5
item.oc.Microchip0.name=简易微芯片
item.oc.Microchip1.name=高级微芯片
item.oc.Microchip2.name=超级微芯片
item.oc.MicrocontrollerCase0.name=基础微控制器外壳
item.oc.MicrocontrollerCase1.name=高级微控制器外壳
item.oc.MicrocontrollerCase3.name=创造微控制器外壳
item.oc.Nanomachines.name=纳米机器
item.oc.NetworkCard.name=网卡
item.oc.NumPad.name=数字键盘
item.oc.PrintedCircuitBoard.name=印制电路板(PCB)
item.oc.Present.name=一点小礼物...
item.oc.PrintedCircuitBoard.name=印刷电路板(PCB)
item.oc.RawCircuitBoard.name=未加工电路板
item.oc.RedstoneCard0.name=基础红石卡
item.oc.RedstoneCard1.name=高级红石卡
@ -81,35 +115,49 @@ item.oc.Server1.name=高级服务器
item.oc.Server2.name=超级服务器
item.oc.Server3.name=创造模式服务器
item.oc.Tablet.name=平板电脑
item.oc.TabletCase0.name=平板电脑保护套
item.oc.TabletCase1.name=平板电脑保护套
item.oc.TabletCase3.name=平板电脑保护套
item.oc.TabletCase0.name=平板电脑保护套T1
item.oc.TabletCase1.name=平板电脑保护套T2
item.oc.TabletCase3.name=平板电脑保护套T3
item.oc.Terminal.name=远程终端
item.oc.TerminalServer.name=终端服务器
item.oc.TexturePicker.name=材质选择器
item.oc.Transistor.name=晶体管
item.oc.UpgradeAngel.name=天使方块升级
item.oc.UpgradeBattery0.name=基础电池升级
item.oc.UpgradeBattery1.name=高级电池升级
item.oc.UpgradeBattery2.name=超级电池升级
item.oc.UpgradeChunkloader.name=区块载入升级
item.oc.UpgradeContainerCard0.name=基础卡容器
item.oc.UpgradeContainerCard1.name=高级卡容器
item.oc.UpgradeContainerCard2.name=超级卡容器
item.oc.UpgradeContainerCard0.name=基础卡
item.oc.UpgradeContainerCard1.name=高级卡
item.oc.UpgradeContainerCard2.name=超级卡
item.oc.UpgradeContainerUpgrade0.name=基础升级组件容器
item.oc.UpgradeContainerUpgrade1.name=高级升级组件容器
item.oc.UpgradeContainerUpgrade2.name=超级升级组件容器
item.oc.UpgradeCrafting.name=合成升级
item.oc.UpgradeDatabase0.name=基础数据库升级
item.oc.UpgradeDatabase1.name=高级数据库升级
item.oc.UpgradeDatabase2.name=超级数据库升级
item.oc.UpgradeExperience.name=经验升级
item.oc.UpgradeGenerator.name=发电机升级
item.oc.UpgradeHover0.name=基础悬浮升级
item.oc.UpgradeHover1.name=高级悬浮升级
item.oc.UpgradeInventory.name=物品栏升级
item.oc.UpgradeInventoryController.name=高级物品栏升级
item.oc.UpgradeInventoryController.name=物品栏控制器升级
item.oc.UpgradeLeash.name=缰绳升级
item.oc.UpgradeNavigation.name=导航升级
item.oc.UpgradePiston.name=活塞升级
item.oc.UpgradeSign.name=告示牌升级
item.oc.UpgradeSign.name=告示牌读写升级
item.oc.UpgradeSolarGenerator.name=太阳能发电机升级
item.oc.UpgradeTank.name=水箱升级
item.oc.UpgradeTankController.name=高级水箱升级
item.oc.UpgradeTractorBeam.name=牵引光束升级
item.oc.WirelessNetworkCard.name=无线网卡升级
item.oc.UpgradeTrading.name=交易升级
item.oc.WirelessNetworkCard.name=无线网卡
item.oc.WorldSensorCard.name=世界感应卡
item.oc.wrench.name=螺丝刀扳手
# Entities
entity.oc.Drone.name=无人机
# GUI
oc:gui.Analyzer.Address=§6地址§f: %s
@ -117,6 +165,7 @@ oc:gui.Analyzer.AddressCopied=地址已复制到剪贴板.
oc:gui.Analyzer.ChargerSpeed=§6充电速度§f: %s
oc:gui.Analyzer.ComponentName=§6组件名§f: %s
oc:gui.Analyzer.Components=§6已连接组件的数量§f: %s
oc:gui.Analyzer.CopyToClipboard=点击以复制到剪贴板.
oc:gui.Analyzer.LastError=§6上一个错误§f: %s
oc:gui.Analyzer.RobotName=§6名称§f: %s
oc:gui.Analyzer.RobotOwner=§6主人§f: %s
@ -125,42 +174,61 @@ oc:gui.Analyzer.StoredEnergy=§6存储能量§f: %s
oc:gui.Analyzer.TotalEnergy=§6存储能量上限§f: %s
oc:gui.Analyzer.Users=§6用户§f: %s
oc:gui.Analyzer.WirelessStrength=§6信号强度§f: %s
oc:gui.Assembler.Collect=采集机器人
oc:gui.Assembler.Collect=收集输出
oc:gui.Assembler.Complexity=复杂度: %s/%s
oc:gui.Assembler.InsertCase=插入一个机箱
oc:gui.Assembler.InsertCPU=插入一个CPU
oc:gui.Assembler.InsertRAM=插入一些存储器
oc:gui.Assembler.Progress=进度: %s%% (%s)
oc:gui.Assembler.Run=组装
oc:gui.Assembler.Warnings=§e警告§7: 推荐的组件丢失.
oc:gui.Assembler.Warning.BIOS=BIOS
oc:gui.Assembler.Warning.GraphicsCard=显卡
oc:gui.Assembler.Warning.Inventory=物品栏升级
oc:gui.Assembler.Warning.Keyboard=键盘
oc:gui.Assembler.Warning.OS=运行环境
oc:gui.Assembler.Warning.Screen=显示屏
oc:gui.Chat.NewVersion=新版本可用: %s
oc:gui.Chat.WarningFingerprint=§c警告§f - 校验不匹配! 预期对应 '§a%s§f' 但识别到 '§e%s§f'. 如果你不是模组的作者或运行的不是反混淆版本, 我 §l强烈§f 建议你重新下载OpenComputers, 因为当前使用的JAR文件已被篡改.
oc:gui.Assembler.Warnings=§e警告§7: 推荐的组件丢失.
oc:gui.Chat.NewVersion=有新版本可用: %s
oc:gui.Chat.TextureName=§7材质名为§a%s§f.
oc:gui.Chat.WarningClassTransformer=执行类转换器时发生§c错误§f. 请将您(全部!)的FML的§alatest.log§f/§afml-server-latest.log§f日志文件一并报告, 谢谢!
oc:gui.Chat.WarningFingerprint=§c警告§f - 指纹校验不匹配! 预期对应 '§a%s§f' 但识别到 '§e%s§f'. 如果您不是模组的作者, 或运行的不是反混淆版本, 我§l强烈§f 建议你重新下载开放式电脑模组, 因为当前使用的JAR文件已被篡改.
oc:gui.Chat.WarningLink=无法打开链接: %s
oc:gui.Chat.WarningLuaFallback=无法使用原有的Lua库, 电脑不会持续现在的状态. 它们会在区块载入时重启.
oc:gui.Chat.WarningPower=没有检测到可提供能源的模组. 电脑, 显示屏和所有其它组件将 §l不需要§f 能量来运作. 安装下列模组中的其中一个来启用能量需求: 建筑, 工业时代2, 通用机械, 热力膨胀 or 通用电力. 在配置文件中禁用能量设定可以让这条信息不再显示.
oc:gui.Chat.WarningProjectRed=你目前使用的Project Red版本中, 红石系统不兼容OpenComputers. 试着升级你的Project Red.
oc:gui.Chat.WarningPower=没有检测到可提供能源的模组. 电脑,显示屏和所有其它组件将§l不需要§f能量来运作. 安装下列任意一个组来启用能量需求:建筑(Buildcraft),电子时代(Electrical Age),工业2(IndustrialCraft 2),通用机械(Mekanism)或热力膨胀(Thermal Expansion). 在配置文件中禁用能量设定可以让这条信息不再显示.
oc:gui.Chat.WarningProjectRed=你目前使用的Project:Red版本不兼容OpenComputers. 请升级您的Project:Red后再试.
oc:gui.Chat.WarningRecipes=加载合成表时遇到一个或多个错误. 部分物品或因此无法合成. 查阅日志文件以获取详细信息.
oc:gui.Chat.WarningSimpleComponent=一个(您的?)扩展Mod使用了§aSimpleComponent§f接口但§e做错了一些事情§f. Component logic无法注入. 查阅日志文件以获取详细信息.
oc:gui.Drive.Managed=Managed
oc:gui.Drive.Unmanaged=Unmanaged
oc:gui.Drive.Warning=§l警告§r:切换模式将会导致当前磁盘上所有数据丢失!
oc:gui.Error.ComponentOverflow=过多的组件连接了计算机.
oc:gui.Error.InternalError=网络错误, 请检查log文件. 这可能是个Bug.
oc:gui.Error.NoCPU=这台计算机上没有安装CPU.
oc:gui.Error.NoEnergy=能量不足.
oc:gui.Error.NoRAM=这台计算机上没有安装存储器.
oc:gui.Error.NoRAM=这台计算机上没有安装存.
oc:gui.Error.OutOfMemory=内存溢出.
oc:gui.Manual.Blocks=开放式电脑-方块
oc:gui.Manual.Home=主页
oc:gui.Manual.Items=开放式电脑-物品
oc:gui.Manual.Warning.BlockMissing=该方块不可用.
oc:gui.Manual.Warning.ImageMissing=未找到图片.
oc:gui.Manual.Warning.ItemMissing=该物品不可用.
oc:gui.Manual.Warning.OreDictMissing=该矿物词典条目不可用.
oc:gui.Raid.Warning=§4添加磁盘会损坏该磁盘.[nl]移除磁盘会损坏Raid.
oc:gui.Robot.Power=能量
oc:gui.Robot.TurnOff=关闭
oc:gui.Robot.TurnOn=开启
oc:gui.Rack.None=无
oc:gui.Rack.Back=后
oc:gui.Rack.Bottom=底部
oc:gui.Rack.Left=左
oc:gui.Rack.Right=右
oc:gui.Rack.Top=上部
oc:gui.Switch.TransferRate=周期率
oc:gui.Robot.TurnOn=开启[nl]§7使用分析器来追踪Bug.§r
oc:gui.ServerRack.Back=后
oc:gui.ServerRack.Bottom=底部
oc:gui.ServerRack.Left=左
oc:gui.ServerRack.None=无
oc:gui.ServerRack.Right=右
oc:gui.Rack.Enabled=启用
oc:gui.Rack.Disabled=禁用
oc:gui.ServerRack.Top=上部
oc:gui.Switch.PacketsPerCycle=数据包 / 周期
oc:gui.Switch.QueueSize=队列长度
oc:gui.Switch.TransferRate=周期率
oc:gui.Terminal.InvalidKey=无效键, 看上去另一个终端已绑定到这台服务器.
oc:gui.Terminal.OutOfRange=无信号.
@ -171,54 +239,82 @@ oc:container.Case=计算机
oc:container.Charger=充电器
oc:container.Disassembler=分解器
oc:container.DiskDrive=磁盘驱动器
oc:container.Printer=打印机
oc:container.Raid=Raid磁盘阵列
oc:container.Relay=中继器
oc:container.Server=服务器
oc:container.Rack=服务器机架
oc:container.Rack=机架
oc:container.Switch=交换机
oc:container.TabletWrapper=平板电脑
# Keybinds
key.materialCosts=显示材料需求
key.clipboardPaste=粘贴到剪贴板
key.materialCosts=显示材料需求
# Item / Block Tooltips
oc:tooltip.AccessPoint=类似于交换机, 但它还能接收无线数据包和无线传递连接包.
oc:tooltip.AbstractBusCard=允许计算机向 §f星门科技 2§7的抽象类总线发送或接收LIP数据包.
oc:tooltip.AbstractBusCard=允许计算机向§f星门科技2§7的抽象类总线发送或接收LIP数据包.
oc:tooltip.Acid=一种有毒的假液相物质, 通常只有某些海盗会使用它们. 它的腐蚀特性令它非常完美地适用于蚀刻电路板的材料.
oc:tooltip.Adapter=用于控制非电脑组件的方块, 比如原版或者来自其它模组的方块.
oc:tooltip.ALU=用来做算逻运算以免你亲自代劳, 它更能胜任这份差事.
oc:tooltip.Analyzer=用于显示方块信息, 比如它们的 §f地址§7 和 §f组件名称§7 .如果计算机未能正常关闭它也会显示使计算机崩溃的报错.
oc:tooltip.Analyzer=用于显示方块信息, 比如它们的§f地址§7和§f组件名称§7. 如果计算机未能正常关闭它也会显示使计算机崩溃的报错.
oc:tooltip.APU=如果你只是需要一个额外的卡槽,这就是你需要的自带GPU(或者IGP,集成图形处理器)的CPU.[nl] 支持的组件: §f%s§7[nl] 最大分辨率: §f%sx%s§7[nl] 最高色深: §f%s§7[nl] 运算/tick: §f%s§7
oc:tooltip.Assembler=允许使用若干不同的电脑组件来组装机器人.
oc:tooltip.Cable=连接方块的廉价选择.
oc:tooltip.Capacitor=储能以备他用. 能够非常快速地充电或放电.
oc:tooltip.CardBase=正如其名, 它是用来安装其它扩展卡的基本卡板.
oc:tooltip.Case=计算机机箱是构建计算机的基本方块, 也是各种 §f扩展卡§7 , §f存储器§7 以及 §f硬盘§7 的外壳.[nl] 格子: §f%s§7
oc:tooltip.Charger=将电容器的能量传输给相邻机器人. 传输效率取决于输入的 §f红石信号§7 强度, 无信号意味着不给机器人充电, 而最强信号则意味着全速给机器人充电.
oc:tooltip.Case=计算机机箱是构建计算机的基本方块, 也是各种§f扩展卡§7,§f存储器§7以及§f硬盘§7的外壳.[nl] 格子: §f%s§7
oc:tooltip.Chamelium=3D打印的基本原材料. 不要误吸:或造成失明和暂时失去意识.
oc:tooltip.ChameliumBlock=整洁干净的玩意. 对于彩色3D打印相当实用, 或者只是拿它的整洁干净的色彩来装饰你的华丽的基地.
oc:tooltip.Charger=将电容器的能量传输给相邻机器人. 传输效率取决于输入的§f红石信号§7强度, 无信号意味着不给机器人充电, 而最强信号则意味着全速给机器人充电.
oc:tooltip.CircuitBoard=现在我们已经取得一些进展. 可以通过蚀刻来得到印制电路板.
oc:tooltip.ControlUnit=用来控制...控制东西...的单元. 你需要这玩意儿来做CPU. 所以反正啦, 这个非常重要.
oc:tooltip.ComponentBus=这个扩展能让服务器同时与更多组件通讯, 工作原理类似CPU.[nl] 支持的组件: §f%s§7
oc:tooltip.CPU=所有计算机最核心的组件, 它的时钟频率有点不可靠, 但是你考虑到它是靠便携日晷来运行的, 还能指望什么呢?[nl] 支持组件: §f%s§7
oc:tooltip.CPU.Architecture=架构: §f%s§7
oc:tooltip.CuttingWire=用于将粘土块切割成电路板的形状. 使用一次就会坏掉, 这可能使得成为历来最低效的工具.
oc:tooltip.DataCard0=提供数种高级算法, 例如哈希和DEFLATE/INFLATE算法.
oc:tooltip.DataCard1=提供数种高级算法, 例如哈希, AES加密和DEFLATE/INFLATE算法.
oc:tooltip.DataCard2=提供数种高级算法, 例如哈希, AES加密, 椭圆曲线加密和DEFLATE/INFLATE算法.
oc:tooltip.DebugCard=创造模式物品, 它能让你更简易的操控世界来进行测试. 请自己承担它带来的危险.
oc:tooltip.Disassembler=将物品分解成基础组件. §l警告§7: 分解得到的物品会有 %s%% 的几率在分解过程中损坏!
oc:tooltip.Debugger=用于在OpenComputer的内部网络格栅中输出调试信息. 请在开发者指导下使用.
oc:tooltip.DiamondChip=一小粒正在发光的钻石. 永远不会破镜重圆.
oc:tooltip.Disassembler=将物品分解成基础组件. §l警告§7: 分解得到的物品会有%s%%的几率在分解过程中损坏!
oc:tooltip.Disk=用于制造持久存储设备的原始媒介材料.
oc:tooltip.DiskDrive.CC=已经 §a支持§7 使用ComputerCraft的软盘了.
oc:tooltip.DiskDrive=用来读写软盘. 可以给机器人安装使其可以插入磁盘.
oc:tooltip.DiskDrive.CC=已经§a支持§7使用ComputerCraft的软盘了.
oc:tooltip.DiskDrive=用来读写软盘.可以给机器人安装使其可以插入磁盘.
oc:tooltip.DiskDriveMountable=和普通磁盘用途一样,但必须装载在机架里.
oc:tooltip.DiskUsage=磁盘使用: %s/%s 字节
oc:tooltip.DiskModeManaged=模式: 管理
oc:tooltip.DiskModeUnmanaged=模式: 不受管理
oc:tooltip.Drone=无人机是一种轻量而快速的侦查单位, 自身拥有有限的载物空间.
oc:tooltip.DroneCase=这个外壳将会在组装机中组装出无人机. 这个外壳可容纳少量组件, 并内建末地石驱动的悬浮系统.
oc:tooltip.EEPROM=小型的可编程存储器, 可存储电脑启动所用的BIOS.
oc:tooltip.FakeEndstone=几乎可以以假乱真, 甚至更加轻盈!
oc:tooltip.Geolyzer=可以检测周围方块的硬度. 这些信息对编写全息地图程序或检测矿物都有很大的帮助.
oc:tooltip.GraphicsCard=用来改变屏幕上的显示内容. 最高分辨率: §f%sx%s§7[nl] 最高色深: §f%s§7[nl] 运算/tick: §f%s§7
oc:tooltip.InternetCard=因特网卡可以让你发送HTTP请求以及使用货真价实的TCP Sockets.
oc:tooltip.Interweb=恭喜, 你赢得了一个 (1) 因特网. 你可以使用因特网卡来连接它. 注意: 不要水贴钓鱼
oc:tooltip.HoverBoots=跳得更高, 摔得更深, 走得更快. 一切尽在Hover Boots (TM), 已获顶级认证.
oc:tooltip.InkCartridge=用于重新填装3D打印机的墨水. 因为某些原因这些墨水不必保留在打印机里.
oc:tooltip.InkCartridgeEmpty=此墨盒经过深度干燥处理. 用颜料重新装填, 抑或弃置. 看我脸色行事.
oc:tooltip.InternetCard=因特网卡可以让你发送HTTP请求以及使用货真价实的TCP套接字.
oc:tooltip.Interweb=恭喜, 你赢得了一个(1)因特网. 你可以使用因特网卡来连接它. 注意: 不要水贴钓鱼
oc:tooltip.IronNugget=颗粒状的铁, 所以叫铁粒啦, 蠢蠢的感觉...
oc:tooltip.Keyboard=可以连接屏幕来输入显示文本.
oc:tooltip.Hologram0=一个能通过电脑控制来投射出任何三维结构的全息投影仪.[nl] 分辨率: §f48x32x48§7 [nl] 最大显示规模: §f3x§7 [nl] 最高色深: §f黑白§7
oc:tooltip.Hologram1=使用电脑控制的高级全息投影仪.[nl] 分辨率: §f48x32x48§7 [nl] 最大显示规模: §f4x§7 [nl] 最高色深: §f三原色§7
oc:tooltip.LinkedCard=连接卡可以成对合成, 并且它们只能与各自对应的连接卡交互. 然而, 它们之间的交互没有距离限制, 甚至可以跨越不同的世界. 但它们传递信息所需要的能量消耗不多不少.
oc:tooltip.LinkedCard_Channel=§8频道: %s§7
oc:tooltip.Manual=包含你需要的关于OpenComputer的一切信息. 还有更多. 为此你只需要...§o请按R键继续§7.
oc:tooltip.MaterialCosts=按住 [§f%s§7] 显示所需材料.
oc:tooltip.Materials=所需材料:
oc:tooltip.Memory=电脑运行必备. 内存越大, 你就可以运行越复杂的程序.
oc:tooltip.Microchip=通常也管这种芯片叫集成电路. 我也不知道为什么能和红石一起运行, 但事实如此.
oc:tooltip.Microcontroller=微控制器是被压缩到不能再压缩的电脑. 它们更多是用于执行特殊任务, 并只运行一个内建于EEPROM中的简单程序.[nl] §c不能和外置组件相连接.§7
oc:tooltip.MicrocontrollerCase=微控制器基础组件. 在组装机中为其添加各种组件并组装微控制器.
oc:tooltip.MotionSensor=可以检测附近生物的动向. 检测需要无遮挡物的环境.
oc:tooltip.Nanomachines=控制单元,同时还是一堆可以吸入的纳米机器(如果你愿意的话).
oc:tooltip.NetworkCard=允许通过其他方块(比如线缆)相连的远程计算机能够向彼此发送信息进行交互.
oc:tooltip.PowerAcceptor=能量转换速度: §f%s/t§7
oc:tooltip.PowerConverter.BuildCraft=§fMJ§7: §a%s:%s§7
oc:tooltip.PowerConverter.Factorization=§fCharge§7: §a%s:%s§7
oc:tooltip.PowerConverter.IndustrialCraft2=§fEU§7: §a%s:%s§7
@ -227,40 +323,54 @@ oc:tooltip.PowerConverter.ThermalExpansion=§fRF§7: §a%s:%s§7
oc:tooltip.PowerConverter.ResonantEngine=§fCoulombs§7: §a%s:%s§7
oc:tooltip.PowerConverter=将其它模组的能量转化为本模组的内部能源形式. 转换比:
oc:tooltip.PowerDistributor=在不同网络中分配能量. 很实用于通过包含多个理论上独立子网络的转换器在系统中共享能量.
oc:tooltip.Present=...,它随时为你的麻烦待命. 打开此礼物将有机会获得§kphat lewt§7![nl]§8在时机合适时,合成OpenComputers的物品.§7
oc:tooltip.Print.BeaconBase=§8可用作信标底座.
oc:tooltip.Print.LightValue=§8光强: %s.
oc:tooltip.Print.RedstoneLevel=§8红石信号强度: %s.
oc:tooltip.PrintedCircuitBoard=扩展卡, 内存等组件的基础板.
oc:tooltip.Printer=利用变色物质和墨盒打印出用户自定义的形状. 需要用电脑进行配置. 不要让幼童接触. 就是这样.
oc:tooltip.Raid=允许将三块硬盘组成一个大文件系统供所有与其连接的电脑使用.
oc:tooltip.RawCircuitBoard=能在熔炉或其它炉子中加工强化.
oc:tooltip.Redstone=能够在方块周围接收或发送红石信号. 可以被与之相连的计算机控制. 基本上就像一个外置红石卡.
oc:tooltip.RedstoneCard.ProjectRed=§fProject Red§7 红石系统已 §a兼容§7.
oc:tooltip.RedstoneCard.RedLogic=§fRedLogic§7 红石系统已 §a兼容§7.
oc:tooltip.RedstoneCard.RedNet=§fRedNet§7 红石系统已 §a兼容§7.
oc:tooltip.RedstoneCard.WirelessCBE=§f无线红石 (ChickenBones)§7 红石系统已 §a兼容§7.
oc:tooltip.RedstoneCard.WirelessSV=§f无线红石 (SlimeVoid)§7 红石系统已 §a兼容§7.
oc:tooltip.RedstoneCard.ProjectRed=§fProject Red§7红石系统已§a兼容§7.
oc:tooltip.RedstoneCard.RedLogic=§fRedLogic§7红石系统已§a兼容§7.
oc:tooltip.RedstoneCard.RedNet=§fRedNet§7红石系统已§a兼容§7.
oc:tooltip.RedstoneCard.WirelessCBE=§f无线红石(ChickenBones)§7红石系统已§a兼容§7.
oc:tooltip.RedstoneCard.WirelessSV=§f无线红石(SlimeVoid)§7红石系统已§a兼容§7.
oc:tooltip.RedstoneCard=允许在计算机和机器人四周接收或发送红石信号.
oc:tooltip.Robot=和计算机不同, 机器人能够移动并且像玩家那样与世界中的东西交互. 然而, 它们 §o不能§r§7 直接与外设进行交互!
oc:tooltip.Relay=可将不同网络连接在一起. 仅信息可通过此设备传递, 其它元件仍不可见. 用法举例: 可用于保持多个独立网络的通信.
oc:tooltip.Robot=和计算机不同, 机器人能够移动并且像玩家那样与世界中的东西交互. 然而, 它们§o不能§r§7直接与外设进行交互!
# The underscore makes sure this isn't hidden with the rest of the tooltip.
oc:tooltip.Robot_Level=§f等级§7: §a%s§7.
oc:tooltip.Robot_StoredEnergy=§f存储能量§7: §a%s§7.
oc:tooltip.Screen=显示文本, 运作需要机箱中的显卡.[nl] 最高分辨率: §f%sx%s§7[nl] 最高色深: §f%s§7
oc:tooltip.Server=这就是服务器, 它与许多其它的服务器拥有相似功能, 但这台服务器可以使用组件进行升级, 就像升级机箱一样. 它也可以放入服务器机架中运行.
oc:tooltip.Server=这就是服务器, 它与许多其它的服务器拥有相似功能, 但这台服务器可以使用组件进行升级, 就像升级机箱一样. 它也可以放入服务器机架中运行.[nl] 支持终端的数量: §f%s§7
oc:tooltip.Server.Components=已安装的组件:
oc:tooltip.Rack=它能装下四台服务器. 使用远程终端访问机架中的服务器.
oc:tooltip.Rack=它能装下四台服务器或者别的设备.
oc:tooltip.Switch=允许设备相互连接不同的网络. 仅能传递网络信息, 并且组件不可见. 例如你可以通过这种方式来建立独立网络但仍允许其使用网卡通讯.
oc:tooltip.Tablet=开发中 - 目前只能用于测试 [nl] 这是一个基于计算机的测试物品. 它还不能被合成. 如果在测试时遇到Bug请及时反馈给作者!
oc:tooltip.Tablet=一台平板电脑,为Lua新人准备. 潜行时右击可强制关机.
oc:tooltip.TabletCase=平板电脑的基础外壳. 在组装机中添加组件以制造平板电脑.
oc:tooltip.Terminal=可以远程控制服务器, 不过前提是你处于信号范围内. 使用方法相同于显示屏与键盘. Shift+右键一个机架中的服务器可以绑定对应的终端.
oc:tooltip.TerminalServer=在工作范围内可与遥控终端连接, 以提供远程控制功能. 内建有虚拟显示器和键盘.
oc:tooltip.TexturePicker=这个工具可以显示放块表面的描述, 可用于3D打印定义中. 完全不是材质名, 完全不是. 很抱歉先生, 不是.
oc:tooltip.Tier=§8等级 %s
oc:tooltip.NetSplitter=作为动态连接器的存在. 每个面的连接设定可通过扳手切换. 红石信号可反相所有面的连接设定.
oc:tooltip.TooLong=按住 [§f%s§7] 显示详细物品信息.
oc:tooltip.Transistor=大多数电脑组件中最基础的元素. 看上去有些扭曲, 但它是有用的.
oc:tooltip.Transposer=可在相邻容器之间自动转移物品和液体。
oc:tooltip.UpgradeAngel=允许机器人凭空放置方块, 甚至是在没有任何依附的情况下.
oc:tooltip.UpgradeBattery=增加机器人存储能量的上限, 让其能够运作很长一段时间也不必充电. [nl] 电容: §f%s§7
oc:tooltip.UpgradeChunkloader=如果机器人走进了一片森林, 周围没有任何生物载入区块, 那么它还能继续移动吗? 这个升级组件可以让你确定这点. 它能让机器人所处的区块保持载入, 但这会让能量不断地消耗.
oc:tooltip.UpgradeContainerCard=卡容器组件可以让你方便随意的将卡装入机器人或从中移出. [nl] 最高等级: §f%s§7
oc:tooltip.UpgradeContainerUpgrade=卡容器升级组件可以让你方便的将卡装入另一个卡容器或从中移出. [nl] 最高等级: §f%s§7
oc:tooltip.UpgradeCrafting=能让机器人的物品栏左上角部分成为合成界面. 物品必须在合成界面里排列整齐.
oc:tooltip.UpgradeDatabase=能对物品信息进行分类, 供其它组件进一步分离用.[nl] 可支持条目数量: §f%s§7
oc:tooltip.UpgradeExperience=这个升级能让机器人在执行一些工作时获取经验并累积. 它们拥有越多的累积经验, 就能够存储越多的能量, 越快的挖掘方块并且使用工具时拥有更高的效率.
oc:tooltip.UpgradeGenerator=可以让机器人通过燃料充能. 燃烧物品得到的发电量取决于燃料的等级.[nl] §f发电效率§7: §a%s%%§7
oc:tooltip.UpgradeHover=这个升级组件可让机器人飞得更高而无需爬墙.[nl] 最大高度: §f%s§7
oc:tooltip.UpgradeInventory=这个升级组件为机器人提供了物品背包. 如果没有这个升级, 机器人将不能存储物品.
oc:tooltip.UpgradeInventoryController=这个升级组件可以控制机器人使其与外部容器互动, 并能允许机器人将装备上的工具替换成其物品栏中的其它物品.
oc:tooltip.UpgradeLeash=这个升级组件可让诸如无人机之类的设备绑在Isaa- 不好意思,*清清嗓子* 我刚才说错了. 我只是被告知这原本是用来拴动物的绳子. 可以拴很多动物, 好奇怪啊.
oc:tooltip.UpgradeNavigation=可以让机器人确认所处位置以及定位. 定位地点即为用于合成此升级组件用到的地图的中心点.
oc:tooltip.UpgradePiston=这个升级十分有用. 它能让机器人像活塞那样移动方块, 但 §l不能§7 移动实体.
oc:tooltip.UpgradeSign=允许机器人读写告示牌.
@ -268,4 +378,101 @@ oc:tooltip.UpgradeSolarGenerator=可以让机器人在太阳光的照射下四
oc:tooltip.UpgradeTank=为你的机器人装上一个可存储流体的水箱. 如果没有升级此功能, 你的机器人将无法在内部存储流体.
oc:tooltip.UpgradeTankController=这个升级能让你的机器人与外界水箱交互, 向其传输流体.
oc:tooltip.UpgradeTractorBeam=十分先进的高科技, 别名 "物品磁铁". 它能让机器人在任何地方捡起3格范围内的掉落物.
oc:tooltip.Waypoint=为安装有导航升级的设备提供参考点。
oc:tooltip.WirelessNetworkCard=允许在发送正常信息的情况下发送无线网络信息. 请确保已设置好 §f信号强度§7 否则不会发出信息. 越高的信号强度会导致越高的能量消耗.
oc:tooltip.WorldSensorCard=可读取关于世界的各种信息, 例如重力加速度和是否有可供呼吸的大气. 使用风险自负. 制造商对由卡片输出结果造成的损失不承担任何法律责任. 我们不仅有律师, 还有现金. 不要试图告倒我们.
oc:tooltip.Wrench=螺丝刀和扳手混合体, 新手友好, 高手毁灭者.
#Achievements
achievement.oc.adapter=Plug In Baby
achievement.oc.adapter.desc=和其它MOD的方块(甚至是原版Minecraft方块)进行互动!
achievement.oc.assembler=完美
achievement.oc.assembler.desc=是时候征服世界了!
achievement.oc.cable=并不是脏兮兮的电线
achievement.oc.cable.desc=搭配权威认证的反SCP-229科技
achievement.oc.capacitor=本设备含电池
achievement.oc.capacitor.desc=不可能阻止它
achievement.oc.card=我们接受卡片
achievement.oc.card.desc=这是为方便您的使用. 我们保证这不是别有用心.
achievement.oc.case=以备后患
achievement.oc.case.desc=Because cuboid towers are the best.
achievement.oc.charger=那就开始做吧!
achievement.oc.charger.desc=开始充——等等!又忘记红石信号了。
achievement.oc.chip=全是些小东西
achievement.oc.chip.desc=曾经真空管也是这样的。
achievement.oc.cpu=超频
achievement.oc.cpu.desc=是时候好好利用这些计算循环了
achievement.oc.disassembler=Scratch That
achievement.oc.disassembler.desc=In case one of your brilliant ideas turns out to be not that brilliant after all.
achievement.oc.diskDrive=Roundabout
achievement.oc.diskDrive.desc=Inferior capacity but such delicious sound.
achievement.oc.drone=啊!飞走了!
achievement.oc.drone.desc=冷静冷静,直接用核弹让他们在轨道上瞬间爆炸
achievement.oc.eeprom=每台电脑
achievement.oc.eeprom.desc=仅限一个, 就是这样. 这是用来决定最终启动顺序的,明白吗?!
achievement.oc.floppy=The One Ri- Disk
achievement.oc.floppy.desc=Not to be confused with Flappy.
achievement.oc.geolyzer=深入地心
achievement.oc.geolyzer.desc=It has extraordinary qualities.
achievement.oc.graphicsCard=LastGen
achievement.oc.graphicsCard.desc=The way it's meant to be... uh... rendered. Yeah. That.
achievement.oc.hdd=Hot Dog Dealer(热狗推销员)
achievement.oc.hdd.desc=等等我不是那个意思。让我想想,好像想起来什么意思了...
achievement.oc.hologram=下一个次元
achievement.oc.hologram.desc=因为2D很无聊啊。或者本来就这样
achievement.oc.keyboard=吸尘器3000型
achievement.oc.keyboard.desc=强烈建议使用时保持将其翻过来并持续摇晃的习惯,以清理其中异物。
achievement.oc.microcontroller=Little Sisters
achievement.oc.microcontroller.desc=计算机的小妹妹哦
achievement.oc.motionSensor=Got the Moves
achievement.oc.motionSensor.desc=Like Steve Swagger.
achievement.oc.networkCard=现在我们在聊天了!
achievement.oc.networkCard.desc=Keep in touch with those distant relatives via transitive relations.
achievement.oc.openOS=启动
achievement.oc.openOS.desc=One OS to - wait, I used that one already? Dang.
achievement.oc.powerDistributor=分享即关怀
achievement.oc.powerDistributor.desc=当你在平衡供电时需要帮助的时候。
achievement.oc.rack=Dat Rack
achievement.oc.rack.desc=我不知道你想歪到哪里去了,我已经说得很明白了,就是服务器架。
achievement.oc.raid=LFG
achievement.oc.raid.desc=Heroic plzkthx.
achievement.oc.ram=随机存取存储器
achievement.oc.ram.desc=恭喜,你的操作完全正确。
achievement.oc.redstoneCard=联系
achievement.oc.redstoneCard.desc=模拟信号时间到.
achievement.oc.redstoneIO=The Outsider
achievement.oc.redstoneIO.desc=将红石信号传播到你需要的地方!
achievement.oc.robot=Beep Boop
achievement.oc.robot.desc=EXTERMINATE!
achievement.oc.screen=试过反复开关这屏幕没?
achievement.oc.screen.desc=真没有。毕竟红石信号就可以开关这屏幕了。
achievement.oc.server=专用
achievement.oc.server.desc=云服务,现已正式推出。
achievement.oc.switch=复杂拓扑学
achievement.oc.switch.desc=远离易碎货物,因为包裹可能会掉下来。
achievement.oc.tablet=不要吸入
achievement.oc.tablet.desc=同时请远离儿童,以避免不必要的信用卡过度透支。
achievement.oc.transistor=Tell Red I said "Hi."
achievement.oc.transistor.desc=制作一个晶体管然后让它工作。然后听录音带。不用谢我。
achievement.oc.wirelessNetworkCard=信号
achievement.oc.wirelessNetworkCard.desc=是时候让数据包踏遍每一个角落了。
# Death messages. Note that the number of entries here must match the number
# set in the actual damage source in code.
death.attack.oc.nanomachinesOverload.1=%s 过于贪婪。
death.attack.oc.nanomachinesOverload.2=%s 神经断裂。
death.attack.oc.nanomachinesOverload.3=%s 的纳米机器失控暴走了。
death.attack.oc.nanomachinesHungry.1=%s 被纳米机器吃掉了。
death.attack.oc.nanomachinesHungry.2=%s 忘记喂饱纳米机器了。
death.attack.oc.nanomachinesHungry.3=%s 已被分解吸收了。
# NEI Integration
nei.options.inventory.oredict=显示矿物字典名
nei.options.inventory.oredict.true=是
nei.options.inventory.oredict.false=否
nei.usage.oc.Manual=打开手册
# Waila Integration
option.oc.address=地址
option.oc.componentName=组件名
option.oc.energy=能量

View File

@ -9,11 +9,14 @@ if #args < 2 then
io.write(" -r: copy directories recursively.\n")
io.write(" -u: copy only when the SOURCE file differs from the destination\n")
io.write(" file or when the destination file is missing.\n")
io.write(" -P: preserve attributes, e.g. symbolic links.\n")
io.write(" -v: verbose output.\n")
io.write(" -x: stay on original source file system.\n")
return 1
end
options.P = options.P or options.r
local from = {}
for i = 1, #args - 1 do
table.insert(from, shell.resolve(args[i]))
@ -66,6 +69,10 @@ end
local function recurse(fromPath, toPath, origin)
status(fromPath, toPath)
local isLink, target = fs.isLink(fromPath)
if isLink and options.P then
return fs.link(target, toPath)
end
if fs.isDirectory(fromPath) then
if not options.r then
io.write("omitting directory `" .. fromPath .. "'\n")

View File

@ -279,11 +279,11 @@ local function test(m,p)
write(':', COLON_COLOR)
needs_line_num = nil
end
local p=m_only and '' or m.line:sub(last_index,(i or 0)-1)
local s=m_only and '' or m.line:sub(last_index,(i or 0)-1)
local g=i and m.line:sub(i,j) or ''
if i==1 then g=trim_front(g) elseif last_index==1 then p=trim_front(p) end
if j==slen then g=trim_back(g) elseif not i then p=trim_back(p) end
write(p)
if i==1 then g=trim_front(g) elseif last_index==1 then s=trim_front(s) end
if j==slen then g=trim_back(g) elseif not i then s=trim_back(s) end
write(s)
write(g, MATCH_COLOR)
empty_line = false
last_index = (j or slen)+1
@ -291,7 +291,7 @@ local function test(m,p)
write("\n")
empty_line = true
needs_filename, needs_line_num = include_filename, print_line_num
end
elseif p:find("^^") then break end
end
if not empty_line then write("\n") end
end

View File

@ -69,7 +69,7 @@ if #args == 0 or options.i then
local function findKeys(t, r, prefix, name)
if type(t) ~= "table" then return end
for k, v in pairs(t) do
if string.match(k, "^"..name) then
if type(k) == "string" and string.match(k, "^"..name) then
local postfix = ""
if type(v) == "function" then postfix = "()"
elseif type(v) == "table" and getmetatable(v) and getmetatable(v).__call then postfix = "()"
@ -98,6 +98,22 @@ if #args == 0 or options.i then
table.insert(r2, k)
end
table.sort(r2)
if #r2 == 1 then
setmetatable(r2, {
__index=function(tbl, key)
if key==2 then
local prev=tbl[1]
tbl[1]=nil
local next = hint(prev,#prev+1)
for i,v in ipairs(next) do
tbl[i] = v
end
setmetatable(tbl,getmetatable(next))
return tbl[1]
end
end,
__len=function()return 2 end})
end
return r2
end

View File

@ -30,6 +30,7 @@ if #args == 0 and (io.stdin.tty or options.i) and not options.c then
local foreground = gpu.setForeground(0xFF0000)
term.write(sh.expand(os.getenv("PS1") or "$ "))
gpu.setForeground(foreground)
term.setCursorBlink(true)
local command = term.read(history, nil, sh.hintHandler)
if not command then
io.write("exit\n")

View File

@ -1,22 +1,18 @@
local computer = require('computer')
local sh = require('sh')
local clock_before = os.clock()
local real_before, cpu_before = computer.uptime(), os.clock()
local cmd_result = 0
if ... then
sh.execute(nil, ...)
cmd_result = sh.getLastExitCode()
end
local real_after, cpu_after = computer.uptime(), os.clock()
local clock_after = os.clock()
local clock_diff = clock_after - clock_before
local real_diff = real_after - real_before
local cpu_diff = cpu_after - cpu_before
-- format time
local minutes = clock_diff / 60
local seconds = clock_diff % 60
local seconds_txt = string.format('%f', seconds)
seconds_txt = seconds_txt:gsub('^(.*%....).*$','%1')
io.write(string.format('\nreal%5dm%ss\n', minutes, seconds_txt))
print(string.format('real%5dm%.3fs', math.floor(real_diff/60), real_diff%60))
print(string.format('cpu %5dm%.3fs', math.floor(cpu_diff/60), cpu_diff%60))
return cmd_result

View File

@ -23,34 +23,42 @@ for key,value in pairs(_coroutine) do
end
end
local kernel_create = _coroutine.create
local function install(path, name)
_coroutine.create = function(f,standAlone)
local co = kernel_create(f)
if not standAlone then
table.insert(process.findProcess().instances, co)
end
return co
end
local load = load
_G.load = function(ld, source, mode, env)
env = env or select(2, process.running())
return load(ld, source, mode, env)
end
local thread = _coroutine.running()
process.list[thread] = {
path = path,
command = name,
env = _ENV,
data =
{
vars={},
io={}, --init will populate this
coroutine_handler=setmetatable({}, {__index=_coroutine})
},
instances = setmetatable({}, {__mode="v"})
}
local init_thread = _coroutine.running()
local init_load = _G.load
_G.load = function(ld, source, mode, env)
env = env or select(2, process.running())
return init_load(ld, source, mode, env)
end
install("/init.lua", "init")
local kernel_create = _coroutine.create
_coroutine.create = function(f,standAlone)
local co = kernel_create(f)
if not standAlone then
table.insert(process.findProcess().instances, co)
end
return co
end
_coroutine.wrap = function(f)
local thread = coroutine.create(f)
return function(...)
local result_pack = table.pack(coroutine.resume(thread, ...))
local result, reason = result_pack[1], result_pack[2]
assert(result, reason)
return select(2, table.unpack(result_pack))
end
end
process.list[init_thread] = {
path = "/init.lua",
command = "init",
env = _ENV,
data =
{
vars={},
io={}, --init will populate this
coroutine_handler=setmetatable({}, {__index=_coroutine})
},
instances = setmetatable({}, {__mode="v"})
}

View File

@ -240,13 +240,20 @@ function buffer:read(...)
local function readLine(chop)
local start = 1
while true do
local l = self.bufferRead:find("\n", start, true)
if l then
local result = self.bufferRead:sub(1, l + (chop and -1 or 0))
self.bufferRead = self.bufferRead:sub(l + 1)
local buf = self.bufferRead
local i = buf:find("[\r\n]", start)
local c = i and buf:sub(i,i)
local is_cr = c == "\r"
if i and (not is_cr or i < #buf) then
local n = buf:sub(i+1,i+1)
if is_cr and n == "\n" then
c = c .. n
end
local result = buf:sub(1, i - 1) .. (chop and "" or c)
self.bufferRead = buf:sub(i + #c)
return result
else
start = #self.bufferRead
start = #self.bufferRead - (is_cr and 1 or 0)
local result, reason = readChunk()
if not result then
if reason then

View File

@ -58,45 +58,18 @@ local function preloadSearcher(module)
end
end
local function delay_index(tbl,key)
local z = getmetatable(tbl)
local method = z.methods[tbl][key]
if method then
if not z.cache[tbl][key] then
local file = io.open(z.path,"r")
if file then
file:seek("set", method[1])
local loaded = load("return function"..file:read(method[2]), "=delayed-"..key,"t",z.env)
assert(loaded,"failed to load "..key)
z.cache[tbl][key] = loaded()
file:close()
--lazy_protect(key, z.cache[key])
end
end
return z.cache[tbl][key]
end
local delay_data = {}
local delay_tools = setmetatable({},{__mode="v"})
package.delay_data = delay_data
function delay_data.__index(tbl,key)
local lookup = delay_tools.lookup or loadfile("/lib/tools/delayLookup.lua")
delay_tools.lookup = lookup
return lookup(delay_data, tbl, key)
end
local function delay_newindex(tbl,key,value)
local z = getmetatable(tbl)
z.methods[tbl][key] = nil
rawset(tbl,key,value)
end
local function delay_pairs(tbl)
local set,k,v = {}
while true do
k,v = next(tbl,k)
if not k then break end
set[k] = v
end
local z = getmetatable(tbl)
for k in pairs(z.methods[tbl]) do
if not set[k] then
set[k] = function(...)return delay_index(tbl,k)(...)end
end
end
return pairs(set)
end
local weak_cache = setmetatable({},{__mode="v"})
delay_data.__pairs = delay_data.__index -- nil key acts like pairs
function delaySearcher(module)
if not delayed[module] then
return "\tno field package.delayed['" .. module .. "']"
@ -105,8 +78,9 @@ function delaySearcher(module)
if not filepath then
return reason
end
weak_cache.parser = weak_cache.parser or loadfile("/lib/tools/delayParse.lua")
local loader, reason = weak_cache.parser(filepath,delay_index,delay_newindex,delay_pairs)
local parser = delay_tools.parser or loadfile("/lib/tools/delayParse.lua")
delay_tools.parser = parser
local loader, reason = parser(filepath,delay_data)
return loader, reason
end

View File

@ -137,6 +137,7 @@ function plib.internal.create(fp)
args = {},
next = nil,
create = _co.create,
wrap = _co.wrap,
previous_handler = _co
}, {__index=_co})
@ -251,15 +252,6 @@ function plib.internal.create(fp)
return _co.status(thread)
end
function pco.wrap(f)
local thread = coroutine.create(f)
return function(...)
local result_pack = table.pack(pco.resume(thread, ...))
local result, reason = result_pack[1], result_pack[2]
assert(result, reason)
return select(2, table.unpack(result_pack))
end
end
if fp then
pco.stack = {process.load(fp,nil,nil--[[init]],"pco root")}

View File

@ -482,7 +482,7 @@ function --[[@delayloaded-start@]] sh.getMatchingPrograms(baseName)
baseName = "^(" .. text.escapeMagic(baseName) .. ".*)%.lua$"
end
for basePath in string.gmatch(os.getenv("PATH"), "[^:]+") do
for file in fs.list(basePath) do
for file in fs.list(shell.resolve(basePath)) do
local match = file:match(baseName)
if match and not result_keys[match] then
table.insert(result, match)

View File

@ -54,44 +54,59 @@ function term.isAvailable(w)
return w and not not (w.gpu and w.screen)
end
function term.internal.pull(input, c, off, p, ...)
local w=W()
function term.internal.pull(input, c, off, t, ...)
t=t or math.huge
if t < 0 then return end
local w,unpack=W(),table.unpack
local d,h,dx,dy,x,y=term.getViewport(w)
local out = (x<1 or x>d or y<1 or y>h)
if not w.blink or (not input and out) or type(p) == "number" then
return event.pull(p,...)
end
local gpu=w.gpu
if out then
if input and out then
input:move(0)
y=w.y
input:scroll()
end
x,y=w.x+dx,w.y+dy
c=c or {gpu.getBackground(),gpu.getForeground(),gpu.get(x,y)}
if not off then
gpu.setForeground(c[1])
gpu.setBackground(c[2])
end
gpu.set(x,y,c[3])
gpu.setForeground(c[2])
gpu.setBackground(c[1])
local a={pcall(event.pull,0.5,p,...)}
if #a>1 then
local gpu
if input or not out then
gpu=w.gpu
local sf,sb=gpu.setForeground,gpu.setBackground
c=c or {{gpu.getBackground()},{gpu.getForeground()},gpu.get(x,y)}
local c11,c12 = unpack(c[1])
local c21,c22 = unpack(c[2])
if not off then
sf(c11,c12)
sb(c21,c22)
end
gpu.set(x,y,c[3])
return select(2,table.unpack(a))
sb(c11,c12)
sf(c21,c22)
end
return term.internal.pull(input,c,not off,p,...)
local a={pcall(event.pull,math.min(t,0.5),...)}
if #a>1 or t<.5 then
if gpu then
gpu.set(x,y,c[3])
end
return select(2,unpack(a))
end
local blinking = w.blink
if input then blinking = input.blink end
return term.internal.pull(input,c,blinking and not off,t-0.5,...)
end
function term.pull(...)
return term.internal.pull(nil,nil,nil,...)
function term.pull(p,...)
local a,t = {p,...}
if type(p) == "number" then t = table.remove(a,1) end
return term.internal.pull(nil,nil,nil,t,table.unpack(a))
end
function term.read(history,dobreak,hintHandler,pwchar,filter)
if not io.stdin.tty then return io.read() end
local ops = history or {}
ops.dobreak = ops.dobreak or dobreak
ops.dobreak = ops.dobreak
if ops.dobreak==nil then ops.dobreak = dobreak end
ops.hintHandler = ops.hintHandler or hintHandler
ops.pwchar = ops.pwchar or pwchar
ops.filter = ops.filter or filter
@ -135,6 +150,7 @@ function term.internal.build_vertical_reader(input)
local win=_.w
local oi,w,h,dx,dy,ox,oy = _.index,term.getViewport(win)
_:move(math.huge)
_:move(-1)
local ex,ey=win.x,win.y
win.x,win.y,_.index=ox,oy,oi
x=oy==ey and ox or 1
@ -147,7 +163,7 @@ function term.internal.build_vertical_reader(input)
local ndata
if arg < 0 then if _.index<=0 then return end
_:move(-1)
ndata=unicode.wtrunc(s1,unicode.wlen(s1))..s2
ndata=unicode.sub(s1,1,-2)..s2
else if _.index>=unicode.len(_.data) then return end
s2=unicode.sub(s2,2)
ndata=s1..s2
@ -202,10 +218,11 @@ function term.readKeyboard(ops)
local filter = ops.filter and function(i) return term.internal.filter(ops.filter,i) end or term.internal.nop
local pwchar = ops.pwchar and function(i) return term.internal.mask(ops.pwchar,i) end or term.internal.nop
local history,db,hints={list=ops,index=0},ops.dobreak,{handler=ops.hintHandler}
term.setCursorBlink(true)
local w=W()
local draw=io.stdin.tty and term.drawText or term.internal.nop
local input={w=w,promptx=w.x,prompty=w.y,index=0,data="",mask=pwchar}
input.blink = ops.blink
if input.blink == nil then input.blink = w.blink end
if ops.nowrap then
term.internal.build_horizontal_reader(input)
else
@ -214,14 +231,15 @@ function term.readKeyboard(ops)
while true do
local name, address, char, code = term.internal.pull(input)
local c = nil
hints.cache=char==9 and hints.cache or nil
local backup_cache = hints.cache
if name =="interrupted" then draw("^C\n",true) return ""
elseif name=="touch" or name=="drag" then term.internal.onTouch(input,char,code)
elseif name=="clipboard" then c=char
elseif name=="clipboard" then c=char hints.cache = nil
elseif name=="key_down" then
hints.cache = nil
local ctrl = kb.isControlDown(address)
if ctrl and code == keys.d then return
elseif char==9 then term.internal.tab(input,hints)
elseif char==9 then hints.cache = backup_cache term.internal.tab(input,hints)
elseif char==13 and filter(input) then
input:move(math.huge)
if db ~= false then draw("\n") end
@ -245,6 +263,8 @@ function term.readKeyboard(ops)
input:update(0)
elseif char>=32 then
c=unicode.char(char)
else
hints.cache = backup_cache
end
end
if c then input:update(c) end
@ -309,12 +329,11 @@ function term.drawText(value, wrap, window)
local wlen_remaining = w - x + 1
local clean_end = ""
if wlen_remaining < wlen_needed then
if type(wrap)=="number" then
next,wlen_needed,slen = term.internal.horizontal_push(x,y,window,wrap,next)
else
next = unicode.wtrunc(next, wlen_remaining + 1)
wlen_needed = unicode.wlen(next)
clean_end = (" "):rep(wlen_remaining-wlen_needed)
next = unicode.wtrunc(next, wlen_remaining + 1)
wlen_needed = unicode.wlen(next)
clean_end = (" "):rep(wlen_remaining-wlen_needed)
if not wrap then
si = math.huge
end
end
gpu.set(x+dx,y+dy,next..clean_end)
@ -350,6 +369,10 @@ function term.setCursorBlink(enabled)
W().blink=enabled
end
function term.getCursorBlink()
return W().blink
end
function term.bind(gpu, screen, kb, window)
window = window or W()
window.gpu = gpu or window.gpu
@ -376,19 +399,10 @@ function --[[@delayloaded-start@]] term.internal.ctrl_movement(input, dir)
return last - index
end --[[@delayloaded-end@]]
function --[[@delayloaded-start@]] term.internal.horizontal_push(x,y,win,wrap,next)
local gpu,w,h,dx,dy = win.gpu,term.getViewport(win)
local wlen_needed = unicode.wlen(next)
local next_width = math.min(wlen_needed, w - wrap)
next = unicode.sub(next, -next_width)
wlen_needed = unicode.wlen(next)
local xdiff = x - (w - wlen_needed)
gpu.copy(wrap+xdiff+dx,y+dy,x-(wrap+xdiff),1,-xdiff,0)
return next,wlen_needed,#next
end --[[@delayloaded-end@]]
function --[[@delayloaded-start@]] term.internal.onTouch(input,gx,gy)
input:move(math.huge)
local w = W()
gx,gy=gx-w.dx,gy-w.dy
local x2,y2,d = input.w.x,input.w.y,input.w.w
input:move((gy*d+gx)-(y2*d+x2))
end --[[@delayloaded-end@]]
@ -399,7 +413,7 @@ function --[[@delayloaded-start@]] term.internal.build_horizontal_reader(input)
local w,h,dx,dy,x,y = term.getViewport(_.w)
local s1,s2=term.internal.split(_)
local wlen = math.min(unicode.wlen(s2),w-x+1)
_.w.gpu.fill(x,y,wlen,1," ")
_.w.gpu.fill(x+dx,y+dy,wlen,1," ")
end
input.move = function(_,n)
local win = _.w
@ -412,7 +426,7 @@ function --[[@delayloaded-start@]] term.internal.build_horizontal_reader(input)
_:scroll()
end
input.draw = function(_,text)
term.drawText(text,_.promptx)
term.drawText(text,false)
end
input.scroll = function(_)
local win = _.w
@ -431,9 +445,8 @@ function --[[@delayloaded-start@]] term.internal.build_horizontal_reader(input)
data = unicode.sub(data,1,i)
local rev = unicode.reverse(data)
local ending = unicode.wtrunc(rev, available+1)
local cut_wlen = unicode.wlen(data) - unicode.wlen(ending)
data = unicode.reverse(ending)
gpu.set(sx,sy,data..blank:rep(cut_wlen))
gpu.set(sx,sy,data..blank)
win.x=math.min(w,_.promptx+unicode.wlen(data))
elseif x < _.promptx then
data = unicode.sub(data,_.index+1)
@ -448,7 +461,7 @@ function --[[@delayloaded-start@]] term.internal.build_horizontal_reader(input)
local gpu,data,px=win.gpu,_.data,_.promptx
local w,h,dx,dy,x,y = term.getViewport(win)
_.index,_.data,win.x=0,"",px
gpu.fill(px+dx,y+dy,w-px+1,1," ")
gpu.fill(px+dx,y+dy,w-px+1-dx,1," ")
end
end --[[@delayloaded-end@]]
@ -467,8 +480,8 @@ end --[[@delayloaded-end@]]
function --[[@delayloaded-start@]] term.internal.filter(filter,input)
if not filter then return true
elseif type(filter) == "string" then return input:match(filter)
elseif filter(input) then return true
elseif type(filter) == "string" then return input.data:match(filter)
elseif filter(input.data) then return true
else require("computer").beep(2000, 0.1) end
end --[[@delayloaded-end@]]
@ -480,7 +493,8 @@ function --[[@delayloaded-start@]] term.internal.tab(input,hints)
hints.cache.i=-1
end
local c=hints.cache
c.i=(c.i+1)%#c
local change = kb.isShiftDown(term.keyboard().address) and -1 or 1
c.i=(c.i+change)%math.max(#c,1)
local next=c[c.i+1]
if next then
local tail = unicode.wlen(input.data) - input.index - 1

View File

@ -0,0 +1,33 @@
local data,tbl,key = ...
local z = data[tbl]
if key then -- index
local method = z.methods[key]
local cache = z.cache[key]
if method and not cache then
local file = io.open(z.path,"r")
if file then
file:seek("set", method[1])
local loaded = load("return function"..file:read(method[2]), "=delayed-"..key,"t",z.env)
file:close()
assert(loaded,"failed to load "..key)
cache = loaded()
--lazy_protect(key, cache)
z.cache[key] = cache
end
end
return cache
else -- pairs
local set,k,v = {}
while true do
k,v = next(tbl,k)
if not k then break end
set[k] = v
end
for k in pairs(z.methods) do
if not set[k] then
set[k] = function(...)return tbl[k](...)end
end
end
return pairs(set)
end

View File

@ -1,4 +1,4 @@
local filepath,delay_index,delay_newindex,delay_pairs = ...
local filepath,delay_data = ...
local file, reason = io.open(filepath, "r")
if not file then
return reason
@ -45,23 +45,20 @@ local library, local_env = loader()
if library then
local_env = local_env or {}
local_env[lib_name] = library
local mt =
{
methods={},
cache={},
env=setmetatable(local_env, {__index=_G}),
path=filepath,
__pairs=delay_pairs,
__index=delay_index,
__newindex=delay_newindex,
}
local env = setmetatable(local_env, {__index=_G})
for path,pack in pairs(methods) do
local target = library
for name in path:gmatch("[^%.]+") do target = target[name] end
mt.methods[target]=pack
mt.cache[target]={}
setmetatable(target, mt)
delay_data[target] =
{
methods = pack,
cache = {},
env = env,
path = filepath
}
setmetatable(target, delay_data)
end
return function()return library end, filepath

View File

@ -129,7 +129,7 @@ function new(readfs, writefs)
if not hnd then
return hnd, err
end
return hnd * 2
return {h=hnd,w=true}
elseif mode:sub(1, 1) == "a" then
if readfs.exists(path) and not writefs.exists(kernel.modules.vfs.path(path)..".cfsdel."..kernel.modules.vfs.name(path)) then
if readfs.isDirectory(path) then
@ -158,7 +158,7 @@ function new(readfs, writefs)
return nil, "Cannot open a directory"
end
local hnd, reason = writefs.open(path, mode)
return hnd and hnd * 2, reason
return hnd and {h=hnd,w=true}, reason
elseif mode:sub(1, 1) == "r" then
local fs = getFileFS(path)
if not fs then return nil, "file not found" end
@ -166,37 +166,35 @@ function new(readfs, writefs)
return nil, "Cannot open a directory"
end
local hnd = fs.open(path, mode)
hnd = hnd * 2
if fs == readfs then hnd = hnd + 1 end
return hnd
return hnd and {h=hnd,w=fs==writefs}
end
end
proxy.seek = function(h, ...)
if h % 2 == 0 then
return writefs.seek(h / 2, ...)
if h.w then
return writefs.seek(h.h, ...)
else
return readfs.seek((h - 1) / 2, ...)
return readfs.seek(h.h, ...)
end
end
proxy.read = function(h, ...)
if h % 2 == 0 then
return writefs.read(h / 2, ...)
if h.w then
return writefs.read(h.h, ...)
else
return readfs.read((h - 1) / 2, ...)
return readfs.read(h.h, ...)
end
end
proxy.close = function(h, ...)
if h % 2 == 0 then
return writefs.close(h / 2, ...)
if h.w then
return writefs.close(h.h, ...)
else
return readfs.close((h - 1) / 2, ...)
return readfs.close(h.h, ...)
end
end
proxy.write = function(h, ...)
if h % 2 == 0 then
return writefs.write(h / 2, ...)
if h.w then
return writefs.write(h.h, ...)
else
return readfs.write((h - 1) / 2, ...)
return readfs.write(h.h, ...)
end
end
return proxy

View File

@ -42,8 +42,10 @@ if filename == "" then
end
filename = shell.resolve(filename)
local preexisted
if fs.exists(filename) then
if not options.f or not os.remove(filename) then
preexisted = true
if not options.f then
if not options.Q then
io.stderr:write("file already exists")
end
@ -51,13 +53,15 @@ if fs.exists(filename) then
end
end
local f, reason = io.open(filename, "wb")
local f, reason = io.open(filename, "a")
if not f then
if not options.Q then
io.stderr:write("failed opening file for writing: " .. reason)
end
return nil, "failed opening file for writing: " .. reason -- for programs using wget as a function
end
f:close()
f = nil
if not options.q then
io.write("Downloading... ")
@ -66,6 +70,10 @@ local result, response = pcall(internet.request, url)
if result then
local result, reason = pcall(function()
for chunk in response do
if not f then
f, reason = io.open(filename, "wb")
assert(f, "failed opening file for writing: " .. tostring(reason))
end
f:write(chunk)
end
end)
@ -73,8 +81,12 @@ if result then
if not options.q then
io.stderr:write("failed.\n")
end
f:close()
fs.remove(filename)
if f then
f:close()
if not preexisted then
fs.remove(filename)
end
end
if not options.Q then
io.stderr:write("HTTP request failed: " .. reason .. "\n")
end
@ -83,8 +95,11 @@ if result then
if not options.q then
io.write("success.\n")
end
if f then
f:close()
end
f:close()
if not options.q then
io.write("Saved data to " .. filename .. "\n")
end
@ -92,11 +107,9 @@ else
if not options.q then
io.write("failed.\n")
end
f:close()
fs.remove(filename)
if not options.Q then
io.stderr:write("HTTP request failed: " .. response .. "\n")
end
return nil, response -- for programs using wget as a function
end
return true -- for programs using wget as a function
return true -- for programs using wget as a function

View File

@ -1055,7 +1055,7 @@ local userdataWrapper = {
__metatable = "userdata",
__tostring = function(self)
local data = wrappedUserdata[self]
return tostring(select(2, pcall(data.toString, data)))
return tostring(select(2, pcall(tostring, data)))
end
}

View File

@ -89,18 +89,18 @@ diskDriveMountable {
[obsidian, "oc:materialCircuitBoardPrinted", obsidian]]
}
server1 {
input: [[obsidian, "oc:ram4", obsidian]
["oc:circuitChip1", "oc:circuitChip2", "oc:circuitChip1"]
input: [[ingotIron, "oc:ram2", ingotIron]
["oc:circuitChip1", "oc:componentBus1", "oc:circuitChip1"]
[obsidian, "oc:materialCircuitBoardPrinted", obsidian]]
}
server2 {
input: [[obsidian, "oc:ram5", obsidian]
["oc:circuitChip2", "oc:circuitChip3", "oc:circuitChip2"]
input: [[ingotGold, "oc:ram4", ingotGold]
["oc:circuitChip2", "oc:componentBus2", "oc:circuitChip2"]
[obsidian, "oc:materialCircuitBoardPrinted", obsidian]]
}
server3 {
input: [[obsidian, "oc:ram6", obsidian]
["oc:circuitChip3", "oc:circuitChip3", "oc:circuitChip3"]
input: [[gemDiamond, "oc:ram6", gemDiamond]
["oc:circuitChip3", "oc:componentBus3", "oc:circuitChip3"]
[obsidian, "oc:materialCircuitBoardPrinted", obsidian]]
}
terminalServer {
@ -169,7 +169,7 @@ dataCard2 {
["", "oc:materialCard", ""]]
}
dataCard3 {
input: [[gemDiamond, "oc:cpu2", "oc:ram5"]
input: [[chipDiamond, "oc:cpu2", "oc:ram5"]
["", "oc:materialCard", ""]]
}
graphicsCard1 {
@ -226,19 +226,19 @@ angelUpgrade {
[ingotIron, materialEnderPearl, ingotIron]]
}
batteryUpgrade1 {
input: [[ingotIron, nuggetGold, ingotIron]
input: [[nuggetIron, nuggetGold, nuggetIron]
[fenceIron, "oc:capacitor", fenceIron]
[ingotIron, nuggetGold, ingotIron]]
[nuggetIron, nuggetGold, nuggetIron]]
}
batteryUpgrade2 {
input: [[ingotGold, "oc:capacitor", ingotGold]
input: [[nuggetIron, "oc:capacitor", nuggetIron]
[fenceIron, nuggetGold, fenceIron]
[ingotGold, "oc:capacitor", ingotGold]]
[nuggetIron, "oc:capacitor", nuggetIron]]
}
batteryUpgrade3 {
input: [[gemDiamond, "oc:capacitor", gemDiamond]
[fenceIron, "oc:capacitor", fenceIron]
[gemDiamond, "oc:capacitor", gemDiamond]]
input: [[nuggetIron, "oc:capacitor", nuggetIron]
["oc:capacitor", chipDiamond, "oc:capacitor"]
[nuggetIron, "oc:capacitor", nuggetIron]]
}
chunkloaderUpgrade {
input: [[ingotGold, blockGlass, ingotGold]
@ -372,23 +372,31 @@ upgradeContainer3 {
[ingotGold, "oc:materialCircuitBoardPrinted", ingotGold]]
}
# Note: iron ingot and nugget recipes are *only* registered if no other mod
# Note: ingot/gem <-> nugget recipes are *only* registered if no other mod
# already provides the same functionality.
nuggetIron {
type: shapeless
input: ingotIron
output: 9
}
ingotIron {
type: shapeless
input: [nuggetIron, nuggetIron, nuggetIron,
nuggetIron, nuggetIron, nuggetIron,
nuggetIron, nuggetIron, nuggetIron]
}
chipDiamond {
type: shapeless
input: gemDiamond
output: 6
}
gemDiamond = false
cuttingWire = false
acid {
type: shapeless
input: [bucketWater, sugar, slimeball, fermentedSpiderEye, bone]
}
ingotIron {
input: [[nuggetIron, nuggetIron, nuggetIron],
[nuggetIron, nuggetIron, nuggetIron],
[nuggetIron, nuggetIron, nuggetIron]]
}
disk {
input: [["", nuggetIron, ""]
[nuggetIron, "", nuggetIron]
@ -436,24 +444,28 @@ numPad {
}
transistor {
input: [[nuggetIron, nuggetIron, nuggetIron]
input: [[ingotIron, ingotIron, ingotIron]
[nuggetGold, paper, nuggetGold]
["", redstone, ""]]
output: 8
}
chip1 {
input: [[nuggetIron, "", nuggetIron]
input: [[nuggetIron, nuggetIron, nuggetIron]
[redstone, "oc:materialTransistor", redstone]
[nuggetIron, "", nuggetIron]]
[nuggetIron, nuggetIron, nuggetIron]]
output: 8
}
chip2 {
input: [[nuggetGold, "", nuggetGold]
input: [[nuggetGold, nuggetGold, nuggetGold]
[redstone, "oc:materialTransistor", redstone]
[nuggetGold, "", nuggetGold]]
[nuggetGold, nuggetGold, nuggetGold]]
output: 4
}
chip3 {
input: [[gemDiamond, "", gemDiamond]
input: [[chipDiamond, chipDiamond, chipDiamond]
[redstone, "oc:materialTransistor", redstone]
[gemDiamond, "", gemDiamond]]
[chipDiamond, chipDiamond, chipDiamond]]
output: 2
}
alu {
input: [[nuggetIron, redstone, nuggetIron]
@ -466,9 +478,9 @@ apu1 {
[nuggetGold, "oc:circuitChip1", nuggetGold]]
}
apu2 {
input: [[gemDiamond, "oc:circuitChip2", gemDiamond]
input: [[chipDiamond, "oc:circuitChip2", chipDiamond]
["oc:cpu3", "oc:componentBus2", "oc:graphicsCard2"]
[gemDiamond, "oc:circuitChip2", gemDiamond]]
[chipDiamond, "oc:circuitChip2", chipDiamond]]
}
componentBus1 {
input: [[nuggetIron, redstone, nuggetIron]
@ -481,9 +493,9 @@ componentBus2 {
[nuggetGold, "oc:materialCircuitBoardPrinted", nuggetGold]]
}
componentBus3 {
input: [[emerald, redstone, emerald]
input: [[chipDiamond, redstone, chipDiamond]
["oc:circuitChip3", "oc:materialCU", ""]
[emerald, "oc:materialCircuitBoardPrinted", emerald]]
[chipDiamond, "oc:materialCircuitBoardPrinted", chipDiamond]]
}
cpu1 {
input: [[nuggetIron, redstone, nuggetIron]
@ -496,9 +508,9 @@ cpu2 {
[nuggetGold, "oc:materialALU", nuggetGold]]
}
cpu3 {
input: [[emerald, redstone, emerald]
input: [[chipDiamond, redstone, chipDiamond]
["oc:circuitChip3", "oc:materialCU", "oc:circuitChip3"]
[emerald, "oc:materialALU", emerald]]
[chipDiamond, "oc:materialALU", chipDiamond]]
}
cu {
input: [[nuggetGold, redstone, nuggetGold]
@ -508,7 +520,8 @@ cu {
rawCircuitBoard {
type: shapeless
input: [nuggetGold, clay, dyeGreen]
input: [ingotGold, clay, dyeGreen]
output: 8
}
circuitBoard = false
printedCircuitBoard {
@ -585,12 +598,12 @@ geolyzer {
}
hologram1 {
input: [["oc:circuitChip2", paneGlass, "oc:circuitChip2"]
["oc:materialCircuitBoardPrinted", gemDiamond, "oc:materialCircuitBoardPrinted"]
["oc:materialCircuitBoardPrinted", chipDiamond, "oc:materialCircuitBoardPrinted"]
[obsidian, yellowDust, obsidian]]
}
hologram2 {
input: [["oc:circuitChip3", blockGlass, "oc:circuitChip3"]
["oc:materialCircuitBoardPrinted", blockDiamond, "oc:materialCircuitBoardPrinted"]
["oc:materialCircuitBoardPrinted", gemDiamond, "oc:materialCircuitBoardPrinted"]
[obsidian, blazePowder, obsidian]]
}
keyboard {
@ -623,7 +636,7 @@ powerDistributor {
[ingotIron, "oc:materialCircuitBoardPrinted", ingotIron]]
}
rack {
input: [["oc:circuitChip2", "oc:wlanCard", "oc:circuitChip2"]
input: [[gemDiamond, "oc:wlanCard", gemDiamond]
[fenceIron, chest, fenceIron]
["oc:relay", "oc:materialCircuitBoardPrinted", "oc:powerDistributor"]]
}

View File

@ -187,11 +187,6 @@ tradingUpgrade {
[dropper, "oc:materialCircuitBoardPrinted", craftingPiston]]
}
nuggetIron {
type: shapeless
input: ingotIron
output: 9
}
cuttingWire {
input: [[stickWood, nuggetIron, stickWood]]
}
@ -240,6 +235,11 @@ alu {
["oc:materialTransistor", "oc:materialTransistor", "oc:materialTransistor"]
[nuggetIron, redstone, nuggetIron]]
}
apu2 {
input: [[gemDiamond, "oc:circuitChip2", gemDiamond]
["oc:cpu3", "oc:componentBus2", "oc:graphicsCard2"]
[gemDiamond, "oc:circuitChip2", gemDiamond]]
}
componentBus1 {
input: [[nuggetIron, redstone, nuggetIron]
["oc:circuitChip1", "oc:materialCU", ""]
@ -347,6 +347,16 @@ geolyzer {
[eyeOfEnder, "oc:circuitChip2", eyeOfEnder]
[ingotGold, "oc:materialCircuitBoardPrinted", ingotGold]]
}
hologram1 {
input: [["oc:circuitChip2", paneGlass, "oc:circuitChip2"]
["oc:materialCircuitBoardPrinted", gemDiamond, "oc:materialCircuitBoardPrinted"]
[obsidian, yellowDust, obsidian]]
}
hologram2 {
input: [["oc:circuitChip3", blockGlass, "oc:circuitChip3"]
["oc:materialCircuitBoardPrinted", blockDiamond, "oc:materialCircuitBoardPrinted"]
[obsidian, blazePowder, obsidian]]
}
keyboard {
input: [["oc:materialButtonGroup", "oc:materialButtonGroup", "oc:materialButtonGroup"]
["oc:materialButtonGroup", "oc:materialArrowKey", "oc:materialNumPad"]]

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

View File

@ -87,6 +87,7 @@ object Constants {
final val DataCardTier3 = "dataCard3"
final val DebugCard = "debugCard"
final val Debugger = "debugger"
final val DiamondChip = "chipDiamond"
final val Disk = "disk"
final val DiskDriveMountable = "diskDriveMountable"
final val Drone = "drone"

View File

@ -45,6 +45,7 @@ class Settings(val config: Config) {
OpenComputers.log.warn("Bad number of HUD coordiantes, ignoring.")
(-1.0, -1.0)
}
val enableNanomachinePfx = config.getBoolean("client.enableNanomachinePfx")
// ----------------------------------------------------------------------- //
// computer
@ -85,6 +86,7 @@ class Settings(val config: Config) {
Array(192, 256, 384, 512, 768, 1024)
}
val ramScaleFor64Bit = config.getDouble("computer.lua.ramScaleFor64Bit") max 1
val maxTotalRam = config.getInt("computer.lua.maxTotalRam") max 0
// ----------------------------------------------------------------------- //
// robot
@ -236,6 +238,7 @@ class Settings(val config: Config) {
private val valueIndustrialCraft2 = config.getDouble("power.value.IndustrialCraft2")
private val valueMekanism = config.getDouble("power.value.Mekanism")
private val valueRedstoneFlux = config.getDouble("power.value.RedstoneFlux")
private val valueRotaryCraft = config.getDouble("power.value.RotaryCraft") / 11256.0
private val valueInternal = 1000
@ -245,6 +248,7 @@ class Settings(val config: Config) {
val ratioIndustrialCraft2 = valueIndustrialCraft2 / valueInternal
val ratioMekanism = valueMekanism / valueInternal
val ratioRedstoneFlux = valueRedstoneFlux / valueInternal
val ratioRotaryCraft = valueRotaryCraft / valueInternal
// ----------------------------------------------------------------------- //
// filesystem
@ -401,7 +405,7 @@ class Settings(val config: Config) {
val logFullLibLoadErrors = config.getBoolean("debug.logFullNativeLibLoadErrors")
val forceNativeLib = config.getString("debug.forceNativeLibWithName")
val logOpenGLErrors = config.getBoolean("debug.logOpenGLErrors")
val logUnifontErrors = config.getBoolean("debug.logUnifontErrors")
val logHexFontErrors = config.getBoolean("debug.logHexFontErrors")
val alwaysTryNative = config.getBoolean("debug.alwaysTryNative")
val debugPersistence = config.getBoolean("debug.verbosePersistenceErrors")
val nativeInTmpDir = config.getBoolean("debug.nativeInTmpDir")

View File

@ -19,7 +19,7 @@ import scala.collection.mutable
*/
class DynamicFontRenderer extends TextureFontRenderer with IResourceManagerReloadListener {
private val glyphProvider: IGlyphProvider = Settings.get.fontRenderer match {
case _ => new FontParserUnifont()
case _ => new FontParserHex()
}
private val textures = mutable.ArrayBuffer.empty[CharTexture]

View File

@ -13,7 +13,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.ByteBuffer;
public class FontParserUnifont implements IGlyphProvider {
public class FontParserHex implements IGlyphProvider {
private static final byte[] OPAQUE = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
private static final byte[] TRANSPARENT = {0, 0, 0, 0};
@ -26,17 +26,19 @@ public class FontParserUnifont implements IGlyphProvider {
}
try {
final InputStream font = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation(Settings.resourceDomain(), "font.hex")).getInputStream();
OpenComputers.log().info("Initialized Unifont glyph provider.");
OpenComputers.log().info("Initialized unicode glyph provider.");
try {
OpenComputers.log().info("Initializing Unifont glyph provider.");
OpenComputers.log().info("Initializing unicode glyph provider.");
final BufferedReader input = new BufferedReader(new InputStreamReader(font));
String line;
int glyphCount = 0;
while ((line = input.readLine()) != null) {
final String[] info = line.split(":");
final int charCode = Integer.parseInt(info[0], 16);
if (charCode < 0 || charCode >= glyphs.length) continue; // Out of bounds.
final int expectedWidth = FontUtils.wcwidth(charCode);
if (expectedWidth < 1) continue; // Skip control characters.
// Two chars representing one byte represent one row of eight pixels.
final byte[] glyph = new byte[info[1].length() >> 1];
final int glyphWidth = glyph.length / getGlyphHeight();
if (expectedWidth == glyphWidth) {
@ -47,15 +49,16 @@ public class FontParserUnifont implements IGlyphProvider {
glyphCount++;
}
glyphs[charCode] = glyph;
} else if (Settings.get().logUnifontErrors()) {
OpenComputers.log().warn(String.format("Size of glyph for code point U+%04X (%s) in Unifont (%d) does not match expected width (%d), ignoring.", charCode, String.valueOf((char) charCode), glyphWidth, expectedWidth));
} else if (Settings.get().logHexFontErrors()) {
OpenComputers.log().warn(String.format("Size of glyph for code point U+%04X (%s) in font (%d) does not match expected width (%d), ignoring.", charCode, String.valueOf((char) charCode), glyphWidth, expectedWidth));
}
}
OpenComputers.log().info("Loaded " + glyphCount + " glyphs.");
} finally {
try {
font.close();
} catch (IOException ignored) {
} catch (IOException ex) {
OpenComputers.log().warn("Error parsing font.", ex);
}
}
} catch (IOException ex) {
@ -71,8 +74,10 @@ public class FontParserUnifont implements IGlyphProvider {
final ByteBuffer buffer = BufferUtils.createByteBuffer(glyph.length * getGlyphWidth() * 4);
for (byte aGlyph : glyph) {
int c = ((int) aGlyph) & 0xFF;
// Grab all bits by grabbing the leftmost one then shifting.
for (int j = 0; j < 8; j++) {
if ((c & 128) > 0) buffer.put(OPAQUE);
final boolean isBitSet = (c & 0x80) > 0;
if (isBitSet) buffer.put(OPAQUE);
else buffer.put(TRANSPARENT);
c <<= 1;
}

View File

@ -12,7 +12,7 @@ public interface IGlyphProvider {
* <p/>
* This should usually also be called from the implementation's constructor.
*/
public void initialize();
void initialize();
/**
* Get a byte array of RGBA data describing the specified char.
@ -30,9 +30,9 @@ public interface IGlyphProvider {
*
* @param charCode the char to get the render glyph data for.
* @return the RGBA byte array representing the char.
* @see li.cil.oc.client.renderer.font.FontParserUnifont#getGlyph(int) See the Unifont parser for a reference implementation.
* @see FontParserHex#getGlyph(int) See the hexfont parser for a reference implementation.
*/
public ByteBuffer getGlyph(int charCode);
ByteBuffer getGlyph(int charCode);
/**
* Get the single-width glyph width for this provider, in pixels.
@ -41,12 +41,12 @@ public interface IGlyphProvider {
* a glyphs actual width (in pixels) is expected to be this value times
* {@link li.cil.oc.util.FontUtils#wcwidth(int)} (for a specific char).
*/
public int getGlyphWidth();
int getGlyphWidth();
/**
* Get the glyph height for this provider, in pixels.
* <p/>
* Each glyph provided is expected to have the same height.
*/
public int getGlyphHeight();
int getGlyphHeight();
}

View File

@ -213,6 +213,7 @@ object Achievement {
withParent(Cable).
whenCrafting(Constants.BlockName.Switch).
whenCrafting(Constants.BlockName.AccessPoint).
whenCrafting(Constants.BlockName.Relay).
add()
val Adapter = newAchievement("adapter").
at(-4, 1).

View File

@ -11,16 +11,19 @@ import li.cil.oc.common.entity.Drone
import li.cil.oc.common.init.Blocks
import li.cil.oc.common.init.Items
import li.cil.oc.common.item.Delegator
import li.cil.oc.common.item.traits.Delegate
import li.cil.oc.common.recipe.Recipes
import li.cil.oc.integration.Mods
import li.cil.oc.server._
import li.cil.oc.server.machine.luac.LuaStateFactory
import li.cil.oc.server.machine.luac.NativeLua52Architecture
import li.cil.oc.server.machine.luaj.LuaJLuaArchitecture
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraftforge.oredict.OreDictionary
import scala.collection.convert.WrapAsScala._
import scala.reflect.ClassTag
class Proxy {
def preInit(e: FMLPreInitializationEvent) {
@ -43,20 +46,8 @@ class Proxy {
OreDictionary.registerOre("chest", net.minecraft.init.Blocks.chest)
OreDictionary.registerOre("chest", net.minecraft.init.Blocks.trapped_chest)
val nuggetIron = Items.get(Constants.ItemName.IronNugget).createItemStack(1)
registerExclusive("nuggetIron", nuggetIron)
Delegator.subItem(nuggetIron) match {
case Some(subItem: item.IronNugget) =>
if (OreDictionary.getOres("nuggetIron").exists(nuggetIron.isItemEqual)) {
Recipes.addSubItem(subItem, "nuggetIron")
Recipes.addItem(net.minecraft.init.Items.iron_ingot, "ingotIron")
}
else {
subItem.showInItemList = false
}
case _ =>
}
tryRegisterNugget[item.IronNugget](Constants.ItemName.IronNugget, "nuggetIron", net.minecraft.init.Items.iron_ingot, "ingotIron")
tryRegisterNugget[item.DiamondChip](Constants.ItemName.DiamondChip, "chipDiamond", net.minecraft.init.Items.diamond, "gemDiamond")
// Avoid issues with Extra Utilities registering colored obsidian as `obsidian`
// oredict entry, but not normal obsidian, breaking some recipes.
@ -108,6 +99,24 @@ class Proxy {
driver.Registry.locked = true
}
def tryRegisterNugget[TItem <: Delegate : ClassTag](nuggetItemName: String, nuggetOredictName: String, ingotItem: Item, ingotOredictName: String): Unit = {
val nugget = Items.get(nuggetItemName).createItemStack(1)
registerExclusive(nuggetOredictName, nugget)
Delegator.subItem(nugget) match {
case Some(subItem: TItem) =>
if (OreDictionary.getOres(nuggetOredictName).exists(nugget.isItemEqual)) {
Recipes.addSubItem(subItem, nuggetItemName)
Recipes.addItem(ingotItem, ingotOredictName)
}
else {
subItem.showInItemList = false
}
case _ =>
}
}
private def registerExclusive(name: String, items: ItemStack*) {
if (OreDictionary.getOres(name).isEmpty) {
for (item <- items) {

View File

@ -2,10 +2,13 @@ package li.cil.oc.common.block
import li.cil.oc.Settings
import li.cil.oc.common.tileentity
import li.cil.oc.integration.util.NEI
import net.minecraft.world.World
// TODO Remove in 1.7
class AccessPoint extends Switch with traits.PowerAcceptor {
NEI.hide(this)
override protected def customTextures = Array(
None,
Some("AccessPointTop"),

View File

@ -18,13 +18,19 @@ import li.cil.oc.integration.fmp.CablePart
import li.cil.oc.util.Color
import net.minecraft.block.Block
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.MovingObjectPosition
import net.minecraft.world.IBlockAccess
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
class Cable extends SimpleBlock with traits.SpecialBlock {
import scala.reflect.ClassTag
class Cable(protected implicit val tileTag: ClassTag[tileentity.Cable]) extends SimpleBlock with traits.SpecialBlock with traits.CustomDrops[tileentity.Cable] {
setLightOpacity(0)
// For Immibis Microblock support.
@ -55,6 +61,17 @@ class Cable extends SimpleBlock with traits.SpecialBlock {
override def isSideSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
@SideOnly(Side.CLIENT)
override def getRenderColor(metadata: Int) = metadata
// ----------------------------------------------------------------------- //
override def getPickBlock(target: MovingObjectPosition, world: World, x: Int, y: Int, z: Int) =
world.getTileEntity(x, y, z) match {
case t: tileentity.Cable => t.createItemStack()
case _ => null
}
// ----------------------------------------------------------------------- //
override def hasTileEntity(metadata: Int) = true
@ -71,6 +88,20 @@ class Cable extends SimpleBlock with traits.SpecialBlock {
override protected def doSetBlockBoundsBasedOnState(world: IBlockAccess, x: Int, y: Int, z: Int): Unit = {
setBlockBounds(Cable.bounds(world, x, y, z))
}
override protected def doCustomInit(tileEntity: tileentity.Cable, player: EntityLivingBase, stack: ItemStack): Unit = {
super.doCustomInit(tileEntity, player, stack)
if (!tileEntity.world.isRemote) {
tileEntity.fromItemStack(stack)
}
}
override protected def doCustomDrops(tileEntity: tileentity.Cable, player: EntityPlayer, willHarvest: Boolean): Unit = {
super.doCustomDrops(tileEntity, player, willHarvest)
if (!player.capabilities.isCreativeMode) {
dropBlockAsItem(tileEntity.world, tileEntity.x, tileEntity.y, tileEntity.z, tileEntity.createItemStack())
}
}
}
object Cable {

View File

@ -9,6 +9,8 @@ import li.cil.oc.client.KeyBindings
import li.cil.oc.common.item.data.PrintData
import li.cil.oc.common.item.data.RobotData
import li.cil.oc.common.tileentity
import li.cil.oc.util.Color
import li.cil.oc.util.ItemColorizer
import li.cil.oc.util.ItemCosts
import net.minecraft.block.Block
import net.minecraft.entity.player.EntityPlayer
@ -62,6 +64,16 @@ class Item(value: Block) extends ItemBlock(value) {
case _ => Settings.namespace + "tile"
}
override def getDamage(stack: ItemStack): Int = {
if (api.Items.get(stack) == api.Items.get(Constants.BlockName.Cable)) {
if (ItemColorizer.hasColor(stack)) {
ItemColorizer.getColor(stack)
}
else Color.LightGray
}
else super.getDamage(stack)
}
override def isBookEnchantable(a: ItemStack, b: ItemStack) = false
override def placeBlockAt(stack: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, side: Int, hitX: Float, hitY: Float, hitZ: Float, metadata: Int) = {

View File

@ -258,6 +258,9 @@ class SimpleBlock(material: Material = Material.iron) extends Block(material) {
case colored: Colored if Color.isDye(player.getHeldItem) =>
colored.color = Color.dyeColor(player.getHeldItem)
world.markBlockForUpdate(x, y, z)
if (colored.consumesDye) {
player.getHeldItem.splitStack(1)
}
true
case _ => onBlockActivated(world, x, y, z, player, ForgeDirection.getOrientation(side), hitX, hitY, hitZ)
}

View File

@ -4,11 +4,14 @@ import li.cil.oc.Settings
import li.cil.oc.client.Textures
import li.cil.oc.common.GuiType
import li.cil.oc.common.tileentity
import li.cil.oc.integration.util.NEI
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.world.World
// TODO Remove in 1.7
class Switch extends SimpleBlock with traits.GUI {
NEI.hide(this)
override protected def customTextures = Array(
None,
Some("SwitchTop"),

View File

@ -533,6 +533,7 @@ object Items extends ItemAPI {
Recipes.addSubItem(new item.TerminalServer(multi), Constants.ItemName.TerminalServer, "oc:terminalServer")
Recipes.addSubItem(new item.DiskDriveMountable(multi), Constants.ItemName.DiskDriveMountable, "oc:diskDriveMountable")
Recipes.addSubItem(new item.UpgradeTrading(multi), Constants.ItemName.TradingUpgrade, "oc:tradingUpgrade")
registerItem(new item.DiamondChip(multi), Constants.ItemName.DiamondChip)
// Register aliases.
for ((k, v) <- aliases) {

View File

@ -0,0 +1,3 @@
package li.cil.oc.common.item
class DiamondChip(val parent: Delegator) extends traits.Delegate

View File

@ -1,7 +1,3 @@
package li.cil.oc.common.item
import li.cil.oc.integration.Mods
class IronNugget(val parent: Delegator) extends traits.Delegate {
showInItemList = !Mods.GregTech.isAvailable
}
class IronNugget(val parent: Delegator) extends traits.Delegate

View File

@ -4,6 +4,7 @@ import li.cil.oc.api
import li.cil.oc.common.asm.Injectable
import li.cil.oc.integration.Mods
import net.minecraft.block.Block
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityMinecart
import net.minecraft.entity.player.EntityPlayer
@ -58,6 +59,10 @@ class Wrench extends traits.SimpleItem with api.internal.Wrench {
def wrenchUsed(player: EntityPlayer, x: Int, y: Int, z: Int): Unit = player.swingItem()
def canWrench(player: EntityPlayer, entity: Entity): Boolean = true
def wrenchUsed(player: EntityPlayer, entity: Entity): Unit = player.swingItem()
// CoFH
def isUsable(stack: ItemStack, player: EntityLivingBase, x: Int, y: Int, z: Int): Boolean = true

View File

@ -279,7 +279,7 @@ class ControllerImpl(val player: EntityPlayer) extends Controller with WirelessE
}
}
if (isClient) {
if (isClient && Settings.get.enableNanomachinePfx) {
val energyRatio = getLocalBuffer / (getLocalBufferSize + 1)
val triggerRatio = activeInputs / (configuration.triggers.length + 1)
val intensity = (energyRatio + triggerRatio) * 0.25

View File

@ -1,5 +1,6 @@
package li.cil.oc.common.nanomachines.provider
import li.cil.oc.Settings
import li.cil.oc.api
import li.cil.oc.api.nanomachines.Behavior
import li.cil.oc.api.prefab.AbstractBehavior
@ -44,7 +45,7 @@ object ParticleProvider extends ScalaProvider("b48c4bbd-51bb-4915-9367-16cff3220
override def update(): Unit = {
val world = player.getEntityWorld
if (world.isRemote) {
if (world.isRemote && Settings.get.enableNanomachinePfx) {
PlayerUtils.spawnParticleAround(player, effectName, api.Nanomachines.getController(player).getInputCount(this) * 0.25)
}
}

View File

@ -2,6 +2,7 @@ package li.cil.oc.common.recipe
import li.cil.oc.util.Color
import li.cil.oc.util.ItemColorizer
import net.minecraft.block.Block
import net.minecraft.entity.passive.EntitySheep
import net.minecraft.inventory.InventoryCrafting
import net.minecraft.item.crafting.IRecipe
@ -13,6 +14,9 @@ import net.minecraft.world.World
* @author asie, Vexatos
*/
class ColorizeRecipe(target: Item, source: Array[Item] = null) extends IRecipe {
def this(target: Block, source: Array[Item]) = this(Item.getItemFromBlock(target), source)
def this(target: Block) = this(target, null)
val targetItem = target
val sourceItems = if (source != null) source else Array(targetItem)

View File

@ -1,17 +1,20 @@
package li.cil.oc.common.recipe
import li.cil.oc.util.ItemColorizer
import net.minecraft.block.Block
import net.minecraft.init.Items
import net.minecraft.inventory.InventoryCrafting
import net.minecraft.item.crafting.IRecipe
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraft.item.crafting.IRecipe
import net.minecraft.world.World
/**
* @author Vexatos
*/
class DecolorizeRecipe(target: Item) extends IRecipe {
def this(target: Block) = this(Item.getItemFromBlock(target))
val targetItem = target
override def matches(crafting: InventoryCrafting, world: World): Boolean = {

View File

@ -328,6 +328,10 @@ object Recipes {
// Hover Boot dyeing
GameRegistry.addRecipe(new ColorizeRecipe(api.Items.get(Constants.ItemName.HoverBoots).item()))
GameRegistry.addRecipe(new DecolorizeRecipe(api.Items.get(Constants.ItemName.HoverBoots).item()))
// Cable dyeing
GameRegistry.addRecipe(new ColorizeRecipe(api.Items.get(Constants.BlockName.Cable).block()))
GameRegistry.addRecipe(new DecolorizeRecipe(api.Items.get(Constants.BlockName.Cable).block()))
}
catch {
case e: Throwable => OpenComputers.log.error("Error parsing recipes, you may not be able to craft any items from this mod!", e)

View File

@ -4,12 +4,31 @@ import li.cil.oc.api
import li.cil.oc.api.network.Visibility
import li.cil.oc.common
import li.cil.oc.util.Color
import li.cil.oc.util.ItemColorizer
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
class Cable extends traits.Environment with traits.NotAnalyzable with traits.ImmibisMicroblock with traits.Colored {
val node = api.Network.newNode(this, Visibility.None).create()
color = Color.LightGray
def createItemStack() = {
val stack = new ItemStack(Item.getItemFromBlock(getBlockType))
if (color != Color.LightGray) {
ItemColorizer.setColor(stack, color)
}
stack
}
def fromItemStack(stack: ItemStack): Unit = {
if (ItemColorizer.hasColor(stack)) {
color = ItemColorizer.getColor(stack)
}
}
override def consumesDye = true
override protected def onColorChanged() {
super.onColorChanged()
if (world != null && isServer) {

View File

@ -157,6 +157,7 @@ class Microcontroller extends traits.PowerAcceptor with traits.Hub with traits.C
plug.node.connect(componentNodes(plug.side.ordinal()))
else
componentNodes(plug.side.ordinal).remove()
connectComponents()
}
override protected def onPlugDisconnect(plug: Plug, node: Node) {

View File

@ -105,8 +105,10 @@ class Rack extends traits.PowerAcceptor with traits.Hub with traits.PowerBalance
mapping(0) match {
case Some(side) if toGlobal(side) == plugSide =>
val mountable = getMountable(slot)
if (mountable != null && mountable.node != null && node != mountable.node) {
mountable.node.connect(sidedNode(plugSide))
val busNode = sidedNode(plugSide)
if (busNode != null && mountable != null && mountable.node != null && busNode != mountable.node) {
api.Network.joinNewNetwork(mountable.node)
busNode.connect(mountable.node)
}
case _ => // Not connected to this side.
}

View File

@ -17,6 +17,8 @@ trait Colored extends TileEntity with internal.Colored {
onColorChanged()
}
def consumesDye = false
override def getColor = color
override def setColor(value: Int) = color = value

View File

@ -2,10 +2,11 @@ package li.cil.oc.common.tileentity.traits
trait PowerAcceptor
extends power.Common
with power.AppliedEnergistics2
with power.Factorization
with power.Galacticraft
with power.IndustrialCraft2Experimental
with power.IndustrialCraft2Classic
with power.Mekanism
with power.RedstoneFlux
with power.AppliedEnergistics2
with power.Factorization
with power.Galacticraft
with power.IndustrialCraft2Experimental
with power.IndustrialCraft2Classic
with power.Mekanism
with power.RedstoneFlux
with power.RotaryCraft

View File

@ -22,9 +22,9 @@ trait Common extends TileEntity {
// but our throughput is per tick, so multiply this up for actual budget.
var budget = energyThroughput * Settings.get.tickFrequency
for (side <- ForgeDirection.VALID_DIRECTIONS) {
val demand = fromOther(math.min(budget, globalDemand(side)))
val demand = toOther(math.min(budget, globalDemand(side)))
if (demand > 1) {
val energy = toOther(provider(demand, side))
val energy = fromOther(provider(demand, side))
if (energy > 0) {
budget -= tryChangeBuffer(side, energy)
}

View File

@ -0,0 +1,89 @@
package li.cil.oc.common.tileentity.traits.power
import cpw.mods.fml.common.Optional
import li.cil.oc.OpenComputers
import li.cil.oc.Settings
import li.cil.oc.common.asm.Injectable
import li.cil.oc.integration.Mods
import li.cil.oc.integration.util.Power
import net.minecraftforge.common.util.ForgeDirection
@Injectable.Interface(value = "Reika.RotaryCraft.API.Power.ShaftPowerReceiver", modid = Mods.IDs.RotaryCraft)
trait RotaryCraft extends Common {
private lazy val useRotaryCraftPower = isServer && Mods.RotaryCraft.isAvailable
private var omega = 0
private var torque = 0
private var power = 0L
private var alpha = 0
// ----------------------------------------------------------------------- //
override def updateEntity() {
if (useRotaryCraftPower) updateEnergy()
super.updateEntity()
}
@Optional.Method(modid = Mods.IDs.RotaryCraft)
private def updateEnergy() {
if (world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
tryAllSides((demand, _) => {
val consumed = demand.toLong min power
power -= consumed
consumed
}, Power.fromWA, Power.toWA)
}
}
// ----------------------------------------------------------------------- //
// ShaftMachine
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def getOmega: Int = omega
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def getTorque: Int = torque
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def getPower: Long = power
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def getName: String = OpenComputers.Name
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def getIORenderAlpha: Int = alpha
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def setIORenderAlpha(value: Int): Unit = alpha = value
// ----------------------------------------------------------------------- //
// ShaftPowerReceiver
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def setOmega(value: Int): Unit = omega = value
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def setTorque(value: Int): Unit = torque = value
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def setPower(value: Long): Unit = power = value
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def noInputMachine(): Unit = {
omega = 0
torque = 0
power = 0
}
// ----------------------------------------------------------------------- //
// PowerAcceptor
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def canReadFrom(forgeDirection: ForgeDirection): Boolean = true
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def isReceiving: Boolean = true
@Optional.Method(modid = Mods.IDs.RotaryCraft)
def getMinTorque(available: Int): Int = 0
}

View File

@ -9,17 +9,18 @@ import li.cil.oc.api.machine.Callback
import li.cil.oc.api.machine.Context
import li.cil.oc.api.network.Component
import li.cil.oc.api.network.ManagedEnvironment
import li.cil.oc.api.prefab.DriverTileEntity
import li.cil.oc.api.prefab.DriverSidedTileEntity
import li.cil.oc.integration.ManagedTileEntityEnvironment
import li.cil.oc.util.ExtendedArguments._
import li.cil.oc.util.ResultWrapper._
import net.minecraft.item.ItemStack
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
object DriverBlockInterface extends DriverTileEntity {
object DriverBlockInterface extends DriverSidedTileEntity {
def getTileEntityClass: Class[_] = classOf[TileInterface]
def createEnvironment(world: World, x: Int, y: Int, z: Int): ManagedEnvironment =
def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection): ManagedEnvironment =
new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileInterface])
final class Environment(val tile: TileInterface) extends ManagedTileEntityEnvironment[TileInterface](tile, "me_interface") with NamedBlock with NetworkControl[TileInterface] {

View File

@ -5,20 +5,21 @@ import appeng.me.helpers.IGridProxyable
import li.cil.oc.api.driver.EnvironmentProvider
import li.cil.oc.api.driver.NamedBlock
import li.cil.oc.api.network.ManagedEnvironment
import li.cil.oc.api.prefab.DriverTileEntity
import li.cil.oc.api.prefab.DriverSidedTileEntity
import li.cil.oc.integration.ManagedTileEntityEnvironment
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
import scala.language.existentials
object DriverController extends DriverTileEntity {
object DriverController extends DriverSidedTileEntity {
private type TileController = TileEntity with IGridProxyable with IActionHost
def getTileEntityClass = AEUtil.controllerClass
def createEnvironment(world: World, x: Int, y: Int, z: Int): ManagedEnvironment =
def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection): ManagedEnvironment =
new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileController])
final class Environment(val tile: TileController) extends ManagedTileEntityEnvironment[TileController](tile, "me_controller") with NamedBlock with NetworkControl[TileController] {

View File

@ -25,14 +25,14 @@ import net.minecraftforge.common.util.ForgeDirection
import scala.collection.convert.WrapAsScala._
object DriverExportBus extends driver.Block {
override def worksWith(world: World, x: Int, y: Int, z: Int) =
object DriverExportBus extends driver.SidedBlock {
override def worksWith(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) =
world.getTileEntity(x, y, z) match {
case container: IPartHost => ForgeDirection.VALID_DIRECTIONS.map(container.getPart).exists(_.isInstanceOf[PartExportBus])
case _ => false
}
override def createEnvironment(world: World, x: Int, y: Int, z: Int) = new Environment(world.getTileEntity(x, y, z).asInstanceOf[IPartHost])
override def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) = new Environment(world.getTileEntity(x, y, z).asInstanceOf[IPartHost])
final class Environment(val host: IPartHost) extends ManagedTileEntityEnvironment[IPartHost](host, "me_exportbus") with NamedBlock with PartEnvironmentBase {
override def preferredName = "me_exportbus"

View File

@ -13,14 +13,14 @@ import net.minecraft.item.ItemStack
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
object DriverImportBus extends driver.Block {
override def worksWith(world: World, x: Int, y: Int, z: Int) =
object DriverImportBus extends driver.SidedBlock {
override def worksWith(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) =
world.getTileEntity(x, y, z) match {
case container: IPartHost => ForgeDirection.VALID_DIRECTIONS.map(container.getPart).exists(_.isInstanceOf[PartImportBus])
case _ => false
}
override def createEnvironment(world: World, x: Int, y: Int, z: Int) = new Environment(world.getTileEntity(x, y, z).asInstanceOf[IPartHost])
override def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) = new Environment(world.getTileEntity(x, y, z).asInstanceOf[IPartHost])
final class Environment(val host: IPartHost) extends ManagedTileEntityEnvironment[IPartHost](host, "me_importbus") with NamedBlock with PartEnvironmentBase {
override def preferredName = "me_importbus"

View File

@ -13,14 +13,14 @@ import net.minecraft.item.ItemStack
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
object DriverPartInterface extends driver.Block {
override def worksWith(world: World, x: Int, y: Int, z: Int) =
object DriverPartInterface extends driver.SidedBlock {
override def worksWith(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) =
world.getTileEntity(x, y, z) match {
case container: IPartHost => ForgeDirection.VALID_DIRECTIONS.map(container.getPart).exists(_.isInstanceOf[PartInterface])
case _ => false
}
override def createEnvironment(world: World, x: Int, y: Int, z: Int) = new Environment(world.getTileEntity(x, y, z).asInstanceOf[IPartHost])
override def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) = new Environment(world.getTileEntity(x, y, z).asInstanceOf[IPartHost])
final class Environment(val host: IPartHost) extends ManagedTileEntityEnvironment[IPartHost](host, "me_interface") with NamedBlock with PartEnvironmentBase {
override def preferredName = "me_interface"

View File

@ -1,23 +1,24 @@
package li.cil.oc.integration.bloodmagic;
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
import li.cil.oc.api.driver.NamedBlock;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
import net.minecraftforge.common.util.ForgeDirection;
public class DriverBloodAltar extends DriverTileEntity {
public class DriverBloodAltar extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IBloodAltar.class;
}
@Override
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IBloodAltar) world.getTileEntity(x, y, z));
}

View File

@ -7,18 +7,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class DriverMasterRitualStone extends DriverTileEntity {
public class DriverMasterRitualStone extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IMasterRitualStone.class;
}
@Override
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IMasterRitualStone) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverControllable extends DriverTileEntity {
public final class DriverControllable extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IControllable.class;
}
@Override
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IControllable) world.getTileEntity(x, y, z));
}

View File

@ -7,19 +7,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverPipeTile extends DriverTileEntity {
public final class DriverPipeTile extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IPipeTile.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IPipeTile) world.getTileEntity(x, y, z));
}

View File

@ -5,19 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnergyHandler extends DriverTileEntity {
public final class DriverEnergyHandler extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnergyHandler.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnergyHandler) world.getTileEntity(x, y, z));
}

View File

@ -6,19 +6,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnergyProvider extends DriverTileEntity {
public final class DriverEnergyProvider extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnergyProvider.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnergyProvider) world.getTileEntity(x, y, z));
}

View File

@ -6,24 +6,24 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnergyReceiver extends DriverTileEntity {
public final class DriverEnergyReceiver extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnergyReceiver.class;
}
@Override
public boolean worksWith(World world, int x, int y, int z) {
return super.worksWith(world, x, y, z) && !(world.getTileEntity(x, y, z) instanceof IEnergyProvider);
public boolean worksWith(World world, int x, int y, int z, final ForgeDirection side) {
return super.worksWith(world, x, y, z, side) && !(world.getTileEntity(x, y, z) instanceof IEnergyProvider);
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnergyReceiver) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnergyInfo extends DriverTileEntity {
public final class DriverEnergyInfo extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnergyInfo.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnergyInfo) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverRedstoneControl extends DriverTileEntity {
public final class DriverRedstoneControl extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IRedstoneControl.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IRedstoneControl) world.getTileEntity(x, y, z));
}

View File

@ -5,19 +5,20 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.apache.commons.lang3.text.WordUtils;
public final class DriverSecureTile extends DriverTileEntity {
public final class DriverSecureTile extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return ISecurable.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((ISecurable) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnderEnergy extends DriverTileEntity {
public final class DriverEnderEnergy extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnderEnergyHandler.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnderEnergyHandler) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnderFluid extends DriverTileEntity {
public final class DriverEnderFluid extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnderFluidHandler.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnderFluidHandler) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnderItem extends DriverTileEntity {
public final class DriverEnderItem extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnderItemHandler.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnderItemHandler) world.getTileEntity(x, y, z));
}

View File

@ -20,13 +20,14 @@ import li.cil.oc.api.network.Visibility;
import li.cil.oc.util.Reflection;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public final class DriverPeripheral implements li.cil.oc.api.driver.Block {
public final class DriverPeripheral implements li.cil.oc.api.driver.SidedBlock {
private static Set<Class<?>> blacklist;
private boolean isBlacklisted(final Object o) {
@ -53,9 +54,9 @@ public final class DriverPeripheral implements li.cil.oc.api.driver.Block {
return false;
}
private IPeripheral findPeripheral(final World world, final int x, final int y, final int z) {
private IPeripheral findPeripheral(final World world, final int x, final int y, final int z, final ForgeDirection side) {
try {
final IPeripheral p = dan200.computercraft.ComputerCraft.getPeripheralAt(world, x, y, z, -1);
final IPeripheral p = dan200.computercraft.ComputerCraft.getPeripheralAt(world, x, y, z, side.ordinal());
if (!isBlacklisted(p)) {
return p;
}
@ -66,7 +67,7 @@ public final class DriverPeripheral implements li.cil.oc.api.driver.Block {
}
@Override
public boolean worksWith(final World world, final int x, final int y, final int z) {
public boolean worksWith(final World world, final int x, final int y, final int z, final ForgeDirection side) {
final TileEntity tileEntity = world.getTileEntity(x, y, z);
return tileEntity != null
// This ensures we don't get duplicate components, in case the
@ -76,12 +77,12 @@ public final class DriverPeripheral implements li.cil.oc.api.driver.Block {
// to be incompatible with OpenComputers when used directly.
&& !isBlacklisted(tileEntity)
// Actual check if it's a peripheral.
&& findPeripheral(world, x, y, z) != null;
&& findPeripheral(world, x, y, z, side) != null;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
return new Environment(findPeripheral(world, x, y, z));
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment(findPeripheral(world, x, y, z, side));
}
public static class Environment extends li.cil.oc.api.prefab.ManagedEnvironment implements li.cil.oc.api.network.ManagedPeripheral {

View File

@ -5,16 +5,17 @@ import li.cil.oc.api.machine.Arguments
import li.cil.oc.api.machine.Callback
import li.cil.oc.api.machine.Context
import li.cil.oc.api.network.ManagedEnvironment
import li.cil.oc.api.prefab.DriverTileEntity
import li.cil.oc.api.prefab.DriverSidedTileEntity
import li.cil.oc.integration.ManagedTileEntityEnvironment
import li.cil.oc.util.ResultWrapper._
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit
object DriverDeepStorageUnit extends DriverTileEntity {
object DriverDeepStorageUnit extends DriverSidedTileEntity {
override def getTileEntityClass: Class[_] = classOf[IDeepStorageUnit]
override def createEnvironment(world: World, x: Int, y: Int, z: Int): ManagedEnvironment =
override def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection): ManagedEnvironment =
new Environment(world.getTileEntity(x, y, z).asInstanceOf[IDeepStorageUnit])
final class Environment(tileEntity: IDeepStorageUnit) extends ManagedTileEntityEnvironment[IDeepStorageUnit](tileEntity, "deep_storage_unit") {

View File

@ -3,16 +3,17 @@ package li.cil.oc.integration.ec
import appeng.tile.misc.TileInterface
import li.cil.oc.api.driver.EnvironmentProvider
import li.cil.oc.api.network.ManagedEnvironment
import li.cil.oc.api.prefab.DriverTileEntity
import li.cil.oc.api.prefab.DriverSidedTileEntity
import li.cil.oc.integration.ManagedTileEntityEnvironment
import li.cil.oc.integration.appeng.AEUtil
import net.minecraft.item.ItemStack
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
object DriverBlockInterface extends DriverTileEntity {
object DriverBlockInterface extends DriverSidedTileEntity {
def getTileEntityClass: Class[_] = classOf[TileInterface]
def createEnvironment(world: World, x: Int, y: Int, z: Int): ManagedEnvironment =
def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection): ManagedEnvironment =
new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileInterface])
final class Environment(val tile: TileInterface) extends ManagedTileEntityEnvironment[TileInterface](tile, "me_interface") with NetworkControl[TileInterface]

View File

@ -4,21 +4,22 @@ import appeng.api.networking.security.IActionHost
import appeng.me.helpers.IGridProxyable
import li.cil.oc.api.driver.EnvironmentProvider
import li.cil.oc.api.network.ManagedEnvironment
import li.cil.oc.api.prefab.DriverTileEntity
import li.cil.oc.api.prefab.DriverSidedTileEntity
import li.cil.oc.integration.ManagedTileEntityEnvironment
import li.cil.oc.integration.appeng.AEUtil
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
import scala.language.existentials
object DriverController extends DriverTileEntity {
object DriverController extends DriverSidedTileEntity {
private type TileController = TileEntity with IGridProxyable with IActionHost
def getTileEntityClass = AEUtil.controllerClass
def createEnvironment(world: World, x: Int, y: Int, z: Int): ManagedEnvironment =
def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection): ManagedEnvironment =
new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileController])
final class Environment(val tile: TileController) extends ManagedTileEntityEnvironment[TileController](tile, "me_controller") with NetworkControl[TileController]

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverFrequencyOwner extends DriverTileEntity {
public final class DriverFrequencyOwner extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return TileFrequencyOwner.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((TileFrequencyOwner) world.getTileEntity(x, y, z));
}

View File

@ -6,15 +6,16 @@ import li.cil.oc.api.driver.NamedBlock
import li.cil.oc.api.machine.Arguments
import li.cil.oc.api.machine.Callback
import li.cil.oc.api.machine.Context
import li.cil.oc.api.prefab.DriverTileEntity
import li.cil.oc.api.prefab.DriverSidedTileEntity
import li.cil.oc.integration.ManagedTileEntityEnvironment
import li.cil.oc.util.ResultWrapper._
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
class DriverAnalyzer extends DriverTileEntity {
class DriverAnalyzer extends DriverSidedTileEntity {
override def getTileEntityClass = classOf[TileAnalyzer]
override def createEnvironment(world: World, x: Int, y: Int, z: Int) = new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileAnalyzer])
override def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) = new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileAnalyzer])
final class Environment(tileEntity: TileAnalyzer) extends ManagedTileEntityEnvironment[TileAnalyzer](tileEntity, "forestry_analyzer") with NamedBlock {
override def preferredName = "forestry_analyzer"

View File

@ -11,23 +11,24 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class DriverBeeHouse extends DriverTileEntity {
public class DriverBeeHouse extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IBeeHousing.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IBeeHousing) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnergyContainer extends DriverTileEntity {
public final class DriverEnergyContainer extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IBasicEnergyContainer.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IBasicEnergyContainer) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnergyConductor extends DriverTileEntity {
public final class DriverEnergyConductor extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnergyConductor.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnergyConductor) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnergySink extends DriverTileEntity {
public final class DriverEnergySink extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnergySink.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnergySink) world.getTileEntity(x, y, z));
}

View File

@ -5,18 +5,19 @@ import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.api.prefab.DriverSidedTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public final class DriverEnergySource extends DriverTileEntity {
public final class DriverEnergySource extends DriverSidedTileEntity {
@Override
public Class<?> getTileEntityClass() {
return IEnergySource.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z, final ForgeDirection side) {
return new Environment((IEnergySource) world.getTileEntity(x, y, z));
}

Some files were not shown because too many files have changed in this diff Show More