mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 09:05:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c71ba862cf | ||
|
|
3c057d277b | ||
|
|
b99abff6ce | ||
|
|
558e7d754e | ||
|
|
d29524bac3 | ||
|
|
929064ee69 | ||
|
|
b4024a7884 | ||
|
|
07f6499143 | ||
|
|
236842f210 | ||
|
|
ef811aebe8 | ||
|
|
d61de63482 | ||
|
|
8368a1d20a | ||
|
|
8b8d3fdef7 | ||
|
|
f5d4fbbee5 | ||
|
|
6f4f60e213 | ||
|
|
01bfc33b28 | ||
|
|
17e1002e86 | ||
|
|
da1b8f4efa | ||
|
|
42bbe44a34 | ||
|
|
f095474adf | ||
|
|
1b5ca64f20 |
No files matched your search
@@ -10,4 +10,4 @@ assignees: ''
|
||||
<!-- Please note, feature requests that are submitted as GitHub issues here are rarely implemented. -->
|
||||
<!-- If you'd like to see something in Forge, you should be ready to implement it as a PR. -->
|
||||
<!-- If you're not sure, open a Draft PR or discuss it in the Discord server. -->
|
||||
<!-- Discord: https://discord.gg/UvedJ9m -->
|
||||
<!-- Discord: https://discord..minecraftforge.net/ -->
|
||||
@@ -11,6 +11,7 @@ assignees: ''
|
||||
|
||||
<!-- For support with crashes and issues, please create a post on the forum instead: -->
|
||||
<!-- https://www.minecraftforge.net/forum/forum/18-support-bug-reports/ -->
|
||||
<!-- You can also use the discord for support, https://discord.minecraftforge.net/ -->
|
||||
|
||||
**Minecraft Version:** {Minecraft version}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ '1.21.11' ]
|
||||
|
||||
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 }}
|
||||
@@ -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 }}
|
||||
Vendored
-104
@@ -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>
|
||||
Vendored
-193
@@ -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
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +62,10 @@ abstract class BundleList extends DefaultTask {
|
||||
def (group, name, other) = artifact.split(':', 3)
|
||||
//println("Group: $group Name: $name")
|
||||
def key = "$group:$name"
|
||||
if (other.indexOf(':') != -1){
|
||||
key += ':' + other.split(':', 2)[1]
|
||||
//println("\tKey: $key")
|
||||
}
|
||||
if (!entries.containsKey(key))
|
||||
entries.put(key, line)
|
||||
}
|
||||
|
||||
@@ -289,6 +289,7 @@ class ATParser {
|
||||
final String comment = idx === -1 ? null : line.substring(idx)
|
||||
if (idx !== -1) line = line.substring(0, idx - 1)
|
||||
final data = (line.trim() + ' ').split(' ', -1)
|
||||
data[1] = data[1].replaceAll('/', '.') // Convert to Source names, internal names are fine by spec, but not supported by old AST based AT implementations.
|
||||
new Entry(data[0], data[1], data[2], comment)
|
||||
}
|
||||
|
||||
|
||||
+23
-10
@@ -79,7 +79,6 @@ final String SPEC_VERSION = gitversion.info.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
|
||||
]
|
||||
@@ -92,7 +91,7 @@ final String MAVEN_PATH = ext.MAVEN_PATH
|
||||
final String BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.2.0:fatjar'
|
||||
final String INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.4.3'
|
||||
final String FART = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.6'
|
||||
final String S2S_TOOL = 'net.minecraftforge:Srg2Source:8.1.1:fatjar'
|
||||
final String S2S_TOOL = 'net.minecraftforge:Srg2Source:8.2.0:fatjar'
|
||||
|
||||
configurations {
|
||||
// Don't pull all libraries, if we're missing something, add it to the installer list so the installer knows to download it.
|
||||
@@ -127,8 +126,7 @@ dependencies {
|
||||
installer(libs.eventbus)
|
||||
installer(libs.jspecify) // Dep of EventBus
|
||||
installer(libs.forgespi)
|
||||
installer(libs.coremods)
|
||||
installer(libs.nashorn) // Dep of Coremods
|
||||
installer(libs.coremods.api)
|
||||
installer(libs.modlauncher)
|
||||
installer(libs.mergetool.api)
|
||||
installer(libs.bundles.night.config)
|
||||
@@ -158,6 +156,12 @@ dependencies {
|
||||
tasks.named('extractRangeMap').configure {
|
||||
tool = S2S_TOOL
|
||||
}
|
||||
tasks.named('applyRangeMap').configure {
|
||||
tool = S2S_TOOL
|
||||
}
|
||||
tasks.named('applyRangeMapBase').configure {
|
||||
tool = S2S_TOOL
|
||||
}
|
||||
|
||||
patcher {
|
||||
excs.from file("$rootDir/src/main/resources/forge.exc")
|
||||
@@ -934,23 +938,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,
|
||||
@@ -959,7 +971,8 @@ tasks.register('mdkZip', Zip) {
|
||||
MAPPING_CHANNEL: MAPPING_CHANNEL,
|
||||
MAPPING_VERSION: MAPPING_VERSION,
|
||||
FORGE_SPEC_VERSION: SPEC_VERSION.split("\\.")[0],
|
||||
MC_NEXT_VERSION: MC_NEXT_VERSION
|
||||
MC_NEXT_VERSION: MC_NEXT_VERSION,
|
||||
EVENTBUS_VERSION: libs.versions.eventbus.get()
|
||||
])
|
||||
rename 'gitignore\\.txt', '.gitignore'
|
||||
rename 'gitattributes\\.txt', '.gitattributes'
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[][Download]
|
||||
[][Download]
|
||||
[][Download] [][Discord] [][Patreon]
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
@@ -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
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package net.minecraftforge.fml;
|
||||
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.fml.config.IConfigEvent;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
@@ -157,6 +158,14 @@ public abstract class ModContainer {
|
||||
*/
|
||||
public abstract Object getMod();
|
||||
|
||||
/**
|
||||
* @return the mod bus group for this specific mod, or null if there is none.
|
||||
* Leave null if you use {@link BusGroup#DEFAULT} for your mod lifecycle events.
|
||||
*/
|
||||
public BusGroup getModBusGroup() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept an arbitrary event for processing by the mod. Probably posted to an event bus in the lower level container.
|
||||
* @param e Event to accept
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.fml;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
@@ -232,7 +233,19 @@ public class ModLoader {
|
||||
for (IModLoadingState mls : stateList) {
|
||||
dispatchAndHandleError(mls, syncExecutor, parallelExecutor, periodicTask, progress);
|
||||
}
|
||||
statusConsumer.accept(String.format("Mod loading complete - %d mods loaded", this.modList.size()));
|
||||
|
||||
var modBusGroups = Set.of(
|
||||
modList.getLoadedMods().stream()
|
||||
.map(ModContainer::getModBusGroup)
|
||||
.filter(Objects::nonNull)
|
||||
.toArray(BusGroup[]::new)
|
||||
);
|
||||
for (var modBusGroup : modBusGroups) {
|
||||
parallelExecutor.execute(modBusGroup::trim);
|
||||
}
|
||||
parallelExecutor.execute(BusGroup.DEFAULT::trim);
|
||||
|
||||
statusConsumer.accept("Mod loading complete - %d mods loaded".formatted(this.modList.size()));
|
||||
progress.complete();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,11 @@ package net.minecraftforge.fml.util.thread;
|
||||
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
||||
public class EffectiveSide
|
||||
{
|
||||
/**
|
||||
* Attempts to determine the effect side of the current thread, based on know threads in networking.
|
||||
* This is not guaranteed to be correct, and modders should use other methods to determine the logical side when possible.
|
||||
*/
|
||||
public class EffectiveSide {
|
||||
public static LogicalSide get() {
|
||||
final ThreadGroup group = Thread.currentThread().getThreadGroup();
|
||||
return group instanceof SidedThreadGroup ? ((SidedThreadGroup) group).getSide() : LogicalSide.CLIENT;
|
||||
|
||||
@@ -7,11 +7,13 @@ package net.minecraftforge.fml.util.thread;
|
||||
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
||||
public final class SidedThreadGroups
|
||||
{
|
||||
public final class SidedThreadGroups {
|
||||
public static final SidedThreadGroup CLIENT = new SidedThreadGroup(LogicalSide.CLIENT);
|
||||
public static final SidedThreadGroup SERVER = new SidedThreadGroup(LogicalSide.SERVER);
|
||||
|
||||
private SidedThreadGroups() {
|
||||
public static SidedThreadGroup get(boolean client) {
|
||||
return client ? CLIENT : SERVER;
|
||||
}
|
||||
|
||||
private SidedThreadGroups() { }
|
||||
}
|
||||
@@ -26,7 +26,6 @@ dependencies {
|
||||
api(libs.apache.commons)
|
||||
api(libs.bundles.night.config)
|
||||
api(libs.modlauncher)
|
||||
api(libs.coremods)
|
||||
api(libs.mojang.logging)
|
||||
api(libs.jarjar.selector)
|
||||
api(libs.jarjar.meta)
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraftforge.accesstransformer.service.AccessTransformerService;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.loading.targets.CommonLaunchHandler;
|
||||
import net.minecraftforge.forgespi.Environment;
|
||||
import net.minecraftforge.forgespi.coremod.ICoreModProvider;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.nio.file.Path;
|
||||
@@ -34,7 +33,6 @@ import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
public class FMLLoader {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static AccessTransformerService accessTransformer;
|
||||
private static ICoreModProvider coreModProvider;
|
||||
private static LanguageLoadingProvider languageLoadingProvider;
|
||||
private static Dist dist;
|
||||
private static String naming;
|
||||
@@ -57,8 +55,6 @@ public class FMLLoader {
|
||||
checkPackage(ITransformationService.class, "4.0", "ModLauncher");
|
||||
accessTransformer = getPlugin(env, "accesstransformer", "1.0", "AccessTransformer");
|
||||
runtimeDistCleaner = getPlugin(env, "runtimedistcleaner", "1.0", "RuntimeDistCleaner");
|
||||
coreModProvider = getSingleService(ICoreModProvider.class, "CoreMod");
|
||||
LOGGER.debug(CORE, "FML found CoreMod version : {}", JarVersionLookupHandler.getInfo(coreModProvider.getClass()).impl().version().orElse("MISSING"));
|
||||
checkPackage(Environment.class, "2.0", "ForgeSPI");
|
||||
|
||||
try {
|
||||
@@ -96,6 +92,7 @@ public class FMLLoader {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static <T> T getSingleService(Class<T> clazz, String name) throws IncompatibleEnvironmentException {
|
||||
var providers = new ArrayList<T>();
|
||||
for (var itr = ServiceLoader.load(FMLLoader.class.getModule().getLayer(), clazz).iterator(); itr.hasNext(); ) {
|
||||
@@ -160,10 +157,6 @@ public class FMLLoader {
|
||||
return List.of(modValidator.getModResources());
|
||||
}
|
||||
|
||||
public static ICoreModProvider getCoreModProvider() {
|
||||
return coreModProvider;
|
||||
}
|
||||
|
||||
public static LanguageLoadingProvider getLanguageLoadingProvider() {
|
||||
return languageLoadingProvider;
|
||||
}
|
||||
@@ -173,7 +166,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());
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ public class FMLServiceProvider implements ITransformationService {
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public @NotNull List<ITransformer> transformers() {
|
||||
LOGGER.debug(CORE, "Loading coremod transformers");
|
||||
return new ArrayList<>(FMLLoader.getCoreModProvider().getCoreModTransformers());
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import net.minecraftforge.fml.loading.EarlyLoadingException.ExceptionData;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||
@@ -19,11 +20,16 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
|
||||
/**
|
||||
* Master list of all mods <em>in the loading context. This class cannot refer outside the
|
||||
* 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;
|
||||
@@ -56,22 +62,23 @@ public class LoadingModList {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void addCoreMods() {
|
||||
modFiles.stream()
|
||||
.map(ModFileInfo::getFile)
|
||||
.map(ModFile::getCoreMods)
|
||||
.flatMap(List::stream)
|
||||
.forEach(FMLLoader.getCoreModProvider()::addCoreMod);
|
||||
}
|
||||
|
||||
public void addAccessTransformers() {
|
||||
var errors = new ArrayList<ExceptionData>();
|
||||
|
||||
for (ModFileInfo modFile : modFiles) {
|
||||
ModFile mod = modFile.getFile();
|
||||
var at = mod.getAccessTransformer().orElse(null);
|
||||
if (at != null) {
|
||||
FMLLoader.addAccessTransformer(at, mod);
|
||||
for (var at : mod.getAccessTransformers()) {
|
||||
if (!Files.exists(at)) {
|
||||
var message = "Invalid mod file: " + modFile.getFile().getFileName() + ". Missing Access Transformer: " + at;
|
||||
errors.add(new 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) {
|
||||
|
||||
@@ -45,6 +45,7 @@ public final class RuntimeDistCleaner implements ILaunchPluginService {
|
||||
|
||||
@Override
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
||||
// TODO: [FML][RuntimeDistCleaner] In 26.1, only return YAY for MC classes on mod dev server
|
||||
if (isEmpty)
|
||||
return NAY;
|
||||
|
||||
@@ -53,7 +54,7 @@ public final class RuntimeDistCleaner implements ILaunchPluginService {
|
||||
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/")))
|
||||
if (FMLEnvironment.dist.isClient() && isMinecraftClass(internalName))
|
||||
return NAY;
|
||||
|
||||
return YAY;
|
||||
@@ -64,15 +65,29 @@ public final class RuntimeDistCleaner implements ILaunchPluginService {
|
||||
var changed = false;
|
||||
|
||||
var annotations = unpack(classNode.visibleAnnotations);
|
||||
var isNonMinecraftClass = !isMinecraftClass(classNode.name);
|
||||
final class LazyInit {
|
||||
private LazyInit() {}
|
||||
private static final boolean CAN_EXPLODE = !FMLEnvironment.production && "21.6".equals(FMLLoader.versionInfo().mcVersion());
|
||||
}
|
||||
|
||||
if (remove(annotations, DIST)) {
|
||||
LOGGER.error(DISTXFORM, "Attempted to load class {} for invalid dist {}", classNode.name, DIST);
|
||||
throw new RuntimeException("Attempted to load class "+ classNode.name + " for invalid dist "+ DIST);
|
||||
throw new RuntimeException("Attempted to load class " + classNode.name + " for invalid dist " + DIST);
|
||||
}
|
||||
|
||||
if (!FMLEnvironment.production && !annotations.isEmpty() && hasModAnnotation(classNode.visibleAnnotations)) {
|
||||
LOGGER.error(DISTXFORM, "Attempted to load class {} with @Mod and @OnlyIn/@OnlyIns annotations", classNode.name);
|
||||
throw new RuntimeException("Found @OnlyIn on @Mod class "+ classNode.name + " - this is not allowed as it causes crashes. Remove the OnlyIn and consider setting clientSideOnly=true in the root of your mods.toml instead");
|
||||
if (!annotations.isEmpty()) {
|
||||
if (isNonMinecraftClass) {
|
||||
if (LazyInit.CAN_EXPLODE)
|
||||
throw new UnsupportedOperationException("Mod class " + classNode.name + " is annotated with @OnlyIn, this is no longer supported as it slowed down startup times");
|
||||
else
|
||||
LOGGER.warn(DISTXFORM, "Class {} is annotated with @OnlyIn, this is deprecated and won't work in a future MC release.", classNode.name);
|
||||
}
|
||||
|
||||
if (!FMLEnvironment.production && hasModAnnotation(classNode.visibleAnnotations)) {
|
||||
LOGGER.error(DISTXFORM, "Attempted to load class {} with @Mod and @OnlyIn/@OnlyIns annotations", classNode.name);
|
||||
throw new RuntimeException("Found @OnlyIn on @Mod class " + classNode.name + " - this is not allowed as it causes crashes. Remove the OnlyIn and consider setting clientSideOnly=true in the root of your mods.toml instead");
|
||||
}
|
||||
}
|
||||
|
||||
if (classNode.interfaces != null && !classNode.interfaces.isEmpty()) {
|
||||
@@ -81,7 +96,7 @@ public final class RuntimeDistCleaner implements ILaunchPluginService {
|
||||
continue;
|
||||
|
||||
if (classNode.interfaces.remove(ann.intf)) {
|
||||
LOGGER.debug(DISTXFORM,"Removing Interface: {} implements {}", classNode.name, ann.intf);
|
||||
LOGGER.debug(DISTXFORM, "Removing Interface: {} implements {}", classNode.name, ann.intf);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -105,6 +120,13 @@ public final class RuntimeDistCleaner implements ILaunchPluginService {
|
||||
LOGGER.debug(DISTXFORM, "Removing field: {}.{}", classNode.name, field.name);
|
||||
itr.remove();
|
||||
changed = true;
|
||||
|
||||
if (isNonMinecraftClass) {
|
||||
if (LazyInit.CAN_EXPLODE)
|
||||
throw new UnsupportedOperationException("Field " + field.name + " in mod class " + classNode.name + " is annotated with @OnlyIn, this is no longer supported as it slowed down startup times");
|
||||
else
|
||||
LOGGER.warn(DISTXFORM, "Field {} in class {} is annotated with @OnlyIn, this is deprecated and won't work in a future MC release.", field.name, classNode.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +138,13 @@ public final class RuntimeDistCleaner implements ILaunchPluginService {
|
||||
itr.remove();
|
||||
lambdaGatherer.accept(method);
|
||||
changed = true;
|
||||
|
||||
if (isNonMinecraftClass) {
|
||||
if (LazyInit.CAN_EXPLODE)
|
||||
throw new UnsupportedOperationException("Method " + method.name + " in mod class " + classNode.name + " is annotated with @OnlyIn, this is no longer supported as it slowed down startup times");
|
||||
else
|
||||
LOGGER.warn(DISTXFORM, "Method {} in class {} is annotated with @OnlyIn, this is deprecated and won't work in a future MC release.", method.name, classNode.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +171,7 @@ public final class RuntimeDistCleaner implements ILaunchPluginService {
|
||||
return changed ? ComputeFlags.SIMPLE_REWRITE : ComputeFlags.NO_REWRITE;
|
||||
}
|
||||
|
||||
private static record Target(String side, String intf) {
|
||||
private record Target(String side, String intf) {
|
||||
static Target from(final AnnotationNode node) {
|
||||
var idx = node.values.indexOf("value");
|
||||
var value = (String[])node.values.get(idx + 1); // Enums are stored as [Type, Value]
|
||||
@@ -208,6 +237,10 @@ public final class RuntimeDistCleaner implements ILaunchPluginService {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isMinecraftClass(final String internalName) {
|
||||
return internalName.startsWith("net/minecraft/") || internalName.startsWith("com/mojang/");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Consumer<Dist> getExtension() {
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.forgespi.coremod.ICoreModFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class CoreModFile implements ICoreModFile {
|
||||
private final Path internalPath;
|
||||
private final ModFile file;
|
||||
private final String name;
|
||||
|
||||
CoreModFile(final String name, final Path path, final ModFile file) {
|
||||
this.name = name;
|
||||
this.internalPath = path;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reader readCoreMod() throws IOException {
|
||||
return Files.newBufferedReader(this.internalPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getPath() {
|
||||
return this.internalPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reader getAdditionalFile(final String fileName) throws IOException {
|
||||
return Files.newBufferedReader(file.findResource(fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnerId() {
|
||||
return this.file.getModInfos().get(0).getModId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{Name: " + name + ", Owner: " + getOwnerId() + " @ " + getPath() + "}";
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,8 @@ public class ModFile implements IModFile {
|
||||
private final IModFileInfo modFileInfo;
|
||||
private ModFileScanData fileModFileScanData;
|
||||
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;
|
||||
@@ -92,24 +92,36 @@ public class ModFile implements IModFile {
|
||||
return modFileInfo.getMods();
|
||||
}
|
||||
|
||||
@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 this.accessTransformers;
|
||||
}
|
||||
|
||||
public boolean identifyMods() {
|
||||
if (this.modFileInfo == null) return this.getType() != Type.MOD;
|
||||
LOGGER.debug(LogMarkers.LOADING,"Loading mod file {} with languages {}", this.getFileName(), this.modFileInfo.requiredLanguageLoaders());
|
||||
this.coreMods = ModFileParser.getCoreMods(this);
|
||||
if (!this.coreMods.isEmpty())
|
||||
LOGGER.warn("Mod file {} contains javascript coremods! JS CoreMods are deprecated and will be removed in a future release. Consider using Mixin or ModLauncher transformers.", this.getFileName());
|
||||
for (var mi : this.coreMods)
|
||||
LOGGER.debug(LogMarkers.LOADING, "Found coremod {}", mi.getPath());
|
||||
this.accessTransformer = findResource("META-INF", "accesstransformer.cfg");
|
||||
return true;
|
||||
}
|
||||
var cfg = this.modFileInfo.getConfig()
|
||||
.<List<String>>getConfigElement("accessTransformers")
|
||||
.orElse(null);
|
||||
|
||||
public List<CoreModFile> getCoreMods() {
|
||||
return coreMods;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
-28
@@ -6,8 +6,6 @@
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.electronwill.nightconfig.core.file.FileConfig;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
@@ -16,13 +14,8 @@ import net.minecraftforge.forgespi.locating.ModFileFactory;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ModFileParser {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -46,25 +39,4 @@ public class ModFileParser {
|
||||
final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig);
|
||||
return new ModFileInfo(modFile, configWrapper, configWrapper::setFile);
|
||||
}
|
||||
|
||||
protected static List<CoreModFile> getCoreMods(final ModFile modFile) {
|
||||
Map<String,String> coreModPaths;
|
||||
try {
|
||||
final Path coremodsjson = modFile.findResource("META-INF", "coremods.json");
|
||||
if (!Files.exists(coremodsjson)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final Type type = new TypeToken<Map<String, String>>() {}.getType();
|
||||
final Gson gson = new Gson();
|
||||
coreModPaths = gson.fromJson(Files.newBufferedReader(coremodsjson), type);
|
||||
} catch (IOException e) {
|
||||
LOGGER.debug(LogMarkers.LOADING,"Failed to read coremod list coremods.json", e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return coreModPaths.entrySet().stream()
|
||||
.peek(e-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {} with Javascript path {}", e.getKey(), e.getValue()))
|
||||
.map(e -> new CoreModFile(e.getKey(), modFile.findResource(e.getValue()),modFile))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,6 @@ public class ModValidator {
|
||||
allErrors.addAll(this.discoveryErrorData);
|
||||
|
||||
loadingModList = ModSorter.sort(candidateMods, allErrors);
|
||||
loadingModList.addCoreMods();
|
||||
loadingModList.addAccessTransformers();
|
||||
loadingModList.setBrokenFiles(brokenFiles);
|
||||
BackgroundScanHandler backgroundScanHandler = new BackgroundScanHandler(candidateMods);
|
||||
|
||||
-1
@@ -156,7 +156,6 @@ abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
|
||||
return new String[] {
|
||||
"net/minecraftforge/",
|
||||
"META-INF/services/",
|
||||
"META-INF/coremods.json",
|
||||
"META-INF/mods.toml"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"artifact": "MixinExtras"
|
||||
},
|
||||
"version": {
|
||||
"range": "[0.5.0,)",
|
||||
"artifactVersion": "0.5.0"
|
||||
"range": "[0.5.3,)",
|
||||
"artifactVersion": "0.5.3"
|
||||
},
|
||||
"path": "",
|
||||
"isObfuscated": false
|
||||
@@ -24,7 +24,7 @@
|
||||
"artifact": "mixinextras-forge"
|
||||
},
|
||||
"version": {
|
||||
"artifactVersion": "0.5.0"
|
||||
"artifactVersion": "0.5.3"
|
||||
},
|
||||
"path": "",
|
||||
"isObfuscated": false
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
implementation(libs.log4j.api)
|
||||
implementation(libs.gson)
|
||||
implementation(libs.modlauncher)
|
||||
implementation(libs.coremods) // Used for ASMAPI (for now)
|
||||
implementation(libs.coremods.api)
|
||||
|
||||
testCompileOnly(libs.jetbrains.annotations)
|
||||
}
|
||||
|
||||
+84
-4
@@ -8,16 +8,27 @@ package net.minecraftforge.forge.transformers;
|
||||
import cpw.mods.modlauncher.api.ITransformer;
|
||||
import cpw.mods.modlauncher.api.ITransformerVotingContext;
|
||||
import cpw.mods.modlauncher.api.TransformerVoteResult;
|
||||
import net.minecraftforge.coremod.api.ASMAPI;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
record FieldToMethodTransformer(String className, Map<String, String> fields) implements ITransformer<ClassNode> {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
// TODO [Forge][Transformer] Make this properly data driven or configurable.
|
||||
// It was hard-coded like this before when using JS CoreMods, though.
|
||||
static final Map<String, Map<String, String>> TARGETS = Map.of(
|
||||
@@ -60,7 +71,7 @@ record FieldToMethodTransformer(String className, Map<String, String> fields) im
|
||||
@Override
|
||||
public @NotNull ClassNode transform(ClassNode input, ITransformerVotingContext context) {
|
||||
for (var entry : this.fields.entrySet()) {
|
||||
ASMAPI.redirectFieldToMethod(input, entry.getKey(), entry.getValue());
|
||||
redirectFieldToMethod(input, entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
return input;
|
||||
@@ -75,4 +86,73 @@ record FieldToMethodTransformer(String className, Map<String, String> fields) im
|
||||
public @NotNull Set<Target> targets() {
|
||||
return Set.of(Target.targetClass(this.className));
|
||||
}
|
||||
|
||||
private static final @Nullable FieldNode findField(final ClassNode classNode, final String name) {
|
||||
FieldNode ret = null;
|
||||
for (var fieldNode : classNode.fields) {
|
||||
if (name.equals(fieldNode.name)) {
|
||||
if (ret != null)
|
||||
throw new IllegalStateException("Found multiple fields with name " + name);
|
||||
ret = fieldNode;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static final @Nullable MethodNode findMethod(final ClassNode classNode, final String name, final String desc) {
|
||||
for (var methodNode : classNode.methods) {
|
||||
if (name.equals(methodNode.name) && desc.equals(methodNode.desc))
|
||||
return methodNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewrites accesses to a specific field in the given class to a method-call.
|
||||
* <p>
|
||||
* The field specified by fieldName must be private and non-static. The method-call the field-access is redirected
|
||||
* to does not take any parameters and returns an object of the same type as the field. If no methodName is passed,
|
||||
* any method matching the described signature will be used as callable method.
|
||||
*
|
||||
* @param classNode the class to rewrite the accesses in
|
||||
* @param fieldName the field accesses should be redirected to
|
||||
* @param methodName the name of the method to redirect accesses through
|
||||
* @apiNote This method was written as a special use case for Forge. It is not recommended to use this method
|
||||
* unless you know what you are doing.
|
||||
*/
|
||||
private static void redirectFieldToMethod(final ClassNode classNode, final String fieldName, final String methodName) {
|
||||
var foundField = findField(classNode, fieldName);
|
||||
if (foundField == null)
|
||||
throw new IllegalStateException("No field with name " + fieldName + " found");
|
||||
|
||||
if (!Modifier.isPrivate(foundField.access) || Modifier.isStatic(foundField.access))
|
||||
throw new IllegalStateException("Field " + fieldName + " is not private and an instance field");
|
||||
|
||||
var methodSignature = "()" + foundField.desc;
|
||||
var foundMethod = findMethod(classNode, methodName, methodSignature);
|
||||
if (foundMethod == null)
|
||||
throw new IllegalStateException("Unable to find method " + methodName + methodSignature);
|
||||
|
||||
for (MethodNode methodNode : classNode.methods) {
|
||||
// skip the found getter method
|
||||
if (methodNode == foundMethod) continue;
|
||||
|
||||
// Why is this filtered? UI twas added in the beginning but would it matter?
|
||||
if (methodSignature.equals(foundMethod)) {
|
||||
LOGGER.debug("FieldToMethodTransformer " + classNode.name + " skipping " + methodNode.name + methodNode.hashCode());
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var insn : methodNode.instructions) {
|
||||
if (insn.getOpcode() != Opcodes.GETFIELD)
|
||||
continue;
|
||||
|
||||
var fieldInsnNode = (FieldInsnNode)insn;
|
||||
if (fieldName.equals(fieldInsnNode.name)) {
|
||||
var replace = new MethodInsnNode(Opcodes.INVOKEVIRTUAL, classNode.name, foundMethod.name, foundMethod.desc, false);
|
||||
methodNode.instructions.set(insn, replace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-9
@@ -10,14 +10,15 @@ import com.google.gson.annotations.SerializedName;
|
||||
import cpw.mods.modlauncher.api.ITransformer;
|
||||
import cpw.mods.modlauncher.api.ITransformerVotingContext;
|
||||
import cpw.mods.modlauncher.api.TransformerVoteResult;
|
||||
import net.minecraftforge.coremod.api.ASMAPI;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
@@ -36,15 +37,16 @@ record MethodRedirector() implements ITransformer<ClassNode> {
|
||||
private static final Replacement[] REPLACEMENTS = {
|
||||
new Replacement(
|
||||
// finalizeSpawn redirection to ForgeEventFactory.onFinalizeSpawn
|
||||
ASMAPI.MethodType.VIRTUAL,
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
"finalizeSpawn",
|
||||
"(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;",
|
||||
GSON.fromJson(new InputStreamReader(sneak(() -> MethodRedirector.class.getModule().getResourceAsStream("coremods/finalize_spawn_targets.json"))), Target[].class),
|
||||
insn -> ASMAPI.buildMethodCall(
|
||||
ASMAPI.MethodType.STATIC,
|
||||
insn -> new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"net/minecraftforge/event/ForgeEventFactory",
|
||||
"onFinalizeSpawn",
|
||||
"(Lnet/minecraft/world/entity/Mob;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
"(Lnet/minecraft/world/entity/Mob;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;",
|
||||
false
|
||||
)
|
||||
)
|
||||
};
|
||||
@@ -58,7 +60,7 @@ record MethodRedirector() implements ITransformer<ClassNode> {
|
||||
}
|
||||
|
||||
record Replacement(
|
||||
ASMAPI.MethodType type,
|
||||
int opcode,
|
||||
String name,
|
||||
String desc,
|
||||
Target[] targets,
|
||||
@@ -94,7 +96,7 @@ record MethodRedirector() implements ITransformer<ClassNode> {
|
||||
var splitPos = methodString.indexOf('(');
|
||||
var methodName = methodString.substring(0, splitPos);
|
||||
var methodDesc = methodString.substring(splitPos);
|
||||
var method = ASMAPI.findMethodNode(clazz, methodName, methodDesc);
|
||||
var method = findMethodNode(clazz, methodName, methodDesc);
|
||||
|
||||
if (method == null) {
|
||||
LOGGER.error("Failed to redirect method call for {}! Method {} not found in class {}! This is a Forge bug, and is likely due to a Minecraft update changing something.", replacement.name, methodString, clazz.name);
|
||||
@@ -107,7 +109,7 @@ record MethodRedirector() implements ITransformer<ClassNode> {
|
||||
var methodInsn = (MethodInsnNode) insn;
|
||||
var redirection = replacement.factory.apply(methodInsn);
|
||||
LOGGER.debug("Redirecting method call {}{} to {}{} inside of {}.{}", methodInsn.name, methodInsn.desc, redirection.name, redirection.desc, clazz.name, method.name);
|
||||
ASMAPI.insertInsn(method, methodInsn, redirection, ASMAPI.InsertMode.REMOVE_ORIGINAL);
|
||||
method.instructions.set(insn, redirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,8 +117,16 @@ record MethodRedirector() implements ITransformer<ClassNode> {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
private static @Nullable MethodNode findMethodNode(ClassNode clazz, String name, String desc) {
|
||||
for (var method : clazz.methods) {
|
||||
if (name.equals(method.name) && desc.equals(method.desc))
|
||||
return method;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean shouldReplace(AbstractInsnNode insn, Replacement replacement) {
|
||||
return insn.getOpcode() == replacement.type.toOpcode()
|
||||
return insn.getOpcode() == replacement.opcode
|
||||
&& replacement.name.equals(((MethodInsnNode) insn).name)
|
||||
&& replacement.desc.equals(((MethodInsnNode) insn).desc);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
[
|
||||
{
|
||||
"class": "net/minecraft/gametest/framework/GameTestHelper",
|
||||
"methods": [
|
||||
"spawn(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/EntitySpawnReason;)Lnet/minecraft/world/entity/Entity;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/server/commands/RaidCommand",
|
||||
"methods": [
|
||||
@@ -23,31 +29,25 @@
|
||||
"trySpawn(Lnet/minecraft/server/level/ServerLevel;)V"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/animal/equine/SkeletonTrapGoal",
|
||||
"methods": [
|
||||
"createHorse(Lnet/minecraft/world/DifficultyInstance;)Lnet/minecraft/world/entity/animal/equine/AbstractHorse;",
|
||||
"createSkeleton(Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/animal/equine/AbstractHorse;)Lnet/minecraft/world/entity/monster/skeleton/Skeleton;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/animal/equine/ZombieHorse",
|
||||
"methods": [
|
||||
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/animal/frog/Tadpole",
|
||||
"methods": [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/animal/horse/SkeletonTrapGoal",
|
||||
"methods": [
|
||||
"createHorse(Lnet/minecraft/world/DifficultyInstance;)Lnet/minecraft/world/entity/animal/horse/AbstractHorse;",
|
||||
"createSkeleton(Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/animal/horse/AbstractHorse;)Lnet/minecraft/world/entity/monster/Skeleton;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/Evoker$EvokerSummonSpellGoal",
|
||||
"methods": [
|
||||
"performSpellCasting()V"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/Spider",
|
||||
"methods": [
|
||||
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/Strider",
|
||||
"methods": [
|
||||
@@ -55,14 +55,38 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/Zombie",
|
||||
"class": "net/minecraft/world/entity/monster/illager/Evoker$EvokerSummonSpellGoal",
|
||||
"methods": [
|
||||
"performSpellCasting()V"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/spider/Spider",
|
||||
"methods": [
|
||||
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/zombie/Drowned",
|
||||
"methods": [
|
||||
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/zombie/Husk",
|
||||
"methods": [
|
||||
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/zombie/Zombie",
|
||||
"methods": [
|
||||
"hurtServer(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/damagesource/DamageSource;F)Z",
|
||||
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/monster/ZombieVillager",
|
||||
"class": "net/minecraft/world/entity/monster/zombie/ZombieVillager",
|
||||
"methods": [
|
||||
|
||||
]
|
||||
@@ -74,9 +98,9 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"class": "net/minecraft/world/entity/npc/Villager",
|
||||
"class": "net/minecraft/world/entity/npc/villager/Villager",
|
||||
"methods": [
|
||||
"getBreedOffspring(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/AgeableMob;)Lnet/minecraft/world/entity/npc/Villager;"
|
||||
"getBreedOffspring(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/AgeableMob;)Lnet/minecraft/world/entity/npc/villager/Villager;"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-3
@@ -5,11 +5,11 @@ org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
|
||||
JAVA_VERSION=21
|
||||
MC_VERSION=1.21.10
|
||||
MC_VERSION=1.21.11
|
||||
MC_NEXT_VERSION=1.22
|
||||
MCP_VERSION=20251007.101210
|
||||
MCP_VERSION=20251223.124241
|
||||
MAPPING_CHANNEL=official
|
||||
MAPPING_VERSION=1.21.10
|
||||
MAPPING_VERSION=1.21.11
|
||||
|
||||
# Set to true before the first build of a new MC version, so we don't do compatibility checks
|
||||
CHECK_COMPATIBILITY=false
|
||||
|
||||
+4
-2
@@ -47,8 +47,9 @@ public class FMLModContainer extends ModContainer {
|
||||
this.contextExtension = () -> context;
|
||||
try {
|
||||
var moduleName = info.getOwningFile().moduleName();
|
||||
var module = gameLayer.findModule(moduleName)
|
||||
.orElseThrow(() -> new IllegalStateException("Failed to find " + moduleName + " in " + gameLayer));
|
||||
var module = gameLayer.findModule(moduleName).orElse(null);
|
||||
if (module == null)
|
||||
throw new IllegalStateException("Failed to find " + moduleName + " in " + gameLayer);
|
||||
|
||||
openModules(gameLayer, module, info.getOwningFile().getFile().getSecureJar());
|
||||
|
||||
@@ -166,6 +167,7 @@ public class FMLModContainer extends ModContainer {
|
||||
return modInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BusGroup getModBusGroup() {
|
||||
return this.eventBusGroup;
|
||||
}
|
||||
|
||||
+30
-201
@@ -1,235 +1,64 @@
|
||||
// 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.46,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
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: mapping_channel, version: mapping_version
|
||||
mappings channel: 'official', version: '@MC_VERSION@'
|
||||
|
||||
// Forge 1.20.6 and newer use official mappings at runtime, so we shouldn't reobf from official to SRG
|
||||
reobf = false
|
||||
|
||||
// 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, 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')
|
||||
|
||||
// Optional additional logging. 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'
|
||||
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
// Recommended for development - enables more descriptive errors at the cost of slower startup and registration.
|
||||
property 'eventbus.api.strictRuntimeChecks', 'true'
|
||||
|
||||
// arg "-mixin.config=${mod_id}.mixins.json"
|
||||
systemProperty 'eventbus.api.strictRuntimeChecks', 'true'
|
||||
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
|
||||
minecraft.mavenizer(it) // In Kotlin, it = this
|
||||
maven fg.forgeMaven
|
||||
maven fg.minecraftLibsMaven
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = 'Forge'
|
||||
url = 'https://maven.minecraftforge.net'
|
||||
}
|
||||
maven {
|
||||
name = 'Minecraft libraries'
|
||||
url = 'https://libraries.minecraft.net'
|
||||
}
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = 'Sponge'
|
||||
url = 'https://repo.spongepowered.org/repository/maven-public'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroupAndSubgroups('org.spongepowered')
|
||||
}
|
||||
}
|
||||
|
||||
// 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'
|
||||
// }
|
||||
}
|
||||
|
||||
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}"
|
||||
|
||||
// Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor
|
||||
// to improve performance in production environments. This line is required to enable said compile-time validation
|
||||
// in your development environment, helping you catch issues early.
|
||||
annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.12'
|
||||
|
||||
// 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) {
|
||||
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) {
|
||||
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
|
||||
])
|
||||
// attributes['MixinConfigs'] = "${mod_id}.mixins.json"
|
||||
}
|
||||
}
|
||||
|
||||
// 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@')
|
||||
annotationProcessor 'net.minecraftforge:eventbus-validator:@EVENTBUS_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 IntelliJ 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, 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'
|
||||
}
|
||||
@@ -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/
|
||||
@@ -22,4 +22,5 @@ eclipse
|
||||
run
|
||||
|
||||
# Files from Forge MDK
|
||||
forge_README.txt
|
||||
forge*changelog.txt
|
||||
+7
-64
@@ -1,66 +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=-Xmx5G
|
||||
org.gradle.daemon=false
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.configureondemand=true
|
||||
|
||||
# In the case that Gradle needs to fork to recompile, this will set the memory for that process.
|
||||
systemProp.net.minecraftforge.gradle.repo.recompile.fork=true
|
||||
systemProp.net.minecraftforge.gradle.repo.recompile.fork.args=-Xmx5G
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.configuration-cache.parallel=true
|
||||
org.gradle.configuration-cache.problems=warn
|
||||
|
||||
# Opts-out of ForgeGradle automatically adding mavenCentral(), Forge's maven and MC libs maven to the repositories block
|
||||
systemProp.net.minecraftforge.gradle.repo.attach=false
|
||||
|
||||
|
||||
## 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
@@ -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.10.0'
|
||||
}
|
||||
rootProject.name = 'examplemod'
|
||||
@@ -1,73 +1,37 @@
|
||||
# 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
|
||||
|
||||
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,)"
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
||||
@@ -131,6 +_,9 @@
|
||||
@@ -133,6 +_,9 @@
|
||||
GlStateManager._colorMask(true, true, true, true);
|
||||
GlStateManager._clear(16384);
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, 0, 0);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlDebug.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlDebug.java
|
||||
@@ -23,6 +_,14 @@
|
||||
@@ -24,6 +_,14 @@
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GlDebug {
|
||||
@@ -24,10 +24,10 @@
|
||||
}
|
||||
|
||||
public List<String> getLastOpenGlDebugMessages() {
|
||||
@@ -121,6 +_,7 @@
|
||||
@@ -120,6 +_,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static GlDebug enableDebugCallback(int p_394351_, boolean p_393026_, Set<String> p_393339_) {
|
||||
public static @Nullable GlDebug enableDebugCallback(int p_394351_, boolean p_393026_, Set<String> p_393339_) {
|
||||
+ p_393026_ |= PRINT_STACKTRACE_ON_ERROR;
|
||||
if (p_394351_ <= 0) {
|
||||
return null;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlDevice.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlDevice.java
|
||||
@@ -90,8 +_,15 @@
|
||||
public GpuTexture createTexture(
|
||||
@Nullable Supplier<String> p_397830_, int p_394481_, TextureFormat p_394839_, int p_391831_, int p_395609_, int p_407582_, int p_408928_
|
||||
@@ -124,8 +_,15 @@
|
||||
int p_407582_,
|
||||
int p_408928_
|
||||
) {
|
||||
+ return createTexture(p_397830_, p_394481_, p_394839_, p_391831_, p_395609_, p_407582_, p_408928_, false);
|
||||
+ }
|
||||
@@ -17,23 +17,23 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,6 +_,15 @@
|
||||
@@ -133,6 +_,15 @@
|
||||
public GpuTexture createTexture(
|
||||
@Nullable String p_394142_, int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_
|
||||
@Nullable String p_394142_, @GpuTexture.Usage int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_
|
||||
) {
|
||||
+ return createTexture(p_394142_, p_395535_, p_394951_, p_393944_, p_392329_, p_408015_, p_406483_, false);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public GpuTexture createTexture(
|
||||
+ @Nullable String p_394142_, int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_, boolean stencil
|
||||
+ @Nullable String p_394142_, @GpuTexture.Usage int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_, boolean stencil
|
||||
+ ) {
|
||||
+ // Forge: stencil rendering is only for depth
|
||||
+ stencil &= p_394951_.hasDepthAspect();
|
||||
if (p_406483_ < 1) {
|
||||
throw new IllegalArgumentException("mipLevels must be at least 1");
|
||||
} else if (p_408015_ < 1) {
|
||||
@@ -149,11 +_,14 @@
|
||||
@@ -183,11 +_,14 @@
|
||||
GlStateManager._texImage2D(
|
||||
k,
|
||||
l,
|
||||
@@ -48,7 +48,7 @@
|
||||
GlConst.toGlType(p_394951_),
|
||||
null
|
||||
);
|
||||
@@ -164,11 +_,14 @@
|
||||
@@ -198,11 +_,14 @@
|
||||
GlStateManager._texImage2D(
|
||||
j,
|
||||
i1,
|
||||
@@ -63,7 +63,7 @@
|
||||
GlConst.toGlType(p_394951_),
|
||||
null
|
||||
);
|
||||
@@ -181,7 +_,7 @@
|
||||
@@ -215,7 +_,7 @@
|
||||
} else if (j1 != 0) {
|
||||
throw new IllegalStateException("OpenGL error " + j1);
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlStateManager.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlStateManager.java
|
||||
@@ -85,6 +_,11 @@
|
||||
@@ -86,6 +_,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlTexture.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlTexture.java
|
||||
@@ -19,8 +_,13 @@
|
||||
private int views;
|
||||
|
||||
protected GlTexture(int p_394590_, String p_393950_, TextureFormat p_392837_, int p_391379_, int p_391947_, int p_396659_, int p_408255_, int p_408889_) {
|
||||
@@ -21,8 +_,13 @@
|
||||
protected GlTexture(
|
||||
@GpuTexture.Usage int p_394590_, String p_393950_, TextureFormat p_392837_, int p_391379_, int p_391947_, int p_396659_, int p_408255_, int p_408889_
|
||||
) {
|
||||
+ this(p_394590_, p_393950_, p_392837_, p_391379_, p_391947_, p_396659_, p_408255_, p_408889_, false);
|
||||
+ }
|
||||
+
|
||||
@@ -14,20 +14,16 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,6 +_,16 @@
|
||||
public void setTextureFilter(FilterMode p_394977_, FilterMode p_397175_, boolean p_393558_) {
|
||||
super.setTextureFilter(p_394977_, p_397175_, p_393558_);
|
||||
this.modesDirty = true;
|
||||
@@ -89,5 +_,12 @@
|
||||
if (this.closed && this.views == 0) {
|
||||
this.destroyImmediately();
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /* FORGE START */
|
||||
+
|
||||
+ private final boolean stencilEnabled;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isStencilEnabled() {
|
||||
+ return this.stencilEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||
@@ -86,7 +_,7 @@
|
||||
@@ -80,7 +_,7 @@
|
||||
this.width = p_83951_;
|
||||
this.height = p_83952_;
|
||||
if (this.useDepth) {
|
||||
- this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, p_83951_, p_83952_, 1, 1);
|
||||
+ this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, p_83951_, p_83952_, 1, 1, this.stencilEnabled);
|
||||
this.depthTextureView = gpudevice.createTextureView(this.depthTexture);
|
||||
this.depthTexture.setTextureFilter(FilterMode.NEAREST, false);
|
||||
this.depthTexture.setAddressMode(AddressMode.CLAMP_TO_EDGE);
|
||||
@@ -155,5 +_,26 @@
|
||||
@Nullable
|
||||
public GpuTextureView getDepthTextureView() {
|
||||
}
|
||||
|
||||
@@ -126,5 +_,26 @@
|
||||
|
||||
public @Nullable GpuTextureView getDepthTextureView() {
|
||||
return this.depthTextureView;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/com/mojang/blaze3d/systems/GpuDevice.java
|
||||
+++ b/com/mojang/blaze3d/systems/GpuDevice.java
|
||||
@@ -26,7 +_,17 @@
|
||||
@Nullable Supplier<String> p_394357_, int p_395623_, TextureFormat p_395807_, int p_395802_, int p_396157_, int p_408810_, int p_407070_
|
||||
@@ -36,9 +_,19 @@
|
||||
int p_407070_
|
||||
);
|
||||
|
||||
+ /** Forge: same as {@link #createTexture(Supplier, int, TextureFormat, int, int, int)} but with stencil support */
|
||||
@@ -9,7 +9,9 @@
|
||||
+ return this.createTexture(p_394357_, p_395623_, p_395807_, p_395802_, p_396157_, p_408810_, p_407070_);
|
||||
+ }
|
||||
+
|
||||
GpuTexture createTexture(@Nullable String p_391798_, int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_);
|
||||
GpuTexture createTexture(
|
||||
@Nullable String p_391798_, @GpuTexture.Usage int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_
|
||||
);
|
||||
+
|
||||
+ /** Forge: same as {@link #createTexture(String, int, TextureFormat, int, int, int)} but with stencil support */
|
||||
+ default GpuTexture createTexture(@Nullable String p_391798_, int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_, boolean stencil) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/textures/GpuTexture.java
|
||||
+++ b/com/mojang/blaze3d/textures/GpuTexture.java
|
||||
@@ -6,7 +_,7 @@
|
||||
@@ -10,7 +_,7 @@
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@DontObfuscate
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||
@@ -15,7 +_,7 @@
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
@@ -14,7 +_,7 @@
|
||||
import org.joml.Vector3fc;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public interface VertexConsumer {
|
||||
@@ -9,15 +9,3 @@
|
||||
VertexConsumer addVertex(float p_344294_, float p_342213_, float p_344859_);
|
||||
|
||||
VertexConsumer setColor(int p_342749_, int p_344324_, int p_343336_, int p_342831_);
|
||||
@@ -131,9 +_,11 @@
|
||||
|
||||
int j1 = ARGB.color(k, (int)f3, (int)f4, (int)f5);
|
||||
int k1 = LightTexture.lightCoordsWithEmission(p_331444_[i1], l);
|
||||
+ k1 = applyBakedLighting(k1, bytebuffer);
|
||||
float f10 = bytebuffer.getFloat(16);
|
||||
float f9 = bytebuffer.getFloat(20);
|
||||
Vector3f vector3f1 = matrix4f.transformPosition(f, f1, f2, new Vector3f());
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_85988_.normal());
|
||||
this.addVertex(vector3f1.x(), vector3f1.y(), vector3f1.z(), j1, f10, f9, p_85993_, k1, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,15 @@
|
||||
public static final int UNKNOWN_ELEMENT = -1;
|
||||
private final List<VertexFormatElement> elements;
|
||||
private final List<String> names;
|
||||
@@ -31,6 +_,7 @@
|
||||
private GpuBuffer immediateDrawVertexBuffer;
|
||||
@Nullable
|
||||
private GpuBuffer immediateDrawIndexBuffer;
|
||||
@@ -29,6 +_,7 @@
|
||||
private final int[] offsetsByElement = new int[32];
|
||||
private @Nullable GpuBuffer immediateDrawVertexBuffer;
|
||||
private @Nullable GpuBuffer immediateDrawIndexBuffer;
|
||||
+ private final com.google.common.collect.ImmutableMap<String, VertexFormatElement> elementMapping;
|
||||
|
||||
VertexFormat(List<VertexFormatElement> p_343616_, List<String> p_345241_, IntList p_345522_, int p_344162_) {
|
||||
this.elements = p_343616_;
|
||||
@@ -43,6 +_,11 @@
|
||||
@@ -41,6 +_,11 @@
|
||||
int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1;
|
||||
this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1;
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
}
|
||||
|
||||
public static VertexFormat.Builder builder() {
|
||||
@@ -141,6 +_,9 @@
|
||||
@@ -139,6 +_,9 @@
|
||||
this.immediateDrawIndexBuffer = uploadToBuffer(this.immediateDrawIndexBuffer, p_391835_, 72, () -> "Immediate index buffer for " + this);
|
||||
return this.immediateDrawIndexBuffer;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/com/mojang/math/Transformation.java
|
||||
+++ b/com/mojang/math/Transformation.java
|
||||
@@ -14,7 +_,7 @@
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
@@ -16,7 +_,7 @@
|
||||
import org.joml.Vector3fc;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
-public final class Transformation {
|
||||
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
|
||||
private final Matrix4fc matrix;
|
||||
public static final Codec<Transformation> CODEC = RecordCodecBuilder.create(
|
||||
p_269604_ -> p_269604_.group(
|
||||
@@ -174,5 +_,19 @@
|
||||
vector3f1.lerp(p_175938_.getScale(), p_175939_);
|
||||
quaternionf1.slerp(p_175938_.getRightRotation(), p_175939_);
|
||||
return new Transformation(vector3f, quaternionf, vector3f1, quaternionf1);
|
||||
@@ -168,5 +_,19 @@
|
||||
this.getScale().lerp(p_175938_.getScale(), p_175939_, new Vector3f()),
|
||||
this.getRightRotation().slerp(p_175938_.getRightRotation(), p_175939_, new Quaternionf())
|
||||
);
|
||||
+ }
|
||||
+
|
||||
+ private Matrix3f normalTransform = null;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
@@ -71,6 +_,15 @@
|
||||
@@ -62,6 +_,15 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -15,4 +15,4 @@
|
||||
+ @Override
|
||||
public void render(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) {
|
||||
super.render(p_283497_, p_88680_, p_88681_, p_88682_);
|
||||
p_283497_.drawCenteredString(this.font, this.lines.title, this.width / 2, 80, -1);
|
||||
p_283497_.drawCenteredString(this.font, this.title, this.width / 2, 80, -1);
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
|
||||
@@ -263,7 +_,7 @@
|
||||
int k = this.getY();
|
||||
p_282595_.blit(RenderPipelines.GUI_TEXTURED, this.image, j + 2, k + 2, 0.0F, 0.0F, 56, 56, 56, 56, 56, 56, i);
|
||||
p_282595_.blitSprite(RenderPipelines.GUI_TEXTURED, SLOT_FRAME_SPRITE, j, k, 60, 60, i);
|
||||
- int l = flag ? -6250336 : -1;
|
||||
+ int l = getFGColor();
|
||||
p_282595_.drawCenteredString(RealmsResetWorldScreen.this.font, this.getMessage(), j + 28, k - 14, l);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -224,6 +_,7 @@
|
||||
@@ -216,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -233,7 +_,11 @@
|
||||
@@ -231,7 +_,11 @@
|
||||
}
|
||||
|
||||
public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, String p_138391_) {
|
||||
- AdvancementHolder advancementholder = this.build(ResourceLocation.parse(p_138391_));
|
||||
+ return save(p_138390_, ResourceLocation.parse(p_138391_));
|
||||
- AdvancementHolder advancementholder = this.build(Identifier.parse(p_138391_));
|
||||
+ return save(p_138390_, Identifier.parse(p_138391_));
|
||||
+ }
|
||||
+
|
||||
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, ResourceLocation id) {
|
||||
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, Identifier id) {
|
||||
+ AdvancementHolder advancementholder = this.build(id);
|
||||
p_138390_.accept(advancementholder);
|
||||
return advancementholder;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/advancements/AdvancementRewards.java
|
||||
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
||||
@@ -43,6 +_,7 @@
|
||||
@@ -44,6 +_,7 @@
|
||||
LootParams lootparams = new LootParams.Builder(serverlevel)
|
||||
.withParameter(LootContextParams.THIS_ENTITY, p_9990_)
|
||||
.withParameter(LootContextParams.ORIGIN, p_9990_.position())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Camera.java
|
||||
+++ b/net/minecraft/client/Camera.java
|
||||
@@ -132,9 +_,13 @@
|
||||
@@ -136,9 +_,13 @@
|
||||
}
|
||||
|
||||
protected void setRotation(float p_90573_, float p_90574_) {
|
||||
@@ -15,10 +15,10 @@
|
||||
FORWARDS.rotate(this.rotation, this.forwards);
|
||||
UP.rotate(this.rotation, this.up);
|
||||
LEFT.rotate(this.rotation, this.left);
|
||||
@@ -250,6 +_,13 @@
|
||||
@@ -168,6 +_,13 @@
|
||||
|
||||
public float getPartialTickTime() {
|
||||
return this.partialTickTime;
|
||||
public float yRot() {
|
||||
return this.yRot;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/client/KeyMapping.java
|
||||
+++ b/net/minecraft/client/KeyMapping.java
|
||||
@@ -19,9 +_,9 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class KeyMapping implements Comparable<KeyMapping> {
|
||||
@@ -12,7 +12,7 @@
|
||||
private final String name;
|
||||
private final InputConstants.Key defaultKey;
|
||||
private final KeyMapping.Category category;
|
||||
@@ -38,7 +_,7 @@
|
||||
@@ -39,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static void forAllKeyMappings(InputConstants.Key p_424096_, Consumer<KeyMapping> p_427756_) {
|
||||
@@ -21,7 +21,7 @@
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (KeyMapping keymapping : list) {
|
||||
p_427756_.accept(keymapping);
|
||||
@@ -100,7 +_,7 @@
|
||||
@@ -106,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean isDown() {
|
||||
@@ -30,12 +30,13 @@
|
||||
}
|
||||
|
||||
public KeyMapping.Category getCategory() {
|
||||
@@ -140,7 +_,16 @@
|
||||
public int compareTo(KeyMapping p_90841_) {
|
||||
return this.category == p_90841_.category
|
||||
? I18n.get(this.name).compareTo(I18n.get(p_90841_.name))
|
||||
- : Integer.compare(KeyMapping.Category.SORT_ORDER.indexOf(this.category), KeyMapping.Category.SORT_ORDER.indexOf(p_90841_.category));
|
||||
+ : compareSort(this.category, p_90841_.category);
|
||||
@@ -149,8 +_,17 @@
|
||||
? I18n.get(this.name).compareTo(I18n.get(p_90841_.name))
|
||||
: Integer.compare(this.order, p_90841_.order);
|
||||
} else {
|
||||
- return Integer.compare(KeyMapping.Category.SORT_ORDER.indexOf(this.category), KeyMapping.Category.SORT_ORDER.indexOf(p_90841_.category));
|
||||
+ return compareSort(this.category, p_90841_.category);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ private static int compareSort(Category c1, Category c2) {
|
||||
@@ -48,7 +49,7 @@
|
||||
}
|
||||
|
||||
public static Supplier<Component> createNameSupplier(String p_90843_) {
|
||||
@@ -149,6 +_,20 @@
|
||||
@@ -159,6 +_,20 @@
|
||||
}
|
||||
|
||||
public boolean same(KeyMapping p_90851_) {
|
||||
@@ -69,7 +70,7 @@
|
||||
return this.key.equals(p_90851_.key);
|
||||
}
|
||||
|
||||
@@ -167,11 +_,13 @@
|
||||
@@ -177,11 +_,13 @@
|
||||
}
|
||||
|
||||
public Component getTranslatedKeyMessage() {
|
||||
@@ -84,7 +85,7 @@
|
||||
}
|
||||
|
||||
public String saveString() {
|
||||
@@ -183,12 +_,94 @@
|
||||
@@ -193,11 +_,94 @@
|
||||
}
|
||||
|
||||
private void registerMapping(InputConstants.Key p_423386_) {
|
||||
@@ -92,8 +93,7 @@
|
||||
+ MAP.put(p_423386_, this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static KeyMapping get(String p_378660_) {
|
||||
public static @Nullable KeyMapping get(String p_378660_) {
|
||||
return ALL.get(p_378660_);
|
||||
+ }
|
||||
+
|
||||
@@ -104,28 +104,28 @@
|
||||
+ /**
|
||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
|
||||
+ */
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, Category category) {
|
||||
+ this(description, keyConflictContext, inputType.getOrCreate(keyCode), category);
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, Category category, int order) {
|
||||
+ this(description, keyConflictContext, inputType.getOrCreate(keyCode), category, order);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
|
||||
+ */
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, InputConstants.Key keyCode, Category category) {
|
||||
+ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category);
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, InputConstants.Key keyCode, Category category, int order) {
|
||||
+ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category, order);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
|
||||
+ */
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, Category category) {
|
||||
+ this(description, keyConflictContext, keyModifier, inputType.getOrCreate(keyCode), category);
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, Category category, int order) {
|
||||
+ this(description, keyConflictContext, keyModifier, inputType.getOrCreate(keyCode), category, order);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
|
||||
+ */
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, Category category) {
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, Category category, int order) {
|
||||
+ this.name = description;
|
||||
+ this.key = keyCode;
|
||||
+ this.defaultKey = keyCode;
|
||||
@@ -133,6 +133,7 @@
|
||||
+ this.keyConflictContext = keyConflictContext;
|
||||
+ this.keyModifier = keyModifier;
|
||||
+ this.keyModifierDefault = keyModifier;
|
||||
+ this.order = order;
|
||||
+ if (this.keyModifier.matches(keyCode))
|
||||
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||
+ ALL.put(description, this);
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
--- a/net/minecraft/client/KeyboardHandler.java
|
||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||
@@ -499,12 +_,12 @@
|
||||
@@ -497,7 +_,7 @@
|
||||
if (screen != null) {
|
||||
try {
|
||||
if (p_90895_ != 1 && p_90895_ != 2) {
|
||||
- if (p_90895_ == 0 && screen.keyReleased(p_423534_)) {
|
||||
+ if (p_90895_ == 0 && net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(screen, p_423534_)) {
|
||||
return;
|
||||
if (options.keyDebugModifier.matches(p_423534_)) {
|
||||
this.usedDebugKeyAsModifier = false;
|
||||
}
|
||||
@@ -506,7 +_,7 @@
|
||||
}
|
||||
} else {
|
||||
screen.afterKeyboardAction();
|
||||
@@ -15,7 +18,7 @@
|
||||
if (this.minecraft.screen == null) {
|
||||
InputConstants.Key inputconstants$key = InputConstants.getKey(p_423534_);
|
||||
KeyMapping.set(inputconstants$key, false);
|
||||
@@ -568,6 +_,7 @@
|
||||
@@ -582,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +26,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,7 +_,7 @@
|
||||
@@ -590,7 +_,7 @@
|
||||
Screen screen = this.minecraft.screen;
|
||||
if (screen != null && this.minecraft.getOverlay() == null) {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -260,7 +_,7 @@
|
||||
@@ -265,7 +_,7 @@
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -9,7 +9,7 @@
|
||||
static Minecraft instance;
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int MAX_TICKS_PER_UPDATE = 10;
|
||||
@@ -439,7 +_,6 @@
|
||||
@@ -431,7 +_,6 @@
|
||||
}
|
||||
}, Util.nonCriticalIoPool());
|
||||
LOGGER.info("Setting user: {}", this.user.getName());
|
||||
@@ -17,7 +17,7 @@
|
||||
this.demo = p_91084_.game.demo;
|
||||
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
|
||||
this.allowsChat = !p_91084_.game.disableChat;
|
||||
@@ -491,10 +_,9 @@
|
||||
@@ -483,10 +_,9 @@
|
||||
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
RenderSystem.initRenderer(
|
||||
this.window.handle(),
|
||||
this.options.glDebugVerbosity,
|
||||
@@ -505,6 +_,7 @@
|
||||
@@ -498,6 +_,7 @@
|
||||
LOGGER.info("Using optional rendering extensions: {}", String.join(", ", RenderSystem.getDevice().getEnabledExtensions()));
|
||||
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
|
||||
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
@@ -37,7 +37,7 @@
|
||||
this.resourcePackRepository.reload();
|
||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||
this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> {
|
||||
@@ -593,6 +_,7 @@
|
||||
@@ -585,6 +_,7 @@
|
||||
this.particleResources = new ParticleResources();
|
||||
this.resourceManager.registerReloadListener(this.particleResources);
|
||||
this.particleEngine = new ParticleEngine(this.level, this.particleResources);
|
||||
@@ -45,7 +45,7 @@
|
||||
this.particleResources.onReload(this.particleEngine::clearParticles);
|
||||
this.waypointStyles = new WaypointStyleManager();
|
||||
this.resourceManager.registerReloadListener(this.waypointStyles);
|
||||
@@ -604,6 +_,9 @@
|
||||
@@ -596,6 +_,9 @@
|
||||
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||
this.gui = new Gui(this);
|
||||
@@ -55,7 +55,7 @@
|
||||
RealmsClient realmsclient = RealmsClient.getOrCreate(this);
|
||||
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
|
||||
RenderSystem.setErrorCallback(this::onFullscreenError);
|
||||
@@ -636,6 +_,7 @@
|
||||
@@ -628,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@
|
||||
this.window.updateVsync(this.options.enableVsync().get());
|
||||
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||
this.window.setAllowCursorChanges(this.options.allowCursorChanges().get());
|
||||
@@ -659,16 +_,17 @@
|
||||
@@ -651,16 +_,17 @@
|
||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
|
||||
this.setOverlay(
|
||||
- new LoadingOverlay(
|
||||
- this, reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> {
|
||||
- this, reloadinstance, p_447796_ -> Util.ifElse(p_447796_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> {
|
||||
+ net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(
|
||||
+ () -> this, () -> reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> {
|
||||
+ () -> this, () -> reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_447796_ -> this.rollbackResourcePacks(p_447796_, minecraft$gameloadcookie), () -> {
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
this.selfTest();
|
||||
}
|
||||
@@ -84,7 +84,7 @@
|
||||
);
|
||||
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.logPath());
|
||||
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
|
||||
@@ -787,6 +_,7 @@
|
||||
@@ -779,6 +_,7 @@
|
||||
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
||||
if (checkModStatus().shouldReportAsModified()) {
|
||||
stringbuilder.append("*");
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
|
||||
stringbuilder.append(" ");
|
||||
@@ -810,6 +_,8 @@
|
||||
@@ -802,6 +_,8 @@
|
||||
}
|
||||
|
||||
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
@@ -101,16 +101,16 @@
|
||||
return p_193587_.game.offlineDeveloperMode ? UserApiService.OFFLINE : p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
|
||||
}
|
||||
|
||||
@@ -822,7 +_,7 @@
|
||||
@@ -814,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
|
||||
private void rollbackResourcePacks(Throwable p_91240_, Minecraft.@Nullable GameLoadCookie p_299515_) {
|
||||
- if (this.resourcePackRepository.getSelectedIds().size() > 1) {
|
||||
+ if (this.resourcePackRepository.getSelectedPacks().stream().anyMatch(e -> !e.isRequired())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
|
||||
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
|
||||
} else {
|
||||
Util.throwAsRuntime(p_91240_);
|
||||
@@ -1108,12 +_,6 @@
|
||||
@@ -1100,12 +_,6 @@
|
||||
LOGGER.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
if (p_91153_ == null) {
|
||||
if (this.clientLevelTeardownInProgress) {
|
||||
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
|
||||
@@ -1132,6 +_,23 @@
|
||||
@@ -1124,6 +_,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,28 +147,28 @@
|
||||
this.screen = p_91153_;
|
||||
if (this.screen != null) {
|
||||
this.screen.added();
|
||||
@@ -1214,6 +_,7 @@
|
||||
FreeTypeUtil.destroy();
|
||||
@@ -1207,6 +_,7 @@
|
||||
Util.shutdownExecutors();
|
||||
RenderSystem.getSamplerCache().close();
|
||||
RenderSystem.getDevice().close();
|
||||
+ net.minecraftforge.fml.config.ConfigTracker.INSTANCE.forceUnload();
|
||||
} catch (Throwable throwable) {
|
||||
LOGGER.error("Shutdown failure!", throwable);
|
||||
throw throwable;
|
||||
@@ -1278,7 +_,9 @@
|
||||
RenderSystem.getDevice().createCommandEncoder().clearColorAndDepthTextures(rendertarget.getColorTexture(), 0, rendertarget.getDepthTexture(), 1.0);
|
||||
profilerfiller.push("gameRenderer");
|
||||
if (!this.noRender) {
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
|
||||
this.gameRenderer.render(this.deltaTracker, p_91384_);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
|
||||
}
|
||||
@@ -1289,7 +_,9 @@
|
||||
RenderSystem.getDevice().createCommandEncoder().clearColorAndDepthTextures(rendertarget.getColorTexture(), 0, rendertarget.getDepthTexture(), 1.0);
|
||||
profilerfiller.push("gameRenderer");
|
||||
if (!this.noRender) {
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
|
||||
this.gameRenderer.render(this.deltaTracker, p_91384_);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
|
||||
}
|
||||
|
||||
profilerfiller.popPush("blit");
|
||||
@@ -1388,10 +_,12 @@
|
||||
profilerfiller.popPush("blit");
|
||||
@@ -1401,10 +_,12 @@
|
||||
this.window.setGuiScale(i);
|
||||
if (this.screen != null) {
|
||||
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
this.screen.resize(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
||||
this.mouseHandler.setIgnoreFirstMove();
|
||||
}
|
||||
@@ -1529,6 +_,7 @@
|
||||
@@ -1542,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@@ -186,58 +186,59 @@
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
@@ -1556,10 +_,18 @@
|
||||
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
@@ -1571,10 +_,18 @@
|
||||
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||
+ if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) {
|
||||
+ if (inputEvent.shouldSwingHand()) {
|
||||
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
|
||||
+ this.player.swing(InteractionHand.MAIN_HAND);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
Direction direction = blockhitresult.getDirection();
|
||||
- if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
|
||||
- this.level.addBreakingBlockEffect(blockpos, direction);
|
||||
+ if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) {
|
||||
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1611,6 +_,8 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
return true;
|
||||
} else {
|
||||
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||
+ if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) {
|
||||
+ if (inputEvent.shouldSwingHand()) {
|
||||
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
|
||||
+ this.player.swing(InteractionHand.MAIN_HAND);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
Direction direction = blockhitresult.getDirection();
|
||||
- if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
|
||||
- this.level.addBreakingBlockEffect(blockpos, direction);
|
||||
+ if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) {
|
||||
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
|
||||
+ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent))
|
||||
switch (this.hitResult.getType()) {
|
||||
case ENTITY:
|
||||
AttackRange attackrange = itemstack.get(DataComponents.ATTACK_RANGE);
|
||||
@@ -1621,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||
if (this.level.getBlockState(blockpos).isAir()) {
|
||||
flag = true;
|
||||
@@ -1634,9 +_,10 @@
|
||||
}
|
||||
|
||||
this.player.resetAttackStrengthTicker();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player);
|
||||
}
|
||||
|
||||
- if (!this.player.isSpectator()) {
|
||||
+ if (!this.player.isSpectator() && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1587,6 +_,8 @@
|
||||
return false;
|
||||
} else {
|
||||
boolean flag = false;
|
||||
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||
+ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent))
|
||||
switch (this.hitResult.getType()) {
|
||||
case ENTITY:
|
||||
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
|
||||
@@ -1594,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||
if (this.level.getBlockState(blockpos).isAir()) {
|
||||
flag = true;
|
||||
@@ -1607,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.player.resetAttackStrengthTicker();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player);
|
||||
}
|
||||
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
return flag;
|
||||
}
|
||||
@@ -1624,6 +_,12 @@
|
||||
@@ -1655,6 +_,12 @@
|
||||
}
|
||||
|
||||
for (InteractionHand interactionhand : InteractionHand.values()) {
|
||||
@@ -250,16 +251,16 @@
|
||||
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
||||
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
||||
return;
|
||||
@@ -1644,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (interactionresult instanceof InteractionResult.Success interactionresult$success2) {
|
||||
- if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
+ if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(interactionhand);
|
||||
@@ -1676,7 +_,7 @@
|
||||
}
|
||||
|
||||
@@ -1656,7 +_,7 @@
|
||||
if (interactionresult instanceof InteractionResult.Success interactionresult$success2) {
|
||||
- if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
+ if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(interactionhand);
|
||||
}
|
||||
|
||||
@@ -1689,7 +_,7 @@
|
||||
int i = itemstack.getCount();
|
||||
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
||||
if (interactionresult1 instanceof InteractionResult.Success interactionresult$success) {
|
||||
@@ -268,7 +269,7 @@
|
||||
this.player.swing(interactionhand);
|
||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.player.hasInfiniteMaterials())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
||||
@@ -1672,6 +_,9 @@
|
||||
@@ -1705,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +279,7 @@
|
||||
if (!itemstack.isEmpty()
|
||||
&& this.gameMode.useItem(this.player, interactionhand) instanceof InteractionResult.Success interactionresult$success1) {
|
||||
if (interactionresult$success1.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
@@ -1701,6 +_,8 @@
|
||||
@@ -1734,6 +_,8 @@
|
||||
}
|
||||
|
||||
ProfilerFiller profilerfiller = Profiler.get();
|
||||
@@ -287,7 +288,7 @@
|
||||
profilerfiller.push("gui");
|
||||
this.chatListener.tick();
|
||||
this.gui.tick(this.pause);
|
||||
@@ -1786,6 +_,7 @@
|
||||
@@ -1815,6 +_,7 @@
|
||||
|
||||
this.tutorial.tick();
|
||||
|
||||
@@ -295,7 +296,7 @@
|
||||
try {
|
||||
this.level.tick(() -> true);
|
||||
} catch (Throwable throwable1) {
|
||||
@@ -1799,6 +_,7 @@
|
||||
@@ -1828,6 +_,7 @@
|
||||
|
||||
throw new ReportedException(crashreport1);
|
||||
}
|
||||
@@ -303,7 +304,7 @@
|
||||
}
|
||||
|
||||
profilerfiller.popPush("animateTick");
|
||||
@@ -1823,6 +_,7 @@
|
||||
@@ -1852,6 +_,7 @@
|
||||
profilerfiller.popPush("keyboard");
|
||||
this.keyboardHandler.tick();
|
||||
profilerfiller.pop();
|
||||
@@ -311,7 +312,7 @@
|
||||
}
|
||||
|
||||
private boolean isLevelRunningNormally() {
|
||||
@@ -2041,6 +_,7 @@
|
||||
@@ -2070,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setLevel(ClientLevel p_91157_) {
|
||||
@@ -319,7 +320,7 @@
|
||||
this.level = p_91157_;
|
||||
this.updateLevelInEngines(p_91157_);
|
||||
}
|
||||
@@ -2094,6 +_,7 @@
|
||||
@@ -2131,6 +_,7 @@
|
||||
IntegratedServer integratedserver = this.singleplayerServer;
|
||||
this.singleplayerServer = null;
|
||||
this.gameRenderer.resetData();
|
||||
@@ -327,7 +328,7 @@
|
||||
this.gameMode = null;
|
||||
this.narrator.clear();
|
||||
this.clientLevelTeardownInProgress = true;
|
||||
@@ -2101,6 +_,7 @@
|
||||
@@ -2138,6 +_,7 @@
|
||||
try {
|
||||
if (this.level != null) {
|
||||
this.gui.onDisconnected();
|
||||
@@ -335,15 +336,15 @@
|
||||
}
|
||||
|
||||
if (integratedserver != null) {
|
||||
@@ -2113,6 +_,7 @@
|
||||
@@ -2150,6 +_,7 @@
|
||||
}
|
||||
|
||||
profilerfiller.pop();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.level);
|
||||
}
|
||||
|
||||
this.setScreenAndShow(p_335030_);
|
||||
@@ -2254,6 +_,7 @@
|
||||
this.setScreenAndShow(p_457642_);
|
||||
@@ -2292,6 +_,7 @@
|
||||
|
||||
private void pickBlock() {
|
||||
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
if (this.minecraft.getOverlay() == null) {
|
||||
if (this.minecraft.screen == null) {
|
||||
if (!this.mouseGrabbed && flag) {
|
||||
@@ -103,7 +_,7 @@
|
||||
try {
|
||||
long i = Util.getMillis();
|
||||
boolean flag1 = i - this.lastClickTime < 250L && this.lastClickButton == mousebuttonevent.button();
|
||||
@@ -106,7 +_,7 @@
|
||||
&& i - this.lastClick.time() < 250L
|
||||
&& this.lastClick.screen() == screen
|
||||
&& this.lastClickButton == mousebuttonevent.button();
|
||||
- if (screen.mouseClicked(mousebuttonevent, flag1)) {
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(screen, d0, d1, mousebuttonevent, flag1)) {
|
||||
this.lastClickTime = i;
|
||||
this.lastClick = new MouseHandler.LastClick(i, screen);
|
||||
this.lastClickButton = mousebuttoninfo.button();
|
||||
return;
|
||||
@@ -118,7 +_,7 @@
|
||||
@@ -121,7 +_,7 @@
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -26,7 +26,7 @@
|
||||
return;
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
@@ -148,6 +_,7 @@
|
||||
@@ -151,6 +_,7 @@
|
||||
KeyMapping.click(inputconstants$key);
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +_,9 @@
|
||||
@@ -207,7 +_,9 @@
|
||||
if (this.minecraft.screen != null) {
|
||||
double d3 = this.getScaledXPos(this.minecraft.getWindow());
|
||||
double d4 = this.getScaledYPos(this.minecraft.getWindow());
|
||||
@@ -45,7 +45,7 @@
|
||||
this.minecraft.screen.afterMouseAction();
|
||||
} else if (this.minecraft.player != null) {
|
||||
Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(d1, d2);
|
||||
@@ -213,6 +_,7 @@
|
||||
@@ -216,6 +_,7 @@
|
||||
}
|
||||
|
||||
int i = vector2i.y == 0 ? -vector2i.x : vector2i.y;
|
||||
@@ -53,7 +53,7 @@
|
||||
if (this.minecraft.player.isSpectator()) {
|
||||
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-i);
|
||||
@@ -321,7 +_,7 @@
|
||||
@@ -324,7 +_,7 @@
|
||||
double d5 = getScaledYPos(window, this.accumulatedDY);
|
||||
|
||||
try {
|
||||
@@ -62,7 +62,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport1 = CrashReport.forThrowable(throwable, "mouseDragged event handler");
|
||||
screen.fillCrashDetails(crashreport1);
|
||||
@@ -408,6 +_,14 @@
|
||||
@@ -411,6 +_,14 @@
|
||||
|
||||
public double ypos() {
|
||||
return this.ypos;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -709,7 +_,8 @@
|
||||
@@ -816,7 +_,8 @@
|
||||
},
|
||||
new OptionInstance.LazyEnum<>(
|
||||
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
|
||||
@@ -10,15 +10,15 @@
|
||||
? Optional.empty()
|
||||
: Optional.of(p_232011_),
|
||||
Codec.STRING
|
||||
@@ -743,6 +_,7 @@
|
||||
@@ -848,6 +_,7 @@
|
||||
);
|
||||
public boolean syncWrites;
|
||||
public boolean startedCleanly = true;
|
||||
+ private final Map<String, String> unknownKeys = new java.util.HashMap<>();
|
||||
|
||||
public OptionInstance<Boolean> darkMojangStudiosBackground() {
|
||||
return this.darkMojangStudiosBackground;
|
||||
@@ -1150,6 +_,7 @@
|
||||
private static void operateOnLevelRenderer(Consumer<LevelRenderer> p_457625_) {
|
||||
LevelRenderer levelrenderer = Minecraft.getInstance().levelRenderer;
|
||||
@@ -1313,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Options(Minecraft p_92138_, File p_92139_) {
|
||||
@@ -26,9 +26,9 @@
|
||||
this.minecraft = p_92138_;
|
||||
this.optionsFile = new File(p_92139_, "options.txt");
|
||||
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
||||
@@ -1290,15 +_,28 @@
|
||||
@@ -1463,15 +_,28 @@
|
||||
this.startedCleanly = p_168428_.process("startedCleanly", this.startedCleanly);
|
||||
p_168428_.process("showNowPlayingToast", this.showNowPlayingToast);
|
||||
p_168428_.process("musicToast", this.musicToast);
|
||||
p_168428_.process("musicFrequency", this.musicFrequency);
|
||||
+ processOptionsKeysOnly(p_168428_);
|
||||
+ processOptionsEnd(p_168428_);
|
||||
@@ -56,7 +56,7 @@
|
||||
for (SoundSource soundsource : SoundSource.values()) {
|
||||
p_168428_.process("soundCategory_" + soundsource.getName(), this.soundSourceVolumes.get(soundsource));
|
||||
}
|
||||
@@ -1313,6 +_,10 @@
|
||||
@@ -1486,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -67,17 +67,17 @@
|
||||
try {
|
||||
if (!this.optionsFile.exists()) {
|
||||
return;
|
||||
@@ -1337,7 +_,8 @@
|
||||
this.graphicsMode.set(isTrue(optional.get()) ? GraphicsStatus.FANCY : GraphicsStatus.FAST);
|
||||
@@ -1505,7 +_,8 @@
|
||||
}
|
||||
|
||||
final CompoundTag compoundtag1 = this.dataFix(compoundtag);
|
||||
- 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_) {
|
||||
@@ -1418,6 +_,17 @@
|
||||
private @Nullable String getValue(String p_394210_) {
|
||||
Tag tag = compoundtag1.get(p_394210_);
|
||||
@@ -1585,6 +_,17 @@
|
||||
);
|
||||
compoundtag1.getString("fullscreenResolution").ifPresent(p_389133_ -> this.fullscreenVideoModeString = p_389133_);
|
||||
KeyMapping.resetMapping();
|
||||
@@ -95,7 +95,7 @@
|
||||
} catch (Exception exception) {
|
||||
LOGGER.error("Failed to load options", (Throwable)exception);
|
||||
}
|
||||
@@ -1445,9 +_,11 @@
|
||||
@@ -1612,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().dataVersion().version());
|
||||
@@ -107,7 +107,7 @@
|
||||
printwriter.print(p_168491_);
|
||||
printwriter.print(':');
|
||||
}
|
||||
@@ -1503,6 +_,12 @@
|
||||
@@ -1670,6 +_,12 @@
|
||||
if (s != null) {
|
||||
printwriter.println("fullscreenResolution:" + s);
|
||||
}
|
||||
@@ -120,7 +120,7 @@
|
||||
} catch (Exception exception) {
|
||||
LOGGER.error("Failed to save options", (Throwable)exception);
|
||||
}
|
||||
@@ -1541,6 +_,7 @@
|
||||
@@ -1707,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void broadcastOptions() {
|
||||
@@ -128,7 +128,7 @@
|
||||
if (this.minecraft.player != null) {
|
||||
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
|
||||
}
|
||||
@@ -1654,6 +_,23 @@
|
||||
@@ -1820,6 +_,23 @@
|
||||
|
||||
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
|
||||
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
file2 = new File(file1, p_92297_);
|
||||
}
|
||||
|
||||
+ var event = new net.minecraftforge.client.event.ScreenshotEvent(p_389141_, file2);
|
||||
+ var event = new net.minecraftforge.client.event.ScreenshotEvent(p_447863_, file2);
|
||||
+ if (net.minecraftforge.client.event.ScreenshotEvent.BUS.post(event)) {
|
||||
+ p_92301_.accept(event.getCancelMessage());
|
||||
+ return;
|
||||
@@ -15,12 +15,12 @@
|
||||
.execute(
|
||||
() -> {
|
||||
@@ -50,10 +_,13 @@
|
||||
NativeImage $$4x = p_389141_;
|
||||
NativeImage $$4x = p_447863_;
|
||||
|
||||
try {
|
||||
- p_389141_.writeToFile(file2);
|
||||
- p_447863_.writeToFile(file2);
|
||||
- Component component = Component.literal(file2.getName())
|
||||
+ p_389141_.writeToFile(target);
|
||||
+ p_447863_.writeToFile(target);
|
||||
+ Component component = Component.literal(target.getName())
|
||||
.withStyle(ChatFormatting.UNDERLINE)
|
||||
.withStyle(p_389149_ -> p_389149_.withClickEvent(new ClickEvent.OpenFile(file2.getAbsoluteFile())));
|
||||
@@ -29,4 +29,4 @@
|
||||
+ else
|
||||
p_92301_.accept(Component.translatable("screenshot.success", component));
|
||||
} catch (Throwable throwable1) {
|
||||
if (p_389141_ != null) {
|
||||
if (p_447863_ != null) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/data/Main.java
|
||||
+++ b/net/minecraft/client/data/Main.java
|
||||
@@ -31,13 +_,18 @@
|
||||
@@ -30,13 +_,18 @@
|
||||
OptionSpec<Void> optionspec1 = optionparser.accepts("client", "Include client generators");
|
||||
OptionSpec<Void> optionspec2 = optionparser.accepts("all", "Include all generators");
|
||||
OptionSpec<String> optionspec3 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/data/models/ItemModelGenerators.java
|
||||
+++ b/net/minecraft/client/data/models/ItemModelGenerators.java
|
||||
@@ -882,6 +_,9 @@
|
||||
@@ -912,6 +_,9 @@
|
||||
this.declareCustomModelItem(Items.COD);
|
||||
this.declareCustomModelItem(Items.FEATHER);
|
||||
this.declareCustomModelItem(Items.LEAD);
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
}
|
||||
|
||||
+ protected Stream<Block> getKnownBlocks() {
|
||||
+ return BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().location().getNamespace()));
|
||||
+ return BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().identifier().getNamespace()));
|
||||
+ }
|
||||
+
|
||||
+ protected Stream<Item> getKnownItems() {
|
||||
+ return BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().location().getNamespace()));
|
||||
+ return BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().identifier().getNamespace()));
|
||||
+ }
|
||||
+
|
||||
+ protected BlockModelGenerators getBlockModelGenerators(BlockStateGeneratorCollector blocks, ItemInfoCollector items, SimpleModelCollector models) {
|
||||
@@ -46,7 +46,7 @@
|
||||
+ private final Supplier<Stream<Block>> known;
|
||||
+
|
||||
+ public BlockStateGeneratorCollector() {
|
||||
+ this(() -> BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().location().getNamespace())));
|
||||
+ this(() -> BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().identifier().getNamespace())));
|
||||
+ }
|
||||
+
|
||||
+ public BlockStateGeneratorCollector(Supplier<Stream<Block>> known) {
|
||||
@@ -61,8 +61,8 @@
|
||||
public void validate() {
|
||||
- Stream<Holder.Reference<Block>> stream = BuiltInRegistries.BLOCK.listElements().filter(p_376480_ -> true);
|
||||
+ Stream<Holder.Reference<Block>> stream = known.get().map(Block::builtInRegistryHolder);
|
||||
List<ResourceLocation> list = stream.filter(p_378423_ -> !this.generators.containsKey(p_378423_.value()))
|
||||
.map(p_378200_ -> p_378200_.key().location())
|
||||
List<Identifier> list = stream.filter(p_378423_ -> !this.generators.containsKey(p_378423_.value()))
|
||||
.map(p_447940_ -> p_447940_.key().identifier())
|
||||
.toList();
|
||||
@@ -97,6 +_,15 @@
|
||||
public static class ItemInfoCollector implements ItemModelOutput {
|
||||
@@ -71,7 +71,7 @@
|
||||
+ private final Supplier<Stream<Item>> known;
|
||||
+
|
||||
+ public ItemInfoCollector() {
|
||||
+ this(() -> BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().location().getNamespace())));
|
||||
+ this(() -> BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().identifier().getNamespace())));
|
||||
+ }
|
||||
+
|
||||
+ public ItemInfoCollector(Supplier<Stream<Item>> known) {
|
||||
@@ -79,16 +79,16 @@
|
||||
+ }
|
||||
|
||||
@Override
|
||||
public void accept(Item p_376450_, ItemModel.Unbaked p_378513_) {
|
||||
public void accept(Item p_376450_, ItemModel.Unbaked p_378513_, ClientItem.Properties p_455809_) {
|
||||
@@ -115,7 +_,7 @@
|
||||
this.copies.put(p_376965_, p_377438_);
|
||||
}
|
||||
|
||||
- public void finalizeAndValidate() {
|
||||
+ public void generateDefaultBlockModels() {
|
||||
BuiltInRegistries.ITEM.forEach(p_378629_ -> {
|
||||
if (!this.copies.containsKey(p_378629_)) {
|
||||
if (p_378629_ instanceof BlockItem blockitem && !this.itemInfos.containsKey(blockitem)) {
|
||||
BuiltInRegistries.ITEM.forEach(p_447944_ -> {
|
||||
if (!this.copies.containsKey(p_447944_)) {
|
||||
if (p_447944_ instanceof BlockItem blockitem && !this.itemInfos.containsKey(blockitem)) {
|
||||
@@ -124,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
@@ -102,10 +102,10 @@
|
||||
this.register(p_376289_, clientitem);
|
||||
}
|
||||
});
|
||||
- List<ResourceLocation> list = BuiltInRegistries.ITEM
|
||||
- List<Identifier> list = BuiltInRegistries.ITEM
|
||||
- .listElements()
|
||||
+ List<ResourceLocation> list = known.get()
|
||||
+ List<Identifier> list = known.get()
|
||||
+ .map(item -> item.builtInRegistryHolder())
|
||||
.filter(p_377225_ -> !this.itemInfos.containsKey(p_377225_.value()))
|
||||
.map(p_378591_ -> p_378591_.key().location())
|
||||
.map(p_447943_ -> p_447943_.key().identifier())
|
||||
.toList();
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/client/gui/Font.java
|
||||
+++ b/net/minecraft/client/gui/Font.java
|
||||
@@ -31,7 +_,7 @@
|
||||
import org.joml.Matrix4f;
|
||||
@@ -32,7 +_,7 @@
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class Font {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
private final SubtitleOverlay subtitleOverlay;
|
||||
private final SpectatorGui spectatorGui;
|
||||
private final PlayerTabOverlay tabList;
|
||||
@@ -196,6 +_,7 @@
|
||||
@@ -193,6 +_,7 @@
|
||||
() -> new JumpableVehicleBarRenderer(p_330021_)
|
||||
);
|
||||
this.resetTitleTimes();
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
public void resetTitleTimes() {
|
||||
@@ -206,6 +_,10 @@
|
||||
@@ -203,6 +_,10 @@
|
||||
|
||||
public void render(GuiGraphics p_282884_, DeltaTracker p_342095_) {
|
||||
if (!(this.minecraft.screen instanceof LevelLoadingScreen)) {
|
||||
@@ -28,16 +28,16 @@
|
||||
if (!this.minecraft.options.hideGui) {
|
||||
this.renderCameraOverlays(p_282884_, p_342095_);
|
||||
this.renderCrosshair(p_282884_, p_342095_);
|
||||
@@ -389,7 +_,7 @@
|
||||
@@ -386,7 +_,7 @@
|
||||
int i = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
|
||||
int j = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window));
|
||||
p_329202_.nextStratum();
|
||||
- this.chat.render(p_329202_, this.tickCount, i, j, false);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount);
|
||||
- this.chat.render(p_329202_, this.getFont(), this.tickCount, i, j, false, false);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount, this.getFont());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,6 +_,8 @@
|
||||
@@ -476,6 +_,8 @@
|
||||
|
||||
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
||||
@@ -46,7 +46,7 @@
|
||||
if (mobeffectinstance.showIcon()) {
|
||||
int k = p_282812_.guiWidth();
|
||||
int l = 1;
|
||||
@@ -507,6 +_,7 @@
|
||||
@@ -506,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
p_282812_.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(holder), k + 3, l + 3, 18, 18, ARGB.white(f));
|
||||
}
|
||||
}
|
||||
@@ -603,6 +_,10 @@
|
||||
@@ -602,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void renderSelectedItemName(GuiGraphics p_283501_) {
|
||||
@@ -65,7 +65,7 @@
|
||||
Profiler.get().push("selectedItemName");
|
||||
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
|
||||
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
|
||||
@@ -610,9 +_,13 @@
|
||||
@@ -609,9 +_,13 @@
|
||||
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
@@ -81,16 +81,16 @@
|
||||
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
||||
k += 14;
|
||||
}
|
||||
@@ -623,7 +_,7 @@
|
||||
@@ -622,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (l > 0) {
|
||||
- p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, ARGB.color(l, -1));
|
||||
+ p_283501_.drawStringWithBackdrop(font, highlightTip, j, k, i, ARGB.color(l, -1));
|
||||
- p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, ARGB.white(l));
|
||||
+ p_283501_.drawStringWithBackdrop(font, highlightTip, j, k, i, ARGB.white(l));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1151,7 +_,7 @@
|
||||
@@ -1148,7 +_,7 @@
|
||||
ItemStack itemstack = this.minecraft.player.getInventory().getSelectedItem();
|
||||
if (itemstack.isEmpty()) {
|
||||
this.toolHighlightTimer = 0;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/client/gui/GuiGraphics.java
|
||||
+++ b/net/minecraft/client/gui/GuiGraphics.java
|
||||
@@ -83,7 +_,7 @@
|
||||
import org.joml.Vector3f;
|
||||
@@ -86,7 +_,7 @@
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class GuiGraphics {
|
||||
+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics {
|
||||
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
|
||||
private final Minecraft minecraft;
|
||||
final Minecraft minecraft;
|
||||
private final Matrix3x2fStack pose;
|
||||
@@ -950,6 +_,7 @@
|
||||
@@ -972,6 +_,7 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
|
||||
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
|
||||
crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_283653_.getItem()));
|
||||
@@ -17,7 +17,7 @@
|
||||
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_283653_.getComponents()));
|
||||
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_283653_.hasFoil()));
|
||||
throw new ReportedException(crashreport);
|
||||
@@ -968,6 +_,7 @@
|
||||
@@ -990,6 +_,7 @@
|
||||
this.renderItemCooldown(p_283349_, p_282641_, p_282146_);
|
||||
this.renderItemCount(p_282005_, p_283349_, p_282641_, p_282146_, p_282803_);
|
||||
this.pose.popMatrix();
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -979,21 +_,30 @@
|
||||
@@ -1001,21 +_,30 @@
|
||||
this.setTooltipForNextFrame(this.minecraft.font, p_407686_, DefaultTooltipPositioner.INSTANCE, p_410475_, p_407139_, false);
|
||||
}
|
||||
|
||||
@@ -50,15 +50,15 @@
|
||||
+ }
|
||||
+
|
||||
public void setTooltipForNextFrame(
|
||||
Font p_407847_, List<Component> p_408847_, Optional<TooltipComponent> p_410489_, int p_409369_, int p_407472_, @Nullable ResourceLocation p_410303_
|
||||
Font p_408450_, List<Component> p_405939_, Optional<TooltipComponent> p_456997_, int p_409519_, int p_410392_, @Nullable Identifier p_460731_
|
||||
) {
|
||||
- List<ClientTooltipComponent> list = p_408847_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
|
||||
- p_410489_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_)));
|
||||
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_408847_, p_410489_, p_409369_, guiWidth(), guiHeight(), p_407847_);
|
||||
this.setTooltipForNextFrameInternal(p_407847_, list, p_409369_, p_407472_, DefaultTooltipPositioner.INSTANCE, p_410303_, false);
|
||||
- List<ClientTooltipComponent> list = p_405939_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
|
||||
- p_456997_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_)));
|
||||
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_405939_, p_456997_, p_409519_, guiWidth(), guiHeight(), p_408450_);
|
||||
this.setTooltipForNextFrameInternal(p_408450_, list, p_409519_, p_410392_, DefaultTooltipPositioner.INSTANCE, p_460731_, false);
|
||||
}
|
||||
|
||||
@@ -1006,7 +_,22 @@
|
||||
@@ -1028,7 +_,22 @@
|
||||
}
|
||||
|
||||
public void setComponentTooltipForNextFrame(Font p_406239_, List<Component> p_410275_, int p_410594_, int p_409343_) {
|
||||
@@ -81,32 +81,33 @@
|
||||
+ this.tooltipStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public void setComponentTooltipForNextFrame(Font p_408650_, List<Component> p_407512_, int p_406019_, int p_408123_, @Nullable ResourceLocation p_409993_) {
|
||||
@@ -1056,9 +_,14 @@
|
||||
public void setComponentTooltipForNextFrame(Font p_408650_, List<Component> p_407512_, int p_406019_, int p_408123_, @Nullable Identifier p_456486_) {
|
||||
@@ -1073,24 +_,31 @@
|
||||
int p_407794_,
|
||||
int p_408784_,
|
||||
ClientTooltipPositioner p_408798_,
|
||||
- @Nullable Identifier p_451079_,
|
||||
+ @Nullable Identifier p_456486_,
|
||||
boolean p_410618_
|
||||
) {
|
||||
if (!p_409928_.isEmpty()) {
|
||||
if (this.deferredTooltip == null || p_410618_) {
|
||||
- this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_407676_);
|
||||
- this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_451079_);
|
||||
+ final var stackContext = this.tooltipStack;
|
||||
+ this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_407676_, stackContext);
|
||||
+ this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_456486_, stackContext);
|
||||
}
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ public void renderTooltip(Font p_283128_, List<ClientTooltipComponent> p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable ResourceLocation p_409298_) {
|
||||
+ renderTooltip(p_283128_, p_282716_, p_283678_, p_281696_, p_409451_, p_409298_, ItemStack.EMPTY);
|
||||
+ public void renderTooltip(Font p_283128_, List<ClientTooltipComponent> p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_456486_) {
|
||||
+ renderTooltip(p_283128_, p_282716_, p_283678_, p_281696_, p_409451_, p_456486_, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
public void renderTooltip(
|
||||
@@ -1067,13 +_,16 @@
|
||||
int p_283678_,
|
||||
int p_281696_,
|
||||
ClientTooltipPositioner p_409451_,
|
||||
- @Nullable ResourceLocation p_409298_
|
||||
+ @Nullable ResourceLocation p_409298_,
|
||||
+ ItemStack itemstack
|
||||
- Font p_283128_, List<ClientTooltipComponent> p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_459396_
|
||||
+ Font p_283128_, List<ClientTooltipComponent> p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_459396_, ItemStack itemstack
|
||||
) {
|
||||
+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(itemstack, this, p_283678_, p_281696_, guiWidth(), guiHeight(), p_282716_, p_283128_, p_409451_, p_409298_);
|
||||
+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(itemstack, this, p_283678_, p_281696_, guiWidth(), guiHeight(), p_282716_, p_283128_, p_409451_, p_459396_);
|
||||
+ if (preEvent == null) return;
|
||||
int i = 0;
|
||||
int j = p_282716_.size() == 1 ? -2 : 0;
|
||||
@@ -117,7 +118,7 @@
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
@@ -1083,16 +_,16 @@
|
||||
@@ -1100,16 +_,16 @@
|
||||
|
||||
int l1 = i;
|
||||
int i2 = j;
|
||||
@@ -126,7 +127,7 @@
|
||||
int l = vector2ic.x();
|
||||
int i1 = vector2ic.y();
|
||||
this.pose.pushMatrix();
|
||||
- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, p_409298_);
|
||||
- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, p_459396_);
|
||||
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, preEvent.getBackground());
|
||||
int j1 = i1;
|
||||
|
||||
@@ -137,7 +138,7 @@
|
||||
j1 += clienttooltipcomponent1.getHeight(p_283128_) + (k1 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -1100,7 +_,7 @@
|
||||
@@ -1117,7 +_,7 @@
|
||||
|
||||
for (int j2 = 0; j2 < p_282716_.size(); j2++) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_282716_.get(j2);
|
||||
@@ -146,7 +147,7 @@
|
||||
j1 += clienttooltipcomponent2.getHeight(p_283128_) + (j2 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -1315,6 +_,14 @@
|
||||
@@ -1328,6 +_,14 @@
|
||||
|
||||
public void submitProfilerChartRenderState(List<ResultField> p_408565_, int p_410147_, int p_406156_, int p_407365_, int p_408180_) {
|
||||
this.guiRenderState.submitPicturesInPictureState(new GuiProfilerChartRenderState(p_408565_, p_410147_, p_406156_, p_407365_, p_408180_, this.scissorStack.peek()));
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/client/gui/components/AbstractButton.java
|
||||
+++ b/net/minecraft/client/gui/components/AbstractButton.java
|
||||
@@ -41,7 +_,7 @@
|
||||
this.getHeight(),
|
||||
ARGB.white(this.alpha)
|
||||
);
|
||||
- int i = ARGB.color(this.alpha, this.active ? -1 : -6250336);
|
||||
+ int i = getFGColor();
|
||||
this.renderString(p_281670_, minecraft.font, i);
|
||||
if (this.isHovered()) {
|
||||
p_281670_.requestCursor(this.isActive() ? CursorTypes.POINTING_HAND : CursorTypes.NOT_ALLOWED);
|
||||
@@ -1,17 +1,16 @@
|
||||
--- a/net/minecraft/client/gui/components/AbstractWidget.java
|
||||
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
|
||||
@@ -238,6 +_,25 @@
|
||||
@@ -221,6 +_,23 @@
|
||||
this.focused = p_93693_;
|
||||
}
|
||||
|
||||
+ // Forge start
|
||||
+ public static final int UNSET_FG_COLOR = -1;
|
||||
+
|
||||
+ protected int packedFGColor = UNSET_FG_COLOR;
|
||||
+
|
||||
+ public int getFGColor() {
|
||||
+ if (packedFGColor != UNSET_FG_COLOR) return packedFGColor;
|
||||
+ return net.minecraft.util.ARGB.color(this.alpha, this.active ? -1 : -6250336); // White : Light Grey
|
||||
+ return this.active ? net.minecraft.util.CommonColors.WHITE : net.minecraft.util.CommonColors.LIGHT_GRAY;
|
||||
+ }
|
||||
+
|
||||
+ public void setFGColor(int color) {
|
||||
@@ -21,7 +20,6 @@
|
||||
+ public void clearFGColor() {
|
||||
+ this.packedFGColor = UNSET_FG_COLOR;
|
||||
+ }
|
||||
+ // Forge end
|
||||
+
|
||||
@Override
|
||||
public NarratableEntry.NarrationPriority narrationPriority() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/components/Button.java
|
||||
+++ b/net/minecraft/client/gui/components/Button.java
|
||||
@@ -32,6 +_,12 @@
|
||||
@@ -33,6 +_,12 @@
|
||||
this.createNarration = p_259552_;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
}
|
||||
|
||||
public Button build() {
|
||||
- Button button = new Button(this.x, this.y, this.width, this.height, this.message, this.onPress, this.createNarration);
|
||||
- Button button = new Button.Plain(this.x, this.y, this.width, this.height, this.message, this.onPress, this.createNarration);
|
||||
- button.setTooltip(this.tooltip);
|
||||
- return button;
|
||||
+ return build(Button::new);
|
||||
+ return build(Button.Plain::new);
|
||||
+ }
|
||||
+
|
||||
+ // Forge (GH-9238)
|
||||
@@ -29,3 +29,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +_,10 @@
|
||||
int p_455297_, int p_455388_, int p_459653_, int p_452847_, Component p_459347_, Button.OnPress p_453378_, Button.CreateNarration p_456163_
|
||||
) {
|
||||
super(p_455297_, p_455388_, p_459653_, p_452847_, p_459347_, p_453378_, p_456163_);
|
||||
+ }
|
||||
+
|
||||
+ protected Plain(Builder builder) {
|
||||
+ super(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/components/toasts/ToastManager.java
|
||||
+++ b/net/minecraft/client/gui/components/toasts/ToastManager.java
|
||||
@@ -146,6 +_,7 @@
|
||||
@@ -142,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void addToast(Toast p_360768_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/render/GuiRenderer.java
|
||||
+++ b/net/minecraft/client/gui/render/GuiRenderer.java
|
||||
@@ -146,6 +_,7 @@
|
||||
@@ -138,6 +_,7 @@
|
||||
builder.put((Class<? extends PictureInPictureRenderState>)pictureinpicturerenderer.getRenderStateClass(), pictureinpicturerenderer);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
|
||||
@@ -103,6 +_,8 @@
|
||||
@@ -102,6 +_,8 @@
|
||||
}
|
||||
|
||||
if (optional.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/LoadingOverlay.java
|
||||
+++ b/net/minecraft/client/gui/screens/LoadingOverlay.java
|
||||
@@ -62,6 +_,8 @@
|
||||
@@ -63,6 +_,8 @@
|
||||
return p_169325_ & 16777215 | p_169326_ << 24;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
@Override
|
||||
public void render(GuiGraphics p_281839_, int p_282704_, int p_283650_, float p_283394_) {
|
||||
int i = p_281839_.guiWidth();
|
||||
@@ -102,6 +_,7 @@
|
||||
@@ -103,6 +_,7 @@
|
||||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
int l2 = (int)(p_281839_.guiWidth() * 0.5);
|
||||
int i1 = (int)(p_281839_.guiHeight() * 0.5);
|
||||
double d0 = Math.min(p_281839_.guiWidth() * 0.75, (double)p_281839_.guiHeight()) * 0.25;
|
||||
@@ -117,6 +_,7 @@
|
||||
@@ -118,6 +_,7 @@
|
||||
if (f < 1.0F) {
|
||||
this.drawProgressBar(p_281839_, i / 2 - k1, i2 - 5, i / 2 + k1, i2 + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F));
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
if (f >= 2.0F) {
|
||||
this.minecraft.setOverlay(null);
|
||||
@@ -126,6 +_,7 @@
|
||||
@@ -127,6 +_,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.fadeOutStart == -1L && this.reload.isDone() && this.isReadyToFadeOut()) {
|
||||
@@ -33,11 +33,11 @@
|
||||
try {
|
||||
this.reload.checkExceptions();
|
||||
this.onFinish.accept(Optional.empty());
|
||||
@@ -133,7 +_,6 @@
|
||||
@@ -134,7 +_,6 @@
|
||||
this.onFinish.accept(Optional.of(throwable));
|
||||
}
|
||||
|
||||
- this.fadeOutStart = Util.getMillis();
|
||||
if (this.minecraft.screen != null) {
|
||||
Window window = this.minecraft.getWindow();
|
||||
this.minecraft.screen.init(this.minecraft, window.getGuiScaledWidth(), window.getGuiScaledHeight());
|
||||
this.minecraft.screen.init(window.getGuiScaledWidth(), window.getGuiScaledHeight());
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
@@ -103,6 +_,7 @@
|
||||
@@ -102,6 +_,7 @@
|
||||
} else {
|
||||
gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/Screen.java
|
||||
+++ b/net/minecraft/client/gui/screens/Screen.java
|
||||
@@ -191,7 +_,7 @@
|
||||
@@ -194,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
|
||||
@@ -343,8 +_,10 @@
|
||||
@@ -326,8 +_,10 @@
|
||||
this.width = p_96608_;
|
||||
this.height = p_96609_;
|
||||
if (!this.initialized) {
|
||||
@@ -20,7 +20,7 @@
|
||||
} else {
|
||||
this.repositionElements();
|
||||
}
|
||||
@@ -361,8 +_,10 @@
|
||||
@@ -344,8 +_,10 @@
|
||||
protected void rebuildWidgets() {
|
||||
this.clearWidgets();
|
||||
this.clearFocus();
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
protected void fadeWidgets(float p_409453_) {
|
||||
@@ -402,6 +_,8 @@
|
||||
@@ -385,6 +_,8 @@
|
||||
this.renderMenuBackground(p_283688_);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
this.minecraft.gui.renderDeferredSubtitles();
|
||||
}
|
||||
|
||||
@@ -484,6 +_,19 @@
|
||||
@@ -467,6 +_,19 @@
|
||||
}
|
||||
|
||||
public void onFilesDrop(List<Path> p_96591_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/TitleScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
|
||||
@@ -55,6 +_,7 @@
|
||||
@@ -53,6 +_,7 @@
|
||||
private boolean fading;
|
||||
private long fadeInStart;
|
||||
private final LogoRenderer logoRenderer;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public TitleScreen() {
|
||||
this(false);
|
||||
@@ -107,11 +_,15 @@
|
||||
@@ -105,11 +_,15 @@
|
||||
int j = this.width - i - 2;
|
||||
int k = 24;
|
||||
int l = this.height / 4 + 48;
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
l = this.createTestWorldButton(l, 24);
|
||||
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
|
||||
@@ -178,7 +_,7 @@
|
||||
@@ -176,7 +_,7 @@
|
||||
}).bounds(this.width / 2 - 100, i = p_96764_ + p_96765_, 200, 20).tooltip(tooltip).build()).active = flag;
|
||||
this.addRenderableWidget(
|
||||
Button.builder(Component.translatable("menu.online"), p_325369_ -> this.minecraft.setScreen(new RealmsMainScreen(this)))
|
||||
@@ -33,11 +33,11 @@
|
||||
.tooltip(tooltip)
|
||||
.build()
|
||||
)
|
||||
@@ -298,9 +_,18 @@
|
||||
@@ -295,9 +_,18 @@
|
||||
s = s + I18n.get("menu.modded");
|
||||
}
|
||||
|
||||
- p_282860_.drawString(this.font, s, 2, this.height - 10, ARGB.color(f, -1));
|
||||
- p_282860_.drawString(this.font, s, 2, this.height - 10, ARGB.white(f));
|
||||
+ final float f_f = f;
|
||||
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brd, brdline) ->
|
||||
+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), ARGB.color(f_f, -1))
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
|
||||
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
|
||||
@@ -39,6 +_,7 @@
|
||||
@@ -40,6 +_,7 @@
|
||||
private int maxY = Integer.MIN_VALUE;
|
||||
private float fade;
|
||||
private boolean centered;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public AdvancementTab(
|
||||
Minecraft p_97145_, AdvancementsScreen p_97146_, AdvancementTabType p_97147_, int p_97148_, AdvancementNode p_297568_, DisplayInfo p_97150_
|
||||
@@ -55,6 +_,15 @@
|
||||
@@ -56,6 +_,15 @@
|
||||
this.addWidget(this.root, p_297568_.holder());
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
public AdvancementTabType getType() {
|
||||
return this.type;
|
||||
}
|
||||
@@ -145,8 +_,8 @@
|
||||
@@ -150,8 +_,8 @@
|
||||
return null;
|
||||
} else {
|
||||
for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
|
||||
|
||||
+8
-8
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
|
||||
@@ -53,6 +_,7 @@
|
||||
@Nullable
|
||||
private AdvancementTab selectedTab;
|
||||
@@ -52,6 +_,7 @@
|
||||
private final Map<AdvancementHolder, AdvancementTab> tabs = Maps.newLinkedHashMap();
|
||||
private @Nullable AdvancementTab selectedTab;
|
||||
private boolean isScrolling;
|
||||
+ private static int tabPage, maxPages;
|
||||
|
||||
public AdvancementsScreen(ClientAdvancements p_97340_) {
|
||||
this(p_97340_, null);
|
||||
@@ -66,6 +_,19 @@
|
||||
@@ -65,6 +_,19 @@
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
@@ -28,7 +28,7 @@
|
||||
this.layout.addTitleHeader(TITLE, this.font);
|
||||
this.tabs.clear();
|
||||
this.selectedTab = null;
|
||||
@@ -110,7 +_,7 @@
|
||||
@@ -109,7 +_,7 @@
|
||||
int j = (this.height - 140) / 2;
|
||||
|
||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||
@@ -37,12 +37,12 @@
|
||||
this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true);
|
||||
break;
|
||||
}
|
||||
@@ -185,10 +_,12 @@
|
||||
@@ -200,10 +_,12 @@
|
||||
p_283395_.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, p_281890_, p_282532_, 0.0F, 0.0F, 252, 140, 256, 256);
|
||||
if (this.tabs.size() > 1) {
|
||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||
+ if (advancementtab.getPage() == tabPage)
|
||||
advancementtab.drawTab(p_283395_, p_281890_, p_282532_, advancementtab == this.selectedTab);
|
||||
advancementtab.drawTab(p_283395_, p_281890_, p_282532_, p_451461_, p_451545_, advancementtab == this.selectedTab);
|
||||
}
|
||||
|
||||
for (AdvancementTab advancementtab1 : this.tabs.values()) {
|
||||
@@ -50,7 +50,7 @@
|
||||
advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_);
|
||||
}
|
||||
}
|
||||
@@ -207,6 +_,7 @@
|
||||
@@ -222,6 +_,7 @@
|
||||
|
||||
if (this.tabs.size() > 1) {
|
||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||
|
||||
+13
-13
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||
@@ -105,6 +_,7 @@
|
||||
@@ -102,6 +_,7 @@
|
||||
int i = this.leftPos;
|
||||
int j = this.topPos;
|
||||
super.render(p_409971_, p_409213_, p_408205_, p_408282_);
|
||||
@@ -8,7 +8,7 @@
|
||||
p_409971_.pose().pushMatrix();
|
||||
p_409971_.pose().translate(i, j);
|
||||
this.renderLabels(p_409971_, p_409213_, p_408205_);
|
||||
@@ -117,6 +_,8 @@
|
||||
@@ -114,6 +_,8 @@
|
||||
this.onStopHovering(slot);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
p_409971_.pose().popMatrix();
|
||||
}
|
||||
|
||||
@@ -200,7 +_,7 @@
|
||||
@@ -197,7 +_,7 @@
|
||||
ItemStack itemstack = this.hoveredSlot.getItem();
|
||||
if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(itemstack)) {
|
||||
p_283594_.setTooltipForNextFrame(
|
||||
@@ -26,7 +26,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -216,7 +_,8 @@
|
||||
@@ -213,7 +_,8 @@
|
||||
|
||||
private void renderFloatingItem(GuiGraphics p_282567_, ItemStack p_281330_, int p_281772_, int p_281689_, @Nullable String p_282568_) {
|
||||
p_282567_.renderItem(p_281330_, p_281772_, p_281689_);
|
||||
@@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
protected void renderLabels(GuiGraphics p_281635_, int p_282681_, int p_283686_) {
|
||||
@@ -317,7 +_,8 @@
|
||||
@@ -313,7 +_,8 @@
|
||||
if (super.mouseClicked(p_427253_, p_427622_)) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -46,7 +46,7 @@
|
||||
Slot slot = this.getHoveredSlot(p_427253_.x(), p_427253_.y());
|
||||
this.doubleclick = this.lastClickSlot == slot && p_427622_;
|
||||
this.skipNextRelease = false;
|
||||
@@ -327,6 +_,7 @@
|
||||
@@ -323,6 +_,7 @@
|
||||
int i = this.leftPos;
|
||||
int j = this.topPos;
|
||||
boolean flag1 = this.hasClickedOutside(p_427253_.x(), p_427253_.y(), i, j);
|
||||
@@ -54,7 +54,7 @@
|
||||
int k = -1;
|
||||
if (slot != null) {
|
||||
k = slot.index;
|
||||
@@ -352,7 +_,7 @@
|
||||
@@ -348,7 +_,7 @@
|
||||
}
|
||||
} else if (!this.isQuickCrafting) {
|
||||
if (this.menu.getCarried().isEmpty()) {
|
||||
@@ -63,7 +63,7 @@
|
||||
this.slotClicked(slot, k, p_427253_.button(), ClickType.CLONE);
|
||||
} else {
|
||||
boolean flag2 = k != -999 && p_427253_.hasShiftDown();
|
||||
@@ -376,7 +_,7 @@
|
||||
@@ -372,7 +_,7 @@
|
||||
this.quickCraftingType = 0;
|
||||
} else if (p_427253_.button() == 1) {
|
||||
this.quickCraftingType = 1;
|
||||
@@ -72,7 +72,7 @@
|
||||
this.quickCraftingType = 2;
|
||||
}
|
||||
}
|
||||
@@ -453,10 +_,13 @@
|
||||
@@ -449,10 +_,13 @@
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(MouseButtonEvent p_430939_) {
|
||||
@@ -86,7 +86,7 @@
|
||||
int k = -1;
|
||||
if (slot != null) {
|
||||
k = slot.index;
|
||||
@@ -473,7 +_,7 @@
|
||||
@@ -469,7 +_,7 @@
|
||||
if (slot2 != null
|
||||
&& slot2.mayPickup(this.minecraft.player)
|
||||
&& slot2.hasItem()
|
||||
@@ -95,7 +95,7 @@
|
||||
&& AbstractContainerMenu.canItemQuickReplace(slot2, this.lastQuickMoved, true)) {
|
||||
this.slotClicked(slot2, slot2.index, p_430939_.button(), ClickType.QUICK_MOVE);
|
||||
}
|
||||
@@ -538,7 +_,7 @@
|
||||
@@ -534,7 +_,7 @@
|
||||
|
||||
this.slotClicked(null, -999, AbstractContainerMenu.getQuickcraftMask(2, this.quickCraftingType), ClickType.QUICK_CRAFT);
|
||||
} else if (!this.menu.getCarried().isEmpty()) {
|
||||
@@ -104,7 +104,7 @@
|
||||
this.slotClicked(slot, k, p_430939_.button(), ClickType.CLONE);
|
||||
} else {
|
||||
boolean flag1 = k != -999 && p_430939_.hasShiftDown();
|
||||
@@ -609,7 +_,7 @@
|
||||
@@ -605,7 +_,7 @@
|
||||
public boolean keyPressed(KeyEvent p_424324_) {
|
||||
if (super.keyPressed(p_424324_)) {
|
||||
return true;
|
||||
@@ -113,7 +113,7 @@
|
||||
this.onClose();
|
||||
return true;
|
||||
} else {
|
||||
@@ -688,6 +_,13 @@
|
||||
@@ -684,6 +_,13 @@
|
||||
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
+31
-31
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
|
||||
@@ -116,6 +_,8 @@
|
||||
@@ -115,6 +_,8 @@
|
||||
private final Set<TagKey<Item>> visibleTags = new HashSet<>();
|
||||
private final boolean displayOperatorCreativeTab;
|
||||
private final EffectsInInventory effects;
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) {
|
||||
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY);
|
||||
@@ -164,7 +_,7 @@
|
||||
@@ -163,7 +_,7 @@
|
||||
private void refreshCurrentTabContents(Collection<ItemStack> p_261591_) {
|
||||
int i = this.menu.getRowIndexForScroll(this.scrollOffs);
|
||||
this.menu.items.clear();
|
||||
@@ -18,7 +18,7 @@
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
this.menu.items.addAll(p_261591_);
|
||||
@@ -332,6 +_,36 @@
|
||||
@@ -329,6 +_,36 @@
|
||||
protected void init() {
|
||||
if (this.minecraft.player.hasInfiniteMaterials()) {
|
||||
super.init();
|
||||
@@ -55,7 +55,7 @@
|
||||
this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
|
||||
this.searchBox.setMaxLength(50);
|
||||
this.searchBox.setBordered(false);
|
||||
@@ -378,7 +_,7 @@
|
||||
@@ -376,7 +_,7 @@
|
||||
public boolean charTyped(CharacterEvent p_424087_) {
|
||||
if (this.ignoreTextInput) {
|
||||
return false;
|
||||
@@ -64,7 +64,7 @@
|
||||
return false;
|
||||
} else {
|
||||
String s = this.searchBox.getValue();
|
||||
@@ -397,7 +_,7 @@
|
||||
@@ -395,7 +_,7 @@
|
||||
@Override
|
||||
public boolean keyPressed(KeyEvent p_429237_) {
|
||||
this.ignoreTextInput = false;
|
||||
@@ -73,7 +73,7 @@
|
||||
if (this.minecraft.options.keyChat.matches(p_429237_)) {
|
||||
this.ignoreTextInput = true;
|
||||
this.selectTab(CreativeModeTabs.searchTab());
|
||||
@@ -433,6 +_,7 @@
|
||||
@@ -431,6 +_,7 @@
|
||||
}
|
||||
|
||||
private void refreshSearchResults() {
|
||||
@@ -81,7 +81,7 @@
|
||||
this.menu.items.clear();
|
||||
this.visibleTags.clear();
|
||||
String s = this.searchBox.getValue();
|
||||
@@ -445,10 +_,10 @@
|
||||
@@ -443,10 +_,10 @@
|
||||
SearchTree<ItemStack> searchtree;
|
||||
if (s.startsWith("#")) {
|
||||
s = s.substring(1);
|
||||
@@ -94,7 +94,7 @@
|
||||
}
|
||||
|
||||
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
|
||||
@@ -480,7 +_,8 @@
|
||||
@@ -478,7 +_,8 @@
|
||||
@Override
|
||||
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
|
||||
if (selectedTab.showTitle()) {
|
||||
@@ -104,7 +104,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +_,7 @@
|
||||
@@ -488,7 +_,7 @@
|
||||
double d0 = p_430803_.x() - this.leftPos;
|
||||
double d1 = p_430803_.y() - this.topPos;
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||
return true;
|
||||
}
|
||||
@@ -512,7 +_,7 @@
|
||||
@@ -510,7 +_,7 @@
|
||||
double d1 = p_423848_.y() - this.topPos;
|
||||
this.scrolling = false;
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||
this.selectTab(creativemodetab);
|
||||
return true;
|
||||
@@ -606,13 +_,15 @@
|
||||
@@ -604,13 +_,15 @@
|
||||
this.originalSlots = null;
|
||||
}
|
||||
|
||||
@@ -139,9 +139,9 @@
|
||||
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
@@ -676,7 +_,14 @@
|
||||
@@ -673,7 +_,14 @@
|
||||
this.effects.render(p_283000_, p_281317_, p_282770_);
|
||||
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
|
||||
this.effects.renderTooltip(p_283000_, p_281317_, p_282770_);
|
||||
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
+ if (this.pages.size() != 1) {
|
||||
@@ -155,7 +155,7 @@
|
||||
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
|
||||
break;
|
||||
}
|
||||
@@ -700,7 +_,7 @@
|
||||
@@ -697,7 +_,7 @@
|
||||
public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
|
||||
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||
boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
|
||||
@@ -164,7 +164,7 @@
|
||||
TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL;
|
||||
TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default;
|
||||
List<Component> list = p_281769_.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipflag);
|
||||
@@ -721,7 +_,7 @@
|
||||
@@ -718,7 +_,7 @@
|
||||
int i = 1;
|
||||
|
||||
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
@@ -173,24 +173,24 @@
|
||||
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
|
||||
}
|
||||
}
|
||||
@@ -732,7 +_,7 @@
|
||||
@@ -729,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (creativemodetab != selectedTab) {
|
||||
this.renderTabButton(p_282663_, creativemodetab);
|
||||
this.renderTabButton(p_282663_, p_282089_, p_282249_, creativemodetab);
|
||||
}
|
||||
@@ -748,6 +_,7 @@
|
||||
p_282663_.blitSprite(RenderPipelines.GUI_TEXTURED, resourcelocation, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15);
|
||||
@@ -749,6 +_,7 @@
|
||||
p_282663_.blitSprite(RenderPipelines.GUI_TEXTURED, identifier, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15);
|
||||
}
|
||||
|
||||
+ if (currentPage.getVisibleTabs().contains(selectedTab)) //Forge: only display tab selection when the selected tab is on the current page
|
||||
this.renderTabButton(p_282663_, selectedTab);
|
||||
this.renderTabButton(p_282663_, p_282089_, p_282249_, selectedTab);
|
||||
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
|
||||
InventoryScreen.renderEntityInInventoryFollowsMouse(
|
||||
@@ -766,7 +_,7 @@
|
||||
@@ -767,7 +_,7 @@
|
||||
}
|
||||
|
||||
private int getTabX(CreativeModeTab p_260136_) {
|
||||
@@ -199,7 +199,7 @@
|
||||
int j = 27;
|
||||
int k = 27 * i;
|
||||
if (p_260136_.isAlignedRight()) {
|
||||
@@ -778,7 +_,7 @@
|
||||
@@ -779,7 +_,7 @@
|
||||
|
||||
private int getTabY(CreativeModeTab p_260181_) {
|
||||
int i = 0;
|
||||
@@ -208,9 +208,9 @@
|
||||
i -= 32;
|
||||
} else {
|
||||
i += this.imageHeight;
|
||||
@@ -806,8 +_,8 @@
|
||||
@@ -807,8 +_,8 @@
|
||||
|
||||
protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
|
||||
protected void renderTabButton(GuiGraphics p_283590_, int p_454271_, int p_455485_, CreativeModeTab p_283489_) {
|
||||
boolean flag = p_283489_ == selectedTab;
|
||||
- boolean flag1 = p_283489_.row() == CreativeModeTab.Row.TOP;
|
||||
- int i = p_283489_.column();
|
||||
@@ -218,16 +218,16 @@
|
||||
+ int i = currentPage.getColumn(p_283489_);
|
||||
int j = this.leftPos + this.getTabX(p_283489_);
|
||||
int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
|
||||
ResourceLocation[] aresourcelocation;
|
||||
@@ -817,6 +_,7 @@
|
||||
aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS;
|
||||
Identifier[] aidentifier;
|
||||
@@ -822,6 +_,7 @@
|
||||
p_283590_.requestCursor(CursorTypes.POINTING_HAND);
|
||||
}
|
||||
|
||||
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
|
||||
p_283590_.blitSprite(RenderPipelines.GUI_TEXTURED, aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
|
||||
p_283590_.blitSprite(RenderPipelines.GUI_TEXTURED, aidentifier[Mth.clamp(i, 0, aidentifier.length)], j, k, 26, 32);
|
||||
int l = j + 13 - 8;
|
||||
int i1 = k + 16 - 8 + (flag1 ? 1 : -1);
|
||||
@@ -853,6 +_,14 @@
|
||||
@@ -858,6 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
static class CustomCreativeSlot extends Slot {
|
||||
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
|
||||
@@ -1034,6 +_,22 @@
|
||||
@@ -1038,6 +_,22 @@
|
||||
@Override
|
||||
public boolean mayPickup(Player p_98665_) {
|
||||
return this.target.mayPickup(p_98665_);
|
||||
@@ -259,7 +259,7 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Slot setBackground(ResourceLocation sprite) {
|
||||
+ public Slot setBackground(Identifier sprite) {
|
||||
+ this.target.setBackground(sprite);
|
||||
+ return this;
|
||||
}
|
||||
|
||||
+16
-28
@@ -1,48 +1,36 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
|
||||
@@ -47,12 +_,16 @@
|
||||
int j = this.screen.width - i;
|
||||
Collection<MobEffectInstance> collection = this.minecraft.player.getActiveEffects();
|
||||
if (!collection.isEmpty() && j >= 32) {
|
||||
boolean flag = j >= 120;
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, !flag, i);
|
||||
- int k = j >= 120 ? j - 7 : 32;
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, j < 120, i);
|
||||
+ if (event == null) return;
|
||||
+ flag = !event.isCompact();
|
||||
+ int k = !event.isCompact() ? j - 7 : 32;
|
||||
+ i = event.getHorizontalOffset();
|
||||
int k = 33;
|
||||
int l = 33;
|
||||
if (collection.size() > 5) {
|
||||
k = 132 / (collection.size() - 1);
|
||||
l = 132 / (collection.size() - 1);
|
||||
}
|
||||
|
||||
- Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection);
|
||||
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().toList();
|
||||
this.renderBackgrounds(p_362146_, i, k, iterable, flag);
|
||||
this.renderIcons(p_362146_, i, k, iterable, flag);
|
||||
if (flag) {
|
||||
@@ -98,6 +_,11 @@
|
||||
int i = this.screen.topPos;
|
||||
this.renderEffects(p_456221_, collection, i, l, p_453611_, p_457243_, k);
|
||||
}
|
||||
}
|
||||
@@ -66,6 +_,11 @@
|
||||
|
||||
for (MobEffectInstance mobeffectinstance : p_361981_) {
|
||||
for (MobEffectInstance mobeffectinstance : iterable) {
|
||||
boolean flag = mobeffectinstance.isAmbient();
|
||||
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
|
||||
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_367085_, p_367644_ + (p_368681_ ? 6 : 7), i, 0)) {
|
||||
+ i += p_367522_;
|
||||
+ continue;
|
||||
+ }
|
||||
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
||||
ResourceLocation resourcelocation = Gui.getMobEffectSprite(holder);
|
||||
p_367085_.blitSprite(RenderPipelines.GUI_TEXTURED, resourcelocation, p_367644_ + (p_368681_ ? 6 : 7), i + 7, 18, 18);
|
||||
@@ -109,6 +_,11 @@
|
||||
int i = this.screen.topPos;
|
||||
|
||||
for (MobEffectInstance mobeffectinstance : p_365480_) {
|
||||
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
|
||||
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_361851_, p_367468_, i, 0)) {
|
||||
+ i += p_365556_;
|
||||
+ if (renderer.renderInventory(mobeffectinstance, this, p_362146_, p_370153_, i, 0)) {
|
||||
+ i += p_365612_;
|
||||
+ continue;
|
||||
+ }
|
||||
Component component = this.getEffectName(mobeffectinstance);
|
||||
p_361851_.drawString(this.screen.getFont(), component, p_367468_ + 10 + 18, i + 6, -1);
|
||||
Component component1 = MobEffectUtil.formatDuration(mobeffectinstance, 1.0F, this.minecraft.level.tickRateManager().tickrate());
|
||||
@@ -124,5 +_,9 @@
|
||||
int j = this.renderBackground(p_362146_, font, component, component1, p_370153_, i, flag, p_457235_);
|
||||
@@ -123,5 +_,9 @@
|
||||
}
|
||||
|
||||
return mutablecomponent;
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
@@ -107,7 +_,7 @@
|
||||
@@ -108,7 +_,7 @@
|
||||
int l1 = 86 - this.font.width(s);
|
||||
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
|
||||
int i2 = -9937334;
|
||||
@@ -9,7 +9,7 @@
|
||||
p_282430_.blitSprite(RenderPipelines.GUI_TEXTURED, ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
|
||||
p_282430_.blitSprite(RenderPipelines.GUI_TEXTURED, DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
|
||||
p_282430_.drawWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, ARGB.opaque((i2 & 16711422) >> 1), false);
|
||||
@@ -158,13 +_,16 @@
|
||||
@@ -160,13 +_,16 @@
|
||||
.registryAccess()
|
||||
.lookupOrThrow(Registries.ENCHANTMENT)
|
||||
.get(this.menu.enchantClue[j]);
|
||||
@@ -17,8 +17,8 @@
|
||||
+ {
|
||||
int l = this.menu.levelClue[j];
|
||||
int i1 = j + 1;
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, p_282491_, p_281953_) && k > 0 && l >= 0 && optional != null) {
|
||||
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, p_282491_, p_281953_) && k > 0 && l >= 0) {
|
||||
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && l >= 0) {
|
||||
List<Component> list = Lists.newArrayList();
|
||||
- list.add(Component.translatable("container.enchant.clue", Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
|
||||
- if (!flag) {
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
|
||||
private static final int TEXTURE_WIDTH = 16;
|
||||
private static final int TEXTURE_HEIGHT = 16;
|
||||
- private final ResourceLocation texture = ResourceLocation.withDefaultNamespace("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
|
||||
+ private final ResourceLocation texture = ResourceLocation.parse(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/");
|
||||
- private final Identifier texture = Identifier.withDefaultNamespace("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
|
||||
+ private final Identifier texture = Identifier.parse(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/");
|
||||
|
||||
public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) {
|
||||
super(p_278017_, p_277942_, p_277778_, Component.translatable("hanging_sign.edit"));
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
|
||||
@@ -230,6 +_,14 @@
|
||||
@@ -236,6 +_,14 @@
|
||||
} else {
|
||||
p_281357_.renderItemDecorations(this.font, p_282046_, p_282403_, p_283601_, p_282046_.getCount() == 1 ? "1" : null);
|
||||
p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_ + 14, p_283601_, p_283466_.getCount() == 1 ? "1" : null);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
@@ -363,6 +_,8 @@
|
||||
@@ -361,6 +_,8 @@
|
||||
p_425273_.setTooltipForNextFrame(Lists.transform(this.onlinePlayersTooltip, Component::getVisualOrderText), p_424268_, p_430737_);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
@@ -115,9 +_,10 @@
|
||||
@@ -116,9 +_,10 @@
|
||||
this.name = p_343976_;
|
||||
this.changeButton = Button.builder(p_343976_, p_342196_ -> {
|
||||
KeyBindsList.this.keyBindsScreen.selectedKey = p_343088_;
|
||||
@@ -12,7 +12,7 @@
|
||||
.createNarration(
|
||||
p_342179_ -> p_343088_.isUnbound()
|
||||
? Component.translatable("narrator.controls.unbound", p_343976_)
|
||||
@@ -125,7 +_,7 @@
|
||||
@@ -126,7 +_,7 @@
|
||||
)
|
||||
.build();
|
||||
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_357685_ -> {
|
||||
@@ -21,7 +21,7 @@
|
||||
KeyBindsList.this.resetMappingAndUpdateButtons();
|
||||
}).bounds(0, 0, 50, 20).createNarration(p_344192_ -> Component.translatable("narrator.controls.reset", p_343976_)).build();
|
||||
this.refreshEntry();
|
||||
@@ -166,7 +_,8 @@
|
||||
@@ -167,7 +_,8 @@
|
||||
MutableComponent mutablecomponent = Component.empty();
|
||||
if (!this.key.isUnbound()) {
|
||||
for (KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) {
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
|
||||
@@ -43,7 +_,7 @@
|
||||
@@ -42,7 +_,7 @@
|
||||
protected void addFooter() {
|
||||
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_343640_ -> {
|
||||
for (KeyMapping keymapping : this.options.keyMappings) {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -75,11 +_,12 @@
|
||||
@@ -74,11 +_,12 @@
|
||||
public boolean keyPressed(KeyEvent p_424487_) {
|
||||
if (this.selectedKey != null) {
|
||||
if (p_424487_.isEscape()) {
|
||||
@@ -24,7 +24,7 @@
|
||||
this.selectedKey = null;
|
||||
this.lastKeySelection = Util.getMillis();
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -102,5 +_,18 @@
|
||||
@@ -101,5 +_,18 @@
|
||||
}
|
||||
|
||||
this.resetButton.active = flag;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
|
||||
@@ -64,7 +_,7 @@
|
||||
@@ -65,7 +_,7 @@
|
||||
Component component = Component.empty().append(this.title).withStyle(ChatFormatting.UNDERLINE, ChatFormatting.BOLD);
|
||||
this.addEntry(new TransferableSelectionList.HeaderEntry(this.minecraft.font, component), (int)(9.0F * 1.5F));
|
||||
this.setSelected(null);
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -171,6 +_,7 @@
|
||||
@@ -173,6 +_,7 @@
|
||||
WorldDataConfiguration worlddataconfiguration = SharedConstants.IS_RUNNING_IN_IDE
|
||||
? new WorldDataConfiguration(new DataPackConfig(List.of("vanilla", "tests"), List.of()), FeatureFlags.DEFAULT_FLAGS)
|
||||
: WorldDataConfiguration.DEFAULT;
|
||||
@@ -8,7 +8,7 @@
|
||||
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, worlddataconfiguration);
|
||||
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(
|
||||
worldloader$initconfig,
|
||||
@@ -471,7 +_,7 @@
|
||||
@@ -472,7 +_,7 @@
|
||||
if (p_269627_) {
|
||||
p_270552_.accept(this.uiState.getSettings().dataConfiguration());
|
||||
} else {
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
},
|
||||
Component.translatable("dataPack.validation.failed"),
|
||||
@@ -585,6 +_,7 @@
|
||||
@@ -584,6 +_,7 @@
|
||||
if (path != null) {
|
||||
if (this.tempDataPackRepository == null) {
|
||||
this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
|
||||
@@ -234,7 +_,7 @@
|
||||
@Nullable
|
||||
public PresetEditor getPresetEditor() {
|
||||
@@ -232,7 +_,7 @@
|
||||
|
||||
public @Nullable PresetEditor getPresetEditor() {
|
||||
Holder<WorldPreset> holder = this.getWorldType().preset();
|
||||
- return holder != null ? PresetEditor.EDITORS.get(holder.unwrapKey()) : null;
|
||||
+ return holder != null ? holder.unwrapKey().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||
@@ -329,6 +_,8 @@
|
||||
@@ -331,6 +_,8 @@
|
||||
this.minecraft.setScreenAndShow(new GenericMessageScreen(Component.translatable("selectWorld.resource_load")));
|
||||
PackRepository packrepository = ServerPacksSource.createPackRepository(p_333651_);
|
||||
|
||||
|
||||
+6
-6
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||
@@ -79,6 +_,7 @@
|
||||
static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join_highlighted");
|
||||
static final ResourceLocation JOIN_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join");
|
||||
@@ -83,6 +_,7 @@
|
||||
static final Identifier JOIN_HIGHLIGHTED_SPRITE = Identifier.withDefaultNamespace("world_list/join_highlighted");
|
||||
static final Identifier JOIN_SPRITE = Identifier.withDefaultNamespace("world_list/join");
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = ResourceLocation.fromNamespaceAndPath("forge","textures/gui/experimental_warning.png");
|
||||
+ private static final Identifier FORGE_EXPERIMENTAL_WARNING_ICON = Identifier.fromNamespaceAndPath("forge","textures/gui/experimental_warning.png");
|
||||
static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED);
|
||||
static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED);
|
||||
static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD);
|
||||
@@ -494,6 +_,19 @@
|
||||
@@ -489,6 +_,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
@Override
|
||||
public Component getNarration() {
|
||||
Component component = Component.translatable(
|
||||
@@ -520,6 +_,7 @@
|
||||
@@ -515,6 +_,7 @@
|
||||
this.infoText.setPosition(i, this.getContentY() + 9 + 9 + 3);
|
||||
this.infoText.render(p_424437_, p_425443_, p_425024_, p_424775_);
|
||||
p_424437_.blit(RenderPipelines.GUI_TEXTURED, this.icon.textureLocation(), this.getContentX(), this.getContentY(), 0.0F, 0.0F, 32, 32, 32, 32);
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
--- a/net/minecraft/client/model/HumanoidModel.java
|
||||
+++ b/net/minecraft/client/model/HumanoidModel.java
|
||||
@@ -290,6 +_,8 @@
|
||||
case BRUSH:
|
||||
this.rightArm.xRot = this.rightArm.xRot * 0.5F - (float) (Math.PI / 5);
|
||||
this.rightArm.yRot = 0.0F;
|
||||
@@ -308,6 +_,8 @@
|
||||
break;
|
||||
case SPEAR:
|
||||
SpearAnimations.thirdPersonHandUse(this.rightArm, this.head, true, p_362371_.getUseItemStackForArm(HumanoidArm.RIGHT), p_362371_);
|
||||
+ default:
|
||||
+ p_366231_.applyTransform(this, p_362371_, net.minecraft.world.entity.HumanoidArm.RIGHT);
|
||||
+ p_362371_.rightArmPose.applyTransform(this, p_362371_, net.minecraft.world.entity.HumanoidArm.RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,6 +_,8 @@
|
||||
case BRUSH:
|
||||
this.leftArm.xRot = this.leftArm.xRot * 0.5F - (float) (Math.PI / 5);
|
||||
this.leftArm.yRot = 0.0F;
|
||||
@@ -355,6 +_,8 @@
|
||||
break;
|
||||
case SPEAR:
|
||||
SpearAnimations.thirdPersonHandUse(this.leftArm, this.head, false, p_363560_.getUseItemStackForArm(HumanoidArm.LEFT), p_363560_);
|
||||
+ default:
|
||||
+ p_370002_.applyTransform(this, p_363560_, net.minecraft.world.entity.HumanoidArm.LEFT);
|
||||
+ p_363560_.leftArmPose.applyTransform(this, p_363560_, net.minecraft.world.entity.HumanoidArm.LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +_,7 @@
|
||||
@@ -427,7 +_,7 @@
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
- public static enum ArmPose {
|
||||
+ public static enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
|
||||
EMPTY(false),
|
||||
ITEM(false),
|
||||
BLOCK(false),
|
||||
@@ -418,10 +_,28 @@
|
||||
|
||||
private ArmPose(final boolean p_102896_) {
|
||||
EMPTY(false, false),
|
||||
ITEM(false, false),
|
||||
BLOCK(false, false),
|
||||
@@ -453,10 +_,29 @@
|
||||
ArmPose(final boolean p_102896_, final boolean p_456170_) {
|
||||
this.twoHanded = p_102896_;
|
||||
this.affectsOffhandPose = p_456170_;
|
||||
+ this.forgeArmPose = null;
|
||||
}
|
||||
|
||||
@@ -41,18 +41,19 @@
|
||||
+ @javax.annotation.Nullable
|
||||
+ private final net.minecraftforge.client.IArmPoseTransformer forgeArmPose;
|
||||
+
|
||||
+ private ArmPose(boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
|
||||
+ private ArmPose(boolean twoHanded, boolean affectsOffhandPose, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
|
||||
+ this.twoHanded = twoHanded;
|
||||
+ this.affectsOffhandPose = affectsOffhandPose;
|
||||
+ com.google.common.base.Preconditions.checkNotNull(forgeArmPose, "Cannot create new ArmPose with null transformer!");
|
||||
+ this.forgeArmPose = forgeArmPose;
|
||||
+ }
|
||||
+
|
||||
+ public static ArmPose create(String name, boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
|
||||
+ public static ArmPose create(String name, boolean twoHanded, boolean affectsOffhandPose, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
|
||||
+ throw new IllegalStateException("Enum not extended");
|
||||
+ }
|
||||
+
|
||||
+ public <T extends HumanoidRenderState> void applyTransform(HumanoidModel<T> model, T state, net.minecraft.world.entity.HumanoidArm arm) {
|
||||
+ if (this.forgeArmPose != null) this.forgeArmPose.applyTransform(model, state, arm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean affectsOffhandPose() {
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
@@ -506,6 +_,7 @@
|
||||
builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition57);
|
||||
@@ -524,6 +_,7 @@
|
||||
builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition58);
|
||||
}
|
||||
});
|
||||
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder);
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
--- a/net/minecraft/client/model/geom/ModelLayers.java
|
||||
+++ b/net/minecraft/client/model/geom/ModelLayers.java
|
||||
@@ -328,15 +_,18 @@
|
||||
@@ -341,15 +_,18 @@
|
||||
}
|
||||
|
||||
public static ModelLayerLocation createStandingSignModelName(WoodType p_171292_) {
|
||||
- return createLocation("sign/standing/" + p_171292_.name(), "main");
|
||||
+ ResourceLocation location = ResourceLocation.parse(p_171292_.name());
|
||||
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "sign/standing/" + location.getPath()), "main");
|
||||
+ Identifier location = Identifier.parse(p_171292_.name());
|
||||
+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "sign/standing/" + location.getPath()), "main");
|
||||
}
|
||||
|
||||
public static ModelLayerLocation createWallSignModelName(WoodType p_363532_) {
|
||||
- return createLocation("sign/wall/" + p_363532_.name(), "main");
|
||||
+ ResourceLocation location = ResourceLocation.parse(p_363532_.name());
|
||||
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "sign/wall/" + location.getPath()), "main");
|
||||
+ Identifier location = Identifier.parse(p_363532_.name());
|
||||
+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "sign/wall/" + location.getPath()), "main");
|
||||
}
|
||||
|
||||
public static ModelLayerLocation createHangingSignModelName(WoodType p_252225_, HangingSignRenderer.AttachmentType p_378070_) {
|
||||
- return createLocation("hanging_sign/" + p_252225_.name() + "/" + p_378070_.getSerializedName(), "main");
|
||||
+ ResourceLocation location = ResourceLocation.parse(p_252225_.name());
|
||||
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath() + "/" + p_378070_.getSerializedName()), "main");
|
||||
+ Identifier location = Identifier.parse(p_252225_.name());
|
||||
+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath() + "/" + p_378070_.getSerializedName()), "main");
|
||||
}
|
||||
|
||||
public static Stream<ModelLayerLocation> getKnownLocations() {
|
||||
@@ -8,7 +8,7 @@
|
||||
this.storage.drop(i, levelchunk);
|
||||
}
|
||||
}
|
||||
@@ -125,6 +_,7 @@
|
||||
@@ -123,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.level.onChunkLoaded(chunkpos);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
||||
@@ -160,6 +_,7 @@
|
||||
@@ -157,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {
|
||||
|
||||
Loaded 100 of 744 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user