openperipheral.api.Constants Java Examples

The following examples show how to use openperipheral.api.Constants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdapterNetwork.java    From OpenPeripheral-Integration with MIT License 6 votes vote down vote up
@ScriptCallable(description = "Get a list of the stored and craftable items in the network.", returnTypes = ReturnType.TABLE)
public List<?> getAvailableItems(IGridHost host,
		@Env(Constants.ARG_CONVERTER) IConverter converter,
		@Optionals @Arg(name = "details", description = "Format of stored items details (defalt: none)") ItemDetails format) {
	IStorageGrid storageGrid = getStorageGrid(host);
	final IItemList<IAEItemStack> storageList = storageGrid.getItemInventory().getStorageList();

	List<Object> result = Lists.newArrayList();
	for (IAEItemStack stack : storageList) {
		@SuppressWarnings("unchecked")
		Map<String, Object> map = (Map<String, Object>)converter.fromJava(stack);
		if (format != null && format != ItemDetails.NONE) {
			final ItemStack itemStack = stack.getItemStack();
			if (format == ItemDetails.PROXY) map.put("item", OpcAccess.itemStackMetaBuilder.createProxy(itemStack));
			else if (format == ItemDetails.ALL) map.put("item", itemStack);
		}
		result.add(map);
	}

	return result;
}
 
Example #2
Source File: PropertyBuilderTest.java    From OpenPeripheral with MIT License 6 votes vote down vote up
private static void verifyIndexedNullableSetterExecution(IMethodExecutor executor, Field targetField, Type keyType) {
	final IIndexedPropertyCallback target = mock(IndexedCallbackSource.class);
	final IConverter converter = Mockito.mock(IConverter.class);
	final IMethodCall call = executor.startCall(target);
	call.setEnv(Constants.ARG_CONVERTER, converter);

	final ConvertedKey markerConvertedKey = new ConvertedKey();
	when(converter.toJava(any(), eq(keyType))).thenReturn(markerConvertedKey);

	final Key markerKey = new Key();

	try {
		final Object[] result = call.call(null, markerKey);
		Assert.assertArrayEquals(new Object[0], result);
	} catch (Exception e) {
		throw Throwables.propagate(e);
	}

	verify(converter).toJava(markerKey, keyType);
	verify(target).setField(targetField, markerConvertedKey, null);
}
 
Example #3
Source File: PropertyBuilderTest.java    From OpenPeripheral with MIT License 6 votes vote down vote up
private static void verifyIndexedSetterExecution(IMethodExecutor executor, Field targetField, Type keyType, Type valueType) {
	final IIndexedPropertyCallback target = mock(IndexedCallbackSource.class);
	final IConverter converter = Mockito.mock(IConverter.class);
	final IMethodCall call = executor.startCall(target);
	call.setEnv(Constants.ARG_CONVERTER, converter);

	final ConvertedKey markerConvertedKey = new ConvertedKey();
	when(converter.toJava(any(), eq(keyType))).thenReturn(markerConvertedKey);

	final ConvertedValue markerConvertedValue = new ConvertedValue();
	when(converter.toJava(any(), eq(valueType))).thenReturn(markerConvertedValue);

	final Value markerValue = new Value();
	final Key markerKey = new Key();

	try {
		final Object[] result = call.call(markerValue, markerKey);
		Assert.assertArrayEquals(new Object[0], result);
	} catch (Exception e) {
		throw Throwables.propagate(e);
	}

	verify(converter).toJava(markerValue, valueType);
	verify(converter).toJava(markerKey, keyType);
	verify(target).setField(targetField, markerConvertedKey, markerConvertedValue);
}
 
Example #4
Source File: PropertyBuilderTest.java    From OpenPeripheral with MIT License 6 votes vote down vote up
private static void verifySingleNullableSetterExecution(IMethodExecutor executor, Field targetField) {
	final IPropertyCallback target = mock(SingleCallbackSource.class);
	final IConverter converter = Mockito.mock(IConverter.class);
	final IMethodCall call = executor.startCall(target);
	call.setEnv(Constants.ARG_CONVERTER, converter);

	try {
		final Object[] result = call.call((Object)null);
		Assert.assertArrayEquals(new Object[0], result);
	} catch (Exception e) {
		throw Throwables.propagate(e);
	}

	verifyNoMoreInteractions(converter);
	verify(target).setField(targetField, null);
}
 
Example #5
Source File: PropertyBuilderTest.java    From OpenPeripheral with MIT License 6 votes vote down vote up
private static void verifySingleSetterExecution(IMethodExecutor executor, Field targetField, Type targetTypeField) {
	final IPropertyCallback target = mock(SingleCallbackSource.class);
	final IConverter converter = Mockito.mock(IConverter.class);
	final IMethodCall call = executor.startCall(target);
	call.setEnv(Constants.ARG_CONVERTER, converter);

	final ConvertedValue markerConvertedValue = new ConvertedValue();
	when(converter.toJava(any(), any(Type.class))).thenReturn(markerConvertedValue);

	final Value markerValue = new Value();
	try {
		final Object[] result = call.call(markerValue);
		Assert.assertArrayEquals(new Object[0], result);
	} catch (Exception e) {
		throw Throwables.propagate(e);
	}

	verify(converter).toJava(markerValue, targetTypeField);
	verify(target).setField(targetField, markerConvertedValue);
}
 
Example #6
Source File: PropertyBuilderTest.java    From OpenPeripheral with MIT License 6 votes vote down vote up
private static void verifySingleGetterExecution(IMethodExecutor executor, Field targetField) {
	final IPropertyCallback target = mock(SingleCallbackSource.class);
	final IConverter converter = mock(IConverter.class);
	final IMethodCall call = executor.startCall(target);
	call.setEnv(Constants.ARG_CONVERTER, converter);

	final Value markerValue = new Value();
	when(target.getField(any(Field.class))).thenReturn(markerValue);

	final ConvertedValue markerConvertedValue = new ConvertedValue();
	when(converter.fromJava(any())).thenReturn(markerConvertedValue);

	try {
		final Object[] result = call.call();
		Assert.assertArrayEquals(new Object[] { markerConvertedValue }, result);
	} catch (Exception e) {
		throw Throwables.propagate(e);
	}

	verify(target).getField(targetField);
	verify(converter).fromJava(markerValue);
}
 
Example #7
Source File: OpenPeripheralCore.java    From OpenPeripheral with MIT License 6 votes vote down vote up
@EventHandler
public void processMessage(FMLInterModComms.IMCEvent event) {
	for (FMLInterModComms.IMCMessage m : event.getMessages()) {
		if (m.isStringMessage()) {
			if (Constants.IMC_IGNORE.equalsIgnoreCase(m.key)) {
				TileEntityBlacklist.INSTANCE.addToBlacklist(m.getStringValue());
			} else if (Constants.IMC_NAME_CLASS.equalsIgnoreCase(m.key)) {
				String value = m.getStringValue();
				String[] fields = value.split("\\s+");
				if (fields.length != 2) {
					Log.warn("Invalid IMC from %s: can't decode type '%s'", m.getSender(), value);
				} else {
					PeripheralTypeProvider.INSTANCE.setType(fields[0], fields[1]);
				}
			}
		}
	}
}
 
Example #8
Source File: PropertyExecutor.java    From OpenPeripheral with MIT License 6 votes vote down vote up
@Override
public IMethodCall startCall(final Object target) {
	return new IMethodCall() {
		private IConverter converter;

		@Override
		public IMethodCall setEnv(String name, Object value) {
			if (Constants.ARG_CONVERTER.equals(name)) this.converter = (IConverter)value;
			return this;
		}

		@Override
		public Object[] call(Object... args) {
			Preconditions.checkNotNull(converter, "Converter not provided");
			return caller.call(converter, target, args);
		}
	};
}
 
Example #9
Source File: ApiSetup.java    From OpenPeripheral with MIT License 6 votes vote down vote up
public void setupApis() {
	registry.registerClass(AdapterRegistryWrapper.Peripherals.class);
	registry.registerClass(AdapterRegistryWrapper.Objects.class);
	registry.registerClass(EntityMetadataBuilder.class);
	registry.registerClass(ItemStackMetadataBuilder.class);

	registry.registerInstance(TypeConvertersProvider.INSTANCE);
	registry.registerInstance(TileEntityBlacklist.INSTANCE);
	registry.registerInstance(PeripheralTypeProvider.INSTANCE);
	registry.registerInstance(TypeClassifier.INSTANCE);
	registry.registerInstance(ArchitectureChecker.INSTANCE);
	registry.registerInstance(FeatureGroupManager.INSTANCE);

	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_COMPUTER_CRAFT)) ModuleComputerCraft.installAPI(registry);
	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_OPEN_COMPUTERS)) ModuleOpenComputers.installAPI(registry);

	registry.freeze();
}
 
Example #10
Source File: MethodDeclaration.java    From OpenPeripheral with MIT License 5 votes vote down vote up
@Override
public IMethodCall setEnv(String name, Object value) {
	if (Constants.ARG_CONVERTER.equals(name)) this.converter = (IConverter)value;

	EnvArg arg = envArgs.get(name);
	if (arg != null) {
		Preconditions.checkState(value == null || arg.cls.isInstance(value),
				"Object of type %s cannot be used as argument %s (name: %s) in method %s",
				value != null? value.getClass() : "<null>", arg.index, name, method);
		setArg(arg.index, value);
	}
	return this;
}
 
Example #11
Source File: EnvironmentGeneratorTest.java    From OpenPeripheral with MIT License 5 votes vote down vote up
private static void setupEnvMocks() {
	IConverter converter = mock(IConverter.class);
	TypeConvertersProvider.INSTANCE.registerConverter(Constants.ARCH_OPEN_COMPUTERS, converter);

	final OpenComputersEnv env = mock(OpenComputersEnv.class);
	when(env.addObjectArgs(any(IMethodCall.class), any(Context.class))).then(returnFirstArg());
	when(env.addPeripheralArgs(any(IMethodCall.class), any(Node.class), any(Context.class))).then(returnFirstArg());
	ModuleOpenComputers.ENV = env;
}
 
Example #12
Source File: AdapterInterface.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@ScriptCallable(description = "Requests the specified item to get crafted.")
public void requestCrafting(IActionHost host,
		@Env(Constants.ARG_ACCESS) IArchitectureAccess access,
		@Env(Constants.ARG_CONVERTER) IConverter converter,
		@Arg(name = "fingerprint", description = "Details of the item you want to craft. Can be found with .getStackInSlot on inventory and .getAvailableItems on AE network") ItemFingerprint needle,
		@Optionals @Arg(name = "qty", description = "The quantity of items you want to craft") Long quantity,
		@Arg(name = "cpu", description = "The name of the CPU you want to use") String wantedCpuName) {
	ICraftingGrid craftingGrid = getCraftingGrid(host);
	if (quantity == null) quantity = 1L;

	ICraftingCPU wantedCpu = findCpu(craftingGrid, wantedCpuName);

	IStorageGrid storageGrid = getStorageGrid(host);
	IMEMonitor<IAEItemStack> monitor = storageGrid.getItemInventory();

	IAEItemStack stack = findCraftableStack(storageGrid.getItemInventory().getStorageList(), needle);
	Preconditions.checkArgument(stack != null, "Can't find craftable item fingerprint %s", needle);

	final IAEItemStack toCraft = stack.copy();
	toCraft.setStackSize(quantity);

	// Create a new CraftingCallback. This callback is called when
	// the network finished calculating the required items. It can do two things for us:
	// a) It sends an event when items are missing to complete the request
	// b) Otherwise it starts the crafting job, which itself is a CraftingRequester OSsending more events to the computer.
	final CraftingCallback craftingCallback = new CraftingCallback(access, converter, craftingGrid, monitor, host, wantedCpu, toCraft);

	// We will need access to the worldObj of the ME Interface -> cast to TileEntity
	final TileEntity tileEntity = (TileEntity)host;

	// Tell the craftingGrid to begin calculating and to report everything to the CraftingCallback
	craftingGrid.beginCraftingJob(tileEntity.getWorldObj(), getGrid(host), new MachineSource(host), toCraft, craftingCallback);

}
 
Example #13
Source File: AdapterInventory.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get a table with all the items of the chest")
public Map<Index, Object> getAllStacks(IInventory target,
		@Env(Constants.ARG_ARCHITECTURE) IArchitecture access,
		@Optionals @Arg(name = "proxy", description = "If false, method will compute whole table, instead of returning proxy") Boolean proxy) {
	final IInventory inventory = InventoryUtils.getInventory(target);
	Map<Index, Object> result = Maps.newHashMap();

	for (int i = 0; i < inventory.getSizeInventory(); i++) {
		ItemStack stack = inventory.getStackInSlot(i);
		if (stack != null) result.put(access.createIndex(i), (proxy != Boolean.FALSE)? OpcAccess.itemStackMetaBuilder.createProxy(stack) : stack);
	}
	return result;
}
 
Example #14
Source File: PropertyBuilderTest.java    From OpenPeripheral with MIT License 5 votes vote down vote up
private static void verifyIndexedGetterExecution(IMethodExecutor executor, Field targetField, Type keyType) {
	final IIndexedPropertyCallback target = mock(IndexedCallbackSource.class);
	final IConverter converter = mock(IConverter.class);
	final IMethodCall call = executor.startCall(target);
	call.setEnv(Constants.ARG_CONVERTER, converter);

	final ConvertedKey convertedIndexValue = new ConvertedKey();
	when(converter.toJava(any(), any(Type.class))).thenReturn(convertedIndexValue);

	final Value markerValue = new Value();
	when(target.getField(any(Field.class), any())).thenReturn(markerValue);

	final ConvertedValue markerConvertedValue = new ConvertedValue();
	when(converter.fromJava(any())).thenReturn(markerConvertedValue);

	final Value indexValue = new Value();

	try {
		final Object[] result = call.call(indexValue);
		Assert.assertArrayEquals(new Object[] { markerConvertedValue }, result);
	} catch (Exception e) {
		throw Throwables.propagate(e);
	}

	verify(converter).toJava(indexValue, keyType);
	verify(target).getField(targetField, convertedIndexValue);
	verify(converter).fromJava(markerValue);
}
 
Example #15
Source File: TileEntitySelector.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@ScriptCallable(description = "Set the items being displayed in all slots")
public void setSlots(
		@Env(Constants.ARG_ARCHITECTURE) IArchitecture access,
		@Arg(name = "items", description = "A table containing itemstacks") Map<Index, ItemStack> stacks) {
	for (int slot = 0; slot < 9; slot++) {
		final ItemStack value = stacks.get(access.wrapObject(slot));
		if (value != null) value.stackSize = 1;

		this.slots[slot].set(value);
	}

	sync();
}
 
Example #16
Source File: OpenPeripheralCore.java    From OpenPeripheral with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void construct(FMLConstructionEvent evt) {
	ArchitectureChecker.INSTANCE.register(Constants.ARCH_COMPUTER_CRAFT, new ComputerCraftChecker());
	ArchitectureChecker.INSTANCE.register(Constants.ARCH_OPEN_COMPUTERS, new OpenComputersChecker());

	apiSetup.setupApis();
	apiSetup.installProviderAccess();

	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_OPEN_COMPUTERS)) ModuleOpenComputers.init();
	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_COMPUTER_CRAFT)) ModuleComputerCraft.init();
}
 
Example #17
Source File: ModuleOpenComputers.java    From OpenPeripheral with MIT License 5 votes vote down vote up
public static void init() {
	final MethodSelector peripheralSelector = new MethodSelector(Constants.ARCH_OPEN_COMPUTERS)
			.allowReturnSignal()
			.addDefaultEnv()
			.addProvidedEnv(Constants.ARG_ACCESS, IArchitectureAccess.class)
			.addProvidedEnv(Constants.ARG_CONTEXT, Context.class)
			.addProvidedEnv(Constants.ARG_NODE, Node.class);

	PERIPHERAL_METHODS_FACTORY = new EnvironmentMethodsFactory<ManagedEnvironment>(
			AdapterRegistry.PERIPHERAL_ADAPTERS,
			peripheralSelector,
			PERIPHERAL_CLASS_PREFIX,
			new PeripheralCodeGenerator());

	InjectedClassesManager.instance.registerProvider(PERIPHERAL_CLASS_PREFIX, new EnvironmentClassBytesProvider<ManagedEnvironment>(PERIPHERAL_METHODS_FACTORY));

	final MethodSelector objectSelector = new MethodSelector(Constants.ARCH_OPEN_COMPUTERS)
			// .allowReturnSignal() // for symmetry with CC
			.addDefaultEnv()
			.addProvidedEnv(Constants.ARG_CONTEXT, Context.class);

	OBJECT_METHODS_FACTORY = new EnvironmentMethodsFactory<Value>(
			AdapterRegistry.OBJECT_ADAPTERS,
			objectSelector,
			OBJECT_CLASS_PREFIX,
			new ObjectCodeGenerator());

	InjectedClassesManager.instance.registerProvider(OBJECT_CLASS_PREFIX, new EnvironmentClassBytesProvider<Value>(OBJECT_METHODS_FACTORY));

	CommandDump.addArchSerializer("OpenComputers", "peripheral", DocBuilder.TILE_ENTITY_DECORATOR, PERIPHERAL_METHODS_FACTORY);
	CommandDump.addArchSerializer("OpenComputers", "object", DocBuilder.SCRIPT_OBJECT_DECORATOR, OBJECT_METHODS_FACTORY);

	final IConverter converter = new TypeConversionRegistryOC();
	TypeConvertersProvider.INSTANCE.registerConverter(Constants.ARCH_OPEN_COMPUTERS, converter);

	TypeClassifier.INSTANCE.registerType(Value.class, SingleArgType.OBJECT);

	ENV = new OpenComputersEnv(converter);
}
 
Example #18
Source File: ComputerCraftEnv.java    From OpenPeripheral with MIT License 5 votes vote down vote up
public IMethodCall addPeripheralArgs(IMethodCall call, IComputerAccess access, ILuaContext context) {
	final CCArchitectureAccess wrapper = new CCArchitectureAccess(access, converter);
	return addCommonArgs(call, context)
			.setEnv(Constants.ARG_ARCHITECTURE, wrapper)
			.setEnv(Constants.ARG_ACCESS, wrapper)
			.setEnv(Constants.ARG_COMPUTER, access);
}
 
Example #19
Source File: OpenComputersEnv.java    From OpenPeripheral with MIT License 5 votes vote down vote up
public IMethodCall addPeripheralArgs(IMethodCall call, Node node, Context context) {
	final OCArchitectureAccess wrapper = new OCArchitectureAccess(node, context, converter);
	return addCommonArgs(call, context)
			.setEnv(Constants.ARG_ARCHITECTURE, wrapper)
			.setEnv(Constants.ARG_ACCESS, wrapper)
			.setEnv(Constants.ARG_NODE, node);
}
 
Example #20
Source File: ModuleComputerCraft.java    From OpenPeripheral with MIT License 5 votes vote down vote up
public static void init() {
	final MethodSelector peripheralSelector = new MethodSelector(Constants.ARCH_COMPUTER_CRAFT)
			.allowReturnSignal()
			.addDefaultEnv()
			.addProvidedEnv(Constants.ARG_ACCESS, IArchitectureAccess.class)
			.addProvidedEnv(Constants.ARG_COMPUTER, IComputerAccess.class)
			.addProvidedEnv(Constants.ARG_CONTEXT, ILuaContext.class);

	PERIPHERAL_METHODS_FACTORY = new ComposedMethodsFactory<IndexedMethodMap>(AdapterRegistry.PERIPHERAL_ADAPTERS, peripheralSelector) {
		@Override
		protected IndexedMethodMap wrapMethods(Class<?> targetCls, Map<String, IMethodExecutor> methods) {
			return new IndexedMethodMap(methods);
		}
	};

	// can't push events, so not allowing return signals
	final MethodSelector objectSelector = new MethodSelector(Constants.ARCH_COMPUTER_CRAFT)
			.addDefaultEnv()
			.addProvidedEnv(Constants.ARG_CONTEXT, ILuaContext.class);

	OBJECT_METHODS_FACTORY = new ComposedMethodsFactory<IndexedMethodMap>(AdapterRegistry.OBJECT_ADAPTERS, objectSelector) {
		@Override
		protected IndexedMethodMap wrapMethods(Class<?> targetCls, Map<String, IMethodExecutor> methods) {
			return new IndexedMethodMap(methods);
		}
	};

	CommandDump.addArchSerializer("ComputerCraft", "peripheral", DocBuilder.TILE_ENTITY_DECORATOR, PERIPHERAL_METHODS_FACTORY);
	CommandDump.addArchSerializer("ComputerCraft", "object", DocBuilder.SCRIPT_OBJECT_DECORATOR, OBJECT_METHODS_FACTORY);

	final IConverter converter = new TypeConversionRegistryCC();
	// CC converter is default one (legacy behaviour)
	TypeConvertersProvider.INSTANCE.registerConverter(Constants.ARCH_COMPUTER_CRAFT, converter);

	TypeClassifier.INSTANCE.registerType(ILuaObject.class, SingleArgType.OBJECT);

	ENV = new ComputerCraftEnv(converter);
}
 
Example #21
Source File: StructuredObjectBase.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.NUMBER, name = "getId")
public Index getId(@Env(Constants.ARG_ARCHITECTURE) IArchitecture access) {
	checkState();
	return access.createIndex(id);
}
 
Example #22
Source File: OpenComputersEnv.java    From OpenPeripheral with MIT License 4 votes vote down vote up
public IMethodCall addObjectArgs(IMethodCall call, Context context) {
	return addCommonArgs(call, context)
			.setEnv(Constants.ARG_ARCHITECTURE, new OCArchitecture(converter));
}
 
Example #23
Source File: ComputerCraftEnv.java    From OpenPeripheral with MIT License 4 votes vote down vote up
@Override
public String architecture() {
	return Constants.ARCH_COMPUTER_CRAFT;
}
 
Example #24
Source File: ComputerCraftEnv.java    From OpenPeripheral with MIT License 4 votes vote down vote up
private IMethodCall addCommonArgs(IMethodCall call, ILuaContext context) {
	return call
			.setEnv(Constants.ARG_CONVERTER, converter)
			.setEnv(Constants.ARG_CONTEXT, context);
}
 
Example #25
Source File: IContainer.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get the ids of all the objects")
public Set<Index> getAllIds(@Env(Constants.ARG_ARCHITECTURE) IArchitecture access);
 
Example #26
Source File: IContainer.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get all objects")
public Map<Index, E> getAllObjects(@Env(Constants.ARG_ARCHITECTURE) IArchitecture access);
 
Example #27
Source File: PropertyBuilderTest.java    From OpenPeripheral with MIT License 4 votes vote down vote up
private static void checkMethodEnv(IMethodExecutor executor) {
	Assert.assertTrue(executor.requiredEnv().containsKey(Constants.ARG_CONVERTER));
	Assert.assertTrue(executor.requiredEnv().get(Constants.ARG_CONVERTER).equals(IConverter.class));
}
 
Example #28
Source File: OpenComputersEnv.java    From OpenPeripheral with MIT License 4 votes vote down vote up
@Override
public String architecture() {
	return Constants.ARCH_OPEN_COMPUTERS;
}
 
Example #29
Source File: OpenPeripheralCore.java    From OpenPeripheral with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void loadComplete(FMLLoadCompleteEvent evt) {
	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_COMPUTER_CRAFT)) ModuleComputerCraft.registerProvider();
}
 
Example #30
Source File: OpenPeripheralCore.java    From OpenPeripheral with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_OPEN_COMPUTERS)) ModuleOpenComputers.registerProvider();
}