Compare commits

..
44 Commits
Author SHA1 Message Date
LexManos 694167779c Add protection against large network channel lists 2026-10-14 19:45:46 -07:00
LexManos 3ea91e77ac Fix legacy object holders not being fired in the registry specific codepath
Better optimize the scanning for object holders by unrolling streams.
2026-10-13 10:24:28 -07:00
BonsUnleashedandLexManos fc27a35722 Store object holder handlers per registry name (#10899)
Co-authored-by: LexManos <[email protected]>
2026-10-12 16:41:51 -07:00
LexManos 12939f4cd3 Fix generic errors in new Eclipse compiler 2026-10-12 16:41:02 -07:00
Odin Okland 7a37f17c89 Use vanilla's entrypoint for GameTest servers (#10884) 2026-09-23 15:14:38 -07:00
Paint_NinjaandMartijn van den Brand 22168f6a69 Fix IForgeBlockStateModel.getModelData not being called correct for #getParticleIcon (#10818) (#10875)
Co-authored-by: Martijn van den Brand <[email protected]>
2026-08-15 13:34:02 -07:00
Meme Man d32d853c0b Update equality check for RegistryObject to include RegistryObject#key. (#10866) 2026-08-04 19:09:58 +01:00
Matt dd24e1385e Toml parsing errors are now visible in the latest log (#10840) 2026-07-09 12:45:19 -07:00
Matt 1ae17d5a04 Add support for multiple access transformer configs. 2026-03-23 12:03:29 -07:00
Jonathing deaf69e1c9 Migrate the MDK to ForgeGradle 7
Backport of d29524b to 1.21.5
2026-03-18 22:54:38 +00:00
Paint_Ninja ea7dff02a3 Skip processing vanilla classes in RuntimeDistCleaner when running on a client
Backport of #10682 to 1.21.5. Also bumped ASM to 9.9.1
2026-03-17 20:19:28 +00:00
LexManos 054c23a59a Update SecureModules to address ZipPath bug with brackets. Closes #10755 2026-01-20 18:28:21 -08:00
LexManos 220dcbe92c Fix Entity patch lines 2026-01-15 11:06:05 -08:00
MattandLexManos 6865f4e77d Optimize memory allocation for checking entity fluid collisions. Backport of #10745 (#10750)
Co-authored-by: LexManos <[email protected]>
2026-01-15 10:45:48 -08:00
LexManos 3ea77c75b4 Mark applyServerBinpatches as a dependency of BundleList. Fixes: #10729 2025-12-04 08:56:28 -08:00
LexManos d97e796c56 Migrate to Github Actions 2025-12-02 14:27:55 -08:00
Matt 6585db991d Fix crafter not inserting into iitemhandler (#10667) (#10672) 2025-09-25 13:10:57 -07:00
Paint_Ninja fe64775f09 Bump ASM to 9.8 for Java 25 runtime support
Note: Forge for 1.21.8 already has ASM 9.8
2025-09-22 11:53:38 +01:00
LexManos 9ccfaf4812 1.21.5 RB 1 2025-08-27 12:02:50 -07:00
Paint_Ninja 3ed3d2b9cf Update to EventBus 6.2.32 (#10644)
- Performance improvements, especially for posting to zero or one listeners on an event
- New Event#cancel() convenience method
- Only the monitor priority is tracked on the Forge bus now
2025-08-27 17:36:13 +01:00
Matt 3d374fe732 [1.21.5] Add ForgeLayeredDraw & ModifyOverlayLayersEvent as API to making gui layers. (#10556) 2025-07-25 10:44:49 -07:00
Paint_Ninja a02f3f9841 Update MDK to fix OOM error and aid getting Mixin setup (#10559) 2025-06-09 22:19:37 +01:00
LexManos c5e462f7d2 Remove legacy patch that caused tripwires to create a loop. Fixes #10558 2025-06-01 00:43:08 -07:00
Matt d1f79d6655 Fix warped and crimson fungi not being able to be placed on nylium. (#10544)
Fix other PlantType parity issues, add test for all vanilla PlantType blocks.
Co-authored-by: LexManos <[email protected]>
2025-05-23 02:22:26 -07:00
LexManos 9d5e81b1a9 Fix modded keybidings being reset to default when reloading. Fixes: #10531 2025-05-22 00:40:04 -07:00
LexManos a1c275df46 Deprecate GatherDataEvent.validate() as validation always happens. And made ExistingFileHelper always function. Closes #10516 2025-05-21 23:42:44 -07:00
LexManos 4ef7fe8bd8 Call getToolModifiedState for AXE_STRIP and AXE_WAX_OFF. 2025-05-21 23:41:54 -07:00
LexManos ce8838e721 Fix Wood Stripping sound not playing. Fixes #10525 2025-05-20 23:12:19 -07:00
LexManos b7e2593d48 Fix dedicated server not loading default language files. Fixes #10555 2025-05-16 13:01:02 -07:00
Joseph T. McQuigg 33d177f02e Make Loot Function without builders Constructors public (#10521) 2025-05-14 21:17:58 -07:00
Olivier Sechet 5d2186df63 Ensure changes from keyboard in ForgeSlider behave as changes from mouse (#10554) 2025-05-09 15:14:16 -07:00
LexManos 77af36b807 Add YourKit mention 2025-05-08 13:40:26 -07:00
Matt 54eeca0aed Fix creative inventory not displaying item categories correctly. Fixes #10524 2025-05-05 14:54:16 -07:00
LexManos 3de0566425 Make unbound tags non-fatal due to Mojang's registry loading order issues. Closes #10524 2025-05-05 14:52:43 -07:00
LexManos a5ebf3b645 Fix PlayerEquipmentInvWrapper offset. Closes #10532 2025-05-05 12:13:58 -07:00
Paint_Ninja 63d0496cc4 Deprecate DistExecutor for removal (#10198) 2025-04-23 20:54:22 +01:00
Paint_Ninja 31f623e794 Cleanup early display's internals a bit more (#10538) 2025-04-23 20:53:29 +01:00
Erizamanu eb001a6382 Add ChunkEvent.LightingCalculated, fixes #8354 (#10533) 2025-04-22 21:11:26 +01:00
Paint_Ninja 504dcad849 Seal most event hierarchies (#10515)
Most events in Forge are not designed to be extended by mod devs but technically allowed it before this PR, leading to a risk of unintentional breaking changes for those that do.

If you need to extend a Forge event, please let us know so that we can explicitly support that and design it with extending in mind. Note that this change does not affect making your own events that directly extend from EventBus' `Event` class.
2025-04-19 13:18:48 +01:00
Matt 81f7f029c3 Fix NPE when breeze deflects a projectile (#10535) 2025-04-19 13:08:10 +01:00
Jonathing 207c1997c9 Fix Swords and Pickaxes not using ToolActions (#10520) 2025-04-06 12:08:21 -05:00
LexManos e348ae5b84 Fix bundles causing crash upon inserting item. Closes #10509 2025-03-27 22:09:50 -07:00
LexManos 0f3b8ee830 Add DeferredRegistryData to help with generating data driven registry entries.
Revive GameTest system and make all but one Forge Test mod pass.
2025-03-27 20:52:35 -07:00
LexManos b4b6e48a7a Fix Mod List Screen's render layout and scroll bars. 2025-03-26 18:54:11 -07:00
395 changed files with 4567 additions and 2120 deletions

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
name: Publish
on:
push:
branches: [ '1.21.5' ]
permissions:
contents: read
jobs:
build:
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@main
with:
java: 21
gradle_setup: './gradlew setup'
gradle_tasks: 'build publish'
artifact_name: 'forge'
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PROMOTE_ARTIFACT_WEBHOOK: ${{ secrets.PROMOTE_ARTIFACT_WEBHOOK }}
PROMOTE_ARTIFACT_USERNAME: ${{ secrets.PROMOTE_ARTIFACT_USERNAME }}
PROMOTE_ARTIFACT_PASSWORD: ${{ secrets.PROMOTE_ARTIFACT_PASSWORD }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}
SIGN_KEYSTORE_PASSWORD: ${{ secrets.SIGN_KEYSTORE_PASSWORD }}
SIGN_KEYSTORE_DATA: ${{ secrets.SIGN_KEYSTORE_DATA }}
+1 -1
View File
@@ -7,7 +7,7 @@ jobs:
name: Upload payload
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable
- uses: actions/upload-artifact@v4 # Payload artifact is consumed in Actionable
with:
name: payload
path: ${{ github.event_path }}
@@ -7,7 +7,7 @@ jobs:
name: Upload payload
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable
- uses: actions/upload-artifact@v4 # Payload artifact is consumed in Actionable
with:
name: payload
path: ${{ github.event_path }}
-104
View File
@@ -1,104 +0,0 @@
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>MinecraftForge_Forge Config DSL Script</name>
<groupId>MinecraftForge_Forge</groupId>
<artifactId>MinecraftForge_Forge_dsl</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<repositories>
<repository>
<id>jetbrains-all</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>teamcity-server</id>
<url>https://teamcity.minecraftforge.net/app/dsl-plugins-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>${basedir}</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration/>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-configs-maven-plugin</artifactId>
<version>${teamcity.dsl.version}</version>
<configuration>
<format>kotlin</format>
<dstDir>target/generated-configs</dstDir>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin</artifactId>
<version>${teamcity.dsl.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-plugins</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-runtime</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
-193
View File
@@ -1,193 +0,0 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues
import jetbrains.buildServer.configs.kotlin.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
/*
The settings script is an entry point for defining a TeamCity
project hierarchy. The script should contain a single call to the
project() function with a Project instance or an init function as
an argument.
VcsRoots, BuildTypes, Templates, and subprojects can be
registered inside the project using the vcsRoot(), buildType(),
template(), and subProject() methods respectively.
To debug settings scripts in command-line, run the
mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
command and attach your debugger to the port 8000.
To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
-> Tool Windows -> Maven Projects), find the generate task node
(Plugins -> teamcity-configs -> teamcity-configs:generate), the
'Debug' option is available in the context menu for the task.
*/
version = "2021.2"
project {
buildType(Build)
buildType(BuildSecondaryBranches)
buildType(PullRequests)
buildType(PullRequestChecks)
buildType(PullRequestCompatibility)
params {
text("docker_jdk_version", "21", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("docker_gradle_version", "8.7", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("git_main_branch", "1.21.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("git_branch_spec", """
+:refs/heads/(main*)
+:refs/heads/(master*)
+:refs/heads/(develop|release|staging|main|master)
+:refs/heads/(1.*)
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
text("github_repository_name", "MinecraftForge", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `MinecraftForge` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forge", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false)
text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false)
//These are references and not actually keys
password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN)
password("env.KEYSTORE_URL", "credentialsJSON:a7ae1c82-8058-4061-8d12-7f6bc2618d2e", display = ParameterDisplay.HIDDEN)
password("env.KEYSTORE_PASSWORD", "credentialsJSON:d7b964e3-a1fd-47a8-b892-6f601fe47479", display = ParameterDisplay.HIDDEN)
text("additional_publishing_gradle_parameters", "-PcrowdinKey=%env.CROWDIN_KEY% -PkeystoreKeyPass=%env.KEYSTORE_PASSWORD% -PkeystoreStorePass=%env.KEYSTORE_PASSWORD% -Pkeystore=%env.KEYSTORE_URL%", label = "Additional gradle parameters for publish", description = "Contains the additional gradle parameters used during publishing.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
checkbox("should_execute_build", "false", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
checked = "true", unchecked = "false")
checkbox("should_execute_test", "false", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
checked = "true", unchecked = "false")
}
features {
githubIssues {
id = "MinecraftForge_MinecraftForge__IssueTracker"
displayName = "MinecraftForge/MinecraftForge"
repositoryURL = "https://github.com/MinecraftForge/MinecraftForge"
}
}
}
object Build : BuildType({
templates(AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"), AbsoluteId("MinecraftForge_PublishProjectUsingGradle"), AbsoluteId("MinecraftForge_TriggersStaticFilesWebpageGenerator"))
id("MinecraftForge_MinecraftForge__Build")
name = "Build"
description = "Builds and Publishes the main branches of the project."
})
object BuildSecondaryBranches : BuildType({
templates(AbsoluteId("MinecraftForge_ExcludesBuildingDefaultBranch"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"))
id("MinecraftForge_MinecraftForge__BuildSecondaryBranches")
name = "Build - Secondary Branches"
description = "Builds and Publishes the secondary branches of the project."
params {
text("git_branch_spec", """
+:refs/heads/(*)
-:refs/heads/noci*
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
object PullRequests : BuildType({
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"))
id("MinecraftForge_MinecraftForge__PullRequests")
name = "Pull Requests"
description = "Builds pull requests for the project"
params {
checkbox("should_execute_build", "true", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
checked = "true", unchecked = "false")
text(
"gradle_build_task",
"assemble",
label = "Gradle build task to execute during build",
description = "Determines the build task that is executed to build the project.",
display = ParameterDisplay.HIDDEN,
allowEmpty = false
)
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
object PullRequestChecks : BuildType({
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
id("MinecraftForge_MinecraftForge__PullRequestChecks")
name = "Pull Requests (Checks)"
description = "Checks pull requests for the project"
steps {
gradle {
name = "Check"
id = "RUNNER_10_Check"
tasks = "checkAll"
gradleParams = "--continue %gradle_custom_args%"
enableStacktrace = true
dockerImage = "%docker_gradle_image%"
dockerRunParameters = """
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
--network=host
-u 1000:1000
%docker_additional_args%
""".trimIndent()
}
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
object PullRequestCompatibility : BuildType({
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
id("MinecraftForge_MinecraftForge__PullRequestCompatibility")
name = "Pull Requests (Compatibility)"
description = "Validates binary compatibility for pull requests made to the project"
steps {
gradle {
name = "Validate"
id = "RUNNER_10_Compatibility"
tasks = "checkJarCompatibility"
gradleParams = "--continue %gradle_custom_args%"
enableStacktrace = true
dockerImage = "%docker_gradle_image%"
dockerRunParameters = """
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
--network=host
-u 1000:1000
%docker_additional_args%
""".trimIndent()
}
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
-65
View File
@@ -1,65 +0,0 @@
Minecraft Forge: Credits/Thank You
Forge is a set of tools and modifications to the Minecraft base game code to assist
mod developers in creating new and exciting content. It has been in development for
several years now, but I would like to take this time thank a few people who have
helped it along its way.
First, the people who originally created the Forge projects way back in Minecraft
alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance
of me taking over the project, who knows what Minecraft modding would be today.
Secondly, someone who has worked with me, and developed some of the core features
that allow modding to be as functional, and as simple as it is, cpw. For developing
FML, which stabilized the client and server modding ecosystem. As well as the base
loading system that allows us to modify Minecraft's code as elegently as possible.
Mezz, who has stepped up as the issue and pull request manager. Helping to keep me
sane as well as guiding the community into creating better additions to Forge.
Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which
I am a part}. For creating some of the core tools needed to make Minecraft modding
both possible, and as stable as can be.
On that note, here is some specific information of the MCP data we use:
* Minecraft Coder Pack (MCP) *
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically
download components of MCP and distribute MCP data files. This permission is not
transitive and others wishing to redistribute the Minecraft Forge source independently
should seek permission of MCP or remove the MCP data files and request their users
to download MCP separately.
And lastly, the countless community members who have spent time submitting bug reports,
pull requests, and just helping out the community in general. Thank you.
--LexManos
=========================================================================
This is Forge Mod Loader.
You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
and minecraft clients.
The code is authored by cpw.
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
https://www.minecraftforum.net/topic/75440-
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
https://minecraftforge.net/
Additionally, it contains an implementation of topological sort based on that
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
It also contains code from the Maven project for performing versioned dependency
resolution. http://maven.apache.org/
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
with credit to it's authors.
Forge Mod Loader downloads components from the Minecraft Coder Pack
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
+3 -3
View File
@@ -4,9 +4,9 @@ repositories {
}
dependencies {
implementation 'org.ow2.asm:asm:9.7'
implementation 'org.ow2.asm:asm-tree:9.7'
implementation 'net.minecraftforge:srgutils:0.5.10'
implementation 'org.ow2.asm:asm:9.9.1'
implementation 'org.ow2.asm:asm-tree:9.9.1'
implementation 'net.minecraftforge:srgutils:0.6.2'
implementation 'commons-io:commons-io:2.13.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r'
@@ -21,6 +21,8 @@ abstract class BundleList extends DefaultTask {
configure {
dependsOn(project.tasks.universalJar)
inputs.file(project.tasks.universalJar.archiveFile)
dependsOn(project.tasks.applyServerBinPatches)
inputs.file(project.tasks.applyServerBinPatches.output)
}
}
+13 -7
View File
@@ -79,7 +79,6 @@ final String SPEC_VERSION = gradleutils.gitInfo.tag
final def MCP_ARTIFACT = project(':mcp').mcp.config.get()
final List<File> EXTRA_TXTS = [
rootProject.file('CREDITS.txt'),
rootProject.file('LICENSE.txt'),
rootProject.tasks.createChangelog.outputFile
]
@@ -231,7 +230,6 @@ patcher {
args '--launchTarget', 'forge_dev_client_data',
'--mod', 'forge',
'--all',
'--validate',
'--output', rootProject.file('src/main/generated/'),
'--existing', sourceSets.main.resources.srcDirs[0],
'--assetsDir', downloadAssets.output,
@@ -924,23 +922,31 @@ tasks.register('installerJar', InstallerJar) {
jarSigner.sign(it)
}
final mdkGradleWrapper = tasks.register('mdkGradleWrapper', Wrapper) {
gradleVersion = '9.3.1'
}
tasks.register('mdkZip', Zip) {
dependsOn mdkGradleWrapper
archiveBaseName = project.name
archiveClassifier = 'mdk'
archiveVersion = project.version
destinationDirectory = file('build/libs')
from rootProject.file('gradlew')
from rootProject.file('gradlew.bat')
from mdkGradleWrapper.map(Wrapper.&getScriptFile)
from mdkGradleWrapper.map(Wrapper.&getBatchScript)
from(EXTRA_TXTS)
from(rootProject.file('gradle/')){
into('gradle/')
into('gradle/wrapper/') {
from mdkGradleWrapper.map(Wrapper.&getJarFile)
from mdkGradleWrapper.map(Wrapper.&getPropertiesFile)
}
from(rootProject.file('mdk/')){
rootProject.file('mdk/gitignore.txt').eachLine{
rootProject.file('mdk/gitignore.txt').eachLine {
if (!it.trim().isEmpty() && !it.trim().startsWith('#'))
exclude it
}
filter(ReplaceTokens, tokens: [
FORGE_VERSION: FORGE_VERSION,
FORGE_GROUP: project.group,
+7 -1
View File
@@ -2,7 +2,7 @@
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.21.4-&query=$.promos["1.21.4-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download]
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.21.5-&query=$.promos["1.21.5-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download]
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.21.5-&query=$.promos["1.21.5-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)][Download] [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)][Discord] [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)][Patreon]
@@ -70,6 +70,11 @@ Please ensure you have a valid email address associated with your GitHub account
to use and modify. However, it costs money to run such a large project as this, so please consider
[becoming a patron][Patreon].*
### Thanks
[![YourKit](https://www.yourkit.com/images/yklogo.png)](https://www.yourkit.com/)
YourKit for providing us accesss to their [YourKit Java Profiler] which helps identify bottlenecks and places for improvment.
[Contributing]: ./CONTRIBUTING.md
[CLA]: https://cla-assistant.io/MinecraftForge/MinecraftForge
@@ -93,3 +98,4 @@ Please ensure you have a valid email address associated with your GitHub account
[Pull-Requests]: https://docs.minecraftforge.net/en/latest/forgedev/#making-changes-and-pull-requests
[Patreon]: https://www.patreon.com/LexManos
[YourKit Java Profiler]: https://www.yourkit.com/java/profiler/
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
for file in $(find repo | grep --invert-match -e md5 -e sha | grep -e .jar -e .zip); do
file_path=$(realpath $file)
file_name=$(basename $file)
echo "$file_name"
files=$(unzip -l $file | awk '{print $4}')
for f in $files; do
out="_actual/$file_name/$f"
parent=$(dirname "$out")
echo $out
if [ ! -d "$parent" ]; then
mkdir -p "$parent"
fi
if [[ $f == *.class ]]; then
javap -v -p jar:file://$file_path!/$f | tail -n +4 >$out.txt
elif [[ $f != */ && $f != "Name" && $f != "----" ]]; then
unzip -o -q $file $f -d _actual/$file_name
fi
done
done
@@ -25,7 +25,18 @@ import java.util.function.Supplier;
* <li>When you want to call one thing on one side, another thing on the other and return a result {@link #safeRunForDist(Supplier, Supplier)}</li>
* <li>When you want to run something on one side {@link #safeRunWhenOn(Dist, Supplier)}</li>
* </ul>
*
* @deprecated Historically, this allowed for safe execution of code on the correct side by exploiting a low-level
* detail in Java 8, but in newer versions a simple if check is enough.
* <br>
* For example:
* <pre>{@code
* if (FMLEnvironment.dist.isClient()) {
* // client code here
* }
* }</pre>
*/
@Deprecated(since = "1.21.5", forRemoval = true)
public final class DistExecutor
{
private static final Logger LOGGER = LogManager.getLogger();
@@ -90,7 +90,12 @@ public class DisplayWindow implements ImmediateWindowProvider {
// The GL ID of the window. Used for all operations
private long window;
// The thread that contains and ticks the window while Forge is loading mods
private ScheduledExecutorService renderScheduler;
private static final ScheduledExecutorService renderScheduler = Executors.newSingleThreadScheduledExecutor(r -> {
final var thread = Executors.defaultThreadFactory().newThread(r);
thread.setName("EarlyDisplay");
thread.setDaemon(true);
return thread;
});
private int fbWidth;
private int fbHeight;
private int fbScale;
@@ -149,7 +154,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
}
this.maximized = parsed.has(maximizedopt) || FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_MAXIMIZED);
StartupNotificationManager.modLoaderConsumer().ifPresent(c->c.accept("Forge loading " + forgeVersion));
StartupNotificationManager.modLoaderConsumer().ifPresent(c->c.accept("Forge loading " + FMLLoader.versionInfo().forgeVersion()));
performanceInfo = new PerformanceInfo();
return start(mcVersion, forgeVersion);
}
@@ -238,7 +243,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
var date = Calendar.getInstance();
if (FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SQUIR) || (date.get(Calendar.MONTH) == Calendar.APRIL && date.get(Calendar.DAY_OF_MONTH) == 1))
this.elements.add(0, RenderElement.squir());
this.elements.addFirst(RenderElement.squir());
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -287,12 +292,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
* Start the window and Render Thread; we're ready to go.
*/
public Runnable start(@Nullable String mcVersion, final String forgeVersion) {
renderScheduler = Executors.newSingleThreadScheduledExecutor(r -> {
final var thread = Executors.defaultThreadFactory().newThread(r);
thread.setName("EarlyDisplay");
thread.setDaemon(true);
return thread;
});
initWindow(mcVersion);
this.initializationFuture = renderScheduler.schedule(() -> initRender(mcVersion, forgeVersion), 1, TimeUnit.MILLISECONDS);
return this::periodicTick;
@@ -304,7 +303,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
return this.glVersion;
}
private void crashElegantly(String errorDetails) {
private static void crashElegantly(String errorDetails) {
StringBuilder msgBuilder = new StringBuilder(2000);
msgBuilder.append("Failed to initialize graphics window with current settings.\n");
msgBuilder.append("\n\n");
@@ -512,7 +511,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
this.winY = y;
}
}
private void handleLastGLFWError(BiConsumer<Integer, String> handler) {
private static void handleLastGLFWError(BiConsumer<Integer, String> handler) {
try (MemoryStack memorystack = MemoryStack.stackPush()) {
PointerBuffer pointerbuffer = memorystack.mallocPointer(1);
int error = glfwGetError(pointerbuffer);
@@ -640,7 +639,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
}
public void addMojangTexture(final int textureId) {
this.elements.add(0, RenderElement.mojang(textureId, framecount));
this.elements.addFirst(RenderElement.mojang(textureId, framecount));
}
public void close() {
@@ -22,8 +22,8 @@ public class RenderElement {
static int globalAlpha = 255;
private int retireCount;
@FunctionalInterface
interface Renderer {
void accept(SimpleBufferBuilder bb, DisplayContext context, int frame);
default Renderer then(Renderer r) {
@@ -38,6 +38,9 @@ public class RenderElement {
interface TextureRenderer {
void accept(SimpleBufferBuilder bb, DisplayContext context, int[] size, int frame);
}
/** @deprecated Use {@link Renderer} directly. This was always eagerly resolved, making it an unnecessary wrapper. */
@Deprecated(since = "1.21.5", forRemoval = true)
@FunctionalInterface
interface Initializer extends Supplier<Renderer> {}
@@ -56,11 +59,18 @@ public class RenderElement {
}
}
/** @deprecated Use {@link RenderElement#RenderElement(Renderer)} instead */
@Deprecated(since = "1.21.5", forRemoval = true)
public RenderElement(final Initializer rendererInitializer) {
this.bb = new SimpleBufferBuilder(1);
this.renderer = rendererInitializer.get();
}
public RenderElement(Renderer renderer) {
this.bb = new SimpleBufferBuilder(1);
this.renderer = renderer;
}
public boolean render(DisplayContext ctx, int count) {
this.renderer.accept(bb, ctx, count);
return this.retireCount == 0 || this.retireCount < count;
@@ -75,7 +85,7 @@ public class RenderElement {
List<SimpleFont.DisplayText> texts = new ArrayList<>();
for (int i = messages.size() - 1; i >= 0; i--) {
final StartupNotificationManager.AgeMessage pair = messages.get(i);
final float fade = clamp((4000.0f - (float) pair.age() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
final float fade = Math.clamp((4000.0f - (float) pair.age() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
if (fade <0.01f) continue;
Message msg = pair.message();
int colour = Math.min((int)(fade * 255f), globalAlpha) << 24 | 0xFFFFFF;
@@ -86,7 +96,7 @@ public class RenderElement {
}
public static RenderElement mojang(final int textureId, final int frameStart) {
return new RenderElement(()->(bb, ctx, frame) -> {
return new RenderElement((bb, ctx, frame) -> {
var size = 256 * ctx.scale();
var x0 = (ctx.scaledWidth() - 2 * size) / 2;
var y0 = 64 * ctx.scale() + 32;
@@ -138,11 +148,11 @@ public class RenderElement {
}));
}
public static RenderElement progressBars(SimpleFont font) {
return new RenderElement(() -> (bb, ctx, frame) -> RenderElement.startupProgressBars(font, bb, ctx, frame));
return new RenderElement((bb, ctx, frame) -> RenderElement.startupProgressBars(font, bb, ctx, frame));
}
public static RenderElement performanceBar(SimpleFont font) {
return new RenderElement(() -> (bb, ctx, frame) -> RenderElement.memoryInfo(font, bb, ctx, frame));
return new RenderElement((bb, ctx, frame) -> RenderElement.memoryInfo(font, bb, ctx, frame));
}
public static void startupProgressBars(SimpleFont font, final SimpleBufferBuilder buffer, final DisplayContext context, final int frameNumber) {
@@ -177,10 +187,10 @@ public class RenderElement {
}
private static float[] indeterminateBar(int frame, boolean isActive) {
if (RenderElement.globalAlpha != 0xFF || !isActive) {
return new float[] {0f,1f};
return new float[] { 0f, 1f };
} else {
var progress = frame % 100;
return new float[]{clamp((progress - 2) / 100f, 0f, 1f), clamp((progress + 2) / 100f, 0f, 1f)};
int progress = frame % 100;
return new float[] { Math.clamp((progress - 2) / 100f, 0f, 1f), Math.clamp((progress + 2) / 100f, 0f, 1f) };
}
}
@@ -239,8 +249,8 @@ public class RenderElement {
};
}
private static Initializer initializeText(SimpleFont font, TextGenerator textGenerator) {
return () -> (bb, context, frame) -> renderText(font, textGenerator, bb, context);
private static Renderer initializeText(SimpleFont font, TextGenerator textGenerator) {
return (bb, context, frame) -> renderText(font, textGenerator, bb, context);
}
private static void renderText(final SimpleFont font, final TextGenerator textGenerator, final SimpleBufferBuilder bb, final DisplayContext context) {
@@ -254,14 +264,13 @@ public class RenderElement {
private static TextGenerator text(int x, int y, String text, int colour) {
return (bb, font, context) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour));
}
private static Initializer initializeTexture(final String textureFileName, int size, int textureNumber, TextureRenderer positionAndColour) {
return ()->{
int[] imgSize = STBHelper.loadTextureFromClasspath(textureFileName, size, GL_TEXTURE0 + textureNumber + INDEX_TEXTURE_OFFSET);
return (bb, ctx, frame) -> {
ctx.elementShader().updateTextureUniform(textureNumber + INDEX_TEXTURE_OFFSET);
ctx.elementShader().updateRenderTypeUniform(ElementShader.RenderType.TEXTURE);
renderTexture(bb, ctx, frame, imgSize, positionAndColour);
};
private static Renderer initializeTexture(final String textureFileName, int size, int textureNumber, TextureRenderer positionAndColour) {
int[] imgSize = STBHelper.loadTextureFromClasspath(textureFileName, size, GL_TEXTURE0 + textureNumber + INDEX_TEXTURE_OFFSET);
return (bb, ctx, frame) -> {
ctx.elementShader().updateTextureUniform(textureNumber + INDEX_TEXTURE_OFFSET);
ctx.elementShader().updateRenderTypeUniform(ElementShader.RenderType.TEXTURE);
renderTexture(bb, ctx, frame, imgSize, positionAndColour);
};
}
@@ -271,21 +280,13 @@ public class RenderElement {
bb.draw();
}
@Deprecated(since = "1.21.5", forRemoval = true)
public static float clamp(float num, float min, float max) {
if (num < min) {
return min;
} else {
return Math.min(num, max);
}
return Math.clamp(num, min, max);
}
public static int clamp(int num, int min, int max) {
if (num < min) {
return min;
} else {
return Math.min(num, max);
}
return Math.min(max, Math.max(num, min));
}
public static int hsvToRGB(float hue, float saturation, float value) {
@@ -22,7 +22,7 @@ public class SimpleFont {
private final int textureNumber;
private final int lineSpacing;
private final int descent;
private final int GLYPH_COUNT = 127-32;
private static final int GLYPH_COUNT = 127 - 32;
private final Glyph[] glyphs;
private record Glyph(char c, int charwidth, int[] pos, float[] uv) {
@@ -120,7 +120,7 @@ public class SimpleFont {
case '\n', '\t' -> 0;
case ' ' -> glyphs[0].charwidth();
default -> {
if (c - 32 < this.GLYPH_COUNT && c > 32) {
if (c - 32 < GLYPH_COUNT && c > 32) {
yield this.glyphs[c - 32].charwidth();
} else {
yield 0;
@@ -151,7 +151,7 @@ public class SimpleFont {
case '\t' -> new Pos(pos.x()+font.glyphs[0].charwidth() * 4, pos.y(), pos.minx());
case ' ' -> new Pos(pos.x()+font.glyphs[0].charwidth(), pos.y(), pos.minx());
default -> {
if (c-32 < font.GLYPH_COUNT && c > 32) {
if (c-32 < GLYPH_COUNT && c > 32) {
pos = font.glyphs[c - 32].loadQuad(pos, colour(), bb);
}
yield pos;
@@ -175,7 +175,7 @@ public class FMLLoader {
}
public static void addAccessTransformer(Path atPath, ModFile modName) {
LOGGER.debug(SCAN, "Adding Access Transformer in {}", modName.getFilePath());
LOGGER.debug(SCAN, "Adding Access Transformer {} in {}", atPath, modName.getFilePath());
accessTransformer.offerResource(atPath, modName.getFileName());
}
@@ -5,11 +5,13 @@
package net.minecraftforge.fml.loading;
import com.mojang.logging.LogUtils;
import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.forgespi.locating.IModFile;
import org.slf4j.Logger;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -24,6 +26,7 @@ import java.util.stream.Collectors;
* loading package</em>
*/
public class LoadingModList {
private static final Logger LOGGER = LogUtils.getLogger();
private static LoadingModList INSTANCE;
private final List<ModFileInfo> modFiles;
private final List<ModInfo> sortedList;
@@ -67,13 +70,22 @@ public class LoadingModList {
}
public void addAccessTransformers() {
var errors = new ArrayList<EarlyLoadingException.ExceptionData>();
for (ModFileInfo modFile : modFiles) {
ModFile mod = modFile.getFile();
var at = mod.getAccessTransformer().orElse(null);
if (at != null) {
FMLLoader.addAccessTransformer(at, mod);
for (Path at : mod.getAccessTransformers()) {
if (!Files.exists(at)) {
var message = "Invalid mod file: " + modFile.getFile().getFileName() + ". Missing Access Transformer: " + at;
errors.add(new EarlyLoadingException.ExceptionData(message));
LOGGER.error(message);
} else {
FMLLoader.addAccessTransformer(at, mod);
}
}
}
if (!errors.isEmpty()) {
preLoadErrors.add(new EarlyLoadingException("Invalid Access Transformers", null, errors));
}
}
public void addForScanning(BackgroundScanHandler backgroundScanHandler) {
@@ -27,7 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
public class RuntimeDistCleaner implements ILaunchPluginService {
public final class RuntimeDistCleaner implements ILaunchPluginService {
private static final Logger LOGGER = LogUtils.getLogger();
private static final Marker DISTXFORM = MarkerFactory.getMarker("DISTXFORM");
private static String DIST;
@@ -52,6 +52,10 @@ public class RuntimeDistCleaner implements ILaunchPluginService {
if (internalName.startsWith("net/minecraftforge/"))
return NAY;
// No Vanilla classes use @OnlyIn(Dist.SERVER), so we can skip them entirely when we're running on a client
if (FMLEnvironment.dist.isClient() && (internalName.startsWith("net/minecraft/") || internalName.startsWith("com/mojang/")))
return NAY;
return YAY;
}
@@ -51,6 +51,7 @@ public class ModFile implements IModFile {
private CompletableFuture<ModFileScanData> futureScanResult;
private List<CoreModFile> coreMods;
private Path accessTransformer;
private List<Path> accessTransformers = Collections.emptyList();
static final Attributes.Name TYPE = new Attributes.Name("FMLModType");
private SecureJar.Status securityStatus;
@@ -94,8 +95,14 @@ public class ModFile implements IModFile {
return modFileInfo.getMods();
}
/** @deprecated Use {@link #getAccessTransformers()} instead*/
@Deprecated(forRemoval=true, since="1.21.11")
public Optional<Path> getAccessTransformer() {
return Optional.ofNullable(Files.exists(accessTransformer) ? accessTransformer : null);
return Optional.ofNullable(accessTransformer);
}
public List<Path> getAccessTransformers() {
return accessTransformers;
}
public boolean identifyMods() {
@@ -104,7 +111,28 @@ public class ModFile implements IModFile {
LOGGER.debug(LogMarkers.LOADING,"Loading mod file {} with languages {}", this.getFilePath(), this.modFileInfo.requiredLanguageLoaders());
this.coreMods = ModFileParser.getCoreMods(this);
this.coreMods.forEach(mi-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {}", mi.getPath()));
this.accessTransformer = findResource("META-INF", "accesstransformer.cfg");
List<String> cfg;
// Note: Some mods may have invalid tomls copied from other projects.
// Unfortunately we must protect against those landmines.
try {
cfg = this.modFileInfo.getConfig().<List<String>>getConfigElement("accessTransformers").orElse(null);
} catch (Exception e) {
cfg = null;
LOGGER.warn("{} contains an invalid 'accessTransformers' TOML entry. Should be e.g. accessTransformers = [\"META-INF/accesstransformer.cfg\", \"META-INF/extra_at.cfg\"] or accessTransformers = [] for no ATs. Falling back to default.", this.getFileName());
}
if (cfg == null) {
var path = findResource("META-INF", "accesstransformer.cfg");
if (Files.exists(path)) {
this.accessTransformer = path;
this.accessTransformers = List.of(path);
}
} else if (!cfg.isEmpty()) {
var paths = new ArrayList<Path>(cfg.size());
for (var path : cfg) {
paths.add(getSecureJar().getPath(path.replace("\\","/")));
}
this.accessTransformers = List.copyOf(paths);
}
return true;
}
@@ -6,6 +6,7 @@
package net.minecraftforge.fml.loading.moddiscovery;
import com.electronwill.nightconfig.core.file.FileConfig;
import com.electronwill.nightconfig.core.io.ParsingException;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mojang.logging.LogUtils;
@@ -13,6 +14,7 @@ import net.minecraftforge.fml.loading.LogMarkers;
import net.minecraftforge.forgespi.language.IModFileInfo;
import net.minecraftforge.forgespi.locating.IModFile;
import net.minecraftforge.forgespi.locating.ModFileFactory;
import net.minecraftforge.forgespi.locating.ModFileLoadingException;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
@@ -31,6 +33,7 @@ public class ModFileParser {
return parser.build(modFile);
}
// Note: Although @Nullable, several other places in FML assume ModFileInfo is not null. Keep this in mind
public static @Nullable IModFileInfo modsTomlParser(final IModFile imodFile) {
ModFile modFile = (ModFile) imodFile;
LOGGER.debug(LogMarkers.LOADING,"Considering mod file candidate {}", modFile.getFilePath());
@@ -41,10 +44,15 @@ public class ModFileParser {
}
final FileConfig fileConfig = FileConfig.builder(modsjson).build();
fileConfig.load();
fileConfig.close();
final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig);
return new ModFileInfo(modFile, configWrapper, configWrapper::setFile);
try {
fileConfig.load();
fileConfig.close();
final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig);
return new ModFileInfo(modFile, configWrapper, configWrapper::setFile);
} catch (ParsingException e) {
LOGGER.error("Mod candidate {} contains a corrupt or misconfigured toml.", modFile.getFileName());
throw new ModFileLoadingException("Mod candidate " + modFile.getFileName() + " contains a corrupt or misconfigured toml.");
}
}
protected static List<CoreModFile> getCoreMods(final ModFile modFile) {
@@ -84,7 +84,7 @@ public abstract class CommonLaunchHandler implements ILaunchHandlerService {
protected static final LaunchType CLIENT_DATA = new LaunchType("client_data", "minecraft", "net.minecraft.client.data.Main", Dist.CLIENT, true);
protected static final LaunchType DATA = new LaunchType("data", "minecraft", "net.minecraft.data.Main", Dist.CLIENT, true);
protected static final LaunchType SERVER = new LaunchType("server", "minecraft", "net.minecraft.server.Main", Dist.DEDICATED_SERVER, false);
protected static final LaunchType SERVER_GAMETEST = new LaunchType("server_gametest", "net.minecraftforge.forge", "net.minecraftforge.gametest.GameTestMain", Dist.DEDICATED_SERVER, false);
protected static final LaunchType SERVER_GAMETEST = new LaunchType("server_gametest", "minecraft", "net.minecraft.gametest.Main", Dist.DEDICATED_SERVER, false);
protected void runTarget(String module, String target, final String[] arguments, final ModuleLayer layer) throws Throwable {
var mod = layer.findModule(module).orElse(null);
+29 -183
View File
@@ -1,216 +1,62 @@
// This is a minimal setup of a Forge mod workspace.
// For complex examples (including AccessTransformers, Jar-in-Jar, and Mixin), see our examples repository.
// https://github.com/MinecraftForge/MDKExamples
plugins {
id 'eclipse'
id 'java'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
id 'eclipse'
id 'net.minecraftforge.gradle' version '[7.0.3,8)'
}
version = mod_version
group = mod_group_id
base {
archivesName = mod_id
}
version = '1.0.0'
group = 'com.example.examplemod'
// Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
// Include generated resources
sourceSets.main.resources { srcDir 'src/generated/resources' }
minecraft {
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
//
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: mapping_channel, version: mapping_version
// Tell FG to not automtically create the reobf tasks, as we now use Official mappings at runtime, If you don't use them at dev time then you'll have to fix your reobf yourself.
reobf = false
mappings channel: 'official', version: '@MC_VERSION@'
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableEclipsePrepareRuns = true
// enableIdeaPrepareRuns = true
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
// It is REQUIRED to be set to true for this template to function.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
copyIdeResources = true
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
// The folder name can be set on a run configuration using the "folderName" property.
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
// generateRunFolders = true
// This property enables access transformers for use in development.
// They will be applied to the Minecraft artifact.
// The access transformer file can be anywhere in the project.
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
// This default location is a best practice to automatically put the file in the right place in the final jar.
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')
workingDir = layout.projectDirectory.dir('run')
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
systemProperty 'forge.enabledGameTestNamespaces', 'examplemod'
}
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
}
register('client')
server {
property 'forge.enabledGameTestNamespaces', mod_id
register('server') {
args '--nogui'
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
}
register('gameTestServer')
data {
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')
register('data') {
workingDir = layout.projectDirectory.dir('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
args '--mod', 'examplemod', '--all', '--output', layout.projectDirectory.dir('src/generated/resources'), '--existing', layout.projectDirectory.dir('src/main/resources')
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
// flatDir {
// dir 'libs'
// }
minecraft.mavenizer(it) // In Kotlin, it = this
maven fg.forgeMaven
maven fg.minecraftLibsMaven
mavenCentral()
}
dependencies {
// Specify the version of Minecraft to use.
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Example mod dependency with JEI
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
// compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}"
// runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}"
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description,
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1', // We are version 1 of ourselves
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_authors
])
}
}
// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
register('mavenJava', MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
implementation minecraft.dependency('net.minecraftforge:forge:@MC_VERSION@-@FORGE_VERSION@')
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
// IntelliJ no longer downloads javadocs and sources by default.
// This tells Gradle to force IDEA to do it.
idea.module { downloadJavadoc = downloadSources = true }
eclipse {
// Run everytime eclipse builds the code
//autoBuildTasks genEclipseRuns
// Run when importing the project
synchronizationTasks 'genEclipseRuns'
}
// Merge the resources and classes into the same directory.
// This is done because java expects modules to be in a single directory.
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
sourceSets.each {
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
// Use the UTF-8 charset for Java compilation
// This is done by default in Java 18+, but this ensures it no matter the Java or Gradle version
options.encoding = 'UTF-8'
}
+6 -16
View File
@@ -1,13 +1,11 @@
Source installation information for modders
-------------------------------------------
This code follows the Minecraft Forge installation methodology. It will apply
some small patches to the vanilla MCP source code, giving you and it access
some small patches to the vanilla MCP source code, giving you and it access
to some of the data and functions you need to build a successful mod.
Note also that the patches are built against "un-renamed" MCP source code (aka
SRG Names) - this means that you will not be able to read them directly against
normal code.
Please note that this example MDK is a simple showcase for the most basic of mods.
To see more examples see our dedicated examples repository under the "Additional Resources" section.
Setup Process:
==============================
@@ -17,30 +15,22 @@ Step 1: Open your command-line and browse to the folder where you extracted the
Step 2: You're left with a choice.
If you prefer to use Eclipse:
1. Run the following command: `./gradlew genEclipseRuns`
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
or run `gradlew eclipse` to generate the project.
If you prefer to use IntelliJ:
1. Open IDEA, and import project.
2. Select your build.gradle file and have it import.
3. Run the following command: `./gradlew genIntellijRuns`
4. Refresh the Gradle Project in IDEA if required.
3. Use the run tasks located under the "Slime Launcher" Gradle task group.
If at any point you are missing libraries in your IDE, or you've run into problems you can
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
(this does not affect your code) and then start the process again.
Mapping Names:
=============================
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
license, if you do not agree with it you can change your mapping names to other crowdsourced names in your
build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here:
https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
Additional Resources:
=========================
Community Documentation: https://docs.minecraftforge.net/en/latest/gettingstarted/
Additional Examples: https://github.com/MinecraftForge/MDKExamples
LexManos' Install Video: https://youtu.be/8VEdtQLuLO0
Forge Forums: https://forums.minecraftforge.net/
Forge Discord: https://discord.minecraftforge.net/
+1
View File
@@ -22,4 +22,5 @@ eclipse
run
# Files from Forge MDK
forge_README.txt
forge*changelog.txt
+7 -57
View File
@@ -1,59 +1,9 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
org.gradle.configuration-cache.problems=warn
## Environment Properties
# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=@MC_VERSION@
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[@MC_VERSION@,@MC_NEXT_VERSION@)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=@FORGE_VERSION@
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[@FORGE_SPEC_VERSION@,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[@FORGE_SPEC_VERSION@,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
#
# | Channel | Version | |
# |-----------|----------------------|--------------------------------------------------------------------------------|
# | official | MCVersion | Official field/method names from Mojang mapping files |
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
#
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
#
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
mapping_channel=@MAPPING_CHANNEL@
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=@MAPPING_VERSION@
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=examplemod
# The human-readable display name for the mod.
mod_name=Example Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.0.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.example.examplemod
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=YourNameHere, OtherNameHere
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
net.minecraftforge.gradle.merge-source-sets=true
+3 -11
View File
@@ -1,13 +1,5 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
rootProject.name = 'examplemod'
+36 -66
View File
@@ -1,73 +1,43 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="${mod_license}"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN),
# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers.
#clientSideOnly=true #optional - defaults to false if absent
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="${mod_id}" #mandatory
# The version number of the mod
version="${mod_version}" #mandatory
# A display name for the mod
displayName="${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
#credits="" #optional
# A text field displayed in the mod UI
authors="${mod_authors}" #optional
# Display Test controls the display for your mod in the server connection screen
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
#displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional)
# See https://docs.minecraftforge.net/en/1.21.x/gettingstarted/modfiles/#modstoml
# There are lots of things you can do with the mods.toml, and not all fields are included with this MDK
# References: https://github.com/MinecraftForge/MDKExamples
# The description text for the mod (multi line!) (#mandatory)
description='''${mod_description}'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.${mod_id}]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="${forge_version_range}" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
modLoader="javafml"
loaderVersion="[@FORGE_SPEC_VERSION@,)"
license="All Rights Reserved"
#issueTrackerURL="https://github.com/MyOrganization/MyMod/" #optional
#clientSideOnly=true #optional, default=false
[[mods]]
modId="examplemod"
version="1.0.0"
displayName="Example Mod"
#updateJSONURL="https://example.com/updates.json" #optional
#displayURL="https://example.com/" #optional
#logoFile="examplemod.png" #optional
#credits="" #optional
authors="YourNameHere, OtherNameHere" #optional
#displayTest="MATCH_VERSION" #optional, default=MATCH_VERSION when not clientSideOnly, else IGNORE_ALL_VERSION
# Access Transformers
# Optional, if not specified Forge will attempt to find the default META-INF/accesstransformer.cfg and silently continue if not found. May default to an empty list in a future MC.
# If you specify AT path strings in this list, Forge will attempt to load each of them and throw errors for any that aren't found.
# Specifying an empty list when your mod has no ATs is recommended to opt-out of the default for slightly better loading performance.
#accessTransformers = []
description='''Example mod description.
Newline characters can be used like this, and rendered on the mods screen properly.'''
[[dependencies.examplemod]] #recommended
modId="forge"
mandatory=true
versionRange="[@FORGE_SPEC_VERSION@,)"
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side="BOTH"
# Here's another dependency
[[dependencies.${mod_id}]]
[[dependencies.examplemod]] #recommended
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="${minecraft_version_range}"
versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@,)"
ordering="NONE"
side="BOTH"
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
# stop your mod loading on the server for example.
#[features.${mod_id}]
#openGLVersion="[3.2,)"
@@ -10,6 +10,14 @@
? Optional.empty()
: Optional.of(p_232011_),
Codec.STRING
@@ -683,6 +_,7 @@
public boolean onboardAccessibility = true;
public boolean syncWrites;
public boolean startedCleanly = true;
+ private final Map<String, String> unknownKeys = new java.util.HashMap<>();
public OptionInstance<Boolean> darkMojangStudiosBackground() {
return this.darkMojangStudiosBackground;
@@ -1050,6 +_,7 @@
}
@@ -18,15 +26,16 @@
this.minecraft = p_92138_;
this.optionsFile = new File(p_92139_, "options.txt");
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
@@ -1181,12 +_,22 @@
@@ -1181,15 +_,28 @@
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness);
this.startedCleanly = p_168428_.process("startedCleanly", this.startedCleanly);
+ processOptionsForge(p_168428_);
+ processOptionsKeysOnly(p_168428_);
+ processOptionsEnd(p_168428_);
+ }
+ // FORGE: split off to allow reloading options after mod loading is done
+ private void processOptionsForge(Options.FieldAccess p_168428_) {
+ // FORGE: split off to allow reloading keys after mod loading is done
+ private void processOptionsKeysOnly(Options.FieldAccess p_168428_) {
for (KeyMapping keymapping : this.keyMappings) {
- String s = keymapping.saveString();
+ String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
@@ -41,7 +50,12 @@
+ }
}
}
+ }
+ private void processOptionsEnd(Options.FieldAccess p_168428_) {
for (SoundSource soundsource : SoundSource.values()) {
p_168428_.process("soundCategory_" + soundsource.getName(), this.soundSourceVolumes.get(soundsource));
}
@@ -1204,6 +_,10 @@
}
@@ -58,11 +72,54 @@
}
- this.processOptions(
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::processOptions;
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsKeysOnly : this::processOptions;
+ processor.accept(
new Options.FieldAccess() {
@Nullable
private String getValue(String p_394210_) {
@@ -1310,6 +_,17 @@
);
compoundtag1.getString("fullscreenResolution").ifPresent(p_389133_ -> this.fullscreenVideoModeString = p_389133_);
KeyMapping.resetMapping();
+
+ if (limited) {
+ this.unknownKeys.clear();
+ } else {
+ var knownKeys = Arrays.stream(this.keyMappings).map(k -> "key_" + k.getName()).collect(Collectors.toSet());
+ for (var entry : compoundtag1.entrySet()) {
+ if (entry.getKey().startsWith("key_") && entry.getValue().asString().isPresent() && !knownKeys.contains(entry.getKey()))
+ this.unknownKeys.put(entry.getKey(), entry.getValue().asString().get());
+ }
+ }
+
} catch (Exception exception) {
LOGGER.error("Failed to load options", (Throwable)exception);
}
@@ -1337,9 +_,11 @@
public void save() {
try (final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) {
printwriter.println("version:" + SharedConstants.getCurrentVersion().getDataVersion().getVersion());
+ var seen = new java.util.HashSet<String>();
this.processOptions(
new Options.FieldAccess() {
public void writePrefix(String p_168491_) {
+ seen.add(p_168491_);
printwriter.print(p_168491_);
printwriter.print(':');
}
@@ -1395,6 +_,12 @@
if (s != null) {
printwriter.println("fullscreenResolution:" + s);
}
+ // Forge add any unknown keys so that Mods can add keybindings between vanilla loading/saving its config.
+ for (var entry : this.unknownKeys.entrySet()) {
+ if (!seen.contains(entry.getKey()))
+ printwriter.println(entry.getKey() + ":" + entry.getValue());
+ }
+
} catch (Exception exception) {
LOGGER.error("Failed to save options", (Throwable)exception);
}
@@ -1433,6 +_,7 @@
}
@@ -15,7 +15,7 @@
boolean flag1 = flag || optionset.has(optionspec1);
Bootstrap.bootStrap();
ClientBootstrap.bootstrap();
+ if (!loader.run(optionset, path, input, flag, flag1, flag, flag, false))
+ if (!loader.run(optionset, path, input, flag, flag1, flag, flag, true))
+ return;
DataGenerator datagenerator = new DataGenerator(path, SharedConstants.getCurrentVersion(), true);
addClientProviders(datagenerator, flag1);
@@ -9,6 +9,40 @@
private final SubtitleOverlay subtitleOverlay;
private final SpectatorGui spectatorGui;
private final PlayerTabOverlay tabList;
@@ -168,7 +_,7 @@
private int lastBubblePopSoundPlayed;
private float autosaveIndicatorValue;
private float lastAutosaveIndicatorValue;
- private final LayeredDraw layers = new LayeredDraw();
+ private final LayeredDraw layers = new net.minecraftforge.client.gui.overlay.ForgeLayeredDraw(net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.VANILLA_ROOT, net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.COMBINE_LIST);
private float scopeScale;
public Gui(Minecraft p_330021_) {
@@ -180,14 +_,14 @@
this.bossOverlay = new BossHealthOverlay(p_330021_);
this.subtitleOverlay = new SubtitleOverlay(p_330021_);
this.resetTitleTimes();
- LayeredDraw layereddraw = new LayeredDraw()
+ LayeredDraw layereddraw = new net.minecraftforge.client.gui.overlay.ForgeLayeredDraw(net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.PRE_SLEEP_STACK, net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.PRE_LIST)
.add(this::renderCameraOverlays)
.add(this::renderCrosshair)
.add(this::renderHotbarAndDecorations)
.add(this::renderExperienceLevel)
.add(this::renderEffects)
.add((p_325313_, p_342678_) -> this.bossOverlay.render(p_325313_));
- LayeredDraw layereddraw1 = new LayeredDraw()
+ LayeredDraw layereddraw1 = new net.minecraftforge.client.gui.overlay.ForgeLayeredDraw(net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.POST_SLEEP_STACK,net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.POST_LIST)
.add(this::renderDemoOverlay)
.add((p_325315_, p_344521_) -> {
if (this.debugOverlay.showDebugScreen()) {
@@ -204,6 +_,7 @@
.add(layereddraw, () -> !p_330021_.options.hideGui)
.add(this::renderSleepOverlay)
.add(layereddraw1, () -> !p_330021_.options.hideGui);
+ ((net.minecraftforge.client.gui.overlay.ForgeLayeredDraw) layers).resolveLayers();
}
public void resetTitleTimes() {
@@ -347,7 +_,7 @@
Window window = this.minecraft.getWindow();
int i = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
@@ -33,25 +33,17 @@
.tooltip(tooltip)
.build()
)
@@ -289,6 +_,7 @@
if ((i & -67108864) != 0) {
super.render(p_282860_, p_281753_, p_283539_, p_282628_);
this.logoRenderer.renderLogo(p_282860_, this.width, f);
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.font, this.width, this.height, i);
if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) {
this.splash.render(p_282860_, this.width, this.font, i);
}
@@ -304,10 +_,18 @@
s = s + I18n.get("menu.modded");
}
- p_282860_.drawString(this.font, s, 2, this.height - 10, 16777215 | i);
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brd, brdline) ->
+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | i)
+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | i)
+ );
+
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brd, brdline) ->
+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | i)
+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | i)
+ );
+
if (this.realmsNotificationsEnabled() && f >= 1.0F) {
@@ -177,7 +177,7 @@
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
- if (creativemodetab.getType() != CreativeModeTab.Type.SEARCH && creativemodetab.contains(p_281769_)) {
+ if (creativemodetab.hasSearchBar() && creativemodetab.contains(p_281769_)) {
+ if (!creativemodetab.hasSearchBar() && creativemodetab.contains(p_281769_)) {
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
}
}
@@ -62,7 +62,7 @@
public void playSeededSound(
@Nullable Entity p_263536_, Entity p_396496_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_
) {
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.minecraft.level, p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_263518_ = event.getSound();
+ p_263487_ = event.getSource();
@@ -14,7 +14,7 @@
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
- this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), p_108651_, this.getSoundSource(), p_108652_, p_108653_, false);
+ var holder = net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(p_108651_);
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, holder, this.getSoundSource(), p_108652_, p_108653_);
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.level(), this, holder, this.getSoundSource(), p_108652_, p_108653_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), event.getSound().get(), event.getSource(), event.getNewVolume(), event.getNewPitch(), false);
+
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/block/BlockModelShaper.java
+++ b/net/minecraft/client/renderer/block/BlockModelShaper.java
@@ -17,8 +_,13 @@
@@ -17,8 +_,15 @@
this.modelManager = p_110880_;
}
@@ -11,7 +11,9 @@
+ }
+
+ public TextureAtlasSprite getParticleIcon(BlockState p_110883_, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) {
+ return this.getBlockModel(p_110883_).particleIcon(level.getModelDataManager().getAt(pos));
+ net.minecraftforge.client.model.data.ModelData data = level.getModelDataManager().getAtOrEmpty(pos);
+ BlockStateModel model = this.getBlockModel(p_110883_);
+ return model.particleIcon(model.getModelData(level, pos, p_110883_, data));
}
public BlockStateModel getBlockModel(BlockState p_110894_) {
@@ -0,0 +1,11 @@
--- a/net/minecraft/core/BlockPos.java
+++ b/net/minecraft/core/BlockPos.java
@@ -31,7 +_,7 @@
import org.slf4j.Logger;
@Immutable
-public class BlockPos extends Vec3i {
+public class BlockPos extends Vec3i implements net.minecraftforge.common.extensions.IForgeBlockPos {
public static final Codec<BlockPos> CODEC = Codec.INT_STREAM
.<BlockPos>comapFlatMap(
p_325638_ -> Util.fixedSize(p_325638_, 3).map(p_175270_ -> new BlockPos(p_175270_[0], p_175270_[1], p_175270_[2])),
@@ -1,5 +1,14 @@
--- a/net/minecraft/core/MappedRegistry.java
+++ b/net/minecraft/core/MappedRegistry.java
@@ -30,6 +_,8 @@
import net.minecraft.util.RandomSource;
public class MappedRegistry<T> implements WritableRegistry<T> {
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger();
+ private static final org.apache.logging.log4j.Marker MARKER = net.minecraftforge.registries.ForgeRegistry.REGISTRIES;
private final ResourceKey<? extends Registry<T>> key;
private final ObjectList<Holder.Reference<T>> byId = new ObjectArrayList<>(256);
private final Reference2IntMap<T> toId = Util.make(new Reference2IntOpenHashMap<>(), p_308420_ -> p_308420_.defaultReturnValue(-1));
@@ -85,6 +_,7 @@
@Override
@@ -35,6 +44,32 @@
}
if (this.allTags.isBound()) {
@@ -304,8 +_,9 @@
.sorted()
.toList();
if (!list1.isEmpty()) {
- throw new IllegalStateException("Unbound tags in registry " + this.key() + ": " + list1);
- } else {
+ LOGGER.debug(MARKER, "Unbound tags in registry " + this.key() + ": " + list1);
+ bindAllUnboundTagsToEmpty();
+ } /* else */ {
this.allTags = MappedRegistry.TagSet.fromMap(this.frozenTags);
this.refreshTagsInHolders();
return this;
@@ -315,6 +_,13 @@
}
}
+ private void bindAllUnboundTagsToEmpty() {
+ for (var tag : this.frozenTags.values()) {
+ if (!tag.isBound())
+ tag.bind(List.of());
+ }
+ }
+
@Override
public Holder.Reference<T> createIntrusiveHolder(T p_205915_) {
if (this.unregisteredIntrusiveHolders == null) {
@@ -389,6 +_,31 @@
};
}
@@ -1,6 +1,50 @@
--- a/net/minecraft/core/RegistrySetBuilder.java
+++ b/net/minecraft/core/RegistrySetBuilder.java
@@ -74,6 +_,10 @@
@@ -22,7 +_,8 @@
import net.minecraft.tags.TagKey;
import org.apache.commons.lang3.mutable.MutableObject;
-public class RegistrySetBuilder {
+public class RegistrySetBuilder implements net.minecraftforge.common.extensions.IForgeRegistrySetBuilder {
+ private final it.unimi.dsi.fastutil.objects.Object2IntMap<ResourceKey<? extends Registry<?>>> indexes = new it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap<>();
private final List<RegistrySetBuilder.RegistryStub<?>> entries = new ArrayList<>();
static <T> HolderGetter<T> wrapContextLookup(final HolderLookup.RegistryLookup<T> p_255625_) {
@@ -66,14 +_,43 @@
public <T> RegistrySetBuilder add(
ResourceKey<? extends Registry<T>> p_256446_, Lifecycle p_256394_, RegistrySetBuilder.RegistryBootstrap<T> p_256638_
) {
- this.entries.add(new RegistrySetBuilder.RegistryStub<>(p_256446_, p_256394_, p_256638_));
+ add(new RegistrySetBuilder.RegistryStub<>(p_256446_, p_256394_, p_256638_));
return this;
}
+ // Forge: This merges two entries in this builder together, so that we can reuse vanilla boostrap methods, or potentially other modder's methods.
+ private <T> RegistrySetBuilder.RegistryStub<T> add(RegistrySetBuilder.RegistryStub<T> entry) {
+ int idx = indexes.getOrDefault(entry.key(), -1);
+ if (idx != -1) {
+ var _oldB = ((RegistrySetBuilder.RegistryStub<T>)this.entries.get(idx)).bootstrap();
+ var _newB = entry.bootstrap();
+ var _new = new RegistrySetBuilder.RegistryStub<>(entry.key(), entry.lifecycle(), ctx -> {
+ _oldB.run(ctx);
+ _newB.run(ctx);
+ });
+ this.entries.set(idx, _new);
+ return _new;
+ } else {
+ this.indexes.put(entry.key(), this.entries.size());
+ this.entries.add(entry);
+ return entry;
+ }
+ }
+
+ public RegistrySetBuilder copy() {
+ var ret = new RegistrySetBuilder();
+ this.entries.forEach(ret::add);
+ return ret;
+ }
+
public <T> RegistrySetBuilder add(ResourceKey<? extends Registry<T>> p_256261_, RegistrySetBuilder.RegistryBootstrap<T> p_256010_) {
return this.add(p_256261_, Lifecycle.stable(), p_256010_);
}
@@ -14,7 +14,7 @@
boolean flag2 = flag || optionset.has(optionspec2);
boolean flag3 = flag || optionset.has(optionspec3);
Collection<Path> collection = optionset.valuesOf(optionspec6).stream().map(p_129659_ -> Paths.get(p_129659_)).toList();
+ if (!loader.run(optionset, path, collection, flag1, flag, flag2, flag3, false))
+ if (!loader.run(optionset, path, collection, flag1, flag, flag2, flag3, true))
+ return;
DataGenerator datagenerator = new DataGenerator(path, SharedConstants.getCurrentVersion(), true);
addServerProviders(datagenerator, collection, flag1, flag2, flag3);
@@ -36,7 +36,18 @@
PackOutput.PathProvider packoutput$pathprovider = this.output.createRegistryElementsPathProvider(resourcekey);
return CompletableFuture.allOf(
p_358460_.listElements()
+ .filter(holder -> this.namespacePredicate.test(holder.key().location().getNamespace()))
+ .filter(holder -> shouldDump(holder.key()))
.map(
p_256105_ -> dumpValue(
packoutput$pathprovider.json(p_256105_.key().location()),
@@ -65,6 +_,10 @@
);
}
);
+ }
+
+ protected boolean shouldDump(ResourceKey<?> key) {
+ return this.namespacePredicate.test(key.location().getNamespace());
}
private static <E> CompletableFuture<?> dumpValue(
@@ -8,3 +8,13 @@
private static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderLookup.Provider p_256242_) {
validateThatAllBiomeFeaturesHaveBiomeFilter(p_256242_.lookupOrThrow(Registries.PLACED_FEATURE), p_256242_.lookupOrThrow(Registries.BIOME));
@@ -119,5 +_,9 @@
HolderLookup.Provider holderlookup$provider = BUILDER.build(registryaccess$frozen);
validateThatAllBiomeFeaturesHaveBiomeFilter(holderlookup$provider);
return holderlookup$provider;
+ }
+
+ public static RegistrySetBuilder builder() {
+ return BUILDER.copy();
}
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/gametest/Main.java
+++ b/net/minecraft/gametest/Main.java
@@ -7,6 +_,8 @@
public class Main {
@DontObfuscate
public static void main(String[] p_393417_) throws Exception {
+ System.setProperty("forge.enableGameTest", "true");
+ System.setProperty("forge.gameTestServer", "true");
SharedConstants.tryDetectVersion();
GameTestMainUtil.runGameTestServer(p_393417_, p_393535_ -> {});
}
@@ -0,0 +1,10 @@
--- a/net/minecraft/gametest/framework/GameTestMainUtil.java
+++ b/net/minecraft/gametest/framework/GameTestMainUtil.java
@@ -69,6 +_,7 @@
Bootstrap.bootStrap();
Util.startTimerHackThread();
+ net.minecraftforge.server.loading.ServerModLoader.load();
String s = optionset.valueOf(universe);
createOrResetDir(s);
p_393652_.accept(s);
@@ -1,18 +1,9 @@
--- a/net/minecraft/resources/DelegatingOps.java
+++ b/net/minecraft/resources/DelegatingOps.java
@@ -218,12 +_,30 @@
@Override
public ListBuilder<T> listBuilder() {
- return new DelegatingOps.DelegateListBuilder(this.delegate.listBuilder());
+ return new ListBuilder.Builder<>(this);
@@ -226,6 +_,24 @@
return new DelegatingOps.DelegateRecordBuilder(this.delegate.mapBuilder());
}
@Override
public RecordBuilder<T> mapBuilder() {
return new DelegatingOps.DelegateRecordBuilder(this.delegate.mapBuilder());
+ }
+
+ // Forge start
+ java.util.Map<ResourceLocation, Object> ctx = new java.util.HashMap<>();
+
@@ -29,6 +20,8 @@
+ public <R> R withContext(ResourceLocation key, Object ctx) {
+ this.ctx.put(key, ctx);
+ return (R)this;
}
+ }
+
protected class DelegateListBuilder implements ListBuilder<T> {
private final ListBuilder<T> original;
@@ -143,7 +143,7 @@
public void playSeededSound(
@Nullable Entity p_392657_, Entity p_394285_, Holder<SoundEvent> p_263412_, SoundSource p_263338_, float p_263352_, float p_263390_, long p_263403_
) {
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_394285_, p_263412_, p_263338_, p_263352_, p_263390_);
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_394285_.level(), p_394285_, p_263412_, p_263338_, p_263352_, p_263390_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_263412_ = event.getSound();
+ p_263338_ = event.getSource();
@@ -0,0 +1,10 @@
--- a/net/minecraft/server/level/ThreadedLevelLightEngine.java
+++ b/net/minecraft/server/level/ThreadedLevelLightEngine.java
@@ -171,6 +_,7 @@
}, () -> "lightChunk " + chunkpos + " " + p_9355_));
return CompletableFuture.supplyAsync(() -> {
p_9354_.setLightCorrect(true);
+ net.minecraftforge.common.ForgeHooks.fireLightingCalculatedEvent(p_9354_);
return p_9354_;
}, p_280982_ -> this.addTask(chunkpos.x, chunkpos.z, ThreadedLevelLightEngine.TaskType.POST_UPDATE, p_280982_));
}
@@ -307,7 +307,7 @@
public boolean isPushedByFluid() {
return true;
}
@@ -3325,9 +_,17 @@
@@ -3325,9 +_,26 @@
return Mth.lerp(p_344421_, this.yRotO, this.yRot);
}
@@ -317,20 +317,32 @@
+ if(p_204032_ == FluidTags.WATER) return this.isInFluidType(net.minecraftforge.common.ForgeMod.WATER_TYPE.get());
+ else if (p_204032_ == FluidTags.LAVA) return this.isInFluidType(net.minecraftforge.common.ForgeMod.LAVA_TYPE.get());
+ else return false;
+ }
+ }
+
+ public void updateFluidHeightAndDoFluidPushing(Predicate<FluidState> shouldUpdate) {
+ private static final class FluidCalcs {
+ double height = 0.0D;
+ Vec3 direction = Vec3.ZERO;
+ int count = 0;
+ double height(double height) {
+ return (this.height = this.height >= height ? this.height : height);
+ }
+ }
+
+ public void updateFluidHeightAndDoFluidPushing(Predicate<FluidState> shouldUpdate) {
if (this.touchingUnloadedChunk()) {
- return false;
+ return;
} else {
AABB aabb = this.getBoundingBox().deflate(0.001);
int i = Mth.floor(aabb.minX);
@@ -3342,25 +_,28 @@
Vec3 vec3 = Vec3.ZERO;
int k1 = 0;
@@ -3339,28 +_,32 @@
double d0 = 0.0;
boolean flag = this.isPushedByFluid();
boolean flag1 = false;
- Vec3 vec3 = Vec3.ZERO;
- int k1 = 0;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
+ var interimCalcs = new it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<net.minecraftforge.fluids.FluidType, org.apache.commons.lang3.tuple.MutableTriple<Double, Vec3, Integer>>(net.minecraftforge.fluids.FluidType.SIZE.get() - 1);
+ it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<net.minecraftforge.fluids.FluidType, FluidCalcs> fluidPushCalcs = null;
for (int l1 = i; l1 < j; l1++) {
for (int i2 = k; i2 < l; i2++) {
@@ -344,60 +356,51 @@
if (d1 >= aabb.minY) {
flag1 = true;
- d0 = Math.max(d1 - aabb.minY, d0);
- if (flag) {
+ var interim = interimCalcs.computeIfAbsent(fluidType, t -> org.apache.commons.lang3.tuple.MutableTriple.of(0.0D, Vec3.ZERO, 0));
+ interim.setLeft(Math.max(d1 - aabb.minY, interim.getLeft()));
+ if (this.isPushedByFluid(fluidType)) {
+ if (fluidPushCalcs == null)
+ fluidPushCalcs = new it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<net.minecraftforge.fluids.FluidType, FluidCalcs>(2);
+ var interim = fluidPushCalcs.computeIfAbsent(fluidType, type -> new FluidCalcs());
+ d0 = interim.height(d1 - aabb.minY);
+ flag = this.isPushedByFluid(fluidType);
if (flag) {
Vec3 vec31 = fluidstate.getFlow(this.level(), blockpos$mutableblockpos);
- if (d0 < 0.4) {
- vec31 = vec31.scale(d0);
+ if (interim.getLeft() < 0.4D) {
+ vec31 = vec31.scale(interim.getLeft());
if (d0 < 0.4) {
vec31 = vec31.scale(d0);
}
- vec3 = vec3.add(vec31);
- k1++;
+ interim.setMiddle(interim.getMiddle().add(vec31));
+ interim.setRight(interim.getRight() + 1);
+ interim.direction = interim.direction.add(vec31);
+ interim.count++;
}
}
}
@@ -3368,27 +_,28 @@
@@ -3368,6 +_,10 @@
}
}
- if (vec3.length() > 0.0) {
- if (k1 > 0) {
- vec3 = vec3.scale(1.0 / k1);
+ interimCalcs.forEach((fluidType, interim) -> {
+ if (interim.getMiddle().length() > 0.0D) {
+ if (interim.getRight() > 0) {
+ interim.setMiddle(interim.getMiddle().scale(1.0D / (double)interim.getRight()));
}
if (!(this instanceof Player)) {
- vec3 = vec3.normalize();
+ interim.setMiddle(interim.getMiddle().normalize());
+ if (fluidPushCalcs == null) return;
+ for (var entry : fluidPushCalcs.entrySet()) {
+ var vec3 = entry.getValue().direction;
+ var k1 = entry.getValue().count;
if (vec3.length() > 0.0) {
if (k1 > 0) {
vec3 = vec3.scale(1.0 / k1);
@@ -3378,6 +_,7 @@
}
Vec3 vec32 = this.getDeltaMovement();
- vec3 = vec3.scale(p_204033_);
+ interim.setMiddle(interim.getMiddle().scale(this.getFluidMotionScale(fluidType)));
+ var p_204033_ = this.getFluidMotionScale(entry.getKey());
vec3 = vec3.scale(p_204033_);
double d2 = 0.003;
- if (Math.abs(vec32.x) < 0.003 && Math.abs(vec32.z) < 0.003 && vec3.length() < 0.0045000000000000005) {
- vec3 = vec3.normalize().scale(0.0045000000000000005);
+ if (Math.abs(vec32.x) < 0.003 && Math.abs(vec32.z) < 0.003 && interim.getMiddle().length() < 0.0045000000000000005) {
+ interim.setMiddle(interim.getMiddle().normalize().scale(0.0045000000000000005));
}
- this.setDeltaMovement(this.getDeltaMovement().add(vec3));
+ this.setDeltaMovement(this.getDeltaMovement().add(interim.getMiddle()));
if (Math.abs(vec32.x) < 0.003 && Math.abs(vec32.z) < 0.003 && vec3.length() < 0.0045000000000000005) {
@@ -3387,8 +_,8 @@
this.setDeltaMovement(this.getDeltaMovement().add(vec3));
}
- this.fluidHeight.put(p_204032_, d0);
- return flag1;
+ this.setFluidTypeHeight(fluidType, interim.getLeft());
+ });
+ this.setFluidTypeHeight(entry.getKey(), entry.getValue().height);
+ }
}
}
@@ -1,15 +1,43 @@
--- a/net/minecraft/world/item/AxeItem.java
+++ b/net/minecraft/world/item/AxeItem.java
@@ -62,7 +_,8 @@
@@ -62,7 +_,7 @@
if (playerHasBlockingItemUseIntent(p_40529_)) {
return InteractionResult.PASS;
} else {
- Optional<BlockState> optional = this.evaluateNewBlockState(level, blockpos, player, level.getBlockState(blockpos));
+ var modded = level.getBlockState(blockpos).getToolModifiedState(p_40529_, net.minecraftforge.common.ToolActions.AXE_STRIP, false);
+ Optional<BlockState> optional = modded != null ? Optional.of(modded) : this.evaluateNewBlockState(level, blockpos, player, level.getBlockState(blockpos));
+ Optional<BlockState> optional = this.evaluateNewBlockState(level, blockpos, player, level.getBlockState(blockpos), p_40529_);
if (optional.isEmpty()) {
return InteractionResult.PASS;
} else {
@@ -88,18 +_,25 @@
}
private Optional<BlockState> evaluateNewBlockState(Level p_312809_, BlockPos p_313114_, @Nullable Player p_312029_, BlockState p_311198_) {
- Optional<BlockState> optional = this.getStripped(p_311198_);
+ return this.evaluateNewBlockState(p_312809_, p_313114_, p_312029_, p_311198_, null);
+ }
+
+ private Optional<BlockState> evaluateNewBlockState(Level p_312809_, BlockPos p_313114_, @Nullable Player p_312029_, BlockState p_311198_, @Nullable UseOnContext ctx) {
+ var strip = ctx == null ? null : p_311198_.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_STRIP, false);
+ Optional<BlockState> optional = strip != null ? Optional.of(strip) : this.getStripped(p_311198_);
if (optional.isPresent()) {
p_312809_.playSound(p_312029_, p_313114_, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);
return optional;
} else {
- Optional<BlockState> optional1 = WeatheringCopper.getPrevious(p_311198_);
+ var scrape = ctx == null ? null : p_311198_.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_STRIP, false);
+ Optional<BlockState> optional1 = scrape != null ? Optional.of(scrape) : WeatheringCopper.getPrevious(p_311198_);
if (optional1.isPresent()) {
p_312809_.playSound(p_312029_, p_313114_, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F);
p_312809_.levelEvent(p_312029_, 3005, p_313114_, 0);
return optional1;
} else {
- Optional<BlockState> optional2 = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(p_311198_.getBlock()))
+ var waxOff = ctx == null ? null : p_311198_.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_WAX_OFF, false);
+ Optional<BlockState> optional2 = waxOff != null ? Optional.of(waxOff) : Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(p_311198_.getBlock()))
.map(p_150694_ -> p_150694_.withPropertiesOf(p_311198_));
if (optional2.isPresent()) {
p_312809_.playSound(p_312029_, p_313114_, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F);
@@ -115,5 +_,21 @@
private Optional<BlockState> getStripped(BlockState p_150691_) {
return Optional.ofNullable(STRIPPABLES.get(p_150691_.getBlock()))
@@ -21,7 +49,7 @@
+ return net.minecraftforge.common.ToolActions.DEFAULT_AXE_ACTIONS.contains(toolAction);
+ }
+
+ @org.jetbrains.annotations.Nullable
+ @Nullable
+ public static BlockState getAxeStrippingState(BlockState originalState) {
+ Block block = STRIPPABLES.get(originalState.getBlock());
+ return block != null ? block.defaultBlockState().setValue(RotatedPillarBlock.AXIS, originalState.getValue(RotatedPillarBlock.AXIS)) : null;
@@ -108,7 +108,7 @@
}
public boolean hasDynamicShape() {
@@ -556,5 +_,74 @@
@@ -556,5 +_,78 @@
public int hashCode() {
return System.identityHashCode(this.first) * 31 + System.identityHashCode(this.second);
}
@@ -148,18 +148,22 @@
+ return state.is(Blocks.CACTUS) || state.is(BlockTags.SAND);
+ } else if (plant.getBlock() == Blocks.SUGAR_CANE && this == Blocks.SUGAR_CANE) {
+ return true;
+ } else if (plantable instanceof BushBlock bush && bush.mayPlaceOn(state, world, pos)) {
+ } else if (plantable instanceof VegetationBlock veg && veg.mayPlaceOn(state, world, pos)) {
+ return true;
+ } else if (net.minecraftforge.common.PlantType.DESERT.equals(type)) {
+ return state.is(BlockTags.SAND) || this == Blocks.TERRACOTTA || this instanceof GlazedTerracottaBlock;
+ return state.is(BlockTags.SAND) || state.is(BlockTags.TERRACOTTA) || state.is(BlockTags.DIRT);
+ } else if (net.minecraftforge.common.PlantType.NETHER.equals(type)) {
+ return this == Blocks.SOUL_SAND;
+ } else if (net.minecraftforge.common.PlantType.FUNGUS.equals(type)) {
+ return state.is(BlockTags.NYLIUM) || this == Blocks.MYCELIUM || this == Blocks.SOUL_SOIL;
+ } else if (net.minecraftforge.common.PlantType.CROP.equals(type)) {
+ return state.is(Blocks.FARMLAND);
+ } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) {
+ return state.isFaceSturdy(world, pos, Direction.UP);
+ return state.isFaceSturdy(world, pos, Direction.UP) && state.canOcclude();
+ } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) {
+ return state.is(BlockTags.DIRT) || this == Blocks.FARMLAND;
+ return state.is(BlockTags.DIRT) || this == Blocks.FARMLAND;
+ } else if (net.minecraftforge.common.PlantType.MOIST.equals(type)) {
+ return state.is(BlockTags.DIRT) || this == Blocks.CLAY || this == Blocks.FARMLAND;
+ } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) {
+ return (state.is(Blocks.WATER) || state.getBlock() instanceof IceBlock) && world.getFluidState(pos.relative(facing)).isEmpty();
+ } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) {
@@ -0,0 +1,33 @@
--- a/net/minecraft/world/level/block/CrafterBlock.java
+++ b/net/minecraft/world/level/block/CrafterBlock.java
@@ -185,12 +_,15 @@
ServerLevel p_336186_, BlockPos p_312358_, CrafterBlockEntity p_309887_, ItemStack p_310474_, BlockState p_310667_, RecipeHolder<?> p_329387_
) {
Direction direction = p_310667_.getValue(ORIENTATION).front();
+ var itemhandler = net.minecraftforge.items.VanillaInventoryCodeHooks.getItemHandler(p_336186_, p_312358_.relative(direction), direction.getOpposite()).orElse(null);
Container container = HopperBlockEntity.getContainerAt(p_336186_, p_312358_.relative(direction));
ItemStack itemstack = p_310474_.copy();
if (container != null && (container instanceof CrafterBlockEntity || p_310474_.getCount() > container.getMaxStackSize(p_310474_))) {
while (!itemstack.isEmpty()) {
ItemStack itemstack2 = itemstack.copyWithCount(1);
ItemStack itemstack1 = HopperBlockEntity.addItem(p_309887_, container, itemstack2, direction.getOpposite());
+ if (itemhandler != null && !itemstack1.isEmpty()) // Vanilla insert failed, try IItemHandler
+ itemstack1 = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, itemstack1, false);
if (!itemstack1.isEmpty()) {
break;
}
@@ -201,10 +_,14 @@
while (!itemstack.isEmpty()) {
int i = itemstack.getCount();
itemstack = HopperBlockEntity.addItem(p_309887_, container, itemstack, direction.getOpposite());
+ if (itemhandler != null && i == itemstack.getCount()) // Vanilla insert failed, try IItemHandler
+ itemstack = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, itemstack, false);
if (i == itemstack.getCount()) {
break;
}
}
+ } else {
+ itemstack = net.minecraftforge.items.ItemHandlerHelper.insertItem(itemhandler, itemstack, false);
}
if (!itemstack.isEmpty()) {
@@ -17,15 +17,6 @@
}
public LevelChunk(ServerLevel p_196850_, ProtoChunk p_196851_, @Nullable LevelChunk.PostLoadProcessor p_196852_) {
@@ -291,7 +_,7 @@
profilerfiller.pop();
}
- boolean flag4 = !blockstate.is(block);
+ boolean flag4 = !blockstate.is(block) || !p_62866_.hasBlockEntity();
boolean flag2 = (p_393998_ & 64) != 0;
boolean flag3 = (p_393998_ & 256) == 0;
if (flag4 && blockstate.hasBlockEntity()) {
@@ -312,7 +_,7 @@
if (!levelchunksection.getBlockState(j, k, l).is(block)) {
return null;
@@ -0,0 +1,11 @@
--- a/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -56,7 +_,7 @@
private static <T, C extends PalettedContainerRO<T>> Codec<C> codec(
IdMap<T> p_238428_, Codec<T> p_238429_, PalettedContainer.Strategy p_238430_, T p_238431_, PalettedContainerRO.Unpacker<T, C> p_238432_
) {
- return RecordCodecBuilder.<PalettedContainerRO.PackedData>create(
+ return RecordCodecBuilder.<PalettedContainerRO.PackedData<T>>create(
p_327417_ -> p_327417_.group(
p_238429_.mapResult(ExtraCodecs.orElsePartial(p_238431_)).listOf().fieldOf("palette").forGetter(PalettedContainerRO.PackedData::paletteEntries),
Codec.LONG_STREAM.lenientOptionalFieldOf("data").forGetter(PalettedContainerRO.PackedData::storage)
@@ -0,0 +1,10 @@
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java
@@ -76,6 +_,7 @@
}
builder.add(new StructureTemplateManager.Source(this::loadFromResource, this::listResources));
+ builder.add(new StructureTemplateManager.Source(net.minecraftforge.common.ForgeHooks::createEmptyStructure, Stream::empty));
this.sources = builder.build();
}
+4 -4
View File
@@ -27,12 +27,12 @@ dependencyResolutionManagement {
library('forgespi', 'net.minecraftforge:forgespi:7.1.5') // Needs modlauncher
library('modlauncher', 'net.minecraftforge:modlauncher:10.2.4') // Needs securemodules
library('securemodules', 'net.minecraftforge:securemodules:2.2.21') // Needs unsafe
library('securemodules', 'net.minecraftforge:securemodules:2.2.24') // Needs unsafe
library('unsafe', 'net.minecraftforge:unsafe:0.9.2')
library('accesstransformers', 'net.minecraftforge:accesstransformers:8.2.2')
library('coremods', 'net.minecraftforge:coremods:5.2.6')
library('nashorn', 'org.openjdk.nashorn:nashorn-core:15.4') // Needed by coremods, because the JRE no longer ships JS
library('eventbus', 'net.minecraftforge:eventbus:6.2.27')
library('eventbus', 'net.minecraftforge:eventbus:6.2.32')
library('typetools', 'net.jodah:typetools:0.6.3') // Needed by EventBus because of lambdas
library('mergetool-api', 'net.minecraftforge:mergetool-api:1.0')
@@ -52,7 +52,7 @@ dependencyResolutionManagement {
library('bootstrap-shim', 'net.minecraftforge', 'bootstrap-shim').versionRef('bootstrap')
// ASM it's used for so many of our hacks
version('asm', '9.7.1')
version('asm', '9.9.1')
library('asm', 'org.ow2.asm', 'asm' ).versionRef('asm')
library('asm-tree', 'org.ow2.asm', 'asm-tree' ).versionRef('asm')
library('asm-util', 'org.ow2.asm', 'asm-util' ).versionRef('asm')
@@ -124,7 +124,7 @@ include ':forge'
project(":forge").projectDir = file("projects/forge")
project(':forge').buildFileName = '../../build_forge.gradle'
if (!System.env.TEAMCITY_VERSION) {
if (false && !System.env.TEAMCITY_VERSION) {
include ':clean'
project(':clean').projectDir = file('projects/clean')
project(':clean').buildFileName = '../../build_clean.gradle'
@@ -108,7 +108,11 @@ public class ClientCommandHandler {
new CommandSource() {
@Override
public void sendSystemMessage(Component message) {
mc.gui.getChat().addMessage(message);
var chat = mc.gui.getChat();
if (mc.isSameThread())
chat.addMessage(message);
else
mc.execute(() -> chat.addMessage(message));
}
@Override
@@ -27,7 +27,6 @@ import net.minecraft.client.gui.components.ChatComponent;
import net.minecraft.client.gui.components.LerpingBossEvent;
import net.minecraft.client.gui.screens.ConfirmScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner;
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
@@ -50,7 +49,6 @@ import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
import net.minecraft.client.renderer.texture.SpriteContents;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.resources.metadata.animation.FrameSize;
import net.minecraft.client.resources.model.ModelBaker;
import net.minecraft.client.resources.model.ModelBakery;
@@ -132,7 +130,6 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.IExtensionPoint;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModLoader;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.network.NetworkContext;
import net.minecraftforge.network.NetworkInitialization;
import net.minecraftforge.network.NetworkRegistry;
@@ -293,50 +290,6 @@ public class ForgeHooksClient {
}
}
/**
* Initialization of Forge Renderers.
*/
static {
//FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId();
//RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
}
private static VersionChecker.Status getForgeVersionStatus() {
final class LazyInit {
private static final VersionChecker.Status INSTANCE = ForgeVersion.getStatus();
static {
forgeStatusLine = switch (INSTANCE) {
// case FAILED -> " Version check failed";
// case UP_TO_DATE -> "Forge up to date";
// case AHEAD -> "Using non-recommended Forge build, issues may arise.";
case OUTDATED, BETA_OUTDATED -> I18n.get("forge.update.newversion", ForgeVersion.getTarget());
default -> null;
};
}
private LazyInit() {}
}
return LazyInit.INSTANCE;
}
// NO-OP method, kept for bin-compat. Used in TitleScreen.java
@Deprecated(forRemoval = true, since = "1.21.4")
public static void renderMainMenu(TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha) {
/*
VersionChecker.Status status = getForgeVersionStatus();
if (status == VersionChecker.Status.BETA || status == VersionChecker.Status.BETA_OUTDATED) {
// Render a warning at the top of the screen
Component line = Component.translatable("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED);
graphics.drawCenteredString(font, line, width / 2, 4, 0xFFFFFF | alpha);
line = Component.translatable("forge.update.beta.2");
graphics.drawCenteredString(font, line, width / 2, 4 + (font.lineHeight + 1), 0xFFFFFF | alpha);
}
*/
}
public static String forgeStatusLine;
@Nullable
@@ -412,7 +412,8 @@ public enum ForgeRenderTypes {
/**
* Use {@link #TEXT_INTENSITY_SEE_THROUGH} instead.
*/
@Deprecated
@SuppressWarnings("unused")
@Deprecated(forRemoval = true, since = "1.21.5")
public static Function<ResourceLocation, RenderType> TEXT_INTENSITY_SEETHROUGH = TEXT_INTENSITY_SEE_THROUGH;
private static RenderType getTextIntensitySeeThrough(ResourceLocation locationIn) {
return create(
@@ -0,0 +1,40 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.client.event;
import net.minecraftforge.client.gui.overlay.ForgeLayeredDraw;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.event.IModBusEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Fired when the {@linkplain ForgeLayeredDraw#VANILLA_ROOT}'s order is resolved during{@link ForgeLayeredDraw#resolveLayers().
* This can be used to add additional or move gui layers and entire layer stacks as needed.
*
* <p> This event is not {@linkplain net.minecraftforge.eventbus.api.Cancelable cancellable} and does not {@linkplain net.minecraftforge.eventbus.api.Event.HasResult have a result}</p>
*
* <p> This event is fired on the {@linkplain IModBusEvent mod event bus},
* only on the {@linkplain net.minecraftforge.fml.LogicalSide logical client}.</p>
*/
public final class AddGuiOverlayLayersEvent extends Event implements IModBusEvent {
@NotNull
private final ForgeLayeredDraw layeredDraw;
@ApiStatus.Internal
public AddGuiOverlayLayersEvent(ForgeLayeredDraw layeredDraw) {
this.layeredDraw = layeredDraw;
}
/**
* Get the layered draw.
* @return the draw layer stack
*/
@NotNull
public ForgeLayeredDraw getLayeredDraw() {
return layeredDraw;
}
}
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.ApiStatus;
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
**/
@Cancelable
public class ClientChatEvent extends Event
public final class ClientChatEvent extends Event
{
private String message;
private final String originalMessage;
@@ -29,7 +29,7 @@ import java.util.UUID;
* @see ChatType
*/
@Cancelable
public class ClientChatReceivedEvent extends Event {
public sealed class ClientChatReceivedEvent extends Event {
private Component message;
private final ChatType.Bound boundChatType;
private final UUID sender;
@@ -94,7 +94,7 @@ public class ClientChatReceivedEvent extends Event {
*
* @see ChatType
*/
public static class Player extends ClientChatReceivedEvent {
public static final class Player extends ClientChatReceivedEvent {
private final PlayerChatMessage playerChatMessage;
@ApiStatus.Internal
@@ -119,7 +119,7 @@ public class ClientChatReceivedEvent extends Event {
* So moved to it's own event. {@link SystemMessageReceivedEvent}
*/
@Deprecated(forRemoval = true, since = "1.21.1")
public static class System extends ClientChatReceivedEvent {
public static final class System extends ClientChatReceivedEvent {
private final boolean overlay;
@ApiStatus.Internal
@@ -21,7 +21,7 @@ import net.minecraftforge.fml.LogicalSide;
* @see ClientPauseChangeEvent.Pre
* @see ClientPauseChangeEvent.Post
*/
public abstract class ClientPauseChangeEvent extends Event {
public abstract sealed class ClientPauseChangeEvent extends Event {
private final boolean pause;
public ClientPauseChangeEvent(boolean pause) {
@@ -38,7 +38,7 @@ public abstract class ClientPauseChangeEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends ClientPauseChangeEvent {
public static final class Pre extends ClientPauseChangeEvent {
public Pre(boolean pause) {
super(pause);
@@ -53,7 +53,7 @@ public abstract class ClientPauseChangeEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends ClientPauseChangeEvent {
public static final class Post extends ClientPauseChangeEvent {
public Post(boolean pause) {
super(pause);
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.ApiStatus;
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class ClientPlayerChangeGameTypeEvent extends Event
public final class ClientPlayerChangeGameTypeEvent extends Event
{
private final PlayerInfo info;
private final GameType currentGameType;
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
* @see LoggingOut
* @see Clone
**/
public abstract class ClientPlayerNetworkEvent extends Event {
public abstract sealed class ClientPlayerNetworkEvent extends Event {
private final MultiPlayerGameMode multiPlayerGameMode;
private final LocalPlayer player;
private final Connection connection;
@@ -67,7 +67,7 @@ public abstract class ClientPlayerNetworkEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class LoggingIn extends ClientPlayerNetworkEvent {
public static final class LoggingIn extends ClientPlayerNetworkEvent {
@ApiStatus.Internal
public LoggingIn(final MultiPlayerGameMode controller, final LocalPlayer player, final Connection networkManager) {
super(controller, player, networkManager);
@@ -84,7 +84,7 @@ public abstract class ClientPlayerNetworkEvent extends Event {
*/
@SuppressWarnings("NullableProblems")
// Shush IntelliJ, we override non-nullables as nullables in this specific event; see later comment
public static class LoggingOut extends ClientPlayerNetworkEvent {
public static final class LoggingOut extends ClientPlayerNetworkEvent {
@ApiStatus.Internal
public LoggingOut(@Nullable final MultiPlayerGameMode controller, @Nullable final LocalPlayer player, @Nullable final Connection networkManager) {
//noinspection ConstantConditions we know these are nullable, but we don't want to annotate the super as nullable since this is the only event with nullables
@@ -133,7 +133,7 @@ public abstract class ClientPlayerNetworkEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Clone extends ClientPlayerNetworkEvent {
public static final class Clone extends ClientPlayerNetworkEvent {
private final LocalPlayer oldPlayer;
@ApiStatus.Internal
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
*
* @see ViewportEvent.ComputeFov
*/
public class ComputeFovModifierEvent extends Event {
public final class ComputeFovModifierEvent extends Event {
private final Player player;
private final float fovModifier;
private final float scale;
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see Render.Foreground
* @see Render.Background
*/
public abstract class ContainerScreenEvent extends Event {
public abstract sealed class ContainerScreenEvent extends Event {
private final AbstractContainerScreen<?> containerScreen;
@ApiStatus.Internal
@@ -48,7 +48,7 @@ public abstract class ContainerScreenEvent extends Event {
* @see Foreground
* @see Background
*/
public static abstract class Render extends ContainerScreenEvent {
public static abstract sealed class Render extends ContainerScreenEvent {
private final GuiGraphics guiGraphics;
private final int mouseX;
private final int mouseY;
@@ -94,7 +94,7 @@ public abstract class ContainerScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Foreground extends Render {
public static final class Foreground extends Render {
@ApiStatus.Internal
public Foreground(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) {
super(guiContainer, guiGraphics, mouseX, mouseY);
@@ -110,7 +110,7 @@ public abstract class ContainerScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Background extends Render {
public static final class Background extends Render {
@ApiStatus.Internal
public Background(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) {
super(guiContainer, guiGraphics, mouseX, mouseY);
@@ -11,7 +11,7 @@ import net.minecraft.client.renderer.special.SpecialModelRenderer;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.eventbus.api.Event;
public class CreateSpecialBlockRendererEvent extends Event {
public final class CreateSpecialBlockRendererEvent extends Event {
private final Map<Block, SpecialModelRenderer.Unbaked> map;
public CreateSpecialBlockRendererEvent(Map<Block, SpecialModelRenderer.Unbaked> map) {
@@ -23,7 +23,7 @@ import java.util.List;
* @see DebugText
* @see Chat
*/
public abstract class CustomizeGuiOverlayEvent extends Event {
public abstract sealed class CustomizeGuiOverlayEvent extends Event {
private final Window window;
private final GuiGraphics guiGraphics;
private final float partialTick;
@@ -57,7 +57,7 @@ public abstract class CustomizeGuiOverlayEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class BossEventProgress extends CustomizeGuiOverlayEvent {
public static final class BossEventProgress extends CustomizeGuiOverlayEvent {
private final LerpingBossEvent bossEvent;
private final int x;
private final int y;
@@ -119,7 +119,7 @@ public abstract class CustomizeGuiOverlayEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class DebugText extends CustomizeGuiOverlayEvent {
public static final class DebugText extends CustomizeGuiOverlayEvent {
private final List<String> text;
private final Side side;
@@ -159,7 +159,7 @@ public abstract class CustomizeGuiOverlayEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Chat extends CustomizeGuiOverlayEvent {
public static final class Chat extends CustomizeGuiOverlayEvent {
private int posX;
private int posY;
@@ -53,7 +53,7 @@ import java.util.function.Supplier;
* @see EntityRenderersEvent.RegisterRenderers
* @see EntityRenderersEvent.AddLayers
*/
public abstract class EntityRenderersEvent extends Event implements IModBusEvent {
public abstract sealed class EntityRenderersEvent extends Event implements IModBusEvent {
@ApiStatus.Internal
protected EntityRenderersEvent() {}
@@ -65,7 +65,7 @@ public abstract class EntityRenderersEvent extends Event implements IModBusEvent
* <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 RegisterLayerDefinitions extends EntityRenderersEvent {
public static final class RegisterLayerDefinitions extends EntityRenderersEvent {
@ApiStatus.Internal
public RegisterLayerDefinitions() {}
@@ -93,7 +93,7 @@ public abstract class EntityRenderersEvent extends Event implements IModBusEvent
* <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 RegisterRenderers extends EntityRenderersEvent {
public static final class RegisterRenderers extends EntityRenderersEvent {
@ApiStatus.Internal
public RegisterRenderers() {}
@@ -127,7 +127,7 @@ public abstract class EntityRenderersEvent extends Event implements IModBusEvent
* <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 AddLayers extends EntityRenderersEvent {
public static final class AddLayers extends EntityRenderersEvent {
private final Map<EntityType<?>, EntityRenderer<?, ?>> renderers;
private final Map<PlayerSkin.Model, EntityRenderer<? extends Player, ?>> skinMap;
private final EntityRendererProvider.Context context;
@@ -201,7 +201,7 @@ public abstract class EntityRenderersEvent extends Event implements IModBusEvent
* <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 CreateSkullModels extends EntityRenderersEvent {
public static final class CreateSkullModels extends EntityRenderersEvent {
private final ImmutableMap.Builder<Type, Function<EntityModelSet, SkullModelBase>> builder;
@ApiStatus.Internal
@@ -10,6 +10,7 @@ import java.util.List;
import java.util.Map;
import java.util.function.Function;
import net.minecraftforge.client.gui.overlay.ForgeLayeredDraw;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -303,4 +304,8 @@ public final class ForgeEventFactoryClient {
// This is on the mod bus because it happens during the initial texture reload, which is while the Forge bus is shut down.
return fireModBus(new ModelEvent.RegisterModelStateDefinitions());
}
public static void onComputeLayerOrder(ForgeLayeredDraw layeredDraw) {
fireModBus(new AddGuiOverlayLayersEvent(layeredDraw));
}
}
@@ -24,7 +24,7 @@ import org.lwjgl.glfw.GLFW;
* @see Key
* @see InteractionKeyMappingTriggered
*/
public abstract class InputEvent extends Event {
public abstract sealed class InputEvent extends Event {
@ApiStatus.Internal
protected InputEvent() {}
@@ -38,7 +38,7 @@ public abstract class InputEvent extends Event {
* @see Pre
* @see Post
*/
public static abstract class MouseButton extends InputEvent {
public static abstract sealed class MouseButton extends InputEvent {
private final int button;
private final int action;
private final int modifiers;
@@ -97,7 +97,7 @@ public abstract class InputEvent extends Event {
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
*/
@Cancelable
public static class Pre extends MouseButton {
public static final class Pre extends MouseButton {
@ApiStatus.Internal
public Pre(int button, int action, int modifiers) {
super(button, action, modifiers);
@@ -114,7 +114,7 @@ public abstract class InputEvent extends Event {
*
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
*/
public static class Post extends MouseButton {
public static final class Post extends MouseButton {
@ApiStatus.Internal
public Post(int button, int action, int modifiers) {
super(button, action, modifiers);
@@ -135,7 +135,7 @@ public abstract class InputEvent extends Event {
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
*/
@Cancelable
public static class MouseScrollingEvent extends InputEvent {
public static final class MouseScrollingEvent extends InputEvent {
private final double deltaX;
private final double deltaY;
private final double mouseX;
@@ -213,7 +213,7 @@ public abstract class InputEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Key extends InputEvent {
public static final class Key extends InputEvent {
private final int key;
private final int scanCode;
private final int action;
@@ -297,7 +297,7 @@ public abstract class InputEvent extends Event {
*/
// TODO: Change the 'button' to sub events. - Lex 0422202
@Cancelable
public static class InteractionKeyMappingTriggered extends InputEvent {
public static final class InteractionKeyMappingTriggered extends InputEvent {
private final int button;
private final KeyMapping keyMapping;
private final InteractionHand hand;
@@ -28,7 +28,7 @@ import java.util.Map;
/**
* Houses events related to models.
*/
public abstract class ModelEvent extends Event {
public abstract sealed class ModelEvent extends Event {
@ApiStatus.Internal
protected ModelEvent() { }
@@ -48,7 +48,7 @@ public abstract class ModelEvent extends Event {
* <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 ModifyBakingResult extends ModelEvent implements IModBusEvent {
public static final class ModifyBakingResult extends ModelEvent implements IModBusEvent {
private final ModelBakery modelBakery;
private final ModelBakery.BakingResult results;
@@ -84,7 +84,7 @@ public abstract class ModelEvent extends Event {
* <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 BakingCompleted extends ModelEvent implements IModBusEvent {
public static final class BakingCompleted extends ModelEvent implements IModBusEvent {
private final ModelManager modelManager;
private final ModelBakery modelBakery;
@@ -118,7 +118,7 @@ public abstract class ModelEvent extends Event {
* <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 RegisterModelStateDefinitions extends ModelEvent implements IModBusEvent {
public static final class RegisterModelStateDefinitions extends ModelEvent implements IModBusEvent {
private final Map<ResourceLocation, StateDefinition<Block, BlockState>> states = new HashMap<>();
private final Map<ResourceLocation, StateDefinition<Block, BlockState>> view = Collections.unmodifiableMap(states);
@@ -148,7 +148,7 @@ public abstract class ModelEvent extends Event {
* <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 RegisterGeometryLoaders extends ModelEvent implements IModBusEvent {
public static final class RegisterGeometryLoaders extends ModelEvent implements IModBusEvent {
private final Map<ResourceLocation, IGeometryLoader> loaders;
@ApiStatus.Internal
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.ApiStatus;
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class MovementInputUpdateEvent extends PlayerEvent {
public final class MovementInputUpdateEvent extends PlayerEvent {
private final ClientInput input;
@ApiStatus.Internal
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.ApiStatus;
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RecipesUpdatedEvent extends Event {
public final class RecipesUpdatedEvent extends Event {
private final ClientRecipeBook recipeBook;
@ApiStatus.Internal
@@ -34,7 +34,7 @@ import org.jetbrains.annotations.ApiStatus;
*
* @see net.minecraftforge.event.RegisterCommandsEvent
*/
public class RegisterClientCommandsEvent extends Event
public final class RegisterClientCommandsEvent extends Event
{
private final CommandDispatcher<CommandSourceStack> dispatcher;
private final CommandBuildContext context;
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.ApiStatus;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterClientReloadListenersEvent extends Event implements IModBusEvent
public final class RegisterClientReloadListenersEvent extends Event implements IModBusEvent
{
private final ReloadableResourceManager resourceManager;
@@ -26,7 +26,7 @@ import java.util.function.Function;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterClientTooltipComponentFactoriesEvent extends Event implements IModBusEvent
public final class RegisterClientTooltipComponentFactoriesEvent extends Event implements IModBusEvent
{
private final Map<Class<? extends TooltipComponent>, Function<TooltipComponent, ClientTooltipComponent>> factories;
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see RegisterColorHandlersEvent.Block
* @see RegisterColorHandlersEvent.Item
*/
public abstract class RegisterColorHandlersEvent extends Event implements IModBusEvent {
public abstract sealed class RegisterColorHandlersEvent extends Event implements IModBusEvent {
@ApiStatus.Internal
protected RegisterColorHandlersEvent() {}
@@ -39,7 +39,7 @@ public abstract class RegisterColorHandlersEvent extends Event implements IModBu
* <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 Block extends RegisterColorHandlersEvent {
public static final class Block extends RegisterColorHandlersEvent {
private final BlockColors blockColors;
@ApiStatus.Internal
@@ -72,7 +72,7 @@ public abstract class RegisterColorHandlersEvent extends Event implements IModBu
* Allows registration of custom {@link ColorResolver} implementations to be used with
* {@link net.minecraft.world.level.BlockAndTintGetter#getBlockTint(BlockPos, ColorResolver)}.
*/
public static class ColorResolvers extends RegisterColorHandlersEvent {
public static final class ColorResolvers extends RegisterColorHandlersEvent {
private final ImmutableList.Builder<ColorResolver> builder;
@ApiStatus.Internal
@@ -24,7 +24,7 @@ import java.util.Map;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterDimensionSpecialEffectsEvent extends Event implements IModBusEvent
public final class RegisterDimensionSpecialEffectsEvent extends Event implements IModBusEvent
{
private final Map<ResourceLocation, DimensionSpecialEffects> effects;
@@ -25,7 +25,7 @@ import java.util.Map;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterEntitySpectatorShadersEvent extends Event implements IModBusEvent
public final class RegisterEntitySpectatorShadersEvent extends Event implements IModBusEvent
{
private final Map<EntityType<?>, ResourceLocation> shaders;
@@ -28,7 +28,7 @@ import java.util.Map;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterItemDecorationsEvent extends Event implements IModBusEvent
public final class RegisterItemDecorationsEvent extends Event implements IModBusEvent
{
private final Map<Item, List<IItemDecorator>> decorators;
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterKeyMappingsEvent extends Event implements IModBusEvent
public final class RegisterKeyMappingsEvent extends Event implements IModBusEvent
{
private final Options options;
@@ -28,7 +28,7 @@ import java.util.Map;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterNamedRenderTypesEvent extends Event implements IModBusEvent
public final class RegisterNamedRenderTypesEvent extends Event implements IModBusEvent
{
private final Map<ResourceLocation, RenderTypeGroup> renderTypes;
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.ApiStatus;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterParticleProvidersEvent extends Event implements IModBusEvent
public final class RegisterParticleProvidersEvent extends Event implements IModBusEvent
{
private final ParticleEngine particleEngine;
@@ -29,7 +29,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterPresetEditorsEvent extends Event implements IModBusEvent
public final class RegisterPresetEditorsEvent extends Event implements IModBusEvent
{
private static final Logger LOGGER = LogManager.getLogger();
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.ApiStatus;
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public class RegisterTextureAtlasSpriteLoadersEvent extends Event implements IModBusEvent {
public final class RegisterTextureAtlasSpriteLoadersEvent extends Event implements IModBusEvent {
private final BiMap<ResourceLocation, ITextureAtlasSpriteLoader> loaders;
@ApiStatus.Internal
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.ApiStatus;
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public class RenderArmEvent extends Event {
public final class RenderArmEvent extends Event {
private final PoseStack poseStack;
private final MultiBufferSource multiBufferSource;
private final int packedLight;
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.ApiStatus;
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public class RenderBlockScreenEffectEvent extends Event
public final class RenderBlockScreenEffectEvent extends Event
{
/**
* The type of the block overlay to be rendered.
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see RenderArmEvent
*/
@Cancelable
public class RenderHandEvent extends Event
public final class RenderHandEvent extends Event
{
private final InteractionHand hand;
private final PoseStack poseStack;
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see Entity
*/
@Cancelable
public abstract class RenderHighlightEvent extends Event
public abstract sealed class RenderHighlightEvent extends Event
{
private final LevelRenderer levelRenderer;
private final Camera camera;
@@ -104,7 +104,7 @@ public abstract class RenderHighlightEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Block extends RenderHighlightEvent
public static final class Block extends RenderHighlightEvent
{
@ApiStatus.Internal
public Block(LevelRenderer levelRenderer, Camera camera, BlockHitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource)
@@ -130,7 +130,7 @@ public abstract class RenderHighlightEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Entity extends RenderHighlightEvent
public static final class Entity extends RenderHighlightEvent
{
@ApiStatus.Internal
public Entity(LevelRenderer levelRenderer, Camera camera, EntityHitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource)
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see ItemFrameRenderer
*/
@Cancelable
public class RenderItemInFrameEvent extends Event {
public final class RenderItemInFrameEvent extends Event {
private final ItemFrameRenderState state;
private final ItemFrameRenderer<?> renderer;
private final PoseStack poseStack;
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see RenderPlayerEvent
* @see LivingEntityRenderer
*/
public abstract class RenderLivingEvent<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends Event {
public abstract sealed class RenderLivingEvent<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends Event {
private final S state;
private final LivingEntityRenderer<T, S, M> renderer;
private final PoseStack poseStack;
@@ -100,7 +100,7 @@ public abstract class RenderLivingEvent<T extends LivingEntity, S extends Living
* @param <M> the model for the living entity
*/
@Cancelable
public static class Pre<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends RenderLivingEvent<T, S, M> {
public static final class Pre<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends RenderLivingEvent<T, S, M> {
@ApiStatus.Internal
public Pre(S state, LivingEntityRenderer<T, S, M> renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
super(state, renderer, poseStack, multiBufferSource, packedLight);
@@ -118,7 +118,7 @@ public abstract class RenderLivingEvent<T extends LivingEntity, S extends Living
* @param <T> the living entity that was rendered
* @param <M> the model for the living entity
*/
public static class Post<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends RenderLivingEvent<T, S, M> {
public static final class Post<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends RenderLivingEvent<T, S, M> {
@ApiStatus.Internal
public Post(S state, LivingEntityRenderer<T, S, M> renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
super(state, renderer, poseStack, multiBufferSource, packedLight);
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see EntityRenderer
*/
@Event.HasResult
public class RenderNameTagEvent extends Event {
public final class RenderNameTagEvent extends Event {
private Component nameplateContent;
private final EntityRenderState state;
private final Component originalContent;
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see RenderPlayerEvent.Post
* @see PlayerRenderer
*/
public abstract class RenderPlayerEvent extends Event {
public abstract sealed class RenderPlayerEvent extends Event {
private final PlayerRenderState state;
private final PlayerRenderer renderer;
private final PoseStack poseStack;
@@ -86,7 +86,7 @@ public abstract class RenderPlayerEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends RenderPlayerEvent {
public static final class Pre extends RenderPlayerEvent {
@ApiStatus.Internal
public Pre(PlayerRenderState state, PlayerRenderer renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
super(state, renderer, poseStack, multiBufferSource, packedLight);
@@ -101,7 +101,7 @@ public abstract class RenderPlayerEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends RenderPlayerEvent {
public static final class Post extends RenderPlayerEvent {
@ApiStatus.Internal
public Post(PlayerRenderState state, PlayerRenderer renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
super(state, renderer, poseStack, multiBufferSource, packedLight);
@@ -34,7 +34,7 @@ import java.util.List;
* @see RenderTooltipEvent.Pre
* @see RenderTooltipEvent.Background
*/
public abstract class RenderTooltipEvent extends Event
public abstract sealed class RenderTooltipEvent extends Event
{
@NotNull
protected final ItemStack itemStack;
@@ -121,7 +121,7 @@ public abstract class RenderTooltipEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class GatherComponents extends Event
public static final class GatherComponents extends Event
{
private final ItemStack itemStack;
private final int screenWidth;
@@ -210,7 +210,7 @@ public abstract class RenderTooltipEvent extends Event
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends RenderTooltipEvent
public static final class Pre extends RenderTooltipEvent
{
private final int screenWidth;
private final int screenHeight;
@@ -289,7 +289,7 @@ public abstract class RenderTooltipEvent extends Event
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Background extends RenderTooltipEvent {
public static final class Background extends RenderTooltipEvent {
private final ResourceLocation originalBackground;
private ResourceLocation background;
@@ -35,7 +35,7 @@ import java.util.function.Consumer;
* @see MouseInput
* @see KeyInput
*/
public abstract class ScreenEvent extends Event {
public abstract sealed class ScreenEvent extends Event {
private final Screen screen;
@ApiStatus.Internal
@@ -61,7 +61,7 @@ public abstract class ScreenEvent extends Event {
* @see Init.Pre
* @see Init.Post
*/
public static abstract class Init extends ScreenEvent {
public static abstract sealed class Init extends ScreenEvent {
private final Consumer<GuiEventListener> add;
private final Consumer<GuiEventListener> remove;
@@ -111,7 +111,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends Init {
public static final class Pre extends Init {
@ApiStatus.Internal
public Pre(Screen screen, List<GuiEventListener> list, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove) {
super(screen, list, add, remove);
@@ -126,7 +126,7 @@ public abstract class ScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends Init {
public static final class Post extends Init {
@ApiStatus.Internal
public Post(Screen screen, List<GuiEventListener> list, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove) {
super(screen, list, add, remove);
@@ -141,7 +141,7 @@ public abstract class ScreenEvent extends Event {
* @see Render.Pre
* @see Render.Post
*/
public static abstract class Render extends ScreenEvent {
public static abstract sealed class Render extends ScreenEvent {
private final GuiGraphics guiGraphics;
private final int mouseX;
private final int mouseY;
@@ -194,7 +194,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends Render {
public static final class Pre extends Render {
@ApiStatus.Internal
public Pre(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
super(screen, guiGraphics, mouseX, mouseY, partialTick);
@@ -209,7 +209,7 @@ public abstract class ScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends Render {
public static final class Post extends Render {
@ApiStatus.Internal
public Post(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
super(screen, guiGraphics, mouseX, mouseY, partialTick);
@@ -226,7 +226,7 @@ public abstract class ScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class BackgroundRendered extends ScreenEvent {
public static final class BackgroundRendered extends ScreenEvent {
private final GuiGraphics guiGraphics;
@ApiStatus.Internal
@@ -255,7 +255,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class RenderInventoryMobEffects extends ScreenEvent {
public static final class RenderInventoryMobEffects extends ScreenEvent {
private final int availableSpace;
private boolean compact;
private int horizontalOffset;
@@ -320,7 +320,7 @@ public abstract class ScreenEvent extends Event {
* @see MouseDragged
* @see MouseScrolled
*/
private static abstract class MouseInput extends ScreenEvent {
private static abstract sealed class MouseInput extends ScreenEvent {
private final double mouseX;
private final double mouseY;
@@ -353,7 +353,7 @@ public abstract class ScreenEvent extends Event {
* @see MouseButtonPressed.Pre
* @see MouseButtonPressed.Post
*/
public static abstract class MouseButtonPressed extends MouseInput {
public static abstract sealed class MouseButtonPressed extends MouseInput {
private final int button;
@ApiStatus.Internal
@@ -383,7 +383,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends MouseButtonPressed {
public static final class Pre extends MouseButtonPressed {
@ApiStatus.Internal
public Pre(Screen screen, double mouseX, double mouseY, int button) {
super(screen, mouseX, mouseY, button);
@@ -406,7 +406,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@HasResult
public static class Post extends MouseButtonPressed {
public static final class Post extends MouseButtonPressed {
private final boolean handled;
@ApiStatus.Internal
@@ -431,7 +431,7 @@ public abstract class ScreenEvent extends Event {
* @see MouseButtonReleased.Pre
* @see MouseButtonReleased.Post
*/
public static abstract class MouseButtonReleased extends MouseInput {
public static abstract sealed class MouseButtonReleased extends MouseInput {
private final int button;
@ApiStatus.Internal
@@ -461,7 +461,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends MouseButtonReleased {
public static final class Pre extends MouseButtonReleased {
@ApiStatus.Internal
public Pre(Screen screen, double mouseX, double mouseY, int button) {
super(screen, mouseX, mouseY, button);
@@ -484,7 +484,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@HasResult
public static class Post extends MouseButtonReleased {
public static final class Post extends MouseButtonReleased {
private final boolean handled;
@ApiStatus.Internal
@@ -509,7 +509,7 @@ public abstract class ScreenEvent extends Event {
* @see MouseDragged.Pre
* @see MouseDragged.Post
*/
public static abstract class MouseDragged extends MouseInput {
public static abstract sealed class MouseDragged extends MouseInput {
private final int mouseButton;
private final double dragX;
private final double dragY;
@@ -557,7 +557,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends MouseDragged {
public static final class Pre extends MouseDragged {
@ApiStatus.Internal
public Pre(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
super(screen, mouseX, mouseY, mouseButton, dragX, dragY);
@@ -574,7 +574,7 @@ public abstract class ScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends MouseDragged {
public static final class Post extends MouseDragged {
@ApiStatus.Internal
public Post(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
super(screen, mouseX, mouseY, mouseButton, dragX, dragY);
@@ -589,7 +589,7 @@ public abstract class ScreenEvent extends Event {
* @see MouseScrolled.Pre
* @see MouseScrolled.Post
*/
public static abstract class MouseScrolled extends MouseInput {
public static abstract sealed class MouseScrolled extends MouseInput {
private final double deltaX;
private final double deltaY;
@@ -625,7 +625,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends MouseScrolled {
public static final class Pre extends MouseScrolled {
@ApiStatus.Internal
public Pre(Screen screen, double mouseX, double mouseY, double deltaX, double deltaY) {
super(screen, mouseX, mouseY, deltaX, deltaY);
@@ -642,7 +642,7 @@ public abstract class ScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends MouseScrolled {
public static final class Post extends MouseScrolled {
@ApiStatus.Internal
public Post(Screen screen, double mouseX, double mouseY, double deltaX, double deltaY) {
super(screen, mouseX, mouseY, deltaX, deltaY);
@@ -659,7 +659,7 @@ public abstract class ScreenEvent extends Event {
* @see InputConstants
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_key" target="_top">the online GLFW documentation</a>
*/
private static abstract class KeyInput extends ScreenEvent {
private static abstract sealed class KeyInput extends ScreenEvent {
private final int keyCode;
private final int scanCode;
private final int modifiers;
@@ -719,7 +719,7 @@ public abstract class ScreenEvent extends Event {
* @see KeyPressed.Pre
* @see KeyPressed.Post
*/
public static abstract class KeyPressed extends KeyInput {
public static abstract sealed class KeyPressed extends KeyInput {
@ApiStatus.Internal
public KeyPressed(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
@@ -736,7 +736,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends KeyPressed {
public static final class Pre extends KeyPressed {
@ApiStatus.Internal
public Pre(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
@@ -754,7 +754,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Post extends KeyPressed {
public static final class Post extends KeyPressed {
@ApiStatus.Internal
public Post(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
@@ -769,7 +769,7 @@ public abstract class ScreenEvent extends Event {
* @see KeyReleased.Pre
* @see KeyReleased.Post
*/
public static abstract class KeyReleased extends KeyInput {
public static abstract sealed class KeyReleased extends KeyInput {
@ApiStatus.Internal
public KeyReleased(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
@@ -786,7 +786,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends KeyReleased {
public static final class Pre extends KeyReleased {
@ApiStatus.Internal
public Pre(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
@@ -804,7 +804,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Post extends KeyReleased {
public static final class Post extends KeyReleased {
@ApiStatus.Internal
public Post(Screen screen, int keyCode, int scanCode, int modifiers) {
super(screen, keyCode, scanCode, modifiers);
@@ -820,7 +820,7 @@ public abstract class ScreenEvent extends Event {
* @see CharacterTyped.Post
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_char" target="_top">the online GLFW documentation</a>
*/
public static class CharacterTyped extends ScreenEvent {
public static sealed class CharacterTyped extends ScreenEvent {
private final char codePoint;
private final int modifiers;
@@ -864,7 +864,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Pre extends CharacterTyped {
public static final class Pre extends CharacterTyped {
@ApiStatus.Internal
public Pre(Screen screen, char codePoint, int modifiers) {
super(screen, codePoint, modifiers);
@@ -881,7 +881,7 @@ public abstract class ScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Post extends CharacterTyped {
public static final class Post extends CharacterTyped {
@ApiStatus.Internal
public Post(Screen screen, char codePoint, int modifiers) {
super(screen, codePoint, modifiers);
@@ -902,7 +902,7 @@ public abstract class ScreenEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class Opening extends ScreenEvent {
public static final class Opening extends ScreenEvent {
@Nullable
private final Screen currentScreen;
private Screen newScreen;
@@ -949,7 +949,7 @@ public abstract class ScreenEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class Closing extends ScreenEvent {
public static final class Closing extends ScreenEvent {
@ApiStatus.Internal
public Closing(Screen screen) {
super(screen);
@@ -31,7 +31,7 @@ import java.io.IOException;
* @see Screenshot
*/
@Cancelable
public class ScreenshotEvent extends Event {
public final class ScreenshotEvent extends Event {
public static final Component DEFAULT_CANCEL_REASON = Component.literal("Screenshot canceled");
private final NativeImage image;
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.ApiStatus;
*
*/
@Cancelable
public class SystemMessageReceivedEvent extends Event {
public final class SystemMessageReceivedEvent extends Event {
private Component message;
private final boolean overlay;
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see TextureStitchEvent.Post
* @see TextureAtlas
*/
public class TextureStitchEvent extends Event implements IModBusEvent
public sealed class TextureStitchEvent extends Event implements IModBusEvent
{
private final TextureAtlas atlas;
@@ -80,7 +80,7 @@ public class TextureStitchEvent extends Event implements IModBusEvent
* <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 Post extends TextureStitchEvent
public static final class Post extends TextureStitchEvent
{
@ApiStatus.Internal
public Post(TextureAtlas map)
@@ -22,7 +22,7 @@ import net.minecraftforge.fml.LogicalSide;
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public class ToastAddEvent extends Event {
public final class ToastAddEvent extends Event {
private final Toast toast;
public ToastAddEvent(Toast toast) {
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.ApiStatus;
* @see ComputeCameraAngles
* @see ComputeFov
*/
public abstract class ViewportEvent extends Event {
public abstract sealed class ViewportEvent extends Event {
private final GameRenderer renderer;
private final Camera camera;
private final double partialTick;
@@ -73,7 +73,7 @@ public abstract class ViewportEvent extends Event {
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
@Cancelable
public static class RenderFog extends ViewportEvent {
public static final class RenderFog extends ViewportEvent {
private final FogMode mode;
private final FogType type;
private float farPlaneDistance;
@@ -182,7 +182,7 @@ public abstract class ViewportEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class ComputeFogColor extends ViewportEvent {
public static final class ComputeFogColor extends ViewportEvent {
private float red;
private float green;
private float blue;
@@ -254,7 +254,7 @@ public abstract class ViewportEvent extends Event {
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class ComputeCameraAngles extends ViewportEvent {
public static final class ComputeCameraAngles extends ViewportEvent {
private float yaw;
private float pitch;
private float roll;
@@ -327,7 +327,7 @@ public abstract class ViewportEvent extends Event {
*
* @see ComputeFovModifierEvent
*/
public static class ComputeFov extends ViewportEvent {
public static final class ComputeFov extends ViewportEvent {
private final boolean usedConfiguredFov;
private float fov;
Loaded 100 of 395 files, more files were not shown because too many files have changed in this diff. Show more