本文整理汇总了Java中net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent类的典型用法代码示例。如果您正苦于以下问题:Java InitGuiEvent类的具体用法?Java InitGuiEvent怎么用?Java InitGuiEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InitGuiEvent类属于net.minecraftforge.client.event.GuiScreenEvent包,在下文中一共展示了InitGuiEvent类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: customSplash
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SubscribeEvent
public void customSplash(InitGuiEvent.Pre event) {
if (!(event.gui instanceof GuiMainMenu)) return;
int hash = event.gui.hashCode();
if (hash == last_hash) return;
last_hash = hash;
GuiMainMenu menu = (GuiMainMenu) event.gui;
ReservoirSampler<String> sampler = new ReservoirSampler<String>(1, new Random());
sampler.give(menu.splashText);
sampler.preGive(359); // NORELEASE: Verify this number each MC version, including minor versions. (Or we could just count it. Hmm.)
// Err, should that be <number of lines> - 1? Or maybe even -2 for the hashCode thing?
sampler.give(""); // !!!! The secret EMPTY splash text! :O
HashSet<String> alreadySeen = new HashSet<String>();
int dupes = 0;
try {
@SuppressWarnings("unchecked")
List<IResource> resources = mc.getResourceManager().getAllResources(new ResourceLocation("minecraft:texts/extra_splashes.txt"));
for (IResource res : resources) {
InputStream is = null;
try {
is = res.getInputStream();
if (is == null) continue;
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(is, Charsets.UTF_8));
String s;
while ((s = bufferedreader.readLine()) != null) {
s = s.trim();
if (s.isEmpty()) continue;
if (s.hashCode() == 125780783) continue; // Probably "This message will never appear on the splash screen, isn't that weird?".hashCode()
if (s.startsWith("#")) continue;
if (!alreadySeen.add(s)) {
dupes++;
continue;
}
sampler.give(s);
}
} finally {
FzUtil.closeNoisily("Closing " + res, is);
}
}
} catch (IOException e) {
e.printStackTrace();
}
if (dupes > 0) {
Core.logWarning("Extra splashes had duplicated lines: " + dupes);
}
if (sampler.size() < 1) return;
menu.splashText = sampler.getSamples().get(0);
}
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:50,代码来源:MiscClientProxy.java
示例17: addButtonsToGui
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void addButtonsToGui(InitGuiEvent.Post event) {
GuiScreen gui = event.getGui();
if (gui == null) {
return;
} // probably doesn't ever happen
// all containers by default but with a blacklist in config
if (gui instanceof GuiContainer &&
!(gui instanceof GuiInventory) &&
!(gui instanceof GuiPlayerExtended) &&
!(gui instanceof GuiPlayerExtWorkbench)) {
String self = gui.getClass().getName();
// && blacklistGuis.contains(self) ==
boolean isInBlacklist = false;
for (String s : blacklistGuis) {
if (s.equalsIgnoreCase(self)) {
isInBlacklist = true;
break;
}
}
if (isInBlacklist) {
return;
}
//" =>NOT in blacklist, ADD THE BUTTONS NOW :: "+position);
int button_id = 256;
// config for different locations - left right bottom top
int x = 0, y = 0, yDelta = 24, xDelta = 0;
// not GuiContainerCreative
GuiContainer guiInv = (GuiContainer) gui;
// align to different area depending on config
if (position.equalsIgnoreCase(posLeft)) {
x = padding;
y = padding;
// we are moving top to bottom, so
xDelta = 0;
yDelta = Const.btnHeight + padding;
}
else if (position.equalsIgnoreCase(posRight)) {
x = Minecraft.getMinecraft().displayWidth / 2 - BTNWIDTH - padding;
y = padding;
// we are moving top to bottom, so
xDelta = 0;
yDelta = Const.btnHeight + padding;
}
else if (position.equalsIgnoreCase(posBottom)) {
// test bottom
x = padding;
y = Minecraft.getMinecraft().displayHeight / 2 - padding - Const.btnHeight;
xDelta = BTNWIDTH + padding;
yDelta = 0;
}
else if (position.equalsIgnoreCase(posAlign) || true) {
// x = gui.height;
// y = gui.width;
int guiLeft = ReflectionHelper.getPrivateValue(GuiContainer.class, guiInv, "i", "field_147003_i", "guiLeft");
int guiTop = ReflectionHelper.getPrivateValue(GuiContainer.class, guiInv, "r", "field_147009_r", "guiTop");
x = guiLeft;
y = guiTop;
// we are moving top to bottom, so
xDelta = 0;
yDelta = Const.btnHeight + padding;
}
event.getButtonList().add(new ButtonTerrariaLootAll(button_id++, x, y));
x += xDelta;
y += yDelta;
event.getButtonList().add(new ButtonTerrariaDepositAll(button_id++, x, y));
x += xDelta;
y += yDelta;
event.getButtonList().add(new ButtonTerrariaQuickStack(button_id++, x, y));
x += xDelta;
y += yDelta;
event.getButtonList().add(new ButtonTerrariaRestock(button_id++, x, y));
}
}
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:75,代码来源:GuiTerrariaButtonsModule.java
示例18: preGui
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
@SubscribeEvent
public void preGui(InitGuiEvent.Pre event){
if(event.gui instanceof GuiMainMenu){
Config.save();
}
}
开发者ID:therealfarfetchd,项目名称:IngameAccountSwitcher,代码行数:7,代码来源:ForgeEvents.java
示例19: getButtonList
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; //导入依赖的package包/类
List<GuiButton> getButtonList(InitGuiEvent e);
开发者ID:Team-Fruit,项目名称:ServerObserver,代码行数:2,代码来源:ICompat.java
注:本文中的net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论