Forge 1.19.3

Created a CreativeModeTabEvent to register creative mode tabs and populate entries per tab
Moved datapack registries to DataPackRegistryEvent.NewRegistry event instead of tying them to ForgeRegistry
Made it easier for mods to datagen datapack builtin entries with DatapackBuiltinEntriesProvider
Provided access to lookupProvider for datagen
Updated dependencies to match versions used by vanilla and update JarJar to 0.3.18
Added a test mod for the new CreativeModeTabEvent
Throws better error message for Forge registries in tag datagen
Deleted ForgeRegistryTagsProvider
Updated ClientChatReceivedEvent and ServerChatEvent for Mojang changes
Added patches for both sign related methods in ModelLayers
Changed RegisterShadersEvent to use ResourceProvider
Migrated old Mojang math types to JOML

Co-authored-by: Marc Hermans <[email protected]>
Co-authored-by: LexManos <[email protected]>
Co-authored-by: sciwhiz12 <[email protected]>
Co-authored-by: coehlrich <[email protected]>
This commit is contained in:
committed 2022-12-08 01:45:22 -06:00
1 parent 617ecb7ad3
commit 8255d7aed3
726 files changed
+7615 -6653

No files matched your search

@@ -6,35 +6,24 @@
package net.minecraftforge.event;
import java.util.Objects;
import net.minecraft.client.Options;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ServerboundChatPacket;
import net.minecraft.network.protocol.game.ServerboundChatPreviewPacket;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.common.ForgeMod;
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.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* This event is fired whenever a {@link ServerboundChatPreviewPacket} or {@link ServerboundChatPacket} is received.
* <p>
* Mods that modify chat messages from this event should call {@link ForgeMod#enableServerChatPreview()}
* from their mod constructor to enable the chat preview and allow signing by clients.
* It is recommended to listen to this event class when modifying chat messages
* rather than a subclass to ensure clients with {@link Options#onlyShowSecureChat()}
* enabled can see the modified messages.
* This event is fired whenever a {@link ServerboundChatPacket} is received from a client
* who has submitted their chat message.
* <p>
* This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
* If the event is cancelled, the message will not be sent to clients.
* <p>
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#SERVER logical server}.
*
* @see ForgeMod#enableServerChatPreview()
**/
@Cancelable
public class ServerChatEvent extends Event
@@ -42,16 +31,14 @@ public class ServerChatEvent extends Event
private final ServerPlayer player;
private final String username;
private final String rawText;
private final boolean canChangeMessage;
private Component message;
@ApiStatus.Internal
protected ServerChatEvent(ServerPlayer player, String rawText, Component message, boolean canChangeMessage)
public ServerChatEvent(ServerPlayer player, String rawText, Component message)
{
this.player = player;
this.username = player.getGameProfile().getName();
this.rawText = rawText;
this.canChangeMessage = canChangeMessage;
this.message = message;
}
@@ -79,33 +66,11 @@ public class ServerChatEvent extends Event
return this.rawText;
}
/**
* {@return whether the message can be changed or not}.
* In vanilla, this will be false if a {@link ServerboundChatPacket} is received
* with signed decorated content already included by the sending player.
* Players who submit a chat message with chat previews disabled will cause this to be true.
*/
public boolean canChangeMessage()
{
return this.canChangeMessage;
}
/**
* Set the message to be sent to the relevant clients.
* <p>
* If {@link #canChangeMessage()} is false, this call will be ignored.
* <p>
* It is recommended to listen to {@link ServerChatEvent} when modifying chat messages
* rather than a subclass to ensure clients with {@link Options#onlyShowSecureChat()}
* enabled can see the modified messages.
*
* @see ForgeMod#enableServerChatPreview()
*/
public void setMessage(Component message)
{
if (!this.canChangeMessage)
return;
this.message = Objects.requireNonNull(message);
}
@@ -116,59 +81,4 @@ public class ServerChatEvent extends Event
{
return this.message;
}
/**
* This event is fired whenever a {@link ServerboundChatPreviewPacket} is received from a client typing a message.
* <p>
* This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
* If the event is cancelled, the chat preview sent back to the client will match the original message.
* <p>
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#SERVER logical server}.
**/
public static class Preview extends ServerChatEvent
{
@ApiStatus.Internal
public Preview(ServerPlayer player, String rawText, Component message)
{
super(player, rawText, message, true);
}
/**
* Set the chat preview to be sent back to the client.
*/
@Override
public void setMessage(Component message)
{
super.setMessage(message);
}
/**
* {@return the chat preview that will be sent back to the client, if the event is not cancelled}
*/
@Override
public Component getMessage()
{
return super.getMessage();
}
}
/**
* This event is fired whenever a {@link ServerboundChatPacket} is received from a client
* who has submitted their chat message.
* <p>
* This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
* If the event is cancelled, the message will not be sent to clients.
* <p>
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#SERVER logical server}.
**/
public static class Submitted extends ServerChatEvent
{
@ApiStatus.Internal
public Submitted(ServerPlayer player, String rawText, Component message, boolean canChangeMessage)
{
super(player, rawText, message, canChangeMessage);
}
}
}