当前位置: 首页>>代码示例>>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;未经允许,请勿转载。