2014-05-07 20:52:10 +00:00
|
|
|
package net.minecraftforge.client.event;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import net.minecraft.client.gui.GuiButton;
|
|
|
|
import net.minecraft.client.gui.GuiScreen;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
|
|
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2014-05-07 20:52:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Event classes for GuiScreen events.
|
|
|
|
*
|
|
|
|
* @author bspkrs
|
|
|
|
*/
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public class GuiScreenEvent extends Event
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The GuiScreen object generating this event.
|
|
|
|
*/
|
|
|
|
public final GuiScreen gui;
|
|
|
|
|
|
|
|
public GuiScreenEvent(GuiScreen gui)
|
|
|
|
{
|
|
|
|
this.gui = gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class InitGuiEvent extends GuiScreenEvent
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The {@code buttonList} field from the GuiScreen object referenced by {@code gui}.
|
|
|
|
*/
|
|
|
|
public List buttonList;
|
|
|
|
|
|
|
|
public InitGuiEvent(GuiScreen gui, List buttonList)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
this.buttonList = buttonList;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires just after initializing {@code GuiScreen.mc}, {@code GuiScreen.fontRendererObj},
|
|
|
|
* {@code GuiScreen.width}, and {@code GuiScreen.height}, and just before calling {@code GuiScreen.buttonList.clear()}
|
|
|
|
* and {@code GuiScreen.initGui()}. To skip or override a screen's initGui() method cancel the event.<br/><br/>
|
|
|
|
*
|
|
|
|
* If canceled the following lines are skipped in {@code GuiScreen.setWorldAndResolution()}:<br/>
|
|
|
|
* {@code this.buttonList.clear();}<br/>
|
|
|
|
* {@code this.initGui();}<br/>
|
|
|
|
*
|
|
|
|
* @author bspkrs
|
|
|
|
*/
|
|
|
|
@Cancelable
|
|
|
|
public static class Pre extends InitGuiEvent
|
|
|
|
{
|
|
|
|
public Pre(GuiScreen gui, List buttonList)
|
|
|
|
{
|
|
|
|
super(gui, buttonList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires right after {@code GuiScreen.initGui()}.
|
|
|
|
* This is a good place to alter a GuiScreen's component layout if desired.
|
|
|
|
*
|
|
|
|
* @author bspkrs
|
|
|
|
*/
|
|
|
|
public static class Post extends InitGuiEvent
|
|
|
|
{
|
|
|
|
public Post(GuiScreen gui, List buttonList)
|
|
|
|
{
|
|
|
|
super(gui, buttonList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class DrawScreenEvent extends GuiScreenEvent
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The x coordinate of the mouse pointer on the screen.
|
|
|
|
*/
|
|
|
|
public final int mouseX;
|
|
|
|
/**
|
|
|
|
* The y coordinate of the mouse pointer on the screen.
|
|
|
|
*/
|
|
|
|
public final int mouseY;
|
|
|
|
/**
|
|
|
|
* Partial render ticks elapsed.
|
|
|
|
*/
|
|
|
|
public final float renderPartialTicks;
|
|
|
|
|
|
|
|
public DrawScreenEvent(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
this.mouseX = mouseX;
|
|
|
|
this.mouseY = mouseY;
|
|
|
|
this.renderPartialTicks = renderPartialTicks;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires just before {@code GuiScreen.drawScreen()} is called.
|
|
|
|
* Cancel this event to skip {@code GuiScreen.drawScreen()}.
|
|
|
|
*
|
|
|
|
* @author bspkrs
|
|
|
|
*/
|
|
|
|
@Cancelable
|
|
|
|
public static class Pre extends DrawScreenEvent
|
|
|
|
{
|
|
|
|
public Pre(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks)
|
|
|
|
{
|
|
|
|
super(gui, mouseX, mouseY, renderPartialTicks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires just after {@code GuiScreen.drawScreen()} is called.
|
|
|
|
*
|
|
|
|
* @author bspkrs
|
|
|
|
*/
|
|
|
|
public static class Post extends DrawScreenEvent
|
|
|
|
{
|
|
|
|
public Post(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks)
|
|
|
|
{
|
|
|
|
super(gui, mouseX, mouseY, renderPartialTicks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class ActionPerformedEvent extends GuiScreenEvent
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The button that was clicked.
|
|
|
|
*/
|
|
|
|
public GuiButton button;
|
|
|
|
/**
|
|
|
|
* A COPY of the {@code buttonList} field from the GuiScreen referenced by {@code gui}.
|
|
|
|
*/
|
|
|
|
public List buttonList;
|
|
|
|
|
|
|
|
public ActionPerformedEvent(GuiScreen gui, GuiButton button, List buttonList)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
this.button = button;
|
|
|
|
this.buttonList = new ArrayList(buttonList);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires once it has been determined that a GuiButton object has been clicked.
|
|
|
|
* Cancel this event to bypass {@code GuiScreen.actionPerformed()}.
|
|
|
|
* Replace button with a different button from buttonList to have that button's action executed.
|
|
|
|
*
|
|
|
|
* @author bspkrs
|
|
|
|
*/
|
|
|
|
@Cancelable
|
|
|
|
public static class Pre extends ActionPerformedEvent
|
|
|
|
{
|
|
|
|
public Pre(GuiScreen gui, GuiButton button, List buttonList)
|
|
|
|
{
|
|
|
|
super(gui, button, buttonList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires after {@code GuiScreen.actionPerformed()} provided that the active
|
|
|
|
* screen has not been changed as a result of {@code GuiScreen.actionPerformed()}.
|
|
|
|
*
|
|
|
|
* @author bspkrs
|
|
|
|
*/
|
|
|
|
public static class Post extends ActionPerformedEvent
|
|
|
|
{
|
|
|
|
public Post(GuiScreen gui, GuiButton button, List buttonList)
|
|
|
|
{
|
|
|
|
super(gui, button, buttonList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-23 01:44:54 +00:00
|
|
|
|
|
|
|
public static class MouseInputEvent extends GuiScreenEvent
|
|
|
|
{
|
|
|
|
public MouseInputEvent(GuiScreen gui)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires when mouse input is detected by a GuiScreen.
|
|
|
|
* Cancel this event to bypass {@code GuiScreen.handleMouseInput()}.
|
|
|
|
*/
|
|
|
|
@Cancelable
|
|
|
|
public static class Pre extends MouseInputEvent
|
|
|
|
{
|
|
|
|
public Pre(GuiScreen gui)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires after {@code GuiScreen.handleMouseInput()} provided that the active
|
|
|
|
* screen has not been changed as a result of {@code GuiScreen.handleMouseInput()}.
|
|
|
|
*/
|
|
|
|
public static class Post extends MouseInputEvent
|
|
|
|
{
|
|
|
|
public Post(GuiScreen gui)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class KeyboardInputEvent extends GuiScreenEvent
|
|
|
|
{
|
|
|
|
public KeyboardInputEvent(GuiScreen gui)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires when keyboard input is detected by a GuiScreen.
|
|
|
|
* Cancel this event to bypass {@code GuiScreen.handleKeyboardInput()}.
|
|
|
|
*/
|
|
|
|
@Cancelable
|
|
|
|
public static class Pre extends KeyboardInputEvent
|
|
|
|
{
|
|
|
|
public Pre(GuiScreen gui)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This event fires after {@code GuiScreen.handleKeyboardInput()} provided that the active
|
|
|
|
* screen has not been changed as a result of {@code GuiScreen.handleKeyboardInput()}.
|
|
|
|
*/
|
|
|
|
public static class Post extends KeyboardInputEvent
|
|
|
|
{
|
|
|
|
public Post(GuiScreen gui)
|
|
|
|
{
|
|
|
|
super(gui);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-05-07 20:52:10 +00:00
|
|
|
}
|