From f5cd2de68ca696fd43a2f124d29c983cc774a376 Mon Sep 17 00:00:00 2001
From: Hileb <107909747+Ecdcaeb@users.noreply.github.com>
Date: Sat, 9 Nov 2024 12:16:28 +0800
Subject: [PATCH] Java Doc for some Client events and helpful api (#242)
* doc
* doc
* doc
* Update IRenderHandler.java
---
.../minecraftforge/client/IRenderHandler.java | 11 +++++++++++
.../client/event/ClientChatReceivedEvent.java | 16 ++++++++++++++++
.../client/event/RenderLivingEvent.java | 14 ++++++++++++++
.../client/event/RenderPlayerEvent.java | 6 ++++++
.../client/event/sound/SoundEvent.java | 8 ++++++++
5 files changed, 55 insertions(+)
diff --git a/src/main/java/net/minecraftforge/client/IRenderHandler.java b/src/main/java/net/minecraftforge/client/IRenderHandler.java
index 8227b8c57..758857303 100644
--- a/src/main/java/net/minecraftforge/client/IRenderHandler.java
+++ b/src/main/java/net/minecraftforge/client/IRenderHandler.java
@@ -24,8 +24,19 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
+/**
+ * Take over the rendering of world effects. For the vanilla, they are Cloud, Sky and Weather.
+ *
+ * Call
{@link net.minecraft.world.WorldProvider#setCloudRenderer(IRenderHandler)}
{@link net.minecraft.world.WorldProvider#setSkyRenderer(IRenderHandler)}
{@link net.minecraft.world.WorldProvider#setWeatherRenderer(IRenderHandler)}
+ * to enable them.
+ */
public abstract class IRenderHandler
{
+ /**
+ * @param partialTicks Fractional part of a tick
+ * @param world the world being rendered
+ * @param mc Current mc instance
+ */
@SideOnly(Side.CLIENT)
public abstract void render(float partialTicks, WorldClient world, Minecraft mc);
}
diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java
index f68648c10..e008367cd 100644
--- a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java
+++ b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java
@@ -24,6 +24,22 @@
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
+/**
+ * ClientChatReceivedEvent is fired whenever the client received a chat message.
+ * This event is fired via {@link net.minecraftforge.event.ForgeEventFactory#onClientChat(ChatType, ITextComponent)},
+ * which is executed by {@link net.minecraft.client.network.NetHandlerPlayClient#handleChat(net.minecraft.network.play.server.SPacketChat)}
+ *
+ * {@link #message} contains the message that will be displayed. This can be changed by mods.
+ *
+ * {@link #type} is the type of the message. This field is read only.
+ *
+ * This event is {@link Cancelable}.
+ * If this event is canceled, the chat message will be ignored and not displayed.
+ *
+ * This event does not have a result. {@link HasResult}
+ *
+ * This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
+ **/
@Cancelable
public class ClientChatReceivedEvent extends Event
{
diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java
index c863ec3fd..f3ea4ade2 100644
--- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java
+++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java
@@ -24,6 +24,14 @@
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.entity.EntityLivingBase;
+/**
+ * RenderLivingEvent is fired whenever the client is about to render a living.
+ * If a method utilizes this {@link Event} as its parameter, the method will receive every child event of this class.
+ *
+ * All children of this event are fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
+ *
+ * @param the type of the living.
+ **/
public abstract class RenderLivingEvent extends Event
{
private final EntityLivingBase entity;
@@ -70,6 +78,12 @@ public static class Post extends RenderLivingEvent renderer, float partialRenderTick, double x, double y, double z){ super(entity, renderer, partialRenderTick, x, y, z); }
}
+ /**
+ * Specials is fired when the living draws the name
+ * This event is fired via {@link RenderLivingBase#renderName(EntityLivingBase, double, double, double)},
+ *
+ * This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
+ **/
public abstract static class Specials extends RenderLivingEvent
{
public Specials(EntityLivingBase entity, RenderLivingBase renderer, double x, double y, double z){ super(entity, renderer, 0, x, y, z); }
diff --git a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java
index 23cfa7ce7..9b17a40d1 100644
--- a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java
+++ b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java
@@ -27,6 +27,12 @@
import javax.annotation.Nonnull;
+/**
+ * RenderLivingEvent is fired whenever the client is about to render a player.
+ * When the rendered target is not the local user, {@link RenderLivingEvent} will be fired if {@link Pre} is not cancelled.
+ *
+ * All children of this event are fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
+ **/
public abstract class RenderPlayerEvent extends PlayerEvent
{
private final RenderPlayer renderer;
diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java
index c29660ab5..85c44cbac 100644
--- a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java
+++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java
@@ -23,6 +23,11 @@
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.SoundManager;
+/**
+ * SoundEvent is fired when an event involving any Sound occurs.
+ *
+ * All children of this event are fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
+ **/
public class SoundEvent extends Event
{
private final SoundManager manager;
@@ -36,6 +41,9 @@ public SoundManager getManager()
return manager;
}
+ /**
+ * When a new sound source is passed to the SoundSystem
+ */
public static class SoundSourceEvent extends SoundEvent
{
private final ISound sound;