本文整理汇总了Java中net.minecraftforge.client.event.GuiScreenEvent类的典型用法代码示例。如果您正苦于以下问题:Java GuiScreenEvent类的具体用法?Java GuiScreenEvent怎么用?Java GuiScreenEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiScreenEvent类属于net.minecraftforge.client.event包,在下文中一共展示了GuiScreenEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDraw
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onDraw(GuiScreenEvent.DrawScreenEvent.Post event) {
if (event.gui instanceof GuiMainMenu
|| event.gui instanceof GuiIngameMenu) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
if (MoteCraft.mote == null) {
this.mc.renderEngine.bindTexture(new ResourceLocation(
MoteCraft.MODID, String.format("wiimote_search%02d.png",
this.animstate / 3)));
} else {
this.mc.renderEngine.bindTexture(new ResourceLocation(
MoteCraft.MODID, "wiimote_found.png"));
}
/*
* this.drawTexturedModalRect( 0, 0, 0, 0, 230, 1000);
*/
Utils.drawTexturedQuadFit(10, 10, 32, 32, zLevel + 1);
}
}
示例2: intercept
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
if (args == null || args.length > 1 || args.length == 0) {
return methodProxy.invokeSuper(obj, args);
}
if (method.getName().contains("guiRender") || method.getName().contains("mouseClick")) {
Object arg0 = args[0];
if (arg0 instanceof GuiScreenEvent) {
GuiScreenEvent drawEvent = (GuiScreenEvent) arg0;
if (drawEvent.getGui() instanceof GuiMainMenu) {
// Don't invoke.
return methodProxy.getSignature().getReturnType().getOpcode(VOID);
}
}
}
return methodProxy.invokeSuper(obj, args);
}
示例3: onInitGuiPost
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onInitGuiPost(GuiScreenEvent.InitGuiEvent.Post event)
{
if(!hasShownFirstGui)
{
hasShownFirstGui = true;
//Add the layer renderers
Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityClassRenderObject(EntityLlama.class);
if(renderer instanceof RenderLlama)
{
RenderLlama renderLlama = (RenderLlama)renderer;
renderLlama.addLayer(new LayerFancyLlama(renderLlama));
}
}
}
示例4: onGuiKeyboardEvent
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onGuiKeyboardEvent(GuiScreenEvent.KeyboardInputEvent.Post event) {
if (Keyboard.getEventKeyState()) {
int eventKey = Keyboard.getEventKey();
if (KeyBindings.TOGGLE.isActiveAndMatches(eventKey)) {
Config.toggleEnabled();
event.setCanceled(true);
} else if (KeyBindings.ZOOM_IN.isActiveAndMatches(eventKey)) {
Config.increaseZoom();
event.setCanceled(true);
} else if (KeyBindings.ZOOM_OUT.isActiveAndMatches(eventKey)) {
Config.decreaseZoom();
event.setCanceled(true);
}
}
}
示例5: guiPostInit
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
if (Minecraft.getMinecraft().player != null) {
if ((event.getGui() instanceof GuiInventory || event.getGui() instanceof GuiContainerCreative || event.getGui() instanceof GuiWearables)
&& !Minecraft.getMinecraft().player.getCapability(TF2weapons.INVENTORY_CAP, null).isEmpty()) {
// GuiContainer gui = (GuiContainer) event.getGui();
event.getButtonList().add(new GuiButton(97535627, event.getGui().width / 2 - 10, event.getGui().height / 2 + 95, 20, 20, "W"));
}
if (event.getGui() instanceof GuiMerchant)
if (((GuiMerchant) event.getGui()).getMerchant().getDisplayName().getUnformattedText().equals(I18n.format("entity.hale.name"))) {
event.getButtonList().add(new GuiButton(7578, event.getGui().width / 2 - 100, event.getGui().height / 2 - 110, 100, 20, "Change Team"));
event.getButtonList().add(new GuiButton(7579, event.getGui().width / 2, event.getGui().height / 2 - 110, 100, 20, "Recover Lost Items"));
}
Minecraft.getMinecraft().player.getCapability(TF2weapons.WEAPONS_CAP, null).state &= 8;
}
}
示例6: guiPostAction
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent
public void guiPostAction(GuiScreenEvent.ActionPerformedEvent.Post event) {
if (event.getGui() instanceof GuiInventory || event.getGui() instanceof GuiContainerCreative)
if (event.getButton().id == 97535627) {
// Minecraft.getMinecraft().displayGuiScreen(null);
TF2weapons.network.sendToServer(new TF2Message.ShowGuiMessage(0));
}
if (event.getGui() instanceof GuiWearables)
if (event.getButton().id == 97535627) {
event.getGui().mc.displayGuiScreen(new GuiInventory(event.getGui().mc.player));
}
// PacketHandler.INSTANCE.sendToServer(new
// PacketOpenNormalInventory(event.getGui().mc.player));
if (event.getGui() instanceof GuiMerchant && event.getButton().id == 7578) {
ClientProxy.displayScreenJoinTeam();
}
else if (event.getGui() instanceof GuiMerchant && event.getButton().id == 7579) {
TF2weapons.network.sendToServer(new TF2Message.ActionMessage(18));
}
}
示例7: onInitGuiPost
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onInitGuiPost(GuiScreenEvent.InitGuiEvent.Post event)
{
if(!hasShownFirstGui)
{
hasShownFirstGui = true;
//Add the layer renderers
Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityClassRenderObject(EntityRabbit.class);
if(renderer instanceof RenderRabbit)
{
RenderRabbit renderRabbit = (RenderRabbit)renderer;
renderRabbit.addLayer(new LayerFancyBunny(renderRabbit));
}
}
}
示例8: mouseClicked
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_)
{
if (p_73864_3_ == 0) {
for (int l = 0; l < this.buttonList.size(); l++)
{
GuiButton guibutton = (GuiButton)this.buttonList.get(l);
if (guibutton.mousePressed(this.mc, p_73864_1_, p_73864_2_))
{
GuiScreenEvent.ActionPerformedEvent.Pre event = new GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList);
if (MinecraftForge.EVENT_BUS.post(event)) {
break;
}
this.selectedButton = event.button;
event.button.func_146113_a(this.mc.getSoundHandler());
actionPerformed(event.button);
if (equals(this.mc.currentScreen)) {
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.buttonList));
}
}
}
}
}
示例9: onInitGuiScreen
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onInitGuiScreen(GuiScreenEvent.InitGuiEvent.Post event) {
if (active) {
LabelButtonInfo.inject(event.getGui());
if (event.getGui() instanceof GuiIngameMenu) {
event.getButtonList().add(new GuiButton(200, (event.getGui().width / 2) - 100, event.getGui().height - 20, I18n.format("gui.controller")));
}
if (event.getGui() instanceof GuiMainMenu) {
this.selector = new GuiButtonSelector(event.getGui().width / 2, event.getGui().height / 2 + 30, 40, event.getButtonList().toArray(new GuiButton[0]));
event.getButtonList().clear();
}
if (event.getButtonList().size() != 0)
ActionButtonChange.moveMouse(new Wrapper(event.getButtonList().get(0)), event.getGui().width, event.getGui().height);
}
}
示例10: preKeyboardInput
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent
public void preKeyboardInput(GuiScreenEvent.KeyboardInputEvent.Pre event) {
if (event.getGui() instanceof GuiContainer && playerHasBook()) {
GuiContainer gui = (GuiContainer) event.getGui();
Slot slot = gui.getSlotUnderMouse();
if (slot != null && slot.getHasStack()) {
if (Keyboard.getEventKey() == ProxyClient.recipeKey.getKeyCode() && RecipeManager.hasRecipes(slot.getStack())) {
GuideBookGui.onOpenCmd = "recipe";
GuideBookGui.onOpenArg = slot.getStack();
Minecraft.getMinecraft().player.openGui(GuideBookMod.instance, 0, Minecraft.getMinecraft().world, 0, 0, 0);
}
else if(Keyboard.getEventKey() == ProxyClient.usageKey.getKeyCode() && RecipeManager.hasUsages(slot.getStack())) {
GuideBookGui.onOpenCmd = "usage";
GuideBookGui.onOpenArg = slot.getStack();
Minecraft.getMinecraft().player.openGui(GuideBookMod.instance, 0, Minecraft.getMinecraft().world, 0, 0, 0);
}
}
}
}
示例11: onGuiScreenonInitGui
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onGuiScreenonInitGui(GuiScreenEvent.InitGuiEvent event) {
if (event.gui instanceof GuiIngameMenu) {
GuiIngameMenu menue = (GuiIngameMenu) event.gui;
event.buttonList.add(new GuiButton(20, menue.width / 2 - 100, menue.height / 4 + 128, 200, 20, "Teambattle Settings"));
}
}
示例12: onDrawBackground
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event)
{
if (renderRecipes && event.getGui() instanceof GuiContainer)
{
GuiContainer gui = (GuiContainer) event.getGui();
RecipeStorage recipes = InputEventHandler.instance().getRecipes();
int count = recipes.getRecipeCount();
for (int recipeId = 0; recipeId < count; recipeId++)
{
this.renderStoredRecipeStack(recipeId, count, recipes.getRecipe(recipeId).getResult(),
gui, gui.mc, recipeId == recipes.getSelection());
}
}
}
示例13: onDrawBackgroundEventPost
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onDrawBackgroundEventPost(GuiScreenEvent.BackgroundDrawnEvent e) {
if (currentTask == ITask.TaskType.INVENTORY_SLOT) {
GuiScreen currentGui = e.getGui();
if (currentGui instanceof GuiContainer) {
Container openContainer = ClientProxy.mc.player.openContainer;
if (openContainer != null) {
if (guiInventoryTask == null)
guiInventoryTask = new GuiInventoryTask(current_target, current_dimension, openContainer, (GuiContainer) currentGui);
guiInventoryTask.drawScreen(e.getMouseX(), e.getMouseY(), 1.0F);
}
}
} else {
guiInventoryTask = null;
}
}
示例14: mouseClickedSuper
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
/**
* Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
*/
protected void mouseClickedSuper(int mouseX, int mouseY, int mouseButton) throws IOException
{
if (mouseButton == 0)
{
for (int i = 0; i < this.buttonList.size(); ++i)
{
GuiButton guibutton = (GuiButton)this.buttonList.get(i);
if (guibutton.mousePressed(this.mc, mouseX, mouseY))
{
GuiScreenEvent.ActionPerformedEvent.Pre event = new GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList);
if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
break;
guibutton = event.getButton();
ReflectionHelper.setPrivateValue(GuiScreen.class, this, guibutton, "selectedButton", "field_146290_a");
guibutton.playPressSound(this.mc.getSoundHandler());
this.actionPerformed(guibutton);
if (this.equals(this.mc.currentScreen))
MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.getButton(), this.buttonList));
}
}
}
}
示例15: mouseClicked
import net.minecraftforge.client.event.GuiScreenEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
protected void mouseClicked(int par1, int par2, int par3) {
if (par3 == 0) {
for (int l = 0; l < this.OFMbuttonList.size(); l++) {
GuiButton guibutton = (GuiButton)this.OFMbuttonList.get(l);
if (guibutton.mousePressed(this.mc, par1, par2)) {
GuiScreenEvent.ActionPerformedEvent.Pre event = new GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.OFMbuttonList);
if (MinecraftForge.EVENT_BUS.post(event))
break;
event.button.func_146113_a(this.mc.getSoundHandler());
actionPerformed(event.button.id);
if (equals(this.mc.currentScreen))
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.OFMbuttonList));
}
}
}
super.mouseClicked(par1, par2, par3);
}