本文整理汇总了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);
}
}
示例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;
}
}
示例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));
}
}
}
示例4: onOpenGui
import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onOpenGui(GuiOpenEvent event)
{
if (TickHandler.getInstance().fakeUseInProgress())
{
event.setCanceled(true);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例9: onGuiUpdate
import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onGuiUpdate(GuiOpenEvent event) {
if(event.getGui() instanceof GuiSleepMP) {
event.setCanceled(true);
}
}
示例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);
}
}