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

@@ -8,13 +8,13 @@ package net.minecraftforge.client.event;
import net.minecraft.Util;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MessageSigner;
import net.minecraft.network.chat.PlayerChatMessage;
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 java.util.UUID;
/**
* Fired when a chat message is received on the client.
@@ -33,16 +33,14 @@ public class ClientChatReceivedEvent extends Event
{
private Component message;
private final ChatType.Bound boundChatType;
private final PlayerChatMessage playerChatMessage;
private final MessageSigner messageSigner;
private final UUID sender;
@ApiStatus.Internal
public ClientChatReceivedEvent(ChatType.Bound boundChatType, Component message, PlayerChatMessage playerChatMessage, MessageSigner messageSigner)
public ClientChatReceivedEvent(ChatType.Bound boundChatType, Component message, UUID sender)
{
this.boundChatType = boundChatType;
this.message = message;
this.playerChatMessage = playerChatMessage;
this.messageSigner = messageSigner;
this.sender = sender;
}
/**
@@ -73,22 +71,12 @@ public class ClientChatReceivedEvent extends Event
}
/**
* {@return the full player chat message}.
* This contains the sender UUID, various signing data, and the optional unsigned contents.
* {@return the message sender}.
* This will be {@link Util#NIL_UUID} if the message is a system message.
*/
public PlayerChatMessage getPlayerChatMessage()
public UUID getSender()
{
return this.playerChatMessage;
}
/**
* {@return the message signer}.
* This contains the sender UUID, timestamp of message creation, and signature salt.
* The {@linkplain MessageSigner#profileId() sender UUID} will be {@link Util#NIL_UUID} if the message is a system message.
*/
public MessageSigner getMessageSigner()
{
return this.messageSigner;
return this.sender;
}
/**
@@ -96,6 +84,38 @@ public class ClientChatReceivedEvent extends Event
*/
public boolean isSystem()
{
return this.messageSigner.isSystem();
return this.sender.equals(Util.NIL_UUID);
}
}
/**
* Fired when a player chat message is received on the client.
*
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
* If the event is cancelled, the message is not displayed in the chat message window.</p>
*
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*
* @see ChatType
*/
public static class Player extends ClientChatReceivedEvent
{
private final PlayerChatMessage playerChatMessage;
@ApiStatus.Internal
public Player(ChatType.Bound boundChatType, Component message, PlayerChatMessage playerChatMessage, UUID sender)
{
super(boundChatType, message, sender);
this.playerChatMessage = playerChatMessage;
}
/**
* {@return the full player chat message}.
* This contains the sender UUID, various signing data, and the optional unsigned contents.
*/
public PlayerChatMessage getPlayerChatMessage()
{
return this.playerChatMessage;
}
}
}
@@ -8,6 +8,7 @@ package net.minecraftforge.client.event;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.server.packs.resources.ResourceProvider;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.LogicalSide;
@@ -29,29 +30,29 @@ import java.util.function.Consumer;
*/
public class RegisterShadersEvent extends Event implements IModBusEvent
{
private final ResourceManager resourceManager;
private final ResourceProvider resourceProvider;
private final List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList;
@ApiStatus.Internal
public RegisterShadersEvent(ResourceManager resourceManager, List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList)
public RegisterShadersEvent(ResourceProvider resourceProvider, List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList)
{
this.resourceManager = resourceManager;
this.resourceProvider = resourceProvider;
this.shaderList = shaderList;
}
/**
* {@return the client-side resource manager}
* {@return the client-side resource provider}
*/
public ResourceManager getResourceManager()
public ResourceProvider getResourceProvider()
{
return resourceManager;
return resourceProvider;
}
/**
* Registers a shader, and a callback for when the shader is loaded.
*
* <p>When creating a {@link ShaderInstance}, pass in the {@linkplain #getResourceManager()
* client-side resource manager} as the resource provider.</p>
* <p>When creating a {@link ShaderInstance}, pass in the {@linkplain #getResourceProvider()
* client-side resource provider} as the resource provider.</p>
*
* <p>Mods should not store the shader instance passed into this method. Instead, mods should store the shader
* passed into the registered load callback.</p>
@@ -6,13 +6,13 @@
package net.minecraftforge.client.event;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.fml.LogicalSide;
import org.jetbrains.annotations.ApiStatus;
import org.joml.Matrix4f;
/**
* Fired after all level rendering.
@@ -11,7 +11,6 @@ import java.util.Map;
import javax.annotation.Nullable;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.LevelRenderer;
@@ -21,13 +20,14 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.ForgeRenderTypes;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.event.IModBusEvent;
import org.joml.Matrix4f;
/**
* Fires at various times during LevelRenderer.renderLevel.
* Fires at various times during LevelRenderer.renderLevel.
* Check {@link #getStage} to render during the appropriate time for your use case.
*
*
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. </p>
*
*
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}. </p>
*/
@@ -122,9 +122,9 @@ public class RenderLevelStageEvent extends Event
/**
* Use to create a custom {@linkplain RenderLevelStageEvent.Stage stages}.
* Fired after the LevelRenderer has been created.
*
*
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. </p>
*
*
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}. </p>
*/
@@ -184,7 +184,7 @@ public class RenderLevelStageEvent extends Event
* Use this to render custom effects into the world, such as custom entity-like objects or special rendering effects.
* Called within a fabulous graphics target.
* Happens after entities render.
*
*
* @see ForgeRenderTypes#TRANSLUCENT_ON_PARTICLES_TARGET
*/
public static final Stage AFTER_PARTICLES = register("after_particles", null);
@@ -6,7 +6,6 @@
package net.minecraftforge.client.event;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.LogicalSide;
@@ -17,10 +16,8 @@ import org.jetbrains.annotations.ApiStatus;
import java.util.Set;
/**
* Fired before and after a texture atlas stitched together.
* See the two subclasses to listen for before and after stitching.
* Fired after a texture atlas is stitched together.
*
* @see TextureStitchEvent.Pre
* @see TextureStitchEvent.Post
* @see TextureAtlas
*/
@@ -42,39 +39,40 @@ public class TextureStitchEvent extends Event implements IModBusEvent
return atlas;
}
/**
* <p>Fired <b>before</b> a texture atlas is stitched together.
* This can be used to add custom sprites to be stitched into the atlas.</p>
*
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
*
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Pre extends TextureStitchEvent
{
private final Set<ResourceLocation> sprites;
@ApiStatus.Internal
public Pre(TextureAtlas map, Set<ResourceLocation> sprites)
{
super(map);
this.sprites = sprites;
}
/**
* Adds a sprite to be stitched into the texture atlas.
*
* <p>Callers should check that the atlas which the event is fired for is the atlas they wish to stitch the
* sprite into, as otherwise they would be stitching the sprite into all atlases.</p>
*
* @param sprite the location of the sprite
*/
public boolean addSprite(ResourceLocation sprite)
{
return this.sprites.add(sprite);
}
}
// Use atlas info JSON files instead
// /**
// * <p>Fired <b>before</b> a texture atlas is stitched together.
// * This can be used to add custom sprites to be stitched into the atlas.</p>
// *
// * <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
// *
// * <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus},
// * only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
// */
// public static class Pre extends TextureStitchEvent
// {
// private final Set<ResourceLocation> sprites;
//
// @ApiStatus.Internal
// public Pre(TextureAtlas map, Set<ResourceLocation> sprites)
// {
// super(map);
// this.sprites = sprites;
// }
//
// /**
// * Adds a sprite to be stitched into the texture atlas.
// *
// * <p>Callers should check that the atlas which the event is fired for is the atlas they wish to stitch the
// * sprite into, as otherwise they would be stitching the sprite into all atlases.</p>
// *
// * @param sprite the location of the sprite
// */
// public boolean addSprite(ResourceLocation sprite)
// {
// return this.sprites.add(sprite);
// }
// }
/**
* Fired <b>after</b> a texture atlas is stitched together and all textures therein has been loaded.