mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
Forge 1.19.1
Load natives from classpath Make command argument types a forge registry Add `EntityMobGriefingEvent` to `Allay#wantsToPickUp` Overhaul `ServerChatEvent` to use `ChatDecorator` system Remove `ClientChatEvent#setMessage` for now Gradle 7.5 Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
3c1126a7b4
commit
6845c094ab
98 files changed
+1025
-733
No files matched your search
@@ -11,25 +11,24 @@ import net.minecraft.commands.Commands;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.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(CommandSourceStack, String)}. <br>
|
||||
* <br>
|
||||
* {@link #parse} contains the instance of {@link ParseResults} for the parsed command.<br>
|
||||
* {@link #exception} begins null, but can be populated with an exception to be thrown within the command.<br>
|
||||
* <br>
|
||||
* This event is {@link Cancelable}. <br>
|
||||
* If the event is canceled, the execution of the command does not occur.<br>
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
* 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.
|
||||
* <p>
|
||||
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#SERVER logical server}.
|
||||
**/
|
||||
@Cancelable
|
||||
public class CommandEvent extends Event
|
||||
{
|
||||
private ParseResults<CommandSourceStack> parse;
|
||||
@Nullable
|
||||
private Throwable exception;
|
||||
|
||||
public CommandEvent(ParseResults<CommandSourceStack> parse)
|
||||
@@ -37,8 +36,30 @@ public class CommandEvent extends Event
|
||||
this.parse = parse;
|
||||
}
|
||||
|
||||
public ParseResults<CommandSourceStack> getParseResults() { return parse; }
|
||||
public void setParseResults(ParseResults<CommandSourceStack> parse) { this.parse = parse; }
|
||||
public Throwable getException() { return exception; }
|
||||
public void setException(Throwable exception) { this.exception = exception; }
|
||||
/**
|
||||
* {@return the parsed command results}
|
||||
*/
|
||||
public ParseResults<CommandSourceStack> getParseResults()
|
||||
{
|
||||
return this.parse;
|
||||
}
|
||||
|
||||
public void setParseResults(ParseResults<CommandSourceStack> parse)
|
||||
{
|
||||
this.parse = parse;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return an exception to be thrown when performing the command, starts null}
|
||||
*/
|
||||
@Nullable
|
||||
public Throwable getException()
|
||||
{
|
||||
return this.exception;
|
||||
}
|
||||
|
||||
public void setException(@Nullable Throwable exception)
|
||||
{
|
||||
this.exception = exception;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user