当前位置: 首页>>代码示例>>Java>>正文


Java GuiOpenEvent.getGui方法代码示例

本文整理汇总了Java中net.minecraftforge.client.event.GuiOpenEvent.getGui方法的典型用法代码示例。如果您正苦于以下问题:Java GuiOpenEvent.getGui方法的具体用法?Java GuiOpenEvent.getGui怎么用?Java GuiOpenEvent.getGui使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.client.event.GuiOpenEvent的用法示例。


在下文中一共展示了GuiOpenEvent.getGui方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onGuiOpened

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onGuiOpened(GuiOpenEvent event) {
    if (!hasAutoLogged)
    if(event.getGui() instanceof GuiDisconnected &&
            !(event.getGui() instanceof GuiDisconnectedOverride)) {
        updateLastConnectedServer();
        GuiDisconnected disconnected = (GuiDisconnected)event.getGui();
        event.setGui(new GuiDisconnectedOverride(
                FastReflection.Fields.GuiDisconnected_parentScreen.get(disconnected),
                "connect.failed",
                FastReflection.Fields.GuiDisconnected_message.get(disconnected),
                FastReflection.Fields.GuiDisconnected_reason.get(disconnected),
                delay.get()
        ));
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:17,代码来源:AutoReconnectMod.java

示例2: onGuiOpenEvent

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGuiOpenEvent(GuiOpenEvent event)
{
	if (event.getGui() == null)
	{
		// a gui has been closed -- reset remote gui

		if (Minecraft.getMinecraft().world instanceof HookedClientWorld)
		{
			((HookedClientWorld)Minecraft.getMinecraft().world).ClearRemoteGui();
		}
		else
		{
			Util.logger.error("Minecraft.getMinecraft().world is not instance of RemoteGuiEnabledClientWorld!");
		}
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:19,代码来源:HookedClientWorldEventSync.java

示例3: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onGuiOpen(GuiOpenEvent event)
{
    if(event.getGui() instanceof GuiMainMenu && !played)
    {
        played = true;
        if(playOn == 1 || playOn == 3)
        {
            SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(name));
            if(sound != null)
            {
                Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, (float)pitch));
            }
            else
            {
                logger.log(Level.WARN, "Could not find sound: %s", new ResourceLocation(name));
            }
        }
    }
}
 
开发者ID:iChun,项目名称:Ding,代码行数:22,代码来源:Ding.java

示例4: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
	GuiScreen gui = event.getGui();
	if(gui !=null && gui instanceof GuiScreenHorseInventory){
		GuiScreenHorseInventory horseGui = (GuiScreenHorseInventory)gui;
		EntityHorse horse = (EntityHorse)ReflectionUtils.getPrivateValue(horseGui, GuiScreenHorseInventory.class, ObfuscatedNames.GuiScreenHorseInventory_horseEntity);
		if(horse !=null && HorseAccessories.hasEnderChest(horse)){
			ContainerHorseChest animalchest = new ContainerHorseChest("HorseChest", 2);
			animalchest.setCustomName(horse.getName());
			event.setGui(new GuiHorseEnderChest(CrystalMod.proxy.getClientPlayer().inventory, animalchest, horse));
			PacketGuiMessage pkt = new PacketGuiMessage("Gui");
			pkt.setOpenGui(GuiHandler.GUI_ID_ENTITY, horse.getEntityId(), 0, 0);
			CrystalModNetwork.sendToServer(pkt);
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:18,代码来源:ClientEventHandler.java

示例5: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onGuiOpen(@Nonnull final GuiOpenEvent event) {
	if (!hasPlayed && event.getGui() instanceof GuiMainMenu) {
		hasPlayed = true;
		final String[] possibles = ModOptions.startupSoundList;
		if (possibles == null || possibles.length == 0)
			return;
		final String res = possibles[XorShiftRandom.current().nextInt(possibles.length)];
		if (!StringUtils.isEmpty(res)) {
			final SoundEvent se = SoundEvent.REGISTRY.getObject(new ResourceLocation(res));
			if (se != null)
				SoundEngine.instance().playSound(new AdhocSound(se, SoundCategory.MASTER));
			else
				DSurround.log().warn("Unable to locate startup sound [%s]", res);
		} else {
			DSurround.log().warn("Improperly formatted startup sound list!");
		}
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:20,代码来源:HumDinger.java

示例6: guiOpenEvent

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void guiOpenEvent(GuiOpenEvent event) {
    if (event.getGui() instanceof GuiContainer) {
        if (lastGui != event.getGui()) {
            if (event.getGui() == null) {
                instanceTooltipHandlers = null;
            } else {
                instanceTooltipHandlers = new LinkedList<>();
                if (event.getGui() instanceof IContainerTooltipHandler) {
                    instanceTooltipHandlers.add(((IContainerTooltipHandler) event.getGui()));
                }
                instanceTooltipHandlers.addAll(tooltipHandlers);
            }
            lastGui = event.getGui();
        }
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:18,代码来源:NEIClientEventHandler.java

示例7: onGuiOpenEvent

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onGuiOpenEvent(GuiOpenEvent event)
{
    // Reset the scrolling modifier when the player opens a GUI.
    // Otherwise the key up event will get eaten and our scrolling mode will get stuck on
    // until the player sneaks again.
    // FIXME Apparently there are key input events for GUI screens in 1.8,
    // so this probably can be removed then.
    InputEventHandler.resetModifiers();

    // Opening the player's Inventory GUI
    if (event.getGui() != null && event.getGui().getClass() == GuiInventory.class)
    {
        EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();

        if (this.handyBagShouldOpen && player != null && ItemHandyBag.getOpenableBag(player).isEmpty() == false)
        {
            if (event.isCancelable())
            {
                event.setCanceled(true);
            }

            PacketHandler.INSTANCE.sendToServer(new MessageOpenGui(player.dimension, ReferenceGuiIds.GUI_ID_HANDY_BAG));
        }
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:27,代码来源:GuiEventHandler.java

示例8: onOpenGui

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onOpenGui(GuiOpenEvent evt) {
    GuiScreen gui = evt.getGui();
    if (gui instanceof GuiMainMenu) {
        try {
            GuiMainMenu menu = (GuiMainMenu) gui;
            String splash = mainMenuGetSplashText(menu);
            if (splash.equals("Kind of dragon free!")) {
                splash = "Not really dragon free!";
                mainMenuSetSplashText(menu, splash);
            } else if (splashLines != null && !splashLines.isEmpty() && rand.nextInt(10) == 0) {
                splash = splashLines.get(rand.nextInt(splashLines.size()));
                mainMenuSetSplashText(menu, splash);
            }
        } catch (Throwable t) {
            L.warn("Can't override splash", t);
        }
    }
}
 
开发者ID:ata4,项目名称:dragon-mounts,代码行数:20,代码来源:DragonSplash.java

示例9: onOpenGui

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onOpenGui(GuiOpenEvent event) {
	Minecraft mc = Minecraft.getMinecraft();
	if (mc.player != null && mc.player.getHealth() <= 0f) {
		mc.player.setSneaking(false);
		if (event.getGui() instanceof GuiChat && mc.gameSettings.keyBindSneak.isKeyDown()) {
			event.setGui(new GuiChat("/team "));
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:11,代码来源:TeamUpAddon.java

示例10: onOpenGui

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onOpenGui(GuiOpenEvent event) {
	Minecraft mc = Minecraft.getMinecraft();
	if (mc.player != null) {
		if (event.getGui() instanceof GuiGameOver && isKnockedOut && !acceptedDeath) { // Minor hack: isKnockedOut is always set AFTER the game over screen pops up, so we can abuse that here
			event.setGui(null);
		} else if (isKnockedOut && event.getGui() instanceof GuiInventory) {
			event.setGui(null);
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:12,代码来源:ClientProxy.java

示例11: guiInit

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void guiInit(GuiOpenEvent e) {
    if(e.getGui() instanceof GuiVideoSettings) {
        e.setGui(new GuiNewVideoSettings(Minecraft.getMinecraft().currentScreen, Minecraft.getMinecraft().gameSettings));
    } else if(e.getGui() instanceof GuiOptions) {
        e.setGui(new GuiNewOptions(((GuiOptions) e.getGui()).lastScreen, Minecraft.getMinecraft().gameSettings));
    }
}
 
开发者ID:jaredlll08,项目名称:Visualize,代码行数:9,代码来源:ClientEventHandler.java

示例12: guiOpenEvent

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void guiOpenEvent(GuiOpenEvent event){
	System.out.println(event.getGui());
	if(event.getGui() instanceof GuiInventory){
		event.setCanceled(true);
		Minecraft.getMinecraft().thePlayer.openGui(Main.instance, 21, Minecraft.getMinecraft().theWorld, (int) Minecraft.getMinecraft().thePlayer.posX, (int) Minecraft.getMinecraft().thePlayer.posY, (int) Minecraft.getMinecraft().thePlayer.posZ);
	}
}
 
开发者ID:GummyBlasian,项目名称:Inventory-Power,代码行数:9,代码来源:RenderModeButtonsTickEvent.java

示例13: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
/**
 * Refresh models, skins and morphs upon entering in Metamorph and/or
 * Blockbuster GUIs.
 */
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
    if (!Blockbuster.proxy.config.auto_refresh_models)
    {
        return;
    }

    GuiScreen gui = event.getGui();

    boolean isMetamorph = gui instanceof GuiCreativeMenu || gui instanceof GuiSurvivalMenu;
    boolean isBlockbuster = gui instanceof GuiDirector || gui instanceof GuiActor;
    boolean exitME = gui == null && Minecraft.getMinecraft().currentScreen instanceof GuiModelEditor;

    if (isMetamorph || isBlockbuster || exitME)
    {
        /* Reload models and skin */
        ModelPack pack = Blockbuster.proxy.models.pack;

        if (pack == null)
        {
            pack = Blockbuster.proxy.getPack();

            if (Minecraft.getMinecraft().isSingleplayer())
            {
                pack.addFolder(DimensionManager.getCurrentSaveRootDirectory() + "/blockbuster/models");
            }
        }

        Blockbuster.proxy.loadModels(pack);
        ClientProxy.actorPack.pack.reload();
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:38,代码来源:MainMenuHandler.java

示例14: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@Method(modid = "aperture")
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
    if (Minecraft.getMinecraft().thePlayer == null)
    {
        return;
    }

    GuiScreen current = Minecraft.getMinecraft().currentScreen;
    GuiScreen toOpen = event.getGui();
    BlockPos pos = getDirectorPos();

    if (pos != null)
    {
        int tick = ClientProxy.cameraEditor.scrub.value;

        if (current != ClientProxy.cameraEditor && toOpen instanceof GuiCameraEditor)
        {
            /* Camera editor opens */
            CameraHandler.tick = tick;

            if (CameraHandler.reload)
            {
                Dispatcher.sendToServer(new PacketDirectorPlay(pos, PacketDirectorPlay.START, tick));
            }

            Dispatcher.sendToServer(new PacketRequestLength(pos));
        }
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:32,代码来源:CameraHandler.java

示例15: onMainMenuOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onMainMenuOpen(GuiOpenEvent event) {
	if (!dumped && event.getGui() instanceof GuiMainMenu) {
		dumped = true;
		TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
		for (Map.Entry<ResourceLocation, ITextureObject> entry : textureManager.mapTextureObjects.entrySet()) {
			ITextureObject textureObject = entry.getValue();
			if (textureObject instanceof TextureMap) {
				String name = entry.getKey().toString().replace(':', '_').replace('/', '_');
				dumpTextureMap((TextureMap) textureObject, name);
			}
		}
	}
}
 
开发者ID:mezz,项目名称:TextureDump,代码行数:16,代码来源:TextureDump.java


注:本文中的net.minecraftforge.client.event.GuiOpenEvent.getGui方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。