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


Java GuiOpenEvent.setCanceled方法代码示例

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


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

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

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

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

示例4: onOpenGui

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onOpenGui(GuiOpenEvent event)
{
    if (TickHandler.getInstance().fakeUseInProgress())
    {
        event.setCanceled(true);
    }
}
 
开发者ID:maruohon,项目名称:placementpreview,代码行数:9,代码来源:RenderEventHandler.java

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

示例6: onGuiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
	EnumControl regenControl = AdvHealthOptions.config.<EnumControl>get(AHOGlobalConfig.generalControl);
	if ((regenControl == EnumControl.HIDDEN) ||
	    !(event.gui instanceof GuiCreateWorld) ||
	     (event.gui instanceof AHOGuiCreateWorld)) return;
	// Replace default create world GUI with custom one. This might be
	// bad if other mods do the same, or try to modify the default one.
	Minecraft mc = Minecraft.getMinecraft();
	mc.displayGuiScreen(new AHOGuiCreateWorld(mc.currentScreen));
	event.setCanceled(true);
}
 
开发者ID:copygirl,项目名称:AdvHealthOptions,代码行数:13,代码来源:ClientProxy.java

示例7: guiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void guiOpen(GuiOpenEvent event)
{
    GuiScreen gui = event.gui;
    GuiScreen curGui = Minecraft.getMinecraft().currentScreen;
    if (gui instanceof GuiDisconnected && !(gui instanceof GuiProgressDisconnected))
    {
        GuiDisconnected dc = (GuiDisconnected) gui;
        if (reasonField == null)
        {
            reasonField = ReflectionHelper.findField(gui.getClass(), "field_146306_a", "reason");
            reasonField.setAccessible(true);
        }

        if (messageField == null)
        {
            messageField = ReflectionHelper.findField(gui.getClass(), "field_146304_f", "message");
            messageField.setAccessible(true);
        }

        if (parentField == null)
        {
            parentField = ReflectionHelper.findField(gui.getClass(), "field_146307_h", "parentScreen");
            parentField.setAccessible(true);
        }

        try
        {
            String reason = (String) reasonField.get(dc);
            IChatComponent message = (IChatComponent) messageField.get(dc);

            if (curGui instanceof GuiProgressDisconnected)
            {
                if (message.getFormattedText().contains("Server is still pre-generating!"))
                {
                    GuiProgressDisconnected curDiscon = (GuiProgressDisconnected) curGui;
                    curDiscon.update(reason, message);
                    event.setCanceled(true);
                }
            }
            else if (message.getFormattedText().contains("Server is still pre-generating!"))
            {
                event.gui = new GuiProgressDisconnected((GuiScreen) parentField.get(dc), reason, message, lastNetworkManager);
                lastNetworkManager = null;
            }
        }
        catch (IllegalAccessException e)
        {
        }
    }
    else if (gui instanceof GuiConnecting)
    {
        //lastNetworkManager = getNetworkManager((GuiConnecting) gui);
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:56,代码来源:EventHandler.java

示例8: guiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void guiOpen(GuiOpenEvent event)
{
    GuiScreen gui = event.getGui();
    GuiScreen curGui = Minecraft.getMinecraft().currentScreen;
    if (gui instanceof GuiDisconnected)
    {
        GuiDisconnected dc = (GuiDisconnected) gui;

        try
        {

            if (reasonField == null)
            {
                reasonField = ReflectionHelper.findField(gui.getClass(), "field_146306_a", "reason");
                reasonField.setAccessible(true);
            }

            if (messageField == null)
            {
                messageField = ReflectionHelper.findField(gui.getClass(), "field_146304_f", "message");
                messageField.setAccessible(true);
            }

            if (parentField == null)
            {
                parentField = ReflectionHelper.findField(gui.getClass(), "field_146307_h", "parentScreen");
                parentField.setAccessible(true);
            }
            String reason = (String) reasonField.get(dc);
            ITextComponent message = (ITextComponent) messageField.get(dc);

            if (curGui instanceof GuiProgressDisconnected)
            {
                if (message.getUnformattedText().contains("Server is still pre-generating!"))
                {
                    GuiProgressDisconnected curDiscon = (GuiProgressDisconnected) curGui;
                    curDiscon.update(reason, message);
                    event.setCanceled(true);
                }
            }
            else if (message.getUnformattedText().contains("Server is still pre-generating!"))
            {
                event.setGui(new GuiProgressDisconnected((GuiScreen) parentField.get(dc), reason, message, lastNetworkManager));
                lastNetworkManager = null;
            }
        }
        catch (Throwable e)
        {
        }
    }
    else if (gui instanceof GuiConnecting)
    {
        //lastNetworkManager = getNetworkManager((GuiConnecting) gui);
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:57,代码来源:EventHandler.java

示例9: onGuiUpdate

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onGuiUpdate(GuiOpenEvent event) {
    if(event.getGui() instanceof GuiSleepMP) {
        event.setCanceled(true);
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:7,代码来源:BedModeMod.java

示例10: blockDeathGui

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void blockDeathGui(GuiOpenEvent event) {
	if(event.getGui() instanceof GuiGameOver && WeaponsCapability.get(Minecraft.getMinecraft().player).isFeign() && Minecraft.getMinecraft().player.getHealth() > 0f) {
		event.setCanceled(true);
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:7,代码来源:TF2EventsClient.java


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