use of mcjty.rftools.api.screens.IModuleProvider in project RFTools by McJty.
the class CommonProxy method preInit.
public void preInit(FMLPreInitializationEvent e) {
MinecraftForge.EVENT_BUS.register(new ForgeEventHandlers());
McJtyLib.preInit(e);
CommandHandler.registerCommands();
reflect();
GeneralConfig.preInit(e);
modConfigDir = e.getModConfigurationDirectory();
mainConfig = new Configuration(new File(modConfigDir.getPath() + File.separator + "rftools", "rftools.cfg"));
CapabilityManager.INSTANCE.register(BuffProperties.class, new Capability.IStorage<BuffProperties>() {
@Override
public NBTBase writeNBT(Capability<BuffProperties> capability, BuffProperties instance, EnumFacing side) {
throw new UnsupportedOperationException();
}
@Override
public void readNBT(Capability<BuffProperties> capability, BuffProperties instance, EnumFacing side, NBTBase nbt) {
throw new UnsupportedOperationException();
}
}, () -> {
throw new UnsupportedOperationException();
});
CapabilityManager.INSTANCE.register(FavoriteDestinationsProperties.class, new Capability.IStorage<FavoriteDestinationsProperties>() {
@Override
public NBTBase writeNBT(Capability<FavoriteDestinationsProperties> capability, FavoriteDestinationsProperties instance, EnumFacing side) {
throw new UnsupportedOperationException();
}
@Override
public void readNBT(Capability<FavoriteDestinationsProperties> capability, FavoriteDestinationsProperties instance, EnumFacing side, NBTBase nbt) {
throw new UnsupportedOperationException();
}
}, () -> {
throw new UnsupportedOperationException();
});
CapabilityManager.INSTANCE.register(IModuleProvider.class, new Capability.IStorage<IModuleProvider>() {
@Override
public NBTBase writeNBT(Capability<IModuleProvider> capability, IModuleProvider instance, EnumFacing side) {
throw new UnsupportedOperationException();
}
@Override
public void readNBT(Capability<IModuleProvider> capability, IModuleProvider instance, EnumFacing side, NBTBase nbt) {
throw new UnsupportedOperationException();
}
}, () -> {
throw new UnsupportedOperationException();
});
readMainConfig();
SimpleNetworkWrapper network = PacketHandler.registerMessages(RFTools.MODID, "rftools");
RFToolsMessages.registerNetworkMessages(network);
ModItems.init();
ModBlocks.init();
ModWorldgen.init();
RFTools.screenModuleRegistry.registerBuiltins();
ForgeChunkManager.setForcedChunkLoadingCallback(RFTools.instance, (tickets, world) -> {
});
}
use of mcjty.rftools.api.screens.IModuleProvider in project RFTools by McJty.
the class GuiScreen method refreshButtons.
private void refreshButtons() {
for (int i = 0; i < ScreenContainer.SCREEN_MODULES; i++) {
final ItemStack slot = tileEntity.getStackInSlot(i);
if (!slot.isEmpty() && ScreenBlock.hasModuleProvider(slot)) {
IModuleProvider moduleProvider = ScreenBlock.getModuleProvider(slot);
Class<? extends IClientScreenModule> clientScreenModuleClass = moduleProvider.getClientScreenModule();
if (!clientScreenModuleClass.isInstance(clientScreenModules[i])) {
installModuleGui(i, slot, moduleProvider, clientScreenModuleClass);
}
} else {
uninstallModuleGui(i);
}
if (modulePanels[i] != null) {
modulePanels[i].setVisible(selected == i);
buttons[i].setPressed(selected == i);
}
}
}
Aggregations