use of pl.asie.charset.module.storage.locks.wrapper.ReadOnlyFluidHandler in project Charset by CharsetMC.
the class CharsetStorageLocks method preInit.
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
masterKeyItem = new ItemMasterKey();
keyItem = new ItemKey();
keyringItem = new ItemKeyring();
lockItem = new ItemLock();
ModCharset.dataFixes.registerFix(FixTypes.ITEM_INSTANCE, new FixCharsetLockKeyTagChange());
if (PatchworkHelper.getBoolean("LOCKS_BLOCK_CAPABILITIES")) {
LocksCapabilityHook.handler = new LocksCapabilityHandler();
LocksCapabilityHandler.addCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, (o) -> {
if (o != null) {
return new ReadOnlyItemHandler((IItemHandler) o);
} else {
return null;
}
}, true);
LocksCapabilityHandler.addCapability(Capabilities.ITEM_INSERTION_HANDLER, (o) -> new DefaultItemInsertionHandler(), true);
LocksCapabilityHandler.addCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, (o) -> {
if (o != null) {
return new ReadOnlyFluidHandler((IFluidHandler) o);
} else {
return null;
}
}, true);
LocksCapabilityHandler.addCapability(Capabilities.BARREL, (o) -> {
if (o != null) {
return new ReadOnlyBarrel((IBarrel) o);
} else {
return null;
}
}, true);
CharsetStorageLocks.config.getCategory("blockedCapabilities").setComment("NOTE: This functionality requires a special configuration option in CharsetPatches to be turned on! Otherwise, it will not be effective!");
if (config.hasChanged()) {
config.save();
}
}
}
Aggregations