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


Java GuiOpenEvent.setGui方法代码示例

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


在下文中一共展示了GuiOpenEvent.setGui方法的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: 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

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

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

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

示例6: guiOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
/** Alters which vanilla Gui is opened. */
@SubscribeEvent
public void guiOpen(GuiOpenEvent event) {

    EntityPlayer player = Minecraft.getMinecraft().player;

    if (event.getGui() instanceof
            net.minecraft.client.gui.inventory.GuiInventory &&
            player.inventoryContainer instanceof ContainerInventory) {
    
        event.setGui(new jayavery.geomastery.gui.GuiInventory(
                (ContainerInventory) player.inventoryContainer));
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:15,代码来源:ClientEvents.java

示例7: onGui

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onGui(GuiOpenEvent event) {
    if (event.getGui() == null || !GuiEnchantment.class.equals(event.getGui().getClass())) {
        // Only hook the enchantment GUI. We don't use instanceof, because we *only* want to
        // hook the unmodified GUI.
        return;
    }
    event.setGui(GuiEnchantmentWrapper.wrap((GuiEnchantment) event.getGui(), worker, lastInteractPos));
}
 
开发者ID:d0sboots,项目名称:EnchantmentRevealer,代码行数:10,代码来源:Events.java

示例8: npcTradeOpen

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void npcTradeOpen(GuiOpenEvent event){
	if(event.getGui() instanceof GuiMerchant){
		if(((GuiMerchant) event.getGui()).getMerchant() instanceof NPCShop){
			lastOpened = (NPCShop) ((GuiMerchant) event.getGui()).getMerchant();
		}else{
			Minecraft mc = Minecraft.getMinecraft();
			event.setGui(new GuiNPCMerchant(mc.player.inventory, lastOpened, mc.world));
		}
	}
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:12,代码来源:ClientProxy.java

示例9: openMainMenu

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly( Side.CLIENT )
public void openMainMenu(final GuiOpenEvent event ) {
    // if the max shades has changed in form the user of the new usage.
    if ((!detectedSdVersion.equals(config.lastSDVersionWarned)) && (sdMajorMismatch || sdMinorMismatch || sdVersionCheckFailed)) {
        event.setGui(new GuiScreenStartup());
    }
}
 
开发者ID:Belgabor,项目名称:DrawersBits,代码行数:9,代码来源:BitDrawers.java

示例10: checkMainMenu

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void checkMainMenu(GuiOpenEvent event) {
	String update = getUpdate();
	if (event.getGui() instanceof GuiMainMenu && update != null) {
		event.setGui(new UiUpdate(event.getGui(), update));
		MinecraftForge.EVENT_BUS.unregister(this);
	}
}
 
开发者ID:tasgoon,项目名称:Coherence,代码行数:10,代码来源:UpdateHandler.java

示例11: checkMultiplayer

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void checkMultiplayer(GuiOpenEvent event) {
    System.out.println("Checking for multiplayer.");
    if (event.getGui() instanceof GuiMultiplayer)
        event.setGui(new UiMultiplayer(new GuiMainMenu()));
}
 
开发者ID:tasgoon,项目名称:Coherence,代码行数:8,代码来源:MultiplayerHandler.java

示例12: applyForgeEventPatch

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@Override
public <T extends Event> boolean applyForgeEventPatch(T e) {
	GuiOpenEvent event = (GuiOpenEvent) e;
	String prefilledText = ReflectionHelper.get(ObfuscatedField.GuiChat_defaultInputFieldText, (net.minecraft.client.gui.GuiChat) event.getGui());
	
	if (event.getGui() instanceof net.minecraft.client.gui.GuiSleepMP) event.setGui(new GuiSleepMP());
	else event.setGui(prefilledText == null ? new GuiChat() : new GuiChat(prefilledText));
	
	PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true);
	return true;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:12,代码来源:PatchChatGui.java

示例13: applyGuiOpenPatches

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
private boolean applyGuiOpenPatches(GuiOpenEvent event) {
	if (event.getGui() instanceof GuiMainMenu && this.startupServerName != null) {
		GuiScreen screen = connectToServerAtStartup(this.startupServerName, this.startupServerPort);
		this.startupServerName = null;
		
		if (screen == null) {
			FMLClientHandler.instance().connectToServerAtStartup(this.startupServerName, this.startupServerPort);
			PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false);
			return false;
		}
		else {
			event.setGui(screen);
			
			PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true);
			return true;
		}
	}
	else if (event.getGui() instanceof net.minecraft.client.gui.GuiMultiplayer) {
		if (parentScreenField == null) {
			PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false);
			return false;
		}
		
		GuiScreen parentScreen = ReflectionHelper.get(ObfuscatedField.GuiMultiplayer_parentScreen, parentScreenField, (net.minecraft.client.gui.GuiMultiplayer) event.getGui());
		event.setGui(new GuiMultiplayer(parentScreen));
		
		PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true);
		return true;
	}
	else throw new IllegalArgumentException("Invalid argument: GuiOpenEvent with GuiMainMenu or GuiMultiplayer required");
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:32,代码来源:PatchEntityPlayerSP.java

示例14: openGui

import net.minecraftforge.client.event.GuiOpenEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void openGui(GuiOpenEvent e) throws Exception {
	if (EasyEditorsApi.isEasyEditorsActive && e.getGui() != null) {
		Class<? extends GuiScreen> oldClass = e.getGui().getClass();
		if (replacementMap.containsKey(oldClass)) {
			e.setGui(replacementMap.get(oldClass).getConstructor(oldClass).newInstance(e.getGui()));
		}
	}
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:10,代码来源:GuiReplacementRegistry.java

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


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