Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Doc for some Client events and helpful api #242

Merged
merged 4 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/java/net/minecraftforge/client/IRenderHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <br><br/>
* Call <br> {@link net.minecraft.world.WorldProvider#setCloudRenderer(IRenderHandler)}<br> {@link net.minecraft.world.WorldProvider#setSkyRenderer(IRenderHandler)}<br> {@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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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. <br>
* 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)}<br>
* <br>
* {@link #message} contains the message that will be displayed. This can be changed by mods.<br>
* <br>
* {@link #type} is the type of the message. This field is read only.<br>
* <br>
* This event is {@link Cancelable}. <br>
* If this event is canceled, the chat message will be ignored and not displayed.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class ClientChatReceivedEvent extends Event
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>
* If a method utilizes this {@link Event} as its parameter, the method will receive every child event of this class.
* <br>
* All children of this event are fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.<br>
*
* @param <T> the type of the living.
**/
public abstract class RenderLivingEvent<T extends EntityLivingBase> extends Event
{
private final EntityLivingBase entity;
Expand Down Expand Up @@ -70,6 +78,12 @@ public static class Post<T extends EntityLivingBase> extends RenderLivingEvent<T
public Post(EntityLivingBase entity, RenderLivingBase<T> 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 <br>
* This event is fired via {@link RenderLivingBase#renderName(EntityLivingBase, double, double, double)},
* <br>
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
**/
public abstract static class Specials<T extends EntityLivingBase> extends RenderLivingEvent<T>
{
public Specials(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z){ super(entity, renderer, 0, x, y, z); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@

import javax.annotation.Nonnull;

/**
* RenderLivingEvent is fired whenever the client is about to render a player.<br>
* When the rendered target is not the local user, {@link RenderLivingEvent} will be fired if {@link Pre} is not cancelled.
* <br>
* All children of this event are fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.<br>
**/
public abstract class RenderPlayerEvent extends PlayerEvent
{
private final RenderPlayer renderer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>
* <br>
* All children of this event are fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.<br>
**/
public class SoundEvent extends Event
{
private final SoundManager manager;
Expand All @@ -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;
Expand Down