Search in sources :

Example 1 with IModuleProvider

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) -> {
    });
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) BoosterConfiguration(mcjty.rftools.blocks.booster.BoosterConfiguration) BlockProtectorConfiguration(mcjty.rftools.blocks.blockprotector.BlockProtectorConfiguration) GeneralConfiguration(mcjty.rftools.GeneralConfiguration) SpawnerConfiguration(mcjty.rftools.blocks.spawner.SpawnerConfiguration) ModularStorageConfiguration(mcjty.rftools.blocks.storage.ModularStorageConfiguration) StorageScannerConfiguration(mcjty.rftools.blocks.storagemonitor.StorageScannerConfiguration) Configuration(net.minecraftforge.common.config.Configuration) ShieldConfiguration(mcjty.rftools.blocks.shield.ShieldConfiguration) CoalGeneratorConfiguration(mcjty.rftools.blocks.generator.CoalGeneratorConfiguration) SecurityConfiguration(mcjty.rftools.blocks.security.SecurityConfiguration) NetworkMonitorConfiguration(mcjty.rftools.items.netmonitor.NetworkMonitorConfiguration) TeleportConfiguration(mcjty.rftools.blocks.teleporter.TeleportConfiguration) MachineInfuserConfiguration(mcjty.rftools.blocks.infuser.MachineInfuserConfiguration) CrafterConfiguration(mcjty.rftools.blocks.crafter.CrafterConfiguration) EnvironmentalConfiguration(mcjty.rftools.blocks.environmental.EnvironmentalConfiguration) ElevatorConfiguration(mcjty.rftools.blocks.elevator.ElevatorConfiguration) ScannerConfiguration(mcjty.rftools.blocks.shaper.ScannerConfiguration) EndergenicConfiguration(mcjty.rftools.blocks.endergen.EndergenicConfiguration) ScreenConfiguration(mcjty.rftools.blocks.screens.ScreenConfiguration) PowerCellConfiguration(mcjty.rftools.blocks.powercell.PowerCellConfiguration) BuilderConfiguration(mcjty.rftools.blocks.builder.BuilderConfiguration) Capability(net.minecraftforge.common.capabilities.Capability) EnumFacing(net.minecraft.util.EnumFacing) FavoriteDestinationsProperties(mcjty.rftools.playerprops.FavoriteDestinationsProperties) BuffProperties(mcjty.rftools.playerprops.BuffProperties) NBTBase(net.minecraft.nbt.NBTBase) ForgeEventHandlers(mcjty.rftools.ForgeEventHandlers) IModuleProvider(mcjty.rftools.api.screens.IModuleProvider) File(java.io.File)

Example 2 with IModuleProvider

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);
        }
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) IModuleProvider(mcjty.rftools.api.screens.IModuleProvider)

Aggregations

IModuleProvider (mcjty.rftools.api.screens.IModuleProvider)2 File (java.io.File)1 ForgeEventHandlers (mcjty.rftools.ForgeEventHandlers)1 GeneralConfiguration (mcjty.rftools.GeneralConfiguration)1 BlockProtectorConfiguration (mcjty.rftools.blocks.blockprotector.BlockProtectorConfiguration)1 BoosterConfiguration (mcjty.rftools.blocks.booster.BoosterConfiguration)1 BuilderConfiguration (mcjty.rftools.blocks.builder.BuilderConfiguration)1 CrafterConfiguration (mcjty.rftools.blocks.crafter.CrafterConfiguration)1 ElevatorConfiguration (mcjty.rftools.blocks.elevator.ElevatorConfiguration)1 EndergenicConfiguration (mcjty.rftools.blocks.endergen.EndergenicConfiguration)1 EnvironmentalConfiguration (mcjty.rftools.blocks.environmental.EnvironmentalConfiguration)1 CoalGeneratorConfiguration (mcjty.rftools.blocks.generator.CoalGeneratorConfiguration)1 MachineInfuserConfiguration (mcjty.rftools.blocks.infuser.MachineInfuserConfiguration)1 PowerCellConfiguration (mcjty.rftools.blocks.powercell.PowerCellConfiguration)1 ScreenConfiguration (mcjty.rftools.blocks.screens.ScreenConfiguration)1 SecurityConfiguration (mcjty.rftools.blocks.security.SecurityConfiguration)1 ScannerConfiguration (mcjty.rftools.blocks.shaper.ScannerConfiguration)1 ShieldConfiguration (mcjty.rftools.blocks.shield.ShieldConfiguration)1 SpawnerConfiguration (mcjty.rftools.blocks.spawner.SpawnerConfiguration)1 ModularStorageConfiguration (mcjty.rftools.blocks.storage.ModularStorageConfiguration)1