net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent Java Examples

The following examples show how to use net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScreenInjector.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void initGui(InitGuiEvent.Post event) {
	if (!(Minecraft.getInstance().currentScreen instanceof MultiplayerScreen)) return;
	
	event.addWidget(new Button(5, 7, 50, 18, "Scraper", button -> {
		Minecraft.getInstance().displayGuiScreen(new ServerScraperScreen((MultiplayerScreen) event.getGui()));
	}));
	event.addWidget(new Button(58, 7, 50, 18, "Cleanup", button -> {
		Minecraft.getInstance().displayGuiScreen(new CleanUpScreen((MultiplayerScreen) event.getGui()));
	}));
}
 
Example #2
Source File: CreativeMenuHandler.java    From Cyberware with MIT License 6 votes vote down vote up
@SubscribeEvent
public void handleButtons(InitGuiEvent event)
{
	if (event.getGui() instanceof GuiContainerCreative)
	{
		GuiContainerCreative gui = (GuiContainerCreative) event.getGui();

		int i = (gui.width - 136) / 2;
		int j = (gui.height - 195) / 2;
		
		List<GuiButton> buttons = event.getButtonList();
		buttons.add(salvaged = new CEXButton(355, i + 166 + 4, j + 29 + 8, 0));
		buttons.add(manufactured = new CEXButton(356, i + 166 + 4, j + 29 + 31, 1));
		
		int selectedTabIndex = ReflectionHelper.getPrivateValue(GuiContainerCreative.class, (GuiContainerCreative) gui, 2);
		if (selectedTabIndex != Cyberware.creativeTab.getTabIndex())
		{
			salvaged.visible = false;
			manufactured.visible = false;
		}
		event.setButtonList(buttons);
	}
}
 
Example #3
Source File: ScreenInjector.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void initGui(InitGuiEvent.Pre event) {
	if (!(Minecraft.getInstance().currentScreen instanceof MainMenuScreen)) return;
	
	Minecraft.getInstance().displayGuiScreen(new BleachMainMenu());
}