當前位置: 首頁>>代碼示例>>Java>>正文


Java GuiOpenEvent類代碼示例

本文整理匯總了Java中net.minecraftforge.client.event.GuiOpenEvent的典型用法代碼示例。如果您正苦於以下問題:Java GuiOpenEvent類的具體用法?Java GuiOpenEvent怎麽用?Java GuiOpenEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GuiOpenEvent類屬於net.minecraftforge.client.event包,在下文中一共展示了GuiOpenEvent類的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: onOpenGui

import net.minecraftforge.client.event.GuiOpenEvent; //導入依賴的package包/類
@SubscribeEvent
public void onOpenGui(GuiOpenEvent event) {
	if (event.gui instanceof GuiMainMenu) {
		event.gui = new RewiMainMenu();
	}
	if (event.gui instanceof GuiIngameMenu) {
		event.gui = new RewiIngameMenu();
	}
	if (event.gui instanceof GuiOptions) {
		event.gui = new RewiOptionsMenu(Minecraft.getMinecraft().currentScreen, Minecraft.getMinecraft().gameSettings);
	}
}
 
開發者ID:CreepPlaysDE,項目名稱:RewiMod,代碼行數:13,代碼來源:GuiHandler.java

示例4: 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

示例5: 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

示例6: 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

示例7: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //導入依賴的package包/類
@SubscribeEvent
	public void onGuiOpen(GuiOpenEvent event)
	{
//		if (event.gui instanceof GuiMainMenu)
//		{	
//			{
//				
//			}
//		}
		if (event.gui instanceof GuiGameOver)
		{
			GuiFNAFGameOver.ticksElapsed = 0;
			mc.getSoundHandler().stopSounds();
			
			if (!mc.getSoundHandler().isSoundPlaying(FNAFSoundHandler.deathStatic))
			{
				mc.getSoundHandler().playSound(FNAFSoundHandler.deathStatic);
			}
		}
	}
 
開發者ID:Link1234Gamer,項目名稱:FiveNightsAtFreddysUniverseMod,代碼行數:21,代碼來源:ClientEventHandler.java

示例8: 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

示例9: onEvent

import net.minecraftforge.client.event.GuiOpenEvent; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(GuiOpenEvent event) {
	if (event.gui instanceof GuiIngameModOptions) {
		event.gui = new GuiModList(new GuiIngameMenu());
	}
}
 
開發者ID:PC-Logix,項目名稱:OpenFM,代碼行數:8,代碼來源:OpenFM.java

示例10: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //導入依賴的package包/類
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
  if (event.gui == null) {
    return;
  }
  try {
    if (event.gui.getClass() == GuiModList.class) {
      event.setCanceled(true);
      Minecraft.getMinecraft().displayGuiScreen(new GuiEnhancedModList((GuiScreen) _mainMenu.get(event.gui)));
    }
    if (event.gui.getClass() == GuiIngameModOptions.class) {
      event.setCanceled(true);
      Minecraft.getMinecraft().displayGuiScreen(new GuiEnhancedModList((GuiScreen) _parentScreen.get(event.gui)));
    }
  } catch (Exception e) {
    Throwables.propagate(e);
  }
}
 
開發者ID:SleepyTrousers,項目名稱:EnderCore,代碼行數:19,代碼來源:EventHandlerGui.java

示例11: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //導入依賴的package包/類
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
    GuiScreen gui = event.gui;
    if (!Settings.autoRespawn)
    {
        return;
    }
    if (gui instanceof GuiGameOver && !hasClicked)
    {
        Minecraft mc = Minecraft.getMinecraft();
        if (!mc.theWorld.getWorldInfo().isHardcoreModeEnabled())
        {
            hasClicked = true;
            mc.thePlayer.respawnPlayer();
            mc.displayGuiScreen((GuiScreen) null);
            event.setCanceled(true);
        }
    }
    else if (!(gui instanceof GuiGameOver) && hasClicked)
    {
        hasClicked = false;
    }
}
 
開發者ID:VikeStep,項目名稱:sprinkles_for_vanilla,代碼行數:25,代碼來源:ClientHandlers.java

示例12: 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

示例13: 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

示例14: openMainMenu

import net.minecraftforge.client.event.GuiOpenEvent; //導入依賴的package包/類
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void openMainMenu(GuiOpenEvent e)
{
	if (e.gui instanceof GuiMainMenu && Config.replacements.isEmpty() && Config.itemReplacements.isEmpty())
	{
		File file = new File(configDir, Refs.MOD_ID + "_data");
		if (!file.exists())
		{
			try
			{
				file.createNewFile();
			}
			catch (Throwable t)
			{
				TooManyDanyOres.logger.warn("Unable to create a data file!");
				TooManyDanyOres.logger.catching(t);
			}
			
			e.gui = new GuiStartupWarning((GuiMainMenu)e.gui);
			
			MinecraftForge.EVENT_BUS.unregister(this);
		}
	}
}
 
開發者ID:CatDany,項目名稱:TooManyDanyOres,代碼行數:26,代碼來源:Warnings.java

示例15: onGui

import net.minecraftforge.client.event.GuiOpenEvent; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGui(GuiOpenEvent event)
{
    if (event.gui instanceof GuiMainMenu)
    {
    	if (shouldLoadGUI && ConfigurationHandler.showIRCGui)
        {
            event.gui = new IRCGui();
            shouldLoadGUI = false;
        }
        else
        {
            ObfuscationReflectionHelper.setPrivateValue(GuiMainMenu.class, (GuiMainMenu) event.gui, getRandTPPISplash(), "splashText", "field_73975_c");
        }
    }
}
 
開發者ID:TPPIDev,項目名稱:TPPI-Tweaks,代碼行數:18,代碼來源:TPPIEventHandler.java


注:本文中的net.minecraftforge.client.event.GuiOpenEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。