1.20.2-pre1

This commit is contained in:
LexManos committed 2023-09-08 10:56:10 -07:00
1 parent 12d24df4f6
commit 3edefbe33e
368 files changed
+3555 -6356

No files matched your search

@@ -20,6 +20,7 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.client.resources.PlayerSkin;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
@@ -141,11 +142,11 @@ public abstract class EntityRenderersEvent extends Event implements IModBusEvent
public static class AddLayers extends EntityRenderersEvent
{
private final Map<EntityType<?>, EntityRenderer<?>> renderers;
private final Map<String, EntityRenderer<? extends Player>> skinMap;
private final Map<PlayerSkin.Model, EntityRenderer<? extends Player>> skinMap;
private final EntityRendererProvider.Context context;
@ApiStatus.Internal
public AddLayers(Map<EntityType<?>, EntityRenderer<?>> renderers, Map<String, EntityRenderer<? extends Player>> playerRenderers, EntityRendererProvider.Context context)
public AddLayers(Map<EntityType<?>, EntityRenderer<?>> renderers, Map<PlayerSkin.Model, EntityRenderer<? extends Player>> playerRenderers, EntityRendererProvider.Context context)
{
this.renderers = renderers;
this.skinMap = playerRenderers;
@@ -159,7 +160,7 @@ public abstract class EntityRenderersEvent extends Event implements IModBusEvent
* {@linkplain ModelLayers#PLAYER regular player model} and {@code slim} for the
* {@linkplain ModelLayers#PLAYER_SLIM slim player model}.
*/
public Set<String> getSkins()
public Set<PlayerSkin.Model> getSkins()
{
return skinMap.keySet();
}
@@ -174,7 +175,7 @@ public abstract class EntityRenderersEvent extends Event implements IModBusEvent
*/
@Nullable
@SuppressWarnings("unchecked")
public <R extends LivingEntityRenderer<? extends Player, ? extends EntityModel<? extends Player>>> R getSkin(String skinName)
public <R extends LivingEntityRenderer<? extends Player, ? extends EntityModel<? extends Player>>> R getSkin(PlayerSkin.Model skinName)
{
return (R) skinMap.get(skinName);
}
@@ -24,12 +24,9 @@ import org.lwjgl.glfw.GLFW;
* @see Key
* @see InteractionKeyMappingTriggered
*/
public abstract class InputEvent extends Event
{
public abstract class InputEvent extends Event {
@ApiStatus.Internal
protected InputEvent()
{
}
protected InputEvent() {}
/**
* Fired when a mouse button is pressed/released. Sub-events get fired {@link Pre before} and {@link Post after} this happens.
@@ -41,15 +38,13 @@ public abstract class InputEvent extends Event
* @see Pre
* @see Post
*/
public static abstract class MouseButton extends InputEvent
{
public static abstract class MouseButton extends InputEvent {
private final int button;
private final int action;
private final int modifiers;
@ApiStatus.Internal
protected MouseButton(int button, int action, int modifiers)
{
protected MouseButton(int button, int action, int modifiers) {
this.button = button;
this.action = action;
this.modifiers = modifiers;
@@ -61,8 +56,7 @@ public abstract class InputEvent extends Event
* @see GLFW mouse constants starting with 'GLFW_MOUSE_BUTTON_'
* @see <a href="https://www.glfw.org/docs/latest/group__buttons.html" target="_top">the online GLFW documentation</a>
*/
public int getButton()
{
public int getButton() {
return this.button;
}
@@ -72,8 +66,7 @@ public abstract class InputEvent extends Event
* @see InputConstants#PRESS
* @see InputConstants#RELEASE
*/
public int getAction()
{
public int getAction() {
return this.action;
}
@@ -88,8 +81,7 @@ public abstract class InputEvent extends Event
* @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit
* @see <a href="https://www.glfw.org/docs/latest/group__mods.html" target="_top">the online GLFW documentation</a>
*/
public int getModifiers()
{
public int getModifiers() {
return this.modifiers;
}
@@ -105,11 +97,9 @@ public abstract class InputEvent extends Event
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
*/
@Cancelable
public static class Pre extends MouseButton
{
public static class Pre extends MouseButton {
@ApiStatus.Internal
public Pre(int button, int action, int modifiers)
{
public Pre(int button, int action, int modifiers) {
super(button, action, modifiers);
}
}
@@ -124,11 +114,9 @@ public abstract class InputEvent extends Event
*
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
*/
public static class Post extends MouseButton
{
public static class Post extends MouseButton {
@ApiStatus.Internal
public Post(int button, int action, int modifiers)
{
public Post(int button, int action, int modifiers) {
super(button, action, modifiers);
}
}
@@ -147,9 +135,9 @@ public abstract class InputEvent extends Event
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
*/
@Cancelable
public static class MouseScrollingEvent extends InputEvent
{
private final double scrollDelta;
public static class MouseScrollingEvent extends InputEvent {
private final double deltaX;
private final double deltaY;
private final double mouseX;
private final double mouseY;
private final boolean leftDown;
@@ -157,9 +145,9 @@ public abstract class InputEvent extends Event
private final boolean rightDown;
@ApiStatus.Internal
public MouseScrollingEvent(double scrollDelta, boolean leftDown, boolean middleDown, boolean rightDown, double mouseX, double mouseY)
{
this.scrollDelta = scrollDelta;
public MouseScrollingEvent(double deltaX, double deltaY, boolean leftDown, boolean middleDown, boolean rightDown, double mouseX, double mouseY) {
this.deltaX = deltaX;
this.deltaY = deltaY;
this.leftDown = leftDown;
this.middleDown = middleDown;
this.rightDown = rightDown;
@@ -168,50 +156,51 @@ public abstract class InputEvent extends Event
}
/**
* {@return the amount of change / delta of the mouse scroll}
* {@return the amount of change / delta of the mouse scroll in the vertical direction}
*/
public double getScrollDelta()
{
return this.scrollDelta;
public double getDeltaX() {
return this.deltaX;
}
/**
* {@return the amount of change / delta of the mouse scroll in the horizontal direction}
*/
public double getDeltaY() {
return this.deltaY;
}
/**
* {@return {@code true} if the left mouse button is pressed}
*/
public boolean isLeftDown()
{
public boolean isLeftDown() {
return this.leftDown;
}
/**
* {@return {@code true} if the right mouse button is pressed}
*/
public boolean isRightDown()
{
public boolean isRightDown() {
return this.rightDown;
}
/**
* {@return {@code true} if the middle mouse button is pressed}
*/
public boolean isMiddleDown()
{
public boolean isMiddleDown() {
return this.middleDown;
}
/**
* {@return the X position of the mouse cursor}
*/
public double getMouseX()
{
public double getMouseX() {
return this.mouseX;
}
/**
* {@return the Y position of the mouse cursor}
*/
public double getMouseY()
{
public double getMouseY() {
return this.mouseY;
}
}
@@ -224,16 +213,14 @@ public abstract class InputEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Key extends InputEvent
{
public static class Key extends InputEvent {
private final int key;
private final int scanCode;
private final int action;
private final int modifiers;
@ApiStatus.Internal
public Key(int key, int scanCode, int action, int modifiers)
{
public Key(int key, int scanCode, int action, int modifiers) {
this.key = key;
this.scanCode = scanCode;
this.action = action;
@@ -247,8 +234,7 @@ public abstract class InputEvent extends Event
* @see GLFW key constants starting with {@code GLFW_KEY_}
* @see <a href="https://www.glfw.org/docs/latest/group__keys.html" target="_top">the online GLFW documentation</a>
*/
public int getKey()
{
public int getKey() {
return this.key;
}
@@ -261,8 +247,7 @@ public abstract class InputEvent extends Event
*
* @see InputConstants#getKey(int, int)
*/
public int getScanCode()
{
public int getScanCode() {
return this.scanCode;
}
@@ -273,8 +258,7 @@ public abstract class InputEvent extends Event
* @see InputConstants#RELEASE
* @see InputConstants#REPEAT
*/
public int getAction()
{
public int getAction() {
return this.action;
}
@@ -289,8 +273,7 @@ public abstract class InputEvent extends Event
* @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit
* @see <a href="https://www.glfw.org/docs/latest/group__mods.html" target="_top">the online GLFW documentation</a>
*/
public int getModifiers()
{
public int getModifiers() {
return this.modifiers;
}
}
@@ -313,16 +296,14 @@ public abstract class InputEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class InteractionKeyMappingTriggered extends InputEvent
{
public static class InteractionKeyMappingTriggered extends InputEvent {
private final int button;
private final KeyMapping keyMapping;
private final InteractionHand hand;
private boolean handSwing = true;
@ApiStatus.Internal
public InteractionKeyMappingTriggered(int button, KeyMapping keyMapping, InteractionHand hand)
{
public InteractionKeyMappingTriggered(int button, KeyMapping keyMapping, InteractionHand hand) {
this.button = button;
this.keyMapping = keyMapping;
this.hand = hand;
@@ -333,16 +314,14 @@ public abstract class InputEvent extends Event
*
* @param value whether to swing the hand
*/
public void setSwingHand(boolean value)
{
public void setSwingHand(boolean value) {
handSwing = value;
}
/**
* {@return whether to swing the hand; always takes effect, regardless of cancellation}
*/
public boolean shouldSwingHand()
{
public boolean shouldSwingHand() {
return handSwing;
}
@@ -353,40 +332,35 @@ public abstract class InputEvent extends Event
* of both event's cancellation.
* Will always be {@link InteractionHand#MAIN_HAND} if this is an attack or pick block input.
*/
public InteractionHand getHand()
{
public InteractionHand getHand() {
return hand;
}
/**
* {@return {@code true} if the mouse button is the left mouse button}
*/
public boolean isAttack()
{
public boolean isAttack() {
return button == 0;
}
/**
* {@return {@code true} if the mouse button is the right mouse button}
*/
public boolean isUseItem()
{
public boolean isUseItem() {
return button == 1;
}
/**
* {@return {@code true} if the mouse button is the middle mouse button}
*/
public boolean isPickBlock()
{
public boolean isPickBlock() {
return button == 2;
}
/**
* {@return the key mapping which triggered this event}
*/
public KeyMapping getKeyMapping()
{
public KeyMapping getKeyMapping() {
return keyMapping;
}
}
@@ -13,6 +13,7 @@ import javax.annotation.Nullable;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.LightTexture;
@@ -26,6 +27,8 @@ import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.LogicalSide;
import net.minecraftforge.fml.event.IModBusEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.jetbrains.annotations.ApiStatus;
import org.joml.Matrix4f;
/**
@@ -37,8 +40,7 @@ import org.joml.Matrix4f;
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}. </p>
*/
public class RenderLevelStageEvent extends Event
{
public class RenderLevelStageEvent extends Event {
private final Stage stage;
private final LevelRenderer levelRenderer;
private final PoseStack poseStack;
@@ -48,8 +50,7 @@ public class RenderLevelStageEvent extends Event
private final Camera camera;
private final Frustum frustum;
public RenderLevelStageEvent(Stage stage, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, float partialTick, Camera camera, Frustum frustum)
{
public RenderLevelStageEvent(Stage stage, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, float partialTick, Camera camera, Frustum frustum) {
this.stage = stage;
this.levelRenderer = levelRenderer;
this.poseStack = poseStack;
@@ -64,64 +65,56 @@ public class RenderLevelStageEvent extends Event
* {@return the current {@linkplain Stage stage} that is being rendered. Check this before doing rendering to ensure
* that rendering happens at the appropriate time.}
*/
public Stage getStage()
{
public Stage getStage() {
return stage;
}
/**
* {@return the level renderer}
*/
public LevelRenderer getLevelRenderer()
{
public LevelRenderer getLevelRenderer() {
return levelRenderer;
}
/**
* {@return the pose stack used for rendering}
*/
public PoseStack getPoseStack()
{
public PoseStack getPoseStack() {
return poseStack;
}
/**
* {@return the projection matrix}
*/
public Matrix4f getProjectionMatrix()
{
public Matrix4f getProjectionMatrix() {
return projectionMatrix;
}
/**
* {@return the current "ticks" value in the {@linkplain LevelRenderer level renderer}}
*/
public int getRenderTick()
{
public int getRenderTick() {
return renderTick;
}
/**
* {@return the current partialTick value used for rendering}
*/
public float getPartialTick()
{
public float getPartialTick() {
return partialTick;
}
/**
* {@return the camera}
*/
public Camera getCamera()
{
public Camera getCamera() {
return camera;
}
/**
* {@return the frustum}
*/
public Frustum getFrustum()
{
public Frustum getFrustum() {
return frustum;
}
@@ -134,8 +127,7 @@ public class RenderLevelStageEvent extends Event
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}. </p>
*/
public static class RegisterStageEvent extends Event implements IModBusEvent
{
public static class RegisterStageEvent extends Event implements IModBusEvent {
/**
* @param name The name of your Stage.
* @param renderType
@@ -144,8 +136,7 @@ public class RenderLevelStageEvent extends Event
*
* @throws IllegalArgumentException if the RenderType passed is already mapped to a Stage.
*/
public Stage register(ResourceLocation name, @Nullable RenderType renderType) throws IllegalArgumentException
{
public Stage register(ResourceLocation name, @Nullable RenderType renderType) throws IllegalArgumentException {
return Stage.register(name, renderType);
}
}
@@ -154,8 +145,7 @@ public class RenderLevelStageEvent extends Event
* A time during level rendering for you to render custom things into the world.
* @see RegisterStageEvent
*/
public static class Stage
{
public static class Stage {
private static final Map<RenderType, Stage> RENDER_TYPE_STAGES = new HashMap<>();
/**
@@ -215,27 +205,23 @@ public class RenderLevelStageEvent extends Event
private final String name;
private Stage(String name)
{
private Stage(String name) {
this.name = name;
}
private static Stage register(ResourceLocation name, @Nullable RenderType renderType) throws IllegalArgumentException
{
private static Stage register(ResourceLocation name, @Nullable RenderType renderType) throws IllegalArgumentException {
Stage stage = new Stage(name.toString());
if (renderType != null && RENDER_TYPE_STAGES.putIfAbsent(renderType, stage) != null)
throw new IllegalArgumentException("Attempted to replace an existing RenderLevelStageEvent.Stage for a RenderType: Stage = " + stage + ", RenderType = " + renderType);
return stage;
}
private static Stage register(String name, @Nullable RenderType renderType) throws IllegalArgumentException
{
private static Stage register(String name, @Nullable RenderType renderType) throws IllegalArgumentException {
return register(new ResourceLocation(name), renderType);
}
@Override
public String toString()
{
public String toString() {
return this.name;
}
@@ -243,9 +229,18 @@ public class RenderLevelStageEvent extends Event
* {@return the {@linkplain Stage stage} bound to the {@linkplain RenderType render type}, or null if no value is present}
*/
@Nullable
public static Stage fromRenderType(RenderType renderType)
{
public static Stage fromRenderType(RenderType renderType) {
return RENDER_TYPE_STAGES.get(renderType);
}
/** Internal just to make our patch smaller, it just fires the event. If you have good reason for this to be external, ask. */
@ApiStatus.Internal
public void dispatch(LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) {
var mc = Minecraft.getInstance();
var profiler = mc.getProfiler();
profiler.push(this.toString());
MinecraftForge.EVENT_BUS.post(new RenderLevelStageEvent(this, levelRenderer, poseStack, projectionMatrix, renderTick, mc.getPartialTick(), camera, frustum));
profiler.pop();
}
}
}
@@ -39,21 +39,18 @@ import java.util.function.Consumer;
* @see KeyInput
*/
@OnlyIn(Dist.CLIENT)
public abstract class ScreenEvent extends Event
{
public abstract class ScreenEvent extends Event {
private final Screen screen;
@ApiStatus.Internal
protected ScreenEvent(Screen screen)
{
protected ScreenEvent(Screen screen) {
this.screen = Objects.requireNonNull(screen);
}
/**
* {@return the screen that caused this event}
*/
public Screen getScreen()
{
public Screen getScreen() {
return screen;
}
@@ -68,16 +65,14 @@ public abstract class ScreenEvent extends Event
* @see Init.Pre
* @see Init.Post
*/
public static abstract class Init extends ScreenEvent
{
public static abstract class Init extends ScreenEvent {
private final Consumer<GuiEventListener> add;
private final Consumer<GuiEventListener> remove;
private final List<GuiEventListener> listenerList;
@ApiStatus.Internal
protected Init(Screen screen, List<GuiEventListener> listenerList, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove)
{
protected Init(Screen screen, List<GuiEventListener> listenerList, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove) {
super(screen);
this.listenerList = Collections.unmodifiableList(listenerList);
this.add = add;
@@ -87,8 +82,7 @@ public abstract class ScreenEvent extends Event
/**
* {@return unmodifiable view of list of event listeners on the screen}
*/
public List<GuiEventListener> getListenersList()
{
public List<GuiEventListener> getListenersList() {
return listenerList;
}
@@ -97,8 +91,7 @@ public abstract class ScreenEvent extends Event
*
* @param listener the listener to add
*/
public void addListener(GuiEventListener listener)
{
public void addListener(GuiEventListener listener) {
add.accept(listener);
}
@@ -107,8 +100,7 @@ public abstract class ScreenEvent extends Event
*
* @param listener the listener to remove
*/
public void removeListener(GuiEventListener listener)
{
public void removeListener(GuiEventListener listener) {
remove.accept(listener);
}
@@ -123,11 +115,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends Init
{
public static class Pre extends Init {
@ApiStatus.Internal
public Pre(Screen screen, List<GuiEventListener> list, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove)
{
public Pre(Screen screen, List<GuiEventListener> list, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove) {
super(screen, list, add, remove);
}
}
@@ -140,11 +130,9 @@ public abstract class ScreenEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends Init
{
public static class Post extends Init {
@ApiStatus.Internal
public Post(Screen screen, List<GuiEventListener> list, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove)
{
public Post(Screen screen, List<GuiEventListener> list, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove) {
super(screen, list, add, remove);
}
}
@@ -157,16 +145,14 @@ public abstract class ScreenEvent extends Event
* @see Render.Pre
* @see Render.Post
*/
public static abstract class Render extends ScreenEvent
{
public static abstract class Render extends ScreenEvent {
private final GuiGraphics guiGraphics;
private final int mouseX;
private final int mouseY;
private final float partialTick;
@ApiStatus.Internal
protected Render(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
{
protected Render(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
super(screen);
this.guiGraphics = guiGraphics;
this.mouseX = mouseX;
@@ -177,32 +163,28 @@ public abstract class ScreenEvent extends Event
/**
* {@return the gui graphics used for rendering}
*/
public GuiGraphics getGuiGraphics()
{
public GuiGraphics getGuiGraphics() {
return guiGraphics;
}
/**
* {@return the X coordinate of the mouse pointer}
*/
public int getMouseX()
{
public int getMouseX() {
return mouseX;
}
/**
* {@return the Y coordinate of the mouse pointer}
*/
public int getMouseY()
{
public int getMouseY() {
return mouseY;
}
/**
* {@return the partial tick}
*/
public float getPartialTick()
{
public float getPartialTick() {
return partialTick;
}
@@ -216,11 +198,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends Render
{
public static class Pre extends Render {
@ApiStatus.Internal
public Pre(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
{
public Pre(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
super(screen, guiGraphics, mouseX, mouseY, partialTick);
}
}
@@ -233,11 +213,9 @@ public abstract class ScreenEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends Render
{
public static class Post extends Render {
@ApiStatus.Internal
public Post(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
{
public Post(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
super(screen, guiGraphics, mouseX, mouseY, partialTick);
}
}
@@ -252,13 +230,11 @@ public abstract class ScreenEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class BackgroundRendered extends ScreenEvent
{
public static class BackgroundRendered extends ScreenEvent {
private final GuiGraphics guiGraphics;
@ApiStatus.Internal
public BackgroundRendered(Screen screen, GuiGraphics guiGraphics)
{
public BackgroundRendered(Screen screen, GuiGraphics guiGraphics) {
super(screen);
this.guiGraphics = guiGraphics;
}
@@ -266,8 +242,7 @@ public abstract class ScreenEvent extends Event
/**
* {@return the gui graphics used for rendering}
*/
public GuiGraphics getGuiGraphics()
{
public GuiGraphics getGuiGraphics() {
return guiGraphics;
}
}
@@ -284,15 +259,13 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class RenderInventoryMobEffects extends ScreenEvent
{
public static class RenderInventoryMobEffects extends ScreenEvent {
private final int availableSpace;
private boolean compact;
private int horizontalOffset;
@ApiStatus.Internal
public RenderInventoryMobEffects(Screen screen, int availableSpace, boolean compact, int horizontalOffset)
{
public RenderInventoryMobEffects(Screen screen, int availableSpace, boolean compact, int horizontalOffset) {
super(screen);
this.availableSpace = availableSpace;
this.compact = compact;
@@ -302,48 +275,42 @@ public abstract class ScreenEvent extends Event
/**
* The available space to the right of the inventory.
*/
public int getAvailableSpace()
{
public int getAvailableSpace() {
return availableSpace;
}
/**
* Whether the effects should be rendered in compact mode (only icons, no text), or the default full size.
*/
public boolean isCompact()
{
public boolean isCompact() {
return compact;
}
/**
* The distance from the left side of the screen that the effect stack is rendered. Positive values shift this more to the right.
*/
public int getHorizontalOffset()
{
public int getHorizontalOffset() {
return horizontalOffset;
}
/**
* Replaces the horizontal offset of the effect stack
*/
public void setHorizontalOffset(int offset)
{
public void setHorizontalOffset(int offset) {
horizontalOffset = offset;
}
/**
* Adds to the horizontal offset of the effect stack. Negative values are acceptable.
*/
public void addHorizontalOffset(int offset)
{
public void addHorizontalOffset(int offset) {
horizontalOffset += offset;
}
/**
* Sets whether the effects should be rendered in compact mode (only icons, no text), or the default full size.
*/
public void setCompact(boolean compact)
{
public void setCompact(boolean compact) {
this.compact = compact;
}
}
@@ -357,14 +324,12 @@ public abstract class ScreenEvent extends Event
* @see MouseDragged
* @see MouseScrolled
*/
private static abstract class MouseInput extends ScreenEvent
{
private static abstract class MouseInput extends ScreenEvent {
private final double mouseX;
private final double mouseY;
@ApiStatus.Internal
protected MouseInput(Screen screen, double mouseX, double mouseY)
{
protected MouseInput(Screen screen, double mouseX, double mouseY) {
super(screen);
this.mouseX = mouseX;
this.mouseY = mouseY;
@@ -373,16 +338,14 @@ public abstract class ScreenEvent extends Event
/**
* {@return the X position of the mouse cursor, relative to the screen}
*/
public double getMouseX()
{
public double getMouseX() {
return mouseX;
}
/**
* {@return the Y position of the mouse cursor, relative to the screen}
*/
public double getMouseY()
{
public double getMouseY() {
return mouseY;
}
}
@@ -394,13 +357,11 @@ public abstract class ScreenEvent extends Event
* @see MouseButtonPressed.Pre
* @see MouseButtonPressed.Post
*/
public static abstract class MouseButtonPressed extends MouseInput
{
public static abstract class MouseButtonPressed extends MouseInput {
private final int button;
@ApiStatus.Internal
public MouseButtonPressed(Screen screen, double mouseX, double mouseY, int button)
{
public MouseButtonPressed(Screen screen, double mouseX, double mouseY, int button) {
super(screen, mouseX, mouseY);
this.button = button;
}
@@ -411,8 +372,7 @@ public abstract class ScreenEvent extends Event
* @see GLFW mouse constants starting with 'GLFW_MOUSE_BUTTON_'
* @see <a href="https://www.glfw.org/docs/latest/group__buttons.html" target="_top">the online GLFW documentation</a>
*/
public int getButton()
{
public int getButton() {
return button;
}
@@ -427,11 +387,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends MouseButtonPressed
{
public static class Pre extends MouseButtonPressed {
@ApiStatus.Internal
public Pre(Screen screen, double mouseX, double mouseY, int button)
{
public Pre(Screen screen, double mouseX, double mouseY, int button) {
super(screen, mouseX, mouseY, button);
}
}
@@ -452,13 +410,11 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@HasResult
public static class Post extends MouseButtonPressed
{
public static class Post extends MouseButtonPressed {
private final boolean handled;
@ApiStatus.Internal
public Post(Screen screen, double mouseX, double mouseY, int button, boolean handled)
{
public Post(Screen screen, double mouseX, double mouseY, int button, boolean handled) {
super(screen, mouseX, mouseY, button);
this.handled = handled;
}
@@ -466,8 +422,7 @@ public abstract class ScreenEvent extends Event
/**
* {@return {@code true} if the mouse click was already handled by its screen}
*/
public boolean wasHandled()
{
public boolean wasHandled() {
return handled;
}
}
@@ -480,13 +435,11 @@ public abstract class ScreenEvent extends Event
* @see MouseButtonReleased.Pre
* @see MouseButtonReleased.Post
*/
public static abstract class MouseButtonReleased extends MouseInput
{
public static abstract class MouseButtonReleased extends MouseInput {
private final int button;
@ApiStatus.Internal
public MouseButtonReleased(Screen screen, double mouseX, double mouseY, int button)
{
public MouseButtonReleased(Screen screen, double mouseX, double mouseY, int button) {
super(screen, mouseX, mouseY);
this.button = button;
}
@@ -497,8 +450,7 @@ public abstract class ScreenEvent extends Event
* @see GLFW mouse constants starting with 'GLFW_MOUSE_BUTTON_'
* @see <a href="https://www.glfw.org/docs/latest/group__buttons.html" target="_top">the online GLFW documentation</a>
*/
public int getButton()
{
public int getButton() {
return button;
}
@@ -513,11 +465,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends MouseButtonReleased
{
public static class Pre extends MouseButtonReleased {
@ApiStatus.Internal
public Pre(Screen screen, double mouseX, double mouseY, int button)
{
public Pre(Screen screen, double mouseX, double mouseY, int button) {
super(screen, mouseX, mouseY, button);
}
}
@@ -538,13 +488,11 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@HasResult
public static class Post extends MouseButtonReleased
{
public static class Post extends MouseButtonReleased {
private final boolean handled;
@ApiStatus.Internal
public Post(Screen screen, double mouseX, double mouseY, int button, boolean handled)
{
public Post(Screen screen, double mouseX, double mouseY, int button, boolean handled) {
super(screen, mouseX, mouseY, button);
this.handled = handled;
}
@@ -552,8 +500,7 @@ public abstract class ScreenEvent extends Event
/**
* @return {@code true} if the mouse release was already handled by its screen
*/
public boolean wasHandled()
{
public boolean wasHandled() {
return handled;
}
}
@@ -566,15 +513,13 @@ public abstract class ScreenEvent extends Event
* @see MouseDragged.Pre
* @see MouseDragged.Post
*/
public static abstract class MouseDragged extends MouseInput
{
public static abstract class MouseDragged extends MouseInput {
private final int mouseButton;
private final double dragX;
private final double dragY;
@ApiStatus.Internal
public MouseDragged(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY)
{
public MouseDragged(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
super(screen, mouseX, mouseY);
this.mouseButton = mouseButton;
this.dragX = dragX;
@@ -587,24 +532,21 @@ public abstract class ScreenEvent extends Event
* @see GLFW mouse constants starting with 'GLFW_MOUSE_BUTTON_'
* @see <a href="https://www.glfw.org/docs/latest/group__buttons.html" target="_top">the online GLFW documentation</a>
*/
public int getMouseButton()
{
public int getMouseButton() {
return mouseButton;
}
/**
* {@return amount of mouse drag along the X axis}
*/
public double getDragX()
{
public double getDragX() {
return dragX;
}
/**
* {@return amount of mouse drag along the Y axis}
*/
public double getDragY()
{
public double getDragY() {
return dragY;
}
@@ -619,11 +561,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends MouseDragged
{
public static class Pre extends MouseDragged {
@ApiStatus.Internal
public Pre(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY)
{
public Pre(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
super(screen, mouseX, mouseY, mouseButton, dragX, dragY);
}
}
@@ -638,11 +578,9 @@ public abstract class ScreenEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends MouseDragged
{
public static class Post extends MouseDragged {
@ApiStatus.Internal
public Post(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY)
{
public Post(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
super(screen, mouseX, mouseY, mouseButton, dragX, dragY);
}
}
@@ -655,23 +593,29 @@ public abstract class ScreenEvent extends Event
* @see MouseScrolled.Pre
* @see MouseScrolled.Post
*/
public static abstract class MouseScrolled extends MouseInput
{
private final double scrollDelta;
public static abstract class MouseScrolled extends MouseInput {
private final double deltaX;
private final double deltaY;
@ApiStatus.Internal
public MouseScrolled(Screen screen, double mouseX, double mouseY, double scrollDelta)
{
public MouseScrolled(Screen screen, double mouseX, double mouseY, double deltaX, double deltaY) {
super(screen, mouseX, mouseY);
this.scrollDelta = scrollDelta;
this.deltaX = deltaX;
this.deltaY = deltaY;
}
/**
* {@return the amount of change / delta of the mouse scroll}
* {@return the amount of change / delta of the mouse scroll in the vertical direction}
*/
public double getScrollDelta()
{
return scrollDelta;
public double getDeltaX() {
return deltaX;
}
/**
* {@return the amount of change / delta of the mouse scroll in the horizontal direction}
*/
public double getDeltaY() {
return deltaY;
}
/**
@@ -685,12 +629,10 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends MouseScrolled
{
public static class Pre extends MouseScrolled {
@ApiStatus.Internal
public Pre(Screen screen, double mouseX, double mouseY, double scrollDelta)
{
super(screen, mouseX, mouseY, scrollDelta);
public Pre(Screen screen, double mouseX, double mouseY, double deltaX, double deltaY) {
super(screen, mouseX, mouseY, deltaX, deltaY);
}
}
@@ -704,12 +646,10 @@ public abstract class ScreenEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends MouseScrolled
{
public static class Post extends MouseScrolled {
@ApiStatus.Internal
public Post(Screen screen, double mouseX, double mouseY, double scrollDelta)
{
super(screen, mouseX, mouseY, scrollDelta);
public Post(Screen screen, double mouseX, double mouseY, double deltaX, double deltaY) {
super(screen, mouseX, mouseY, deltaX, deltaY);
}
}
}
@@ -723,15 +663,13 @@ public abstract class ScreenEvent extends Event
* @see InputConstants
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_key" target="_top">the online GLFW documentation</a>
*/
private static abstract class KeyInput extends ScreenEvent
{
private static abstract class KeyInput extends ScreenEvent {
private final int keyCode;
private final int scanCode;
private final int modifiers;
@ApiStatus.Internal
protected KeyInput(Screen screen, int keyCode, int scanCode, int modifiers)
{
protected KeyInput(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen);
this.keyCode = keyCode;
this.scanCode = scanCode;
@@ -745,8 +683,7 @@ public abstract class ScreenEvent extends Event
* @see GLFW key constants starting with {@code GLFW_KEY_}
* @see <a href="https://www.glfw.org/docs/latest/group__keys.html" target="_top">the online GLFW documentation</a>
*/
public int getKeyCode()
{
public int getKeyCode() {
return keyCode;
}
@@ -759,8 +696,7 @@ public abstract class ScreenEvent extends Event
*
* @see InputConstants#getKey(int, int)
*/
public int getScanCode()
{
public int getScanCode() {
return scanCode;
}
@@ -775,8 +711,7 @@ public abstract class ScreenEvent extends Event
* @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit
* @see <a href="https://www.glfw.org/docs/latest/group__mods.html" target="_top">the online GLFW documentation</a>
*/
public int getModifiers()
{
public int getModifiers() {
return modifiers;
}
}
@@ -788,11 +723,9 @@ public abstract class ScreenEvent extends Event
* @see KeyPressed.Pre
* @see KeyPressed.Post
*/
public static abstract class KeyPressed extends KeyInput
{
public static abstract class KeyPressed extends KeyInput {
@ApiStatus.Internal
public KeyPressed(Screen screen, int keyCode, int scanCode, int modifiers)
{
public KeyPressed(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
}
@@ -807,11 +740,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends KeyPressed
{
public static class Pre extends KeyPressed {
@ApiStatus.Internal
public Pre(Screen screen, int keyCode, int scanCode, int modifiers)
{
public Pre(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
}
}
@@ -827,11 +758,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Post extends KeyPressed
{
public static class Post extends KeyPressed {
@ApiStatus.Internal
public Post(Screen screen, int keyCode, int scanCode, int modifiers)
{
public Post(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
}
}
@@ -844,11 +773,9 @@ public abstract class ScreenEvent extends Event
* @see KeyReleased.Pre
* @see KeyReleased.Post
*/
public static abstract class KeyReleased extends KeyInput
{
public static abstract class KeyReleased extends KeyInput {
@ApiStatus.Internal
public KeyReleased(Screen screen, int keyCode, int scanCode, int modifiers)
{
public KeyReleased(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
}
@@ -863,11 +790,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends KeyReleased
{
public static class Pre extends KeyReleased {
@ApiStatus.Internal
public Pre(Screen screen, int keyCode, int scanCode, int modifiers)
{
public Pre(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
}
}
@@ -883,11 +808,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Post extends KeyReleased
{
public static class Post extends KeyReleased {
@ApiStatus.Internal
public Post(Screen screen, int keyCode, int scanCode, int modifiers)
{
public Post(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
}
}
@@ -901,14 +824,12 @@ public abstract class ScreenEvent extends Event
* @see CharacterTyped.Post
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_char" target="_top">the online GLFW documentation</a>
*/
public static class CharacterTyped extends ScreenEvent
{
public static class CharacterTyped extends ScreenEvent {
private final char codePoint;
private final int modifiers;
@ApiStatus.Internal
public CharacterTyped(Screen screen, char codePoint, int modifiers)
{
public CharacterTyped(Screen screen, char codePoint, int modifiers) {
super(screen);
this.codePoint = codePoint;
this.modifiers = modifiers;
@@ -917,8 +838,7 @@ public abstract class ScreenEvent extends Event
/**
* {@return the character code point}
*/
public char getCodePoint()
{
public char getCodePoint() {
return codePoint;
}
@@ -933,8 +853,7 @@ public abstract class ScreenEvent extends Event
* @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit
* @see <a href="https://www.glfw.org/docs/latest/group__mods.html" target="_top">the online GLFW documentation</a>
*/
public int getModifiers()
{
public int getModifiers() {
return modifiers;
}
@@ -949,11 +868,9 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends CharacterTyped
{
public static class Pre extends CharacterTyped {
@ApiStatus.Internal
public Pre(Screen screen, char codePoint, int modifiers)
{
public Pre(Screen screen, char codePoint, int modifiers) {
super(screen, codePoint, modifiers);
}
}
@@ -968,11 +885,9 @@ public abstract class ScreenEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends CharacterTyped
{
public static class Post extends CharacterTyped {
@ApiStatus.Internal
public Post(Screen screen, char codePoint, int modifiers)
{
public Post(Screen screen, char codePoint, int modifiers) {
super(screen, codePoint, modifiers);
}
}
@@ -991,15 +906,13 @@ public abstract class ScreenEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Opening extends ScreenEvent
{
public static class Opening extends ScreenEvent {
@Nullable
private final Screen currentScreen;
private Screen newScreen;
@ApiStatus.Internal
public Opening(@Nullable Screen currentScreen, Screen screen)
{
public Opening(@Nullable Screen currentScreen, Screen screen) {
super(screen);
this.currentScreen = currentScreen;
this.newScreen = screen;
@@ -1011,8 +924,7 @@ public abstract class ScreenEvent extends Event
* May be null if no screen was open.
*/
@Nullable
public Screen getCurrentScreen()
{
public Screen getCurrentScreen() {
return currentScreen;
}
@@ -1020,16 +932,14 @@ public abstract class ScreenEvent extends Event
* @return The screen that will be opened if the event is not cancelled. May be null.
*/
@Nullable
public Screen getNewScreen()
{
public Screen getNewScreen() {
return newScreen;
}
/**
* Sets the new screen to be opened if the event is not cancelled. May be null.
*/
public void setNewScreen(Screen newScreen)
{
public void setNewScreen(Screen newScreen) {
this.newScreen = newScreen;
}
}
@@ -1043,11 +953,9 @@ public abstract class ScreenEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Closing extends ScreenEvent
{
public static class Closing extends ScreenEvent {
@ApiStatus.Internal
public Closing(Screen screen)
{
public Closing(Screen screen) {
super(screen);
}
}