Minecraft 1.21.9 update.

There a lot of performance improvements related to events.
  No more InheritableEvent for abstract events that you shouldn't add listeners to anyway, like EntityEvent. Use their sub-events.
  Made a lot more events records and interfaces. Mostly just a binary break, but has better performance.
  Mod bus posting methods are now static, no more ModLoader.get() for those.

ObjectHolder was removed, use RegistryObject.
Changed RuntimeEnumExtender to only target Minecraft classes. If you want other modders to interact with your API, use an Interface instead of Enum.
Moved some abstract event methods to only the relevant sub-events now, e.g. can no longer check the side of a ClientTickEvent, because it'll always be client

Rendering has changed a lot, they now batch most things together so that the game will render faster.
RenderHighlightEvent changed a lot

See https://github.com/MinecraftForge/MinecraftForge-Experimental/tree/1.21.9-dev for unsquashed commits.

Co-authored-by: Paint_Ninja <[email protected]>
This commit is contained in:
LexManosandPaint_Ninja committed 2025-10-01 13:05:12 -07:00
1 parent c1d703e395
commit b0ccf1a480
490 files changed
+4601 -6528

No files matched your search

@@ -8,29 +8,27 @@ package net.minecraftforge.event;
import com.mojang.brigadier.ParseResults;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
import net.minecraftforge.eventbus.api.event.MutableEvent;
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
import net.minecraftforge.fml.LogicalSide;
import org.jetbrains.annotations.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
/**
* CommandEvent is fired after a command is parsed, but before it is executed.
* This event is fired during the invocation of {@link Commands#performCommand(ParseResults, String)}.
* <p>
* This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
* If the event is cancelled, the command will not be executed.
* This event is {@linkplain Cancellable cancellable}. If the event is cancelled, the command will not be executed.
* <p>
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#SERVER logical server}.
* This event is fired only on the {@linkplain LogicalSide#SERVER logical server}.
**/
@NullMarked
public final class CommandEvent extends MutableEvent implements Cancellable {
public static final CancellableEventBus<CommandEvent> BUS = CancellableEventBus.create(CommandEvent.class);
private ParseResults<CommandSourceStack> parse;
@Nullable
private Throwable exception;
private @Nullable Throwable exception;
public CommandEvent(ParseResults<CommandSourceStack> parse) {
this.parse = parse;