本文整理汇总了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;
}
}
}
}
示例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));
}
}
示例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));
// }
// }
}
示例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);
}
}
示例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, ""));
}
}
示例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")));
}
}
示例7: onGuiPostInit
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGuiPostInit(InitGuiEvent.Post event) {
if (enableTerrariaButtons) {
addButtonsToGui(event);
}
}
示例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, ""));
}
}
示例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));
}
示例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);
}
}
示例11: getButtonList
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@Override
public List<GuiButton> getButtonList(final InitGuiEvent e) {
return e.getButtonList();
}
示例12: open
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SubscribeEvent
public void open(final InitGuiEvent.Post e) {
this.guiHandler.open(e);
}
示例13: getButtonList
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@Override
public List<GuiButton> getButtonList(final InitGuiEvent e) {
return e.buttonList;
}
示例14: getButtonList
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public List<GuiButton> getButtonList(final InitGuiEvent e) {
return e.buttonList;
}
示例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);
}
}