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


Java InitGuiEvent类代码示例

本文整理汇总了Java中net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent的典型用法代码示例。如果您正苦于以下问题:Java InitGuiEvent类的具体用法?Java InitGuiEvent怎么用?Java InitGuiEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InitGuiEvent类属于net.minecraftforge.client.event.GuiScreenEvent包,在下文中一共展示了InitGuiEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: patchupTheStupidSecretButton

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SubscribeEvent
public void patchupTheStupidSecretButton(InitGuiEvent.Post event) {
    if (!(event.gui instanceof GuiOptions)) return;
    
    for (Object obj : event.buttonList) {
        if (obj instanceof GuiButton) {
            GuiButton button = (GuiButton) obj;
            if (button.id == 8675309) {
                button.displayString = "Shaders; press F4 to reset";
                button.xPosition = 0;
                button.yPosition = 0;
                return;
            }
        }
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:17,代码来源:MiscClientProxy.java

示例2: onGuiPostInit

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGuiPostInit(InitGuiEvent.Post event) {
  Gui gui = event.getGui();
  if (gui == null) { return; } // probably doesnt ever happen
  if (ModConfig.showGuiButton && gui instanceof net.minecraft.client.gui.inventory.GuiInventory) {
    // omg thanks so much to this guy
    // http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/mods-discussion/1390983-making-guis-scale-to-screen-width-height
    ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
    int screenWidth = res.getScaledWidth();
    int screenHeight = res.getScaledHeight();
    int button_id = 256;
    int x, y;
    //align t top right
    x = screenWidth / 2 + Const.VWIDTH / 2 - GuiButtonOpenInventory.width - 1;
    y = screenHeight / 2 - Const.VHEIGHT / 2 - GuiButtonOpenInventory.height + 1;
    boolean hasPotions = Minecraft.getMinecraft().player.getActivePotionEffects().size() > 0;
    if (hasPotions) {
      x += 60;
    }
    //this is the tab button
    event.getButtonList().add(new GuiButtonOpenInventory(button_id++, x, y));
  }
}
 
开发者ID:LothrazarMinecraftMods,项目名称:OverpoweredInventory,代码行数:25,代码来源:EventHandler.java

示例3: onGuiPostInit

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
	@SideOnly(Side.CLIENT)
	@SubscribeEvent
	public void onGuiPostInit(InitGuiEvent.Post event)
	{
//		Blocks.enchanting_table.s
//		if(event.gui instanceof EnchantingInterruptor)
//		{
//			((EnchantingInterruptor)event.gui).redoButtons = true;
//		} else if(event.gui instanceof GuiContainer)
//		{
//			GuiContainer gui = (GuiContainer)event.gui;
//			Container container = gui.inventorySlots;
//			
//			event.buttonList.add(new InvoScrollBar(256, 0, 0, 1, 1, "", container, gui));
//			
//			if(event.gui instanceof GuiInventory)
//			{
//				final ScaledResolution scaledresolution = new ScaledResolution(event.gui.mc, event.gui.mc.displayWidth, event.gui.mc.displayHeight);
//                int i = scaledresolution.getScaledWidth();
//                int j = scaledresolution.getScaledHeight();
//				event.buttonList.add(new GuiButtonUnlockSlot(event.buttonList.size(), i/2 - 50, j - 40, 100, 20, event.gui.mc.thePlayer));
//			}
//		}
	}
 
开发者ID:GenDeathrow,项目名称:Skills,代码行数:26,代码来源:GuiManager.java

示例4: onGuiInit

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SubscribeEvent
public void onGuiInit(InitGuiEvent event)
{
    if (event.getGui() instanceof GuiMainMenu)
    {
        event.getButtonList().add(this.openModelEditor);
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:9,代码来源:MainMenuHandler.java

示例5: guiEvent

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SubscribeEvent
public void guiEvent(InitGuiEvent.Post event){
	GuiScreen gui = event.getGui();
	if(gui instanceof GuiMainMenu){
		event.getButtonList().add(new GuiButtonWithImage(20, gui.width / 2 + 104, (gui.height / 4 + 48) + 72 + 12, 20, 20, ""));
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:In-Game-Account-Switcher,代码行数:8,代码来源:ClientEvents.java

示例6: onGuiInit

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@SubscribeEvent
public void onGuiInit(InitGuiEvent event)
{
    if(event.gui instanceof GuiOptions)
    {
        int x = event.gui.width / 2 + 5 + 150 + 5;
        int y = event.gui.height / 6 + 48 - 6;
        event.buttonList.add(new GuiIconButton(0x42, x, y, new ResourceLocation(MODID, "textures/gui/palette.png")));
    }
}
 
开发者ID:jglrxavpok,项目名称:ShadyMod,代码行数:12,代码来源:ShadyMod.java

示例7: onGuiPostInit

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGuiPostInit(InitGuiEvent.Post event) {
  if (enableTerrariaButtons) {
    addButtonsToGui(event);
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:8,代码来源:GuiTerrariaButtonsModule.java

示例8: guiEvent

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SubscribeEvent
public void guiEvent(InitGuiEvent.Post event){
	GuiScreen gui = event.gui;
	if(gui instanceof GuiMainMenu){
		event.buttonList.add(new GuiButtonWithImage(20, gui.width / 2 + 104, (gui.height / 4 + 48) + 72 + 12, 20, 20, ""));
	}
}
 
开发者ID:therealfarfetchd,项目名称:IngameAccountSwitcher,代码行数:8,代码来源:ForgeEvents.java

示例9: setWorldAndResolution

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
public void setWorldAndResolution(Minecraft p_146280_1_, int p_146280_2_, int p_146280_3_)
{
    this.mc = p_146280_1_;
    this.fontRendererObj = p_146280_1_.fontRenderer;
    this.width = p_146280_2_;
    this.height = p_146280_3_;
    if (!MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Pre(this, this.buttonList)))
    {
        this.buttonList.clear();
        this.initGui();
    }
    MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Post(this, this.buttonList));
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:14,代码来源:GuiScreen.java

示例10: addButtons

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void addButtons(InitGuiEvent.Post e) {
    if (e.gui instanceof GuiRepair) {
        final List<GuiButton> list = new ArrayList<GuiButton>();
        //TODO Add buttons.



        e.buttonList.addAll(list);
    }
}
 
开发者ID:vdvman1,项目名称:betterAnvil-forge,代码行数:13,代码来源:EventHandlerBA.java

示例11: getButtonList

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@Override
public List<GuiButton> getButtonList(final InitGuiEvent e) {
	return e.getButtonList();
}
 
开发者ID:Team-Fruit,项目名称:ServerObserver,代码行数:5,代码来源:Compat.java

示例12: open

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SubscribeEvent
public void open(final InitGuiEvent.Post e) {
	this.guiHandler.open(e);
}
 
开发者ID:Team-Fruit,项目名称:ServerObserver,代码行数:5,代码来源:CoreHandler.java

示例13: getButtonList

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@Override
public List<GuiButton> getButtonList(final InitGuiEvent e) {
	return e.buttonList;
}
 
开发者ID:Team-Fruit,项目名称:ServerObserver,代码行数:5,代码来源:Compat.java

示例14: getButtonList

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public List<GuiButton> getButtonList(final InitGuiEvent e) {
	return e.buttonList;
}
 
开发者ID:Team-Fruit,项目名称:ServerObserver,代码行数:6,代码来源:Compat.java

示例15: onInitGuiEvent

import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
/**
 * Called when the GUI is displayed and when the window resizes.
 */
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onInitGuiEvent(InitGuiEvent.Post event)
{
    // Only process if the world is loaded
    if (Minecraft.getMinecraft().world == null) { return; }
    final GuiScreen gui = event.getGui();

    // NOTE: even if the gui overlay is not visible, it still get the basic config to avoid crashes and leaks
    if (gui != null) {
        /*
        LogHelper.trace("EventDelegatorGuiOverlay.onInitGuiEvent.Post() - %s", gui);
        LogHelper.trace("    is GuiContainer: %s, is GuiInventory: %s", (gui instanceof GuiContainer), (gui instanceof GuiInventory));
        if (gui instanceof GuiContainer) {
            LogHelper.trace("    guiLeft: %d, guiTop: %d, xSize: %d, ySize: %d, inventory: %s", ((GuiContainer) gui).getGuiLeft(), ((GuiContainer) gui).getGuiTop(),
                    ((GuiContainer) gui).getXSize(), ((GuiContainer) gui).getYSize(), ((GuiContainer) gui).inventorySlots);
            if (((GuiContainer) gui).inventorySlots != null) {
                LogHelper.trace("    inventory size: %s", ((GuiContainer) gui).inventorySlots.inventorySlots.size());
            }
        }
        */

        this.getGuiOverlay().setWorldAndResolution(gui.width, gui.height);
        this.getGuiOverlay().setExternalGuiPosition(gui);
    }
    if (!this.shouldDisplayGuiOverlay(gui)) { return; }


    final InfoGuiOverlayDisplayParams displayParams = getDisplayParamsForGui(gui);

    this.getGuiOverlay().guiLeft = displayParams.getGuiLeft();
    this.getGuiOverlay().guiTop = displayParams.getGuiTop();
    this.getGuiOverlay().refreshExtraSlotsInfo(gui.mc.player.inventory);

    // Reposition the overlay if the potion effects are taking space
    if (this.getGuiOverlay().isPotionShiftActive()) {
        if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_LEFT)) {
            this.getGuiOverlay().guiLeft += ModConfig.POTION_SHIFT_MARGIN_LEFT;
        } else if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_RIGHT)) {
            this.getGuiOverlay().guiLeft += ModConfig.POTION_SHIFT_MARGIN_RIGHT;
        }

        // Resets the state since the overlay class is shared among all containers.
        this.getGuiOverlay().setPotionShiftState(false);
    }
}
 
开发者ID:sidben,项目名称:VisibleArmorSlots,代码行数:50,代码来源:EventDelegatorGuiOverlay.java


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