mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-27 23:45:44 +00:00
1.20.6 Initial Update
New Decompiler Runtime Official mappings ItemStacks arnt Capability providers anymore, use Vanilla's system. Co-authored-by: RealMangoRage <[email protected]> Co-authored-by: Paint_Ninja <[email protected]>
This commit is contained in:
1114 files changed
+24245
-28536
No files matched your search
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
||||
/**
|
||||
* Fired when {@linkplain Minecraft#pause Minecraft.pause} value got updated by
|
||||
* the {@linkplain Minecraft#runTick(boolean) Minecraft.runTick(...)} on a single-player world
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @deprecated use {@linkplain ClientPauseChangeEvent.Post ClientPauseChangeEvent.Post} instead
|
||||
* @see ClientPauseChangeEvent.Pre
|
||||
* @see ClientPauseChangeEvent.Post
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since="1.20.4")
|
||||
public class ClientPauseEvent extends Event
|
||||
{
|
||||
private final boolean paused;
|
||||
|
||||
public ClientPauseEvent(boolean isPaused)
|
||||
{
|
||||
this.paused = isPaused;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return game is paused}
|
||||
*/
|
||||
public boolean isPaused()
|
||||
{
|
||||
return paused;
|
||||
}
|
||||
}
|
||||
@@ -26,15 +26,13 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @see LoggingOut
|
||||
* @see Clone
|
||||
**/
|
||||
public abstract class ClientPlayerNetworkEvent extends Event
|
||||
{
|
||||
public abstract class ClientPlayerNetworkEvent extends Event {
|
||||
private final MultiPlayerGameMode multiPlayerGameMode;
|
||||
private final LocalPlayer player;
|
||||
private final Connection connection;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected ClientPlayerNetworkEvent(final MultiPlayerGameMode multiPlayerGameMode, final LocalPlayer player, final Connection connection)
|
||||
{
|
||||
protected ClientPlayerNetworkEvent(final MultiPlayerGameMode multiPlayerGameMode, final LocalPlayer player, final Connection connection) {
|
||||
this.multiPlayerGameMode = multiPlayerGameMode;
|
||||
this.player = player;
|
||||
this.connection = connection;
|
||||
@@ -43,24 +41,21 @@ public abstract class ClientPlayerNetworkEvent extends Event
|
||||
/**
|
||||
* {@return the multiplayer game mode controller for the player}
|
||||
*/
|
||||
public MultiPlayerGameMode getMultiPlayerGameMode()
|
||||
{
|
||||
public MultiPlayerGameMode getMultiPlayerGameMode() {
|
||||
return multiPlayerGameMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the player instance}
|
||||
*/
|
||||
public LocalPlayer getPlayer()
|
||||
{
|
||||
public LocalPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the network connection for the player}
|
||||
*/
|
||||
public Connection getConnection()
|
||||
{
|
||||
public Connection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
@@ -72,11 +67,9 @@ public abstract class ClientPlayerNetworkEvent 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 LoggingIn extends ClientPlayerNetworkEvent
|
||||
{
|
||||
public static class LoggingIn extends ClientPlayerNetworkEvent {
|
||||
@ApiStatus.Internal
|
||||
public LoggingIn(final MultiPlayerGameMode controller, final LocalPlayer player, final Connection networkManager)
|
||||
{
|
||||
public LoggingIn(final MultiPlayerGameMode controller, final LocalPlayer player, final Connection networkManager) {
|
||||
super(controller, player, networkManager);
|
||||
}
|
||||
}
|
||||
@@ -91,11 +84,9 @@ public abstract class ClientPlayerNetworkEvent extends Event
|
||||
*/
|
||||
@SuppressWarnings("NullableProblems")
|
||||
// Shush IntelliJ, we override non-nullables as nullables in this specific event; see later comment
|
||||
public static class LoggingOut extends ClientPlayerNetworkEvent
|
||||
{
|
||||
public static class LoggingOut extends ClientPlayerNetworkEvent {
|
||||
@ApiStatus.Internal
|
||||
public LoggingOut(@Nullable final MultiPlayerGameMode controller, @Nullable final LocalPlayer player, @Nullable final Connection networkManager)
|
||||
{
|
||||
public LoggingOut(@Nullable final MultiPlayerGameMode controller, @Nullable final LocalPlayer player, @Nullable final Connection networkManager) {
|
||||
//noinspection ConstantConditions we know these are nullable, but we don't want to annotate the super as nullable since this is the only event with nullables
|
||||
super(controller, player, networkManager);
|
||||
}
|
||||
@@ -107,8 +98,7 @@ public abstract class ClientPlayerNetworkEvent extends Event
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public MultiPlayerGameMode getMultiPlayerGameMode()
|
||||
{
|
||||
public MultiPlayerGameMode getMultiPlayerGameMode() {
|
||||
return super.getMultiPlayerGameMode();
|
||||
}
|
||||
|
||||
@@ -119,8 +109,7 @@ public abstract class ClientPlayerNetworkEvent extends Event
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public LocalPlayer getPlayer()
|
||||
{
|
||||
public LocalPlayer getPlayer() {
|
||||
return super.getPlayer();
|
||||
}
|
||||
|
||||
@@ -131,8 +120,7 @@ public abstract class ClientPlayerNetworkEvent extends Event
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public Connection getConnection()
|
||||
{
|
||||
public Connection getConnection() {
|
||||
return super.getConnection();
|
||||
}
|
||||
}
|
||||
@@ -145,13 +133,11 @@ public abstract class ClientPlayerNetworkEvent 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 Clone extends ClientPlayerNetworkEvent
|
||||
{
|
||||
public static class Clone extends ClientPlayerNetworkEvent {
|
||||
private final LocalPlayer oldPlayer;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Clone(final MultiPlayerGameMode pc, final LocalPlayer oldPlayer, final LocalPlayer newPlayer, final Connection networkManager)
|
||||
{
|
||||
public Clone(final MultiPlayerGameMode pc, final LocalPlayer oldPlayer, final LocalPlayer newPlayer, final Connection networkManager) {
|
||||
super(pc, newPlayer, networkManager);
|
||||
this.oldPlayer = oldPlayer;
|
||||
}
|
||||
@@ -159,16 +145,14 @@ public abstract class ClientPlayerNetworkEvent extends Event
|
||||
/**
|
||||
* {@return the previous player instance}
|
||||
*/
|
||||
public LocalPlayer getOldPlayer()
|
||||
{
|
||||
public LocalPlayer getOldPlayer() {
|
||||
return oldPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the newly created player instance}
|
||||
*/
|
||||
public LocalPlayer getNewPlayer()
|
||||
{
|
||||
public LocalPlayer getNewPlayer() {
|
||||
return super.getPlayer();
|
||||
}
|
||||
|
||||
@@ -178,8 +162,7 @@ public abstract class ClientPlayerNetworkEvent extends Event
|
||||
* @see #getNewPlayer()
|
||||
*/
|
||||
@Override
|
||||
public LocalPlayer getPlayer()
|
||||
{
|
||||
public LocalPlayer getPlayer() {
|
||||
return super.getPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,21 +23,18 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see Render.Foreground
|
||||
* @see Render.Background
|
||||
*/
|
||||
public abstract class ContainerScreenEvent extends Event
|
||||
{
|
||||
public abstract class ContainerScreenEvent extends Event {
|
||||
private final AbstractContainerScreen<?> containerScreen;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected ContainerScreenEvent(AbstractContainerScreen<?> containerScreen)
|
||||
{
|
||||
protected ContainerScreenEvent(AbstractContainerScreen<?> containerScreen) {
|
||||
this.containerScreen = containerScreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the container screen}
|
||||
*/
|
||||
public AbstractContainerScreen<?> getContainerScreen()
|
||||
{
|
||||
public AbstractContainerScreen<?> getContainerScreen() {
|
||||
return containerScreen;
|
||||
}
|
||||
|
||||
@@ -51,15 +48,13 @@ public abstract class ContainerScreenEvent extends Event
|
||||
* @see Foreground
|
||||
* @see Background
|
||||
*/
|
||||
public static abstract class Render extends ContainerScreenEvent
|
||||
{
|
||||
public static abstract class Render extends ContainerScreenEvent {
|
||||
private final GuiGraphics guiGraphics;
|
||||
private final int mouseX;
|
||||
private final int mouseY;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected Render(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY)
|
||||
{
|
||||
protected Render(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) {
|
||||
super(guiContainer);
|
||||
this.guiGraphics = guiGraphics;
|
||||
this.mouseX = mouseX;
|
||||
@@ -69,24 +64,21 @@ public abstract class ContainerScreenEvent 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;
|
||||
}
|
||||
|
||||
@@ -102,11 +94,9 @@ public abstract class ContainerScreenEvent 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 Foreground extends Render
|
||||
{
|
||||
public static class Foreground extends Render {
|
||||
@ApiStatus.Internal
|
||||
public Foreground(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY)
|
||||
{
|
||||
public Foreground(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) {
|
||||
super(guiContainer, guiGraphics, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
@@ -120,11 +110,9 @@ public abstract class ContainerScreenEvent 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 Background extends Render
|
||||
{
|
||||
public static class Background extends Render {
|
||||
@ApiStatus.Internal
|
||||
public Background(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY)
|
||||
{
|
||||
public Background(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) {
|
||||
super(guiContainer, guiGraphics, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,28 +5,59 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.audio.Channel;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.MouseHandler;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.model.EntityModel;
|
||||
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.ShaderInstance;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context;
|
||||
import net.minecraft.client.renderer.entity.ItemFrameRenderer;
|
||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.client.resources.PlayerSkin.Model;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.packs.resources.ResourceProvider;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundSourceEvent;
|
||||
import net.minecraftforge.client.event.sound.PlayStreamingSourceEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
|
||||
public class ForgeEventFactoryClient {
|
||||
public final class ForgeEventFactoryClient {
|
||||
private ForgeEventFactoryClient() {}
|
||||
|
||||
private static boolean post(Event e) {
|
||||
return MinecraftForge.EVENT_BUS.post(e);
|
||||
}
|
||||
@@ -36,27 +67,33 @@ public class ForgeEventFactoryClient {
|
||||
return e;
|
||||
}
|
||||
|
||||
public static void gatherLayers(Map<EntityType<?>, EntityRenderer<?>> renderers, Map<Model, EntityRenderer<? extends Player>> playerRenderers, Context context) {
|
||||
public static void onGatherLayers(Map<EntityType<?>, EntityRenderer<?>> renderers, Map<Model, EntityRenderer<? extends Player>> playerRenderers, Context context) {
|
||||
// TODO: Why is this a ModLoader event...
|
||||
ModLoader.get().postEvent(new EntityRenderersEvent.AddLayers(renderers, playerRenderers, context));
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseReleasedPre(Screen guiScreen, double mouseX, double mouseY, int button) {
|
||||
return post(new ScreenEvent.MouseButtonReleased.Pre(guiScreen, mouseX, mouseY, button));
|
||||
public static void onRegisterShaders(ResourceProvider resourceProvider, List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList) {
|
||||
// TODO: Why i this a ModLoader event...
|
||||
ModLoader.get().postEvent(new RegisterShadersEvent(resourceProvider, shaderList));
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseReleasedPost(Screen guiScreen, double mouseX, double mouseY, int button, boolean handled) {
|
||||
var result = fire(new ScreenEvent.MouseButtonReleased.Post(guiScreen, mouseX, mouseY, button, handled)).getResult();
|
||||
return result == Event.Result.DEFAULT ? handled : result == Event.Result.ALLOW;
|
||||
public static void onScreenMouseReleased(boolean[] state, Screen screen, double mouseX, double mouseY, int button) {
|
||||
state[0] = post(new ScreenEvent.MouseButtonReleased.Pre(screen, mouseX, mouseY, button));
|
||||
if (!state[0]) {
|
||||
state[0] = screen.mouseReleased(mouseX, mouseY, button);
|
||||
var result = fire(new ScreenEvent.MouseButtonReleased.Post(screen, mouseX, mouseY, button, state[0])).getResult();
|
||||
state[0] = result == Event.Result.DEFAULT ? state[0] : result == Event.Result.ALLOW;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseClickedPre(Screen guiScreen, double mouseX, double mouseY, int button) {
|
||||
return post(new ScreenEvent.MouseButtonPressed.Pre(guiScreen, mouseX, mouseY, button));
|
||||
}
|
||||
public static void onScreenMouseClicked(boolean[] state, Screen screen, double mouseX, double mouseY, int button) {
|
||||
state[0] = post(new ScreenEvent.MouseButtonPressed.Pre(screen, mouseX, mouseY, button));
|
||||
if (!state[0]) {
|
||||
state[0] = screen.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseClickedPost(Screen guiScreen, double mouseX, double mouseY, int button, boolean handled) {
|
||||
var result = fire(new ScreenEvent.MouseButtonPressed.Post(guiScreen, mouseX, mouseY, button, handled)).getResult();
|
||||
return result == Event.Result.DEFAULT ? handled : result == Event.Result.ALLOW;
|
||||
var result = fire(new ScreenEvent.MouseButtonPressed.Post(screen, mouseX, mouseY, button, state[0])).getResult();
|
||||
state[0] = result == Event.Result.DEFAULT ? state[0] : result == Event.Result.ALLOW;
|
||||
}
|
||||
|
||||
public static boolean onMouseButtonPre(int button, int action, int mods) {
|
||||
@@ -105,4 +142,96 @@ public class ForgeEventFactoryClient {
|
||||
public static void onPlayStreamingSource(SoundEngine engine, SoundInstance sound, Channel channel) {
|
||||
post(new PlayStreamingSourceEvent(engine, sound, channel));
|
||||
}
|
||||
|
||||
public static ScreenshotEvent onScreenshot(NativeImage image, File screenshotFile) {
|
||||
return fire(new ScreenshotEvent(image, screenshotFile));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyPressedPre(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
return post(new ScreenEvent.KeyPressed.Pre(screen, keyCode, scanCode, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyPressedPost(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
return post(new ScreenEvent.KeyPressed.Post(screen, keyCode, scanCode, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyReleasedPre(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
return post(new ScreenEvent.KeyReleased.Pre(screen, keyCode, scanCode, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyReleasedPost(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
return post(new ScreenEvent.KeyReleased.Post(screen, keyCode, scanCode, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenCharTypedPre(Screen screen, char codePoint, int modifiers) {
|
||||
return post(new ScreenEvent.CharacterTyped.Pre(screen, codePoint, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenCharTypedPost(Screen screen, char codePoint, int modifiers) {
|
||||
return post(new ScreenEvent.CharacterTyped.Post(screen, codePoint, modifiers));
|
||||
}
|
||||
|
||||
public static InputEvent.InteractionKeyMappingTriggered onClickInput(int button, KeyMapping keyBinding, InteractionHand hand) {
|
||||
return fire(new InputEvent.InteractionKeyMappingTriggered(button, keyBinding, hand));
|
||||
}
|
||||
|
||||
public static void onContainerRenderBackground(AbstractContainerScreen<?> screen, GuiGraphics graphics, int mouseX, int mouseY) {
|
||||
post(new ContainerScreenEvent.Render.Background(screen, graphics, mouseX, mouseY));
|
||||
}
|
||||
|
||||
public static void onContainerRenderForeground(AbstractContainerScreen<?> screen, GuiGraphics graphics, int mouseX, int mouseY) {
|
||||
post(new ContainerScreenEvent.Render.Foreground(screen, graphics, mouseX, mouseY));
|
||||
}
|
||||
|
||||
public static void firePlayerLogin(MultiPlayerGameMode pc, LocalPlayer player, Connection networkManager) {
|
||||
post(new ClientPlayerNetworkEvent.LoggingIn(pc, player, networkManager));
|
||||
}
|
||||
|
||||
public static void firePlayerLogout(@Nullable MultiPlayerGameMode pc, @Nullable LocalPlayer player) {
|
||||
post(new ClientPlayerNetworkEvent.LoggingOut(pc, player, player != null ? player.connection != null ? player.connection.getConnection() : null : null));
|
||||
}
|
||||
|
||||
public static void firePlayerRespawn(MultiPlayerGameMode pc, LocalPlayer oldPlayer, LocalPlayer newPlayer, Connection networkManager) {
|
||||
post(new ClientPlayerNetworkEvent.Clone(pc, oldPlayer, newPlayer, networkManager));
|
||||
}
|
||||
|
||||
public static ViewportEvent.ComputeFov fireComputeFov(GameRenderer renderer, Camera camera, double partialTick, double fov, boolean usedConfiguredFov) {
|
||||
return fire(new ViewportEvent.ComputeFov(renderer, camera, partialTick, fov, usedConfiguredFov));
|
||||
}
|
||||
|
||||
public static ViewportEvent.ComputeCameraAngles fireComputeCameraAngles(GameRenderer renderer, Camera camera, float partial) {
|
||||
return fire(new ViewportEvent.ComputeCameraAngles(renderer, camera, partial, camera.getYRot(), camera.getXRot(), 0));
|
||||
}
|
||||
|
||||
public static <T extends LivingEntity, M extends EntityModel<T>> boolean onRenderLivingPre(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderLivingEvent.Pre<T, M>(entity, renderer, partialTick, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static <T extends LivingEntity, M extends EntityModel<T>> boolean onRenderLivingPost(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderLivingEvent.Post<T, M>(entity, renderer, partialTick, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static boolean onRenderPlayerPre(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderPlayerEvent.Pre(player, renderer, partialTick, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static boolean onRenderPlayerPost(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderPlayerEvent.Post(player, renderer, partialTick, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static boolean onRenderArm(PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, AbstractClientPlayer player, HumanoidArm arm) {
|
||||
return post(new RenderArmEvent(poseStack, multiBufferSource, packedLight, player, arm));
|
||||
}
|
||||
|
||||
public static boolean onRenderItemInFrame(ItemFrame itemFrame, ItemFrameRenderer<?> renderItemFrame, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderItemInFrameEvent(itemFrame, renderItemFrame, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static RenderNameTagEvent fireRenderNameTagEvent(Entity entity, Component content, EntityRenderer<?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, float partialTick) {
|
||||
return fire(new RenderNameTagEvent(entity, content, entityRenderer, poseStack, multiBufferSource, packedLight, partialTick));
|
||||
}
|
||||
|
||||
public static void onRenderScreenBackground(Screen screen, GuiGraphics guiGraphics) {
|
||||
fire(new ScreenEvent.BackgroundRendered(screen, guiGraphics));
|
||||
}
|
||||
}
|
||||
@@ -295,6 +295,7 @@ 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>
|
||||
*/
|
||||
// TODO: Change the 'button' to sub events. - Lex 0422202
|
||||
@Cancelable
|
||||
public static class InteractionKeyMappingTriggered extends InputEvent {
|
||||
private final int button;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
/** Forge 1.20.5 - Removed, Mojang created a layered rendering system that should make this all obsolete finally.. - Lex 042724
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
@@ -29,7 +30,7 @@ import java.util.Map;
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
* /
|
||||
public class RegisterGuiOverlaysEvent extends Event implements IModBusEvent
|
||||
{
|
||||
private final Map<ResourceLocation, IGuiOverlay> overlays;
|
||||
@@ -47,7 +48,7 @@ public class RegisterGuiOverlaysEvent extends Event implements IModBusEvent
|
||||
*
|
||||
* @param id A unique resource id for this overlay
|
||||
* @param overlay The overlay
|
||||
*/
|
||||
* /
|
||||
public void registerBelowAll(@NotNull String id, @NotNull IGuiOverlay overlay)
|
||||
{
|
||||
register(Ordering.BEFORE, null, id, overlay);
|
||||
@@ -60,7 +61,7 @@ public class RegisterGuiOverlaysEvent extends Event implements IModBusEvent
|
||||
* {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays.
|
||||
* @param id A unique resource id for this overlay
|
||||
* @param overlay The overlay
|
||||
*/
|
||||
* /
|
||||
public void registerBelow(@NotNull ResourceLocation other, @NotNull String id, @NotNull IGuiOverlay overlay)
|
||||
{
|
||||
register(Ordering.BEFORE, other, id, overlay);
|
||||
@@ -73,7 +74,7 @@ public class RegisterGuiOverlaysEvent extends Event implements IModBusEvent
|
||||
* {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays.
|
||||
* @param id A unique resource id for this overlay
|
||||
* @param overlay The overlay
|
||||
*/
|
||||
* /
|
||||
public void registerAbove(@NotNull ResourceLocation other, @NotNull String id, @NotNull IGuiOverlay overlay)
|
||||
{
|
||||
register(Ordering.AFTER, other, id, overlay);
|
||||
@@ -84,7 +85,7 @@ public class RegisterGuiOverlaysEvent extends Event implements IModBusEvent
|
||||
*
|
||||
* @param id A unique resource id for this overlay
|
||||
* @param overlay The overlay
|
||||
*/
|
||||
* /
|
||||
public void registerAboveAll(@NotNull String id, @NotNull IGuiOverlay overlay)
|
||||
{
|
||||
register(Ordering.AFTER, null, id, overlay);
|
||||
@@ -116,3 +117,4 @@ public class RegisterGuiOverlaysEvent extends Event implements IModBusEvent
|
||||
BEFORE, AFTER
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -7,7 +7,6 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.renderer.ShaderInstance;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.resources.ResourceProvider;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
@@ -28,14 +27,12 @@ import java.util.function.Consumer;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public class RegisterShadersEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public class RegisterShadersEvent extends Event implements IModBusEvent {
|
||||
private final ResourceProvider resourceProvider;
|
||||
private final List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterShadersEvent(ResourceProvider resourceProvider, List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList)
|
||||
{
|
||||
public RegisterShadersEvent(ResourceProvider resourceProvider, List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList) {
|
||||
this.resourceProvider = resourceProvider;
|
||||
this.shaderList = shaderList;
|
||||
}
|
||||
@@ -43,8 +40,7 @@ public class RegisterShadersEvent extends Event implements IModBusEvent
|
||||
/**
|
||||
* {@return the client-side resource provider}
|
||||
*/
|
||||
public ResourceProvider getResourceProvider()
|
||||
{
|
||||
public ResourceProvider getResourceProvider() {
|
||||
return resourceProvider;
|
||||
}
|
||||
|
||||
@@ -60,8 +56,7 @@ public class RegisterShadersEvent extends Event implements IModBusEvent
|
||||
* @param shaderInstance a shader
|
||||
* @param onLoaded a callback for when the shader is loaded
|
||||
*/
|
||||
public void registerShader(ShaderInstance shaderInstance, Consumer<ShaderInstance> onLoaded)
|
||||
{
|
||||
public void registerShader(ShaderInstance shaderInstance, Consumer<ShaderInstance> onLoaded) {
|
||||
shaderList.add(Pair.of(shaderInstance, onLoaded));
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public class RenderArmEvent extends Event
|
||||
{
|
||||
public class RenderArmEvent extends Event {
|
||||
private final PoseStack poseStack;
|
||||
private final MultiBufferSource multiBufferSource;
|
||||
private final int packedLight;
|
||||
@@ -37,8 +36,7 @@ public class RenderArmEvent extends Event
|
||||
private final HumanoidArm arm;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderArmEvent(PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, AbstractClientPlayer player, HumanoidArm arm)
|
||||
{
|
||||
public RenderArmEvent(PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, AbstractClientPlayer player, HumanoidArm arm) {
|
||||
this.poseStack = poseStack;
|
||||
this.multiBufferSource = multiBufferSource;
|
||||
this.packedLight = packedLight;
|
||||
@@ -49,24 +47,21 @@ public class RenderArmEvent extends Event
|
||||
/**
|
||||
* {@return the arm being rendered}
|
||||
*/
|
||||
public HumanoidArm getArm()
|
||||
{
|
||||
public HumanoidArm getArm() {
|
||||
return arm;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
public PoseStack getPoseStack() {
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the source of rendering buffers}
|
||||
*/
|
||||
public MultiBufferSource getMultiBufferSource()
|
||||
{
|
||||
public MultiBufferSource getMultiBufferSource() {
|
||||
return multiBufferSource;
|
||||
}
|
||||
|
||||
@@ -75,8 +70,7 @@ public class RenderArmEvent extends Event
|
||||
*
|
||||
* @see LightTexture
|
||||
*/
|
||||
public int getPackedLight()
|
||||
{
|
||||
public int getPackedLight() {
|
||||
return packedLight;
|
||||
}
|
||||
|
||||
@@ -84,8 +78,7 @@ public class RenderArmEvent extends Event
|
||||
* {@return the client player that is having their arm rendered} In general, this will be the same as
|
||||
* {@link net.minecraft.client.Minecraft#player}.
|
||||
*/
|
||||
public AbstractClientPlayer getPlayer()
|
||||
{
|
||||
public AbstractClientPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
/** Forge 1.20.5 - Removed, Mojang created a layered rendering system that should make this all obsolete finally.. - Lex 042724
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
@@ -12,14 +13,13 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Fired when the HUD is rendered to the screen.
|
||||
* See the two subclasses for listening to the two possible phases.
|
||||
*
|
||||
* @see Pre
|
||||
* @see Post
|
||||
*/
|
||||
* /
|
||||
public abstract class RenderGuiEvent extends Event
|
||||
{
|
||||
private final Window window;
|
||||
@@ -60,7 +60,7 @@ public abstract class RenderGuiEvent extends Event
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see Post
|
||||
*/
|
||||
* /
|
||||
@Cancelable
|
||||
public static class Pre extends RenderGuiEvent
|
||||
{
|
||||
@@ -78,7 +78,7 @@ public abstract class RenderGuiEvent 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 RenderGuiEvent
|
||||
{
|
||||
@ApiStatus.Internal
|
||||
@@ -88,3 +88,4 @@ public abstract class RenderGuiEvent extends Event
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -3,6 +3,7 @@
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
/** Forge 1.20.5 - Removed, Mojang created a layered rendering system that should make this all obsolete finally.. - Lex 042724
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
@@ -22,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* @see Pre
|
||||
* @see Post
|
||||
*/
|
||||
* /
|
||||
public abstract class RenderGuiOverlayEvent extends Event
|
||||
{
|
||||
private final Window window;
|
||||
@@ -70,7 +71,7 @@ public abstract class RenderGuiOverlayEvent extends Event
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see Post
|
||||
*/
|
||||
* /
|
||||
@Cancelable
|
||||
public static class Pre extends RenderGuiOverlayEvent
|
||||
{
|
||||
@@ -88,7 +89,7 @@ public abstract class RenderGuiOverlayEvent 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 RenderGuiOverlayEvent
|
||||
{
|
||||
@ApiStatus.Internal
|
||||
@@ -98,3 +99,4 @@ public abstract class RenderGuiOverlayEvent extends Event
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -30,8 +30,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see ItemFrameRenderer
|
||||
*/
|
||||
@Cancelable
|
||||
public class RenderItemInFrameEvent extends Event
|
||||
{
|
||||
public class RenderItemInFrameEvent extends Event {
|
||||
private final ItemStack itemStack;
|
||||
private final ItemFrame itemFrameEntity;
|
||||
private final ItemFrameRenderer<?> renderer;
|
||||
@@ -40,9 +39,7 @@ public class RenderItemInFrameEvent extends Event
|
||||
private final int packedLight;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderItemInFrameEvent(ItemFrame itemFrame, ItemFrameRenderer<?> renderItemFrame, PoseStack poseStack,
|
||||
MultiBufferSource multiBufferSource, int packedLight)
|
||||
{
|
||||
public RenderItemInFrameEvent(ItemFrame itemFrame, ItemFrameRenderer<?> renderItemFrame, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
itemStack = itemFrame.getItem();
|
||||
itemFrameEntity = itemFrame;
|
||||
renderer = renderItemFrame;
|
||||
@@ -54,40 +51,35 @@ public class RenderItemInFrameEvent extends Event
|
||||
/**
|
||||
* {@return the item stack being rendered}
|
||||
*/
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the item frame entity}
|
||||
*/
|
||||
public ItemFrame getItemFrameEntity()
|
||||
{
|
||||
public ItemFrame getItemFrameEntity() {
|
||||
return itemFrameEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the renderer for the item frame entity}
|
||||
*/
|
||||
public ItemFrameRenderer<?> getRenderer()
|
||||
{
|
||||
public ItemFrameRenderer<?> getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
public PoseStack getPoseStack() {
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the source of rendering buffers}
|
||||
*/
|
||||
public MultiBufferSource getMultiBufferSource()
|
||||
{
|
||||
public MultiBufferSource getMultiBufferSource() {
|
||||
return multiBufferSource;
|
||||
}
|
||||
|
||||
@@ -96,8 +88,7 @@ public class RenderItemInFrameEvent extends Event
|
||||
*
|
||||
* @see LightTexture
|
||||
*/
|
||||
public int getPackedLight()
|
||||
{
|
||||
public int getPackedLight() {
|
||||
return packedLight;
|
||||
}
|
||||
}
|
||||
@@ -43,14 +43,14 @@ import org.joml.Matrix4f;
|
||||
public class RenderLevelStageEvent extends Event {
|
||||
private final Stage stage;
|
||||
private final LevelRenderer levelRenderer;
|
||||
private final PoseStack poseStack;
|
||||
private final Matrix4f poseStack;
|
||||
private final Matrix4f projectionMatrix;
|
||||
private final int renderTick;
|
||||
private final float partialTick;
|
||||
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, Matrix4f poseStack, Matrix4f projectionMatrix, int renderTick, float partialTick, Camera camera, Frustum frustum) {
|
||||
this.stage = stage;
|
||||
this.levelRenderer = levelRenderer;
|
||||
this.poseStack = poseStack;
|
||||
@@ -79,7 +79,7 @@ public class RenderLevelStageEvent extends Event {
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack() {
|
||||
public Matrix4f getPoseStack() {
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class RenderLevelStageEvent extends Event {
|
||||
|
||||
/** 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) {
|
||||
public void dispatch(LevelRenderer levelRenderer, Matrix4f poseStack, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) {
|
||||
var mc = Minecraft.getInstance();
|
||||
var profiler = mc.getProfiler();
|
||||
profiler.push(this.toString());
|
||||
|
||||
@@ -31,8 +31,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see RenderPlayerEvent
|
||||
* @see LivingEntityRenderer
|
||||
*/
|
||||
public abstract class RenderLivingEvent<T extends LivingEntity, M extends EntityModel<T>> extends Event
|
||||
{
|
||||
public abstract class RenderLivingEvent<T extends LivingEntity, M extends EntityModel<T>> extends Event {
|
||||
private final LivingEntity entity;
|
||||
private final LivingEntityRenderer<T, M> renderer;
|
||||
private final float partialTick;
|
||||
@@ -41,9 +40,7 @@ public abstract class RenderLivingEvent<T extends LivingEntity, M extends Entity
|
||||
private final int packedLight;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected RenderLivingEvent(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack,
|
||||
MultiBufferSource multiBufferSource, int packedLight)
|
||||
{
|
||||
protected RenderLivingEvent(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
this.entity = entity;
|
||||
this.renderer = renderer;
|
||||
this.partialTick = partialTick;
|
||||
@@ -55,40 +52,35 @@ public abstract class RenderLivingEvent<T extends LivingEntity, M extends Entity
|
||||
/**
|
||||
* @return the living entity being rendered
|
||||
*/
|
||||
public LivingEntity getEntity()
|
||||
{
|
||||
public LivingEntity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the renderer for the living entity
|
||||
*/
|
||||
public LivingEntityRenderer<T, M> getRenderer()
|
||||
{
|
||||
public LivingEntityRenderer<T, M> getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the partial tick}
|
||||
*/
|
||||
public float getPartialTick()
|
||||
{
|
||||
public float getPartialTick() {
|
||||
return partialTick;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
public PoseStack getPoseStack() {
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the source of rendering buffers}
|
||||
*/
|
||||
public MultiBufferSource getMultiBufferSource()
|
||||
{
|
||||
public MultiBufferSource getMultiBufferSource() {
|
||||
return multiBufferSource;
|
||||
}
|
||||
|
||||
@@ -97,8 +89,7 @@ public abstract class RenderLivingEvent<T extends LivingEntity, M extends Entity
|
||||
*
|
||||
* @see LightTexture
|
||||
*/
|
||||
public int getPackedLight()
|
||||
{
|
||||
public int getPackedLight() {
|
||||
return packedLight;
|
||||
}
|
||||
|
||||
@@ -117,11 +108,9 @@ public abstract class RenderLivingEvent<T extends LivingEntity, M extends Entity
|
||||
* @param <M> the model for the living entity
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Pre<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M>
|
||||
{
|
||||
public static class Pre<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M> {
|
||||
@ApiStatus.Internal
|
||||
public Pre(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight)
|
||||
{
|
||||
public Pre(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(entity, renderer, partialTick, poseStack, multiBufferSource, packedLight);
|
||||
}
|
||||
}
|
||||
@@ -137,11 +126,9 @@ public abstract class RenderLivingEvent<T extends LivingEntity, M extends Entity
|
||||
* @param <T> the living entity that was rendered
|
||||
* @param <M> the model for the living entity
|
||||
*/
|
||||
public static class Post<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M>
|
||||
{
|
||||
public static class Post<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M> {
|
||||
@ApiStatus.Internal
|
||||
public Post(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight)
|
||||
{
|
||||
public Post(LivingEntity entity, LivingEntityRenderer<T, M> renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(entity, renderer, partialTick, poseStack, multiBufferSource, packedLight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see EntityRenderer
|
||||
*/
|
||||
@Event.HasResult
|
||||
public class RenderNameTagEvent extends EntityEvent
|
||||
{
|
||||
public class RenderNameTagEvent extends EntityEvent {
|
||||
private Component nameplateContent;
|
||||
private final Component originalContent;
|
||||
private final EntityRenderer<?> entityRenderer;
|
||||
@@ -44,8 +43,7 @@ public class RenderNameTagEvent extends EntityEvent
|
||||
private final float partialTick;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderNameTagEvent(Entity entity, Component content, EntityRenderer<?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, float partialTick)
|
||||
{
|
||||
public RenderNameTagEvent(Entity entity, Component content, EntityRenderer<?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, float partialTick) {
|
||||
super(entity);
|
||||
this.originalContent = content;
|
||||
this.setContent(this.originalContent);
|
||||
@@ -61,48 +59,42 @@ public class RenderNameTagEvent extends EntityEvent
|
||||
*
|
||||
* @param contents the new text
|
||||
*/
|
||||
public void setContent(Component contents)
|
||||
{
|
||||
public void setContent(Component contents) {
|
||||
this.nameplateContent = contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the text on the nameplate that will be rendered, if the event is not {@link Result#DENY DENIED}}
|
||||
*/
|
||||
public Component getContent()
|
||||
{
|
||||
public Component getContent() {
|
||||
return this.nameplateContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the original text on the nameplate}
|
||||
*/
|
||||
public Component getOriginalContent()
|
||||
{
|
||||
public Component getOriginalContent() {
|
||||
return this.originalContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the entity renderer rendering the nameplate}
|
||||
*/
|
||||
public EntityRenderer<?> getEntityRenderer()
|
||||
{
|
||||
public EntityRenderer<?> getEntityRenderer() {
|
||||
return this.entityRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
public PoseStack getPoseStack() {
|
||||
return this.poseStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the source of rendering buffers}
|
||||
*/
|
||||
public MultiBufferSource getMultiBufferSource()
|
||||
{
|
||||
public MultiBufferSource getMultiBufferSource() {
|
||||
return this.multiBufferSource;
|
||||
}
|
||||
|
||||
@@ -111,16 +103,14 @@ public class RenderNameTagEvent extends EntityEvent
|
||||
*
|
||||
* @see net.minecraft.client.renderer.LightTexture
|
||||
*/
|
||||
public int getPackedLight()
|
||||
{
|
||||
public int getPackedLight() {
|
||||
return this.packedLight;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the partial tick}
|
||||
*/
|
||||
public float getPartialTick()
|
||||
{
|
||||
public float getPartialTick() {
|
||||
return this.partialTick;
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see RenderPlayerEvent.Post
|
||||
* @see PlayerRenderer
|
||||
*/
|
||||
public abstract class RenderPlayerEvent extends PlayerEvent
|
||||
{
|
||||
public abstract class RenderPlayerEvent extends PlayerEvent {
|
||||
private final PlayerRenderer renderer;
|
||||
private final float partialTick;
|
||||
private final PoseStack poseStack;
|
||||
@@ -33,8 +32,7 @@ public abstract class RenderPlayerEvent extends PlayerEvent
|
||||
private final int packedLight;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected RenderPlayerEvent(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight)
|
||||
{
|
||||
protected RenderPlayerEvent(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(player);
|
||||
this.renderer = renderer;
|
||||
this.partialTick = partialTick;
|
||||
@@ -46,32 +44,28 @@ public abstract class RenderPlayerEvent extends PlayerEvent
|
||||
/**
|
||||
* {@return the player entity renderer}
|
||||
*/
|
||||
public PlayerRenderer getRenderer()
|
||||
{
|
||||
public PlayerRenderer getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the partial tick}
|
||||
*/
|
||||
public float getPartialTick()
|
||||
{
|
||||
public float getPartialTick() {
|
||||
return partialTick;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
public PoseStack getPoseStack() {
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the source of rendering buffers}
|
||||
*/
|
||||
public MultiBufferSource getMultiBufferSource()
|
||||
{
|
||||
public MultiBufferSource getMultiBufferSource() {
|
||||
return multiBufferSource;
|
||||
}
|
||||
|
||||
@@ -80,8 +74,7 @@ public abstract class RenderPlayerEvent extends PlayerEvent
|
||||
*
|
||||
* @see LightTexture
|
||||
*/
|
||||
public int getPackedLight()
|
||||
{
|
||||
public int getPackedLight() {
|
||||
return packedLight;
|
||||
}
|
||||
|
||||
@@ -97,11 +90,9 @@ public abstract class RenderPlayerEvent extends PlayerEvent
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Pre extends RenderPlayerEvent
|
||||
{
|
||||
public static class Pre extends RenderPlayerEvent {
|
||||
@ApiStatus.Internal
|
||||
public Pre(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight)
|
||||
{
|
||||
public Pre(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(player, renderer, partialTick, poseStack, multiBufferSource, packedLight);
|
||||
}
|
||||
}
|
||||
@@ -114,11 +105,9 @@ public abstract class RenderPlayerEvent extends PlayerEvent
|
||||
* <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 RenderPlayerEvent
|
||||
{
|
||||
public static class Post extends RenderPlayerEvent {
|
||||
@ApiStatus.Internal
|
||||
public Post(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight)
|
||||
{
|
||||
public Post(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(player, renderer, partialTick, poseStack, multiBufferSource, packedLight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,15 +30,13 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see ComputeCameraAngles
|
||||
* @see ComputeFov
|
||||
*/
|
||||
public abstract class ViewportEvent extends Event
|
||||
{
|
||||
public abstract class ViewportEvent extends Event {
|
||||
private final GameRenderer renderer;
|
||||
private final Camera camera;
|
||||
private final double partialTick;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public ViewportEvent(GameRenderer renderer, Camera camera, double partialTick)
|
||||
{
|
||||
public ViewportEvent(GameRenderer renderer, Camera camera, double partialTick) {
|
||||
this.renderer = renderer;
|
||||
this.camera = camera;
|
||||
this.partialTick = partialTick;
|
||||
@@ -47,24 +45,21 @@ public abstract class ViewportEvent extends Event
|
||||
/**
|
||||
* {@return the game renderer}
|
||||
*/
|
||||
public GameRenderer getRenderer()
|
||||
{
|
||||
public GameRenderer getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the camera information}
|
||||
*/
|
||||
public Camera getCamera()
|
||||
{
|
||||
public Camera getCamera() {
|
||||
return camera;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the partial tick}
|
||||
*/
|
||||
public double getPartialTick()
|
||||
{
|
||||
public double getPartialTick() {
|
||||
return partialTick;
|
||||
}
|
||||
|
||||
@@ -78,8 +73,7 @@ public abstract class ViewportEvent extends Event
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class RenderFog extends ViewportEvent
|
||||
{
|
||||
public static class RenderFog extends ViewportEvent {
|
||||
private final FogMode mode;
|
||||
private final FogType type;
|
||||
private float farPlaneDistance;
|
||||
@@ -87,8 +81,7 @@ public abstract class ViewportEvent extends Event
|
||||
private FogShape fogShape;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderFog(FogMode mode, FogType type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape)
|
||||
{
|
||||
public RenderFog(FogMode mode, FogType type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape) {
|
||||
super(Minecraft.getInstance().gameRenderer, camera, partialTicks);
|
||||
this.mode = mode;
|
||||
this.type = type;
|
||||
@@ -100,40 +93,35 @@ public abstract class ViewportEvent extends Event
|
||||
/**
|
||||
* {@return the mode of fog being rendered}
|
||||
*/
|
||||
public FogMode getMode()
|
||||
{
|
||||
public FogMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the type of fog being rendered}
|
||||
*/
|
||||
public FogType getType()
|
||||
{
|
||||
public FogType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the distance to the far plane where the fog ends}
|
||||
*/
|
||||
public float getFarPlaneDistance()
|
||||
{
|
||||
public float getFarPlaneDistance() {
|
||||
return farPlaneDistance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the distance to the near plane where the fog starts}
|
||||
*/
|
||||
public float getNearPlaneDistance()
|
||||
{
|
||||
public float getNearPlaneDistance() {
|
||||
return nearPlaneDistance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the shape of the fog being rendered}
|
||||
*/
|
||||
public FogShape getFogShape()
|
||||
{
|
||||
public FogShape getFogShape() {
|
||||
return fogShape;
|
||||
}
|
||||
|
||||
@@ -143,8 +131,7 @@ public abstract class ViewportEvent extends Event
|
||||
* @param distance the new distance to the far place
|
||||
* @see #scaleFarPlaneDistance(float)
|
||||
*/
|
||||
public void setFarPlaneDistance(float distance)
|
||||
{
|
||||
public void setFarPlaneDistance(float distance) {
|
||||
farPlaneDistance = distance;
|
||||
}
|
||||
|
||||
@@ -154,8 +141,7 @@ public abstract class ViewportEvent extends Event
|
||||
* @param distance the new distance to the near plane
|
||||
* @see #scaleNearPlaneDistance(float)
|
||||
*/
|
||||
public void setNearPlaneDistance(float distance)
|
||||
{
|
||||
public void setNearPlaneDistance(float distance) {
|
||||
nearPlaneDistance = distance;
|
||||
}
|
||||
|
||||
@@ -164,8 +150,7 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param shape the new shape of the fog
|
||||
*/
|
||||
public void setFogShape(FogShape shape)
|
||||
{
|
||||
public void setFogShape(FogShape shape) {
|
||||
fogShape = shape;
|
||||
}
|
||||
|
||||
@@ -174,8 +159,7 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param factor the factor to scale the far plane distance by
|
||||
*/
|
||||
public void scaleFarPlaneDistance(float factor)
|
||||
{
|
||||
public void scaleFarPlaneDistance(float factor) {
|
||||
farPlaneDistance *= factor;
|
||||
}
|
||||
|
||||
@@ -184,8 +168,7 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param factor the factor to scale the near plane distance by
|
||||
*/
|
||||
public void scaleNearPlaneDistance(float factor)
|
||||
{
|
||||
public void scaleNearPlaneDistance(float factor) {
|
||||
nearPlaneDistance *= factor;
|
||||
}
|
||||
}
|
||||
@@ -198,15 +181,13 @@ public abstract class ViewportEvent 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 ComputeFogColor extends ViewportEvent
|
||||
{
|
||||
public static class ComputeFogColor extends ViewportEvent {
|
||||
private float red;
|
||||
private float green;
|
||||
private float blue;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public ComputeFogColor(Camera camera, float partialTicks, float red, float green, float blue)
|
||||
{
|
||||
public ComputeFogColor(Camera camera, float partialTicks, float red, float green, float blue) {
|
||||
super(Minecraft.getInstance().gameRenderer, camera, partialTicks);
|
||||
this.setRed(red);
|
||||
this.setGreen(green);
|
||||
@@ -216,8 +197,7 @@ public abstract class ViewportEvent extends Event
|
||||
/**
|
||||
* {@return the red color value of the fog}
|
||||
*/
|
||||
public float getRed()
|
||||
{
|
||||
public float getRed() {
|
||||
return red;
|
||||
}
|
||||
|
||||
@@ -226,16 +206,14 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param red the new red color value
|
||||
*/
|
||||
public void setRed(float red)
|
||||
{
|
||||
public void setRed(float red) {
|
||||
this.red = red;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the green color value of the fog}
|
||||
*/
|
||||
public float getGreen()
|
||||
{
|
||||
public float getGreen() {
|
||||
return green;
|
||||
}
|
||||
|
||||
@@ -244,16 +222,14 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param green the new blue color value
|
||||
*/
|
||||
public void setGreen(float green)
|
||||
{
|
||||
public void setGreen(float green) {
|
||||
this.green = green;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the blue color value of the fog}
|
||||
*/
|
||||
public float getBlue()
|
||||
{
|
||||
public float getBlue() {
|
||||
return blue;
|
||||
}
|
||||
|
||||
@@ -262,8 +238,7 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param blue the new blue color value
|
||||
*/
|
||||
public void setBlue(float blue)
|
||||
{
|
||||
public void setBlue(float blue) {
|
||||
this.blue = blue;
|
||||
}
|
||||
}
|
||||
@@ -277,15 +252,13 @@ public abstract class ViewportEvent 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 ComputeCameraAngles extends ViewportEvent
|
||||
{
|
||||
public static class ComputeCameraAngles extends ViewportEvent {
|
||||
private float yaw;
|
||||
private float pitch;
|
||||
private float roll;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public ComputeCameraAngles(GameRenderer renderer, Camera camera, double renderPartialTicks, float yaw, float pitch, float roll)
|
||||
{
|
||||
public ComputeCameraAngles(GameRenderer renderer, Camera camera, double renderPartialTicks, float yaw, float pitch, float roll) {
|
||||
super(renderer, camera, renderPartialTicks);
|
||||
this.setYaw(yaw);
|
||||
this.setPitch(pitch);
|
||||
@@ -295,8 +268,7 @@ public abstract class ViewportEvent extends Event
|
||||
/**
|
||||
* {@return the yaw of the player's camera}
|
||||
*/
|
||||
public float getYaw()
|
||||
{
|
||||
public float getYaw() {
|
||||
return yaw;
|
||||
}
|
||||
|
||||
@@ -305,16 +277,14 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param yaw the new yaw
|
||||
*/
|
||||
public void setYaw(float yaw)
|
||||
{
|
||||
public void setYaw(float yaw) {
|
||||
this.yaw = yaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pitch of the player's camera}
|
||||
*/
|
||||
public float getPitch()
|
||||
{
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
@@ -323,16 +293,14 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param pitch the new pitch
|
||||
*/
|
||||
public void setPitch(float pitch)
|
||||
{
|
||||
public void setPitch(float pitch) {
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the roll of the player's camera}
|
||||
*/
|
||||
public float getRoll()
|
||||
{
|
||||
public float getRoll() {
|
||||
return roll;
|
||||
}
|
||||
|
||||
@@ -341,8 +309,7 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param roll the new roll
|
||||
*/
|
||||
public void setRoll(float roll)
|
||||
{
|
||||
public void setRoll(float roll) {
|
||||
this.roll = roll;
|
||||
}
|
||||
}
|
||||
@@ -358,14 +325,12 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @see ComputeFovModifierEvent
|
||||
*/
|
||||
public static class ComputeFov extends ViewportEvent
|
||||
{
|
||||
public static class ComputeFov extends ViewportEvent {
|
||||
private final boolean usedConfiguredFov;
|
||||
private double fov;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public ComputeFov(GameRenderer renderer, Camera camera, double renderPartialTicks, double fov, boolean usedConfiguredFov)
|
||||
{
|
||||
public ComputeFov(GameRenderer renderer, Camera camera, double renderPartialTicks, double fov, boolean usedConfiguredFov) {
|
||||
super(renderer, camera, renderPartialTicks);
|
||||
this.usedConfiguredFov = usedConfiguredFov;
|
||||
this.setFOV(fov);
|
||||
@@ -374,8 +339,7 @@ public abstract class ViewportEvent extends Event
|
||||
/**
|
||||
* {@return the raw field of view value}
|
||||
*/
|
||||
public double getFOV()
|
||||
{
|
||||
public double getFOV() {
|
||||
return fov;
|
||||
}
|
||||
|
||||
@@ -384,16 +348,14 @@ public abstract class ViewportEvent extends Event
|
||||
*
|
||||
* @param fov the new FOV value
|
||||
*/
|
||||
public void setFOV(double fov)
|
||||
{
|
||||
public void setFOV(double fov) {
|
||||
this.fov = fov;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return whether the base fov value started with a constant or was sourced from the fov set in the options}
|
||||
*/
|
||||
public boolean usedConfiguredFov()
|
||||
{
|
||||
public boolean usedConfiguredFov() {
|
||||
return usedConfiguredFov;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user