net.minecraft.client.gui.ScreenManager Java Examples

The following examples show how to use net.minecraft.client.gui.ScreenManager. 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: ProxyClient.java    From EnderStorage with MIT License 6 votes vote down vote up
@Override
public void clientSetup(FMLClientSetupEvent event) {
    ScreenManager.registerFactory(ModContent.containerItemStorage, GuiEnderItemStorage::new);

    spriteHelper.addIIconRegister(EnderPouchBakery.INSTANCE);
    ClientRegistry.bindTileEntityRenderer(tileEnderChestType, RenderTileEnderChest::new);
    ClientRegistry.bindTileEntityRenderer(tileEnderTankType, RenderTileEnderTank::new);

    if (!EnderStorageConfig.disableCreatorVisuals) {
        for (PlayerRenderer renderPlayer : Minecraft.getInstance().getRenderManager().getSkinMap().values()) {
            renderPlayer.addLayer(new TankLayerRenderer(renderPlayer));
        }
    }

    ModelResourceLocation invLocation = new ModelResourceLocation(itemEnderPouch.getRegistryName(), "inventory");
    modelHelper.register(invLocation, new CCBakeryModel());
    ModelBakery.registerItemKeyGenerator(itemEnderPouch, stack -> {
        Frequency frequency = Frequency.readFromStack(stack);
        boolean open = EnderStorageManager.instance(true).getStorage(frequency, EnderItemStorage.TYPE).openCount() > 0;
        return ModelBakery.defaultItemKeyGenerator.generateKey(stack) + "|" + frequency.toModelLoc() + "|" + open;
    });

    modelHelper.register(new ModelResourceLocation(itemEnderChest.getRegistryName(), "inventory"), new EnderChestItemRender());
    modelHelper.register(new ModelResourceLocation(itemEnderTank.getRegistryName(), "inventory"), new EnderTankItemRender());
}
 
Example #2
Source File: ClientPacketHandler.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
@SuppressWarnings ("unchecked")
private void handleOpenContainer(PacketCustom packet, Minecraft mc) {
    ContainerType<?> rawType = packet.readRegistryIdUnsafe(ForgeRegistries.CONTAINERS);
    int windowId = packet.readVarInt();
    ITextComponent name = packet.readTextComponent();
    if (rawType instanceof ICCLContainerType<?>) {
        ICCLContainerType<?> type = (ICCLContainerType<?>) rawType;
        ScreenManager.getScreenFactory(rawType, mc, windowId, name)//
                .map(e -> (ScreenManager.IScreenFactory<Container, ?>) e)//
                .ifPresent(screenFactory -> {
                    Container container = type.create(windowId, Minecraft.getInstance().player.inventory, packet);
                    Screen screen = screenFactory.create(container, mc.player.inventory, name);
                    mc.player.openContainer = ((IHasContainer<?>) screen).getContainer();
                    mc.displayGuiScreen(screen);
                });

    }
}
 
Example #3
Source File: SurvivalistMod.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void clientSetup(FMLClientSetupEvent event)
{
    ScreenManager.registerFactory(DryingRackContainer.TYPE, DryingRackScreen::new);
    ScreenManager.registerFactory(SawmillContainer.TYPE, SawmillScreen::new);

    ModelLoaderRegistry.registerLoader(location("rack"), DryingRackBakedModel.ModelLoader.INSTANCE);

    //RenderTypeLookup.setRenderLayer(SurvivalistBlocks.RACK.get(), (layer) -> layer == RenderType.getSolid() || layer == RenderType.getCutout());
}
 
Example #4
Source File: ClientSetup.java    From MiningGadgets with MIT License 4 votes vote down vote up
/**
 * Called from some Client Dist runner in the main class
 */
private static void registerContainerScreens() {
    ScreenManager.registerFactory(ModContainers.MODIFICATIONTABLE_CONTAINER.get(), ModificationTableScreen::new);
    ScreenManager.registerFactory(ModContainers.FILTER_CONTAINER.get(), FilterScreen::new);
}