mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 09:05:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0a68b8c79 | ||
|
|
f225d1f3fb | ||
|
|
15214a6e9a | ||
|
|
dfce6b62d4 | ||
|
|
0232ad7424 | ||
|
|
e6ff2e0c24 | ||
|
|
72980d2b03 | ||
|
|
6e3b51d81f | ||
|
|
6b1c628326 | ||
|
|
85f9b1012c | ||
|
|
7569de7004 | ||
|
|
5ccde7422c | ||
|
|
ad6bf9428e | ||
|
|
d176bab28e | ||
|
|
58d6f072e4 | ||
|
|
cc393818e4 | ||
|
|
e84098a011 | ||
|
|
f2db3941ea | ||
|
|
c2bfe12068 | ||
|
|
d9e3a0081e | ||
|
|
84d7a0facb | ||
|
|
9c66928854 | ||
|
|
4b494451db | ||
|
|
e9ea4ca169 | ||
|
|
c5ca054936 | ||
|
|
7d2c7c0f91 | ||
|
|
54b872af69 | ||
|
|
ae954bea17 | ||
|
|
ad59985a9b | ||
|
|
f8fdd43552 | ||
|
|
b269f7dbfd | ||
|
|
e688f136dd | ||
|
|
81276b341a | ||
|
|
f050617b47 | ||
|
|
e6c7958456 | ||
|
|
4802ceeccc | ||
|
|
2ea16d89ca | ||
|
|
e541201129 | ||
|
|
09aac3a4d3 | ||
|
|
dccb1ab3a4 | ||
|
|
8bf96d8738 | ||
|
|
069a94f205 | ||
|
|
332ed4ab76 | ||
|
|
030f2dbd38 | ||
|
|
ec3abdea14 | ||
|
|
4cf5508e04 | ||
|
|
d861f647d7 | ||
|
|
992f793695 | ||
|
|
69eb940764 | ||
|
|
c1f26d544a | ||
|
|
8255d7aed3 | ||
|
|
617ecb7ad3 | ||
|
|
dd8239c255 | ||
|
|
bdddc8c5d4 | ||
|
|
c1c619a109 | ||
|
|
f7eea35cb9 | ||
|
|
a2434e1607 | ||
|
|
b806ecd0ff | ||
|
|
8358b800e9 | ||
|
|
b25a092cf1 | ||
|
|
d812fdd0a3 | ||
|
|
2d3ee8a228 | ||
|
|
97a9ca65f1 | ||
|
|
f043fbbc51 | ||
|
|
a19ab3a8d4 | ||
|
|
bc0517a404 | ||
|
|
dc9c0d7e35 | ||
|
|
1a2207b3b2 | ||
|
|
84ab9764e3 | ||
|
|
bef68991f0 | ||
|
|
526c13d662 | ||
|
|
67ffb78c23 | ||
|
|
8f407c3a22 | ||
|
|
8980252e16 | ||
|
|
3baee80485 | ||
|
|
ca9599bb4d | ||
|
|
051db7907a | ||
|
|
bdba5ef2d3 | ||
|
|
838b9c0eda | ||
|
|
be584c54aa | ||
|
|
1b3640b42d | ||
|
|
be5dab5801 | ||
|
|
aae628cd18 | ||
|
|
e7bd08649f | ||
|
|
e1017a4c7e | ||
|
|
6f8ba9d295 | ||
|
|
ac94478ae7 | ||
|
|
515c6082e0 | ||
|
|
a753598113 | ||
|
|
bc6c4be4e4 | ||
|
|
98823a8f07 | ||
|
|
ecd8f1e54d | ||
|
|
b0caea8e20 | ||
|
|
e0477f8776 | ||
|
|
94e1e54b53 | ||
|
|
9ce72331b7 | ||
|
|
1c31f42dae | ||
|
|
0978a94358 | ||
|
|
e956a9c9f3 | ||
|
|
82026d11a4 | ||
|
|
6d233ac75c | ||
|
|
73c1934e7e | ||
|
|
bf1194ec75 | ||
|
|
22d2740725 | ||
|
|
02f26dc7a1 | ||
|
|
db14cbb0e0 | ||
|
|
a2b35cae92 | ||
|
|
aab0e4c82e | ||
|
|
6609708d14 | ||
|
|
ed198f062c | ||
|
|
4e2d656e9d | ||
|
|
2a4230868f | ||
|
|
cf778b1759 | ||
|
|
1b6daddd40 | ||
|
|
d7b137d144 | ||
|
|
b5d5855559 | ||
|
|
c0aa8dd808 | ||
|
|
4f2f5c02a0 | ||
|
|
7a6843fa4a | ||
|
|
f0ecf16c6b | ||
|
|
8998fa71b2 | ||
|
|
4e677a7558 | ||
|
|
07254b36d7 | ||
|
|
a51b8d256d | ||
|
|
75fcd9448e | ||
|
|
6b45999702 | ||
|
|
a4f52f4057 | ||
|
|
b8b3201372 | ||
|
|
41deadc1e2 | ||
|
|
82e8d06e54 | ||
|
|
51db5f2ff7 | ||
|
|
2ec9e515ff | ||
|
|
0579572148 | ||
|
|
83f4e6353c | ||
|
|
130953e519 | ||
|
|
7981093591 | ||
|
|
79112d6208 | ||
|
|
a3eb6263f4 | ||
|
|
d91bc9c73d | ||
|
|
c807665ab9 | ||
|
|
7b97c181b9 | ||
|
|
c42b0847d2 | ||
|
|
f182cb00c1 | ||
|
|
3181b5da23 | ||
|
|
983c119477 | ||
|
|
874ff1bba2 | ||
|
|
06d9d89f98 | ||
|
|
c713bad8c3 | ||
|
|
fe19491822 | ||
|
|
c80e8a1aca |
No files matched your search
@@ -0,0 +1,16 @@
|
||||
name: 'Comment actions'
|
||||
|
||||
on: issue_comment
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
labels:
|
||||
uses: MinecraftForge/SharedActions/.github/workflows/comment_actions.yml@main
|
||||
secrets:
|
||||
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
|
||||
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
|
||||
@@ -0,0 +1,16 @@
|
||||
name: 'Issue actions'
|
||||
|
||||
on: issues
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
labels:
|
||||
uses: MinecraftForge/SharedActions/.github/workflows/issue_actions.yml@main
|
||||
secrets:
|
||||
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
|
||||
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
|
||||
@@ -0,0 +1,16 @@
|
||||
name: 'Pull Request Review actions'
|
||||
|
||||
on: pull_request_review
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
labels:
|
||||
uses: MinecraftForge/SharedActions/.github/workflows/pr_review_actions.yml@main
|
||||
secrets:
|
||||
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
|
||||
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
|
||||
@@ -0,0 +1,16 @@
|
||||
name: 'Pull Request actions'
|
||||
|
||||
on: pull_request
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
labels:
|
||||
uses: MinecraftForge/SharedActions/.github/workflows/pr_actions.yml@main
|
||||
secrets:
|
||||
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
|
||||
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
|
||||
@@ -0,0 +1,16 @@
|
||||
name: 'Push actions'
|
||||
|
||||
on: push
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
labels:
|
||||
uses: MinecraftForge/SharedActions/.github/workflows/push_actions.yml@main
|
||||
secrets:
|
||||
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
|
||||
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
|
||||
@@ -1,27 +0,0 @@
|
||||
name: Support Requests
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- labeled
|
||||
- unlabeled
|
||||
- reopened
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
support:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/support-requests@v2
|
||||
with:
|
||||
support-label: Forum
|
||||
issue-comment: >
|
||||
:wave: We use the issue tracker exclusively for final bug reports and feature requests.
|
||||
However, this issue appears to be better suited for the
|
||||
[Forge Support Forums](https://forums.minecraftforge.net/) or
|
||||
[Forge Discord](https://discord.gg/UvedJ9m). Please create a new topic on the support forum
|
||||
with this issue or ask in the `#tech-support` channel in the Discord server, and the
|
||||
conversation can continue there.
|
||||
lock-issue: true
|
||||
Vendored
+74
-2
@@ -1,5 +1,7 @@
|
||||
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
|
||||
@@ -30,11 +32,13 @@ project {
|
||||
buildType(Build)
|
||||
buildType(BuildSecondaryBranches)
|
||||
buildType(PullRequests)
|
||||
buildType(PullRequestChecks)
|
||||
buildType(PullRequestCompatibility)
|
||||
|
||||
params {
|
||||
text("docker_jdk_version", "17", 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", "7.4", 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.18.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("docker_gradle_version", "7.5.1", 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.19.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*)
|
||||
@@ -134,3 +138,71 @@ object PullRequests : BuildType({
|
||||
""".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()
|
||||
}
|
||||
})
|
||||
+75
-58
@@ -1,4 +1,10 @@
|
||||
import groovy.json.JsonBuilder
|
||||
import net.minecraftforge.forge.tasks.checks.CheckATs
|
||||
import net.minecraftforge.forge.tasks.checks.CheckExcs
|
||||
import net.minecraftforge.forge.tasks.checks.CheckPatches
|
||||
import net.minecraftforge.forge.tasks.checks.CheckSAS
|
||||
import net.minecraftforge.forge.tasks.checks.CheckTask
|
||||
import net.minecraftforge.forge.tasks.checks.CheckMode
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.util.Date
|
||||
@@ -19,7 +25,7 @@ plugins {
|
||||
id 'com.github.ben-manes.versions' version '0.36.0'
|
||||
id 'net.minecraftforge.gradleutils' version '2.+'
|
||||
id 'eclipse'
|
||||
id 'de.undercouch.download' version '4.1.2'
|
||||
id 'de.undercouch.download' version '5.1.3'
|
||||
id 'net.minecraftforge.gradle.patcher' version '[5.1.50,5.2.0)' apply false
|
||||
id 'net.minecraftforge.gradle.mcp' version '[5.1.50,5.2.0)' apply false
|
||||
}
|
||||
@@ -36,14 +42,14 @@ ext {
|
||||
]
|
||||
}
|
||||
MAPPING_CHANNEL = 'official'
|
||||
MAPPING_VERSION = '1.19.1'
|
||||
MC_VERSION = '1.19.1'
|
||||
MAPPING_VERSION = '1.19.3'
|
||||
MC_VERSION = '1.19.3'
|
||||
MC_NEXT_VERSION = '1.20'
|
||||
MCP_VERSION = '20220727.212338'
|
||||
MCP_VERSION = '20221207.122022'
|
||||
SPI_VERSION = '6.0.0'
|
||||
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
||||
COREMODS_VERSION = '5.0.1'
|
||||
EVENTBUS_VERSION = '6.0.0'
|
||||
EVENTBUS_VERSION = '6.0.3'
|
||||
MODLAUNCHER_VERSION = '10.0.8'
|
||||
SECUREJARHANDLER_VERSION = '2.1.4'
|
||||
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
|
||||
@@ -56,17 +62,17 @@ ext {
|
||||
JETBRAINS_ANNOTATIONS_VERSION = '23.0.0'
|
||||
SLF4J_API_VERSION = '1.8.0-beta4'
|
||||
APACHE_MAVEN_ARTIFACT_VERSION = '3.8.5'
|
||||
JARJAR_VERSION = '0.3.19'
|
||||
|
||||
// These versions should be kept in sync with the version manifest JSON
|
||||
// To use a version newer than the version manifest JSON, the dependency must be added to the installer configuration
|
||||
MOJANG_LOGGING_VERSION = '1.0.0'
|
||||
LOG4J_VERSION = '2.17.0'
|
||||
GUAVA_VERSION = '31.0.1-jre'
|
||||
GSON_VERSION = '2.8.9'
|
||||
MOJANG_LOGGING_VERSION = '1.1.1'
|
||||
LOG4J_VERSION = '2.19.0'
|
||||
GUAVA_VERSION = '31.1-jre'
|
||||
GSON_VERSION = '2.10'
|
||||
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
|
||||
JOPT_SIMPLE_VERSION = '5.0.4'
|
||||
COMMONS_IO_VERSION = '2.11.0'
|
||||
JARJAR_VERSION = '0.3.9'
|
||||
|
||||
GIT_INFO = gradleutils.gitInfo
|
||||
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
||||
@@ -77,7 +83,7 @@ ext {
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
|
||||
MIN_TAG_FOR_CHANGELOG = "41.0"
|
||||
MIN_TAG_FOR_CHANGELOG = '41.0'
|
||||
}
|
||||
|
||||
println('Version: ' + VERSION +
|
||||
@@ -262,6 +268,7 @@ def sharedDeps = {
|
||||
moduleonly "org.ow2.asm:asm-util:${ASM_VERSION}"
|
||||
moduleonly "org.ow2.asm:asm-analysis:${ASM_VERSION}"
|
||||
moduleonly "cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}"
|
||||
moduleonly "net.minecraftforge:JarJarFileSystems:${JARJAR_VERSION}"
|
||||
|
||||
installer "cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}"
|
||||
installer "org.ow2.asm:asm:${ASM_VERSION}"
|
||||
@@ -285,7 +292,8 @@ def sharedDeps = {
|
||||
installer "org.jline:jline-terminal:${JLINE_VERSION}" // Dep of TerminalConsoleAppender
|
||||
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
|
||||
installer 'org.openjdk.nashorn:nashorn-core:15.3'
|
||||
installer "net.minecraftforge:JarJar:${JARJAR_VERSION}"
|
||||
installer "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}"
|
||||
installer "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}"
|
||||
|
||||
/*
|
||||
installer 'org.lwjgl:lwjgl:3.2.2'
|
||||
@@ -1166,89 +1174,98 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
|
||||
task checkATs(type: CheckATs, dependsOn: [extractInheritance, createSrg2Mcp]) {
|
||||
inheritance = extractInheritance.output
|
||||
tasks.register('checkAll') {
|
||||
dependsOn 'checkLicenses'
|
||||
group = 'checks'
|
||||
}
|
||||
tasks.register('checkAllAndFix') {
|
||||
dependsOn 'findFieldInstanceChecks', 'checkLicenses'
|
||||
group = 'checks'
|
||||
}
|
||||
|
||||
CheckTask.registerTask(tasks, 'ATs', CheckATs) {
|
||||
dependsOn extractInheritance, createSrg2Mcp
|
||||
ats.from patcher.accessTransformers
|
||||
inheritance = extractInheritance.output
|
||||
mappings = createSrg2Mcp.output
|
||||
}
|
||||
|
||||
task checkSAS(type: CheckSAS, dependsOn: extractInheritance) {
|
||||
inheritance = extractInheritance.output
|
||||
CheckTask.registerTask(tasks, 'SAS', CheckSAS) {
|
||||
dependsOn extractInheritance
|
||||
sass.from patcher.sideAnnotationStrippers
|
||||
inheritance = extractInheritance.output
|
||||
}
|
||||
|
||||
task checkExcs(type: CheckExcs, dependsOn: jar) {
|
||||
CheckTask.registerTask(tasks, 'Excs', CheckExcs) {
|
||||
dependsOn jar
|
||||
binary = jar.archiveFile.get().asFile
|
||||
excs.from patcher.excs
|
||||
}
|
||||
|
||||
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks]){}
|
||||
|
||||
task checkPatchesAndFix(type: CheckPatches, dependsOn: genPatches) {
|
||||
CheckTask.registerTask(tasks, 'Patches', CheckPatches) {
|
||||
dependsOn genPatches
|
||||
patchDir = file("$rootDir/patches")
|
||||
autoFix = true
|
||||
}
|
||||
|
||||
task checkPatches(type: CheckPatches, dependsOn: genPatches) {
|
||||
patchDir = file("$rootDir/patches")
|
||||
autoFix = false
|
||||
patchesWithS2SArtifact = [
|
||||
'minecraft/net/minecraft/client/renderer/ViewArea.java.patch',
|
||||
'minecraft/net/minecraft/data/models/blockstates/Variant.java.patch',
|
||||
]
|
||||
}
|
||||
|
||||
genPatches {
|
||||
finalizedBy checkPatches
|
||||
finalizedBy checkAndFixPatches
|
||||
autoHeader true
|
||||
lineEnding = '\n'
|
||||
}
|
||||
|
||||
def baseForgeVersion = System.getProperty("forge.compatibility_check_version")
|
||||
if (baseForgeVersion == null)
|
||||
baseForgeVersion = "${MC_VERSION}-${GIT_INFO.tag}.0"
|
||||
if (baseForgeVersion == "null")
|
||||
baseForgeVersion = null // Allow disabling from system property if not wanted
|
||||
def baseForgeUniversal = null
|
||||
if (baseForgeVersion != null)
|
||||
baseForgeUniversal = project.dependencies.create("net.minecraftforge:forge:${baseForgeVersion}:universal")
|
||||
def baseForgeVersionProperty = project.objects.property(String)
|
||||
baseForgeVersionProperty.set(project.provider { getLatestForgeVersion(MC_VERSION) }.map { MC_VERSION + '-' + it })
|
||||
baseForgeVersionProperty.finalizeValueOnRead()
|
||||
def jarCompatibilityTaskSetup = { task ->
|
||||
task.group = 'jar compatibility'
|
||||
task.onlyIf {
|
||||
baseForgeVersion != null
|
||||
baseForgeVersionProperty.getOrNull() != null
|
||||
}
|
||||
task.inputs.property 'baseForgeVersion', baseForgeVersion
|
||||
}
|
||||
|
||||
task downloadBaseCompatibilityBinPatches(type: DownloadBaseCompatibilityBinPatches) {
|
||||
inputVersion = baseForgeVersion
|
||||
tasks.register('setupCheckJarCompatibility', SetupCheckJarCompatibility) {
|
||||
inputVersion = baseForgeVersionProperty
|
||||
}
|
||||
|
||||
task applyBaseCompatibilityJarBinPatches(type: ApplyBinPatches) {
|
||||
tasks.register('applyBaseCompatibilityJarBinPatches', ApplyBinPatches) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
|
||||
clean = createJoinedSRG.output
|
||||
patch = downloadBaseCompatibilityBinPatches.output
|
||||
clean = project.tasks.createJoinedSRG.output
|
||||
patch = project.tasks.named('setupCheckJarCompatibility').flatMap { it.baseBinPatchesOutput }
|
||||
output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') }
|
||||
}
|
||||
|
||||
task checkJarCompatibility(type: CheckJarCompatibility) {
|
||||
tasks.register('mergeBaseForgeJar', MergeJars) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
|
||||
if (baseForgeVersion != null) {
|
||||
def fmlLibs = project.configurations.detachedConfiguration(PACKED_DEPS.collect {
|
||||
def artifactId = it.split(':')[1]
|
||||
return project.dependencies.create("net.minecraftforge:${artifactId}:${baseForgeVersion}")
|
||||
}.toArray(Dependency[]::new))
|
||||
inputJars.from(project.tasks.named('applyBaseCompatibilityJarBinPatches').flatMap { it.output })
|
||||
inputJars.from(baseForgeVersionProperty.map { inputVersion ->
|
||||
def output = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-universal.jar") }.get().asFile
|
||||
project.rootProject.extensions.download.run {
|
||||
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-universal.jar"
|
||||
dest output
|
||||
}
|
||||
return output
|
||||
})
|
||||
}
|
||||
|
||||
baseJar = project.tasks.applyBaseCompatibilityJarBinPatches.output
|
||||
baseLibraries.from(project.configurations.detachedConfiguration(baseForgeUniversal))
|
||||
baseLibraries.from(project.tasks.createJoinedSRG.output)
|
||||
baseLibraries.from(fmlLibs)
|
||||
tasks.register('checkJarCompatibility', CheckJarCompatibility) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
dependsOn 'setupCheckJarCompatibility'
|
||||
|
||||
inputJar = project.tasks.reobfJar.output
|
||||
concreteLibraries.from(PACKED_DEPS.collect { rootProject.tasks.getByPath(it).archiveFile })
|
||||
baseJar = project.tasks.named('mergeBaseForgeJar').flatMap { it.output }
|
||||
baseLibraries.from(project.tasks.named('createJoinedSRG').flatMap { it.output })
|
||||
|
||||
commonLibraries.from(project.configurations.minecraftImplementation)
|
||||
commonLibraries.from(project.configurations.installer)
|
||||
commonLibraries.from(project.configurations.moduleonly)
|
||||
}
|
||||
inputJar = project.tasks.named('reobfJar').flatMap { it.output }
|
||||
concreteLibraries.from(project.PACKED_DEPS.collect { project.rootProject.tasks.getByPath(it).archiveFile })
|
||||
|
||||
commonLibraries.from(project.configurations.minecraftImplementation)
|
||||
commonLibraries.from(project.configurations.installer)
|
||||
commonLibraries.from(project.configurations.moduleonly)
|
||||
}
|
||||
|
||||
task launcherJson(type: LauncherJson) {
|
||||
|
||||
@@ -7,4 +7,6 @@ dependencies {
|
||||
implementation 'org.ow2.asm:asm:9.3'
|
||||
implementation 'org.ow2.asm:asm-tree:9.3'
|
||||
implementation 'net.minecraftforge:srgutils:0.4.+'
|
||||
implementation 'commons-io:commons-io:2.8.0'
|
||||
implementation 'com.google.code.gson:gson:2.10'
|
||||
}
|
||||
@@ -1,267 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import net.minecraftforge.srgutils.IMappingFile
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
abstract class CheckATs extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getAts()
|
||||
@InputFile @Optional abstract RegularFileProperty getMappings()
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
def mappings = mappings.map { IMappingFile.load(it.asFile) }.getOrNull()
|
||||
Util.init()
|
||||
def parse = { line ->
|
||||
def idx = line.indexOf('#')
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
def (modifier, cls, desc) = (line.trim() + ' ').split(' ', -1)
|
||||
def key = cls + (desc.isEmpty() ? '' : ' ' + desc)
|
||||
return [modifier, cls, desc, comment, key]
|
||||
}
|
||||
def accessLevel = { access ->
|
||||
if ((access & Opcodes.ACC_PUBLIC) != 0) return 3
|
||||
if ((access & Opcodes.ACC_PROTECTED) != 0) return 2
|
||||
if ((access & Opcodes.ACC_PRIVATE) != 0) return 0
|
||||
return 1
|
||||
}
|
||||
def accessStr = { access ->
|
||||
if (access.endsWith('-f') || access.endsWith('+f'))
|
||||
return 4
|
||||
switch (access.toLowerCase()) {
|
||||
case 'public': return 3
|
||||
case 'protected': return 2
|
||||
case 'default': return 1
|
||||
case 'private': return 0
|
||||
default: return -1
|
||||
}
|
||||
}
|
||||
def json = inheritance.get().asFile.json()
|
||||
|
||||
ats.each { f ->
|
||||
TreeMap lines = [:]
|
||||
def group = null
|
||||
for (def line : f.readLines()) {
|
||||
if (line.isEmpty()) continue
|
||||
if (line.startsWith('#group ')) {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line.substring(7))
|
||||
|
||||
if (desc != '*' && desc != '*()' && desc != '<init>')
|
||||
throw new IllegalStateException('Invalid group: ' + line)
|
||||
|
||||
group = [modifier: modifier, cls: cls, desc: desc, comment: comment,
|
||||
existing: [] as Set,
|
||||
children: [] as TreeSet,
|
||||
group: true
|
||||
]
|
||||
if (lines.containsKey(key))
|
||||
throw new IllegalStateException('Duplicate group: ' + line)
|
||||
|
||||
lines[key] = group
|
||||
} else if (group != null) {
|
||||
if (line.startsWith('#endgroup')) {
|
||||
group = null
|
||||
} else {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line)
|
||||
group['existing'].add(key)
|
||||
}
|
||||
} else if (line.startsWith('#endgroup')) {
|
||||
throw new IllegalStateException('Invalid group ending: ' + line)
|
||||
} else if (line.startsWith('#')) {
|
||||
//Nom
|
||||
} else {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line)
|
||||
if (lines.containsKey(key)) {
|
||||
println('Duplicate: ' + line)
|
||||
continue
|
||||
}
|
||||
lines[key] = [modifier: modifier, cls: cls, desc: desc, comment: comment, group: false]
|
||||
}
|
||||
}
|
||||
|
||||
// Process Groups, this will remove any entries outside the group that is covered by the group
|
||||
for (def key : new ArrayList<>(lines.keySet())) {
|
||||
def entry = lines.get(key)
|
||||
if (entry != null && entry['group']) {
|
||||
def cls = entry['cls']
|
||||
def jcls = json.get(cls.replaceAll('\\.', '/'))
|
||||
if (jcls == null) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group: ' + key)
|
||||
} else if ('*' == entry['desc']) {
|
||||
if (!jcls.containsKey('fields')) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group, Class has no fields: ' + key)
|
||||
} else {
|
||||
jcls['fields'].each { field, value ->
|
||||
def fkey = cls + ' ' + field
|
||||
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
|
||||
if (lines.containsKey(fkey)) {
|
||||
lines.remove(fkey)
|
||||
} else if (!entry['existing'].contains(fkey)) {
|
||||
println('Added: ' + fkey)
|
||||
}
|
||||
entry['children'].add(fkey)
|
||||
} else if (lines.containsKey(fkey)) {
|
||||
lines.remove(fkey)
|
||||
println('Removed: ' + fkey)
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('*()' == entry['desc']) {
|
||||
if (!jcls.containsKey('methods')) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group, Class has no methods: ' + key)
|
||||
} else {
|
||||
jcls['methods'].each{ mtd, value ->
|
||||
if (mtd.startsWith('<clinit>') || mtd.startsWith('lambda$'))
|
||||
return
|
||||
key = cls + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
|
||||
if (lines.containsKey(key)) {
|
||||
lines.remove(key)
|
||||
} else if (!entry['existing'].contains(key)) {
|
||||
println('Added: ' + key)
|
||||
}
|
||||
entry['children'].add(key)
|
||||
} else if (lines.containsKey(key)) {
|
||||
lines.remove(key)
|
||||
println('Removed: ' + key)
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('<init>' == entry['desc']) { //Make all public non-abstract subclasses
|
||||
json.each{ tcls,value ->
|
||||
if (!value.containsKey('methods') || ((value['access'] & Opcodes.ACC_ABSTRACT) != 0))
|
||||
return
|
||||
def parents = [] as Set
|
||||
def parent = tcls
|
||||
while (parent != null && json.containsKey(parent)) {
|
||||
parents.add(parent)
|
||||
def p = json[parent]
|
||||
parent = p == null ? null : p['superName']
|
||||
}
|
||||
if (parents.contains(cls.replaceAll('\\.', '/'))) {
|
||||
value['methods'].each{ mtd, v ->
|
||||
if (mtd.startsWith('<init>')) {
|
||||
def child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel.call(v['access']) < 3) {
|
||||
if (lines.containsKey(child)) {
|
||||
lines.remove(child)
|
||||
} else if (!entry['existing'].contains(child)) {
|
||||
println('Added: ' + child)
|
||||
}
|
||||
entry['children'].add(child)
|
||||
} else if (lines.containsKey(child)) {
|
||||
lines.remove(child)
|
||||
println('Removed: ' + child)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process normal lines, remove invalid and remove narrowing
|
||||
for (def key : new ArrayList<>(lines.keySet())) {
|
||||
def entry = lines.get(key)
|
||||
if (entry != null && !entry['group']) {
|
||||
def cls = entry['cls']
|
||||
def jcls = json.get(cls.replaceAll('\\.', '/'))
|
||||
if (jcls == null) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else if (entry['desc'] == '') {
|
||||
if (accessLevel.call(jcls['access']) > accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
}
|
||||
} else if (!entry['desc'].contains('(')) {
|
||||
if (!jcls.containsKey('fields') || !jcls['fields'].containsKey(entry['desc'])) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else {
|
||||
def value = jcls['fields'][entry['desc']]
|
||||
if (accessLevel.call(value['access']) > accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
println(entry.comment)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
def jdesc = entry['desc'].replace('(', ' (')
|
||||
if (!jcls.containsKey('methods') || !jcls['methods'].containsKey(jdesc)) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else {
|
||||
def value = jcls['methods'][jdesc]
|
||||
if (accessLevel.call(value['access']) > accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def data = []
|
||||
def remapComment = { entry ->
|
||||
if (!mappings || !entry || !entry.desc) return null
|
||||
def comment = entry.comment?.substring(1)?.trim()
|
||||
def jsonCls = json.get(entry.cls.replaceAll('\\.', '/'))
|
||||
def mappingsClass = mappings?.getClass(jsonCls.name)
|
||||
if (!mappingsClass) return entry.comment
|
||||
def idx = entry.desc.indexOf('(')
|
||||
def mappedName = idx == -1
|
||||
? mappingsClass.remapField(entry.desc)
|
||||
: mappingsClass.remapMethod(entry.desc.substring(0, idx), entry.desc.substring(idx))
|
||||
if (!mappedName) return entry.comment
|
||||
if (mappedName == '<init>')
|
||||
mappedName = 'constructor'
|
||||
|
||||
if (comment?.startsWith(mappedName))
|
||||
return '# ' + comment
|
||||
if (comment && comment.indexOf(' ') != -1) {
|
||||
def split = comment.split(" - ").toList()
|
||||
if (split[0].indexOf(' ') != -1)
|
||||
// The first string is more than one word, so append before it
|
||||
return "# ${mappedName} - ${comment}"
|
||||
split.remove(0)
|
||||
return "# ${mappedName} - ${String.join(' - ', split)}"
|
||||
}
|
||||
return '# ' + mappedName
|
||||
}
|
||||
lines.each { key,value ->
|
||||
if (!value.group) {
|
||||
def comment = remapComment.call(value)
|
||||
data.add(value.modifier + ' ' + key + (comment ? ' ' + comment : ''))
|
||||
} else {
|
||||
data.add('#group ' + value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
|
||||
value.children.each {
|
||||
def line = value.modifier + ' ' + it
|
||||
def (modifier, cls, desc, comment) = parse.call(line)
|
||||
comment = remapComment.call([modifier: modifier, cls: cls, desc: desc, comment: comment])
|
||||
data.add(line + (comment ? ' ' + comment : ''))
|
||||
}
|
||||
data.add('#endgroup')
|
||||
}
|
||||
}
|
||||
f.text = data.join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.ClassVisitor
|
||||
import org.objectweb.asm.MethodVisitor
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.Type
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
abstract class CheckExcs extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getBinary()
|
||||
@InputFiles abstract ConfigurableFileCollection getExcs()
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def known = []
|
||||
binary.get().asFile.withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
def visitor = new ClassVisitor(Opcodes.ASM9) {
|
||||
private String cls
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||
this.cls = name
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
known.add(this.cls + '.' + name + descriptor)
|
||||
super.visitMethod(access, name, descriptor, signature, exceptions)
|
||||
}
|
||||
}
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) != null) {
|
||||
if (zein.name.endsWith('.class')) {
|
||||
ClassReader reader = new ClassReader(zin)
|
||||
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
excs.each { f ->
|
||||
def lines = []
|
||||
f.eachLine { line ->
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
|
||||
if (!line.contains('=')) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
def (key, value) = line.split('=', 2)
|
||||
if (!known.contains(key)) {
|
||||
println('Unknown: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
def (cls, desc) = key.split('\\.', 2)
|
||||
if (!desc.contains('(')) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
def name = desc.split('\\(', 2)[0]
|
||||
desc = '(' + desc.split('\\(', 2)[1]
|
||||
|
||||
def (exceptions, args) = value.contains('|') ? value.split('|', 2) : [value, '']
|
||||
|
||||
if (args.split(',').length != Type.getArgumentTypes(desc).length) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
lines.add(line)
|
||||
}
|
||||
f.text = lines.sort().join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.regex.Pattern
|
||||
|
||||
abstract class CheckPatches extends DefaultTask {
|
||||
@InputDirectory abstract DirectoryProperty getPatchDir()
|
||||
@Input boolean autoFix = false
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
def hasS2SArtifact = [
|
||||
Paths.get("patches/minecraft/net/minecraft/client/renderer/ViewArea.java.patch"),
|
||||
Paths.get("patches/minecraft/net/minecraft/data/models/blockstates/Variant.java.patch")
|
||||
]
|
||||
|
||||
def verified = true;
|
||||
patchDir.get().asFileTree.each { patch ->
|
||||
def patchPath = project.rootDir.toPath().relativize(patch.toPath())
|
||||
verified &= verifyPatch(patch, autoFix, patchPath.toString(), hasS2SArtifact.contains(patchPath))
|
||||
}
|
||||
|
||||
if (!verified)
|
||||
throw new RuntimeException('One or more patches failed verification. Check the log for errors.')
|
||||
}
|
||||
|
||||
def verifyPatch(patch, fix, patchPath, hasS2SArtifact) {
|
||||
def hunk_start_pattern = Pattern.compile('^@@ -[0-9,]* \\+[0-9,_]* @@$')
|
||||
def white_space_pattern = Pattern.compile('^[+\\-]\\s*$')
|
||||
def import_pattern = Pattern.compile('^[+\\-]\\s*import.*')
|
||||
def field_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$')
|
||||
def method_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$')
|
||||
def class_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$')
|
||||
|
||||
def accessMap = [("private"):0, (null):1, ("protected"):2, ("public"):3]
|
||||
|
||||
def hasProblem = false;
|
||||
def lines = patch.readLines()
|
||||
|
||||
def hunksStart = 0
|
||||
def onlyWhiteSpace = false
|
||||
|
||||
def didFix = false
|
||||
def newLines = []
|
||||
def whiteSpaceErrors = []
|
||||
|
||||
// First two lines are file name ++/-- and we do not care
|
||||
newLines.add(lines[0] + '\n')
|
||||
newLines.add(lines[1] + '\n')
|
||||
|
||||
int i = 2
|
||||
for (; i < lines.size(); ++i) {
|
||||
def line = lines[i]
|
||||
newLines.add(line + '\n')
|
||||
|
||||
if (hunk_start_pattern.matcher(line).find()) {
|
||||
if (onlyWhiteSpace) {
|
||||
if (fix || hasS2SArtifact) {
|
||||
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
didFix = true
|
||||
}
|
||||
else {
|
||||
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!whiteSpaceErrors.empty)
|
||||
hasProblem = true
|
||||
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
|
||||
whiteSpaceErrors.clear()
|
||||
}
|
||||
hunksStart = i
|
||||
onlyWhiteSpace = true
|
||||
continue
|
||||
}
|
||||
|
||||
if (line.startsWithAny('+','-')) {
|
||||
def prefixChange = false
|
||||
def prevLine = lines[i - 1]
|
||||
|
||||
if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') {
|
||||
def prevTrim = prevLine.substring(1).replaceAll("\\s", "")
|
||||
def currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (prevTrim.equals(currTrim)) {
|
||||
prefixChange = true
|
||||
}
|
||||
|
||||
def pMatcher = field_pattern.matcher(prevLine)
|
||||
def cMatcher = field_pattern.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // = ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // field name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
|
||||
pMatcher = method_pattern.matcher(prevLine)
|
||||
cMatcher = method_pattern.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // params
|
||||
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
|
||||
pMatcher = class_pattern.matcher(prevLine)
|
||||
cMatcher = class_pattern.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // class | interface
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
|
||||
if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) {
|
||||
def nextLine = lines[i + 1]
|
||||
if (nextLine.charAt(0) == (char)'+') {
|
||||
def nextTrim = nextLine.substring(1).replaceAll("\\s", "")
|
||||
def currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (nextTrim.equals(currTrim)) {
|
||||
prefixChange = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def isWhiteSpaceChange = white_space_pattern.matcher(line).find()
|
||||
|
||||
if (!prefixChange && !isWhiteSpaceChange) {
|
||||
onlyWhiteSpace = hasS2SArtifact && import_pattern.matcher(line).find()
|
||||
}
|
||||
else if (isWhiteSpaceChange) {
|
||||
def prevLineChange = prevLine.startsWithAny('+','-')
|
||||
def nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
|
||||
|
||||
if (!prevLineChange && !nextLineChange) {
|
||||
whiteSpaceErrors.add(String.format("Patch contains white space change in valid hunk at line %d (cannot auto fix), file: %s", i + 1, patchPath))
|
||||
}
|
||||
}
|
||||
|
||||
if (line.contains("\t")) {
|
||||
if (!fix) {
|
||||
logger.lifecycle("Patch contains tabs on line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
else {
|
||||
logger.lifecycle("Fixing tabs on line {}, file: {}", i + 1, patchPath)
|
||||
line = line.replaceAll('\t', ' ')
|
||||
newLines.remove(newLines.size() - 1)
|
||||
newLines.add(line + '\n')
|
||||
didFix = true
|
||||
}
|
||||
}
|
||||
|
||||
if (import_pattern.matcher(line).find() && !hasS2SArtifact) {
|
||||
logger.lifecycle("Patch contains import change on line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (onlyWhiteSpace) {
|
||||
if (fix || hasS2SArtifact) {
|
||||
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
didFix = true
|
||||
}
|
||||
else {
|
||||
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!whiteSpaceErrors.empty)
|
||||
hasProblem = true
|
||||
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
|
||||
}
|
||||
|
||||
if (didFix) {
|
||||
if (newLines.size() <= 2) {
|
||||
logger.lifecycle("Patch is now empty removing, file: {}", patchPath)
|
||||
Files.delete(patch.toPath())
|
||||
}
|
||||
else {
|
||||
if (!hasS2SArtifact)
|
||||
logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***")
|
||||
patch.withWriter('UTF-8') { writer ->
|
||||
newLines.each { l -> writer.write(l) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !hasProblem
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
abstract class CheckSAS extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getSass()
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def json = inheritance.get().asFile.json()
|
||||
|
||||
sass.each { f ->
|
||||
def lines = []
|
||||
f.eachLine { line ->
|
||||
if (line[0] == '\t') return //Skip any tabbed lines, those are ones we add
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
lines.add(line)
|
||||
return
|
||||
}
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
def (cls, name, desc) = (line.trim().replace('(', ' (') + ' ').split(' ', -1)
|
||||
cls = cls.replaceAll('\\.', '/')
|
||||
|
||||
if (json[cls] == null) {
|
||||
println('Invalid: ' + line)
|
||||
} else if (name.isEmpty()) { //Class SAS
|
||||
def toAdd = []
|
||||
def clsSided = isSided(json[cls])
|
||||
def sided = clsSided
|
||||
|
||||
/* TODO: MergeTool doesn't do fields
|
||||
if (json[cls]['fields'] != null) {
|
||||
for (entry in json[cls]['fields']) {
|
||||
if (isSided(entry.value)) {
|
||||
sided = true
|
||||
toAdd.add('\t' + cls + ' ' + entry.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (json[cls]['methods'] != null) {
|
||||
for (entry in json[cls]['methods']) {
|
||||
if (isSided(entry.value)) {
|
||||
sided = true
|
||||
toAdd.add('\t' + cls + ' ' + entry.key.replaceAll(' ', ''))
|
||||
findChildMethods(json, cls, entry.key).each { lines.add('\t' + it) }
|
||||
findChildMethods(json, cls, entry.key).each { println(line + ' -- ' + it) }
|
||||
} else if (clsSided) {
|
||||
findChildMethods(json, cls, entry.key).each { lines.add('\t' + it) }
|
||||
findChildMethods(json, cls, entry.key).each { println(line + ' -- ' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sided) {
|
||||
lines.add(cls + (comment == null ? '' : ' ' + comment))
|
||||
lines.addAll(toAdd.sort())
|
||||
} else
|
||||
println('Invalid: ' + line)
|
||||
|
||||
} else if (desc.isEmpty()) { // Fields
|
||||
/* TODO: MergeTool doesn't do fields
|
||||
if (json[cls]['fields'] != null && isSided(json[cls]['fields'][name]))
|
||||
lines.add(cls + ' ' + name + (comment == null ? '' : ' ' + comment))
|
||||
else
|
||||
*/
|
||||
println('Invalid: ' + line)
|
||||
} else { // Methods
|
||||
if (json[cls]['methods'] == null || !isSided(json[cls]['methods'][name + ' ' + desc]))
|
||||
println('Invalid: ' + line)
|
||||
else {
|
||||
lines.add(cls + ' ' + name + desc + (comment == null ? '' : ' ' + comment))
|
||||
findChildMethods(json, cls, name + ' ' + desc).each { println(line + ' -- ' + it) }
|
||||
findChildMethods(json, cls, name + ' ' + desc).each { lines.add('\t' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
f.text = lines.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
protected static isSided(json) {
|
||||
if (json == null || json['annotations'] == null)
|
||||
return false
|
||||
for (ann in json['annotations']) {
|
||||
if ('Lnet/minecraftforge/api/distmarker/OnlyIn;'.equals(ann.desc))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
protected static findChildMethods(json, cls, desc)
|
||||
{
|
||||
return json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls && isSided(it.methods[desc]) }
|
||||
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
|
||||
}
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.nio.file.Files
|
||||
|
||||
abstract class DownloadBaseCompatibilityBinPatches extends DefaultTask {
|
||||
DownloadBaseCompatibilityBinPatches() {
|
||||
group = 'jar compatibility'
|
||||
onlyIf {
|
||||
inputVersion.getOrNull() != null
|
||||
}
|
||||
|
||||
output.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
def dep = project.dependencies.create("net.minecraftforge:forge:${inputVersion.get()}:userdev")
|
||||
def baseForgeUserdev = project.configurations.detachedConfiguration(dep).resolve().iterator().next()
|
||||
|
||||
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
|
||||
|
||||
Files.copy(joinedLzma.toPath(), output.get().asFile.toPath())
|
||||
}
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
abstract Property<String> getInputVersion()
|
||||
|
||||
@OutputFile
|
||||
abstract RegularFileProperty getOutput()
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TupleConstructor
|
||||
|
||||
@CompileStatic
|
||||
@TupleConstructor
|
||||
final class InheritanceData implements Annotatable {
|
||||
String name
|
||||
int access
|
||||
String superName
|
||||
List<String> interfaces = []
|
||||
Map<String, Method> methods = [:]
|
||||
Map<String, Field> fields = [:]
|
||||
List<Annotation> annotations = []
|
||||
|
||||
@TupleConstructor
|
||||
static final class Method implements Annotatable {
|
||||
int access
|
||||
String override
|
||||
List<Annotation> annotations = []
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Field implements Annotatable {
|
||||
int access
|
||||
String desc
|
||||
List<Annotation> annotations = []
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Annotation {
|
||||
String desc
|
||||
}
|
||||
|
||||
private static final Gson GSON = new Gson()
|
||||
static Map<String, InheritanceData> parse(File file) {
|
||||
try (final reader = file.newReader()) {
|
||||
return GSON.fromJson(reader, new TypeToken<Map<String, InheritanceData>>() {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
interface Annotatable {
|
||||
List<InheritanceData.Annotation> getAnnotations()
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.apache.commons.io.IOUtils
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
abstract class MergeJars extends DefaultTask {
|
||||
MergeJars() {
|
||||
output.convention(project.layout.buildDirectory.dir(name).map { it.file('output.jar') })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
def jars = inputJars.files
|
||||
|
||||
try (ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(output.get().asFile))) {
|
||||
for (def jar : jars) {
|
||||
try (ZipInputStream zin = new ZipInputStream(new FileInputStream(jar))) {
|
||||
def entry
|
||||
while ((entry = zin.getNextEntry()) != null) {
|
||||
ZipEntry _new = new ZipEntry(entry.getName())
|
||||
_new.setTime(0) //SHOULD be the same time as the main entry, but NOOOO _new.setTime(entry.getTime()) throws DateTimeException, so you get 0, screw you!
|
||||
zout.putNextEntry(_new)
|
||||
IOUtils.copy(zin, zout)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@InputFiles
|
||||
abstract ConfigurableFileCollection getInputJars()
|
||||
|
||||
@OutputFile
|
||||
abstract RegularFileProperty getOutput()
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
abstract class SetupCheckJarCompatibility extends DefaultTask {
|
||||
SetupCheckJarCompatibility() {
|
||||
group = 'jar compatibility'
|
||||
onlyIf {
|
||||
inputVersion.getOrNull() != null
|
||||
}
|
||||
outputs.upToDateWhen { false } // Never up to date, because this setup task should always run
|
||||
|
||||
baseBinPatchesOutput.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
def inputVersion = inputVersion.get()
|
||||
def fmlLibs = project.configurations.detachedConfiguration(project.PACKED_DEPS.collect {
|
||||
def artifactId = it.split(':')[1]
|
||||
return project.dependencies.create("net.minecraftforge:${artifactId}:${inputVersion}")
|
||||
}.toArray(Dependency[]::new))
|
||||
|
||||
project.tasks.named('checkJarCompatibility') {
|
||||
baseLibraries.from(project.provider {
|
||||
fmlLibs.resolvedConfiguration.lenientConfiguration.files
|
||||
})
|
||||
}
|
||||
|
||||
def baseForgeUserdev = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-userdev.jar") }.get().asFile
|
||||
project.rootProject.extensions.download.run {
|
||||
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-userdev.jar"
|
||||
dest baseForgeUserdev
|
||||
}
|
||||
|
||||
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
|
||||
|
||||
Files.copy(joinedLzma.toPath(), baseBinPatchesOutput.get().asFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
|
||||
}
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
abstract Property<String> getInputVersion()
|
||||
|
||||
@OutputFile
|
||||
abstract RegularFileProperty getBaseBinPatchesOutput()
|
||||
}
|
||||
@@ -18,17 +18,17 @@ public class Util {
|
||||
return md.digest().collect {String.format "%02x", it}.join()
|
||||
}
|
||||
File.metaClass.getSha1 = { !delegate.exists() ? null : delegate.sha1() }
|
||||
|
||||
|
||||
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
|
||||
File.metaClass.getJson = { return delegate.exists() ? new JsonSlurper().parse(delegate) : [:] }
|
||||
File.metaClass.setJson = { json -> delegate.text = new JsonBuilder(json).toPrettyString() }
|
||||
|
||||
|
||||
Date.metaClass.iso8601 = { ->
|
||||
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
def result = format.format(delegate)
|
||||
return result[0..21] + ':' + result[22..-1]
|
||||
}
|
||||
|
||||
|
||||
String.metaClass.rsplit = { String del, int limit = -1 ->
|
||||
def lst = new ArrayList()
|
||||
def x = 0, idx
|
||||
@@ -41,7 +41,7 @@ public class Util {
|
||||
return lst
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String[] getClasspath(project, libs, artifact) {
|
||||
def ret = []
|
||||
artifactTree(project, artifact).each { key, lib ->
|
||||
@@ -51,7 +51,7 @@ public class Util {
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
public static def getArtifacts(project, config, classifiers) {
|
||||
def ret = [:]
|
||||
config.resolvedConfiguration.resolvedArtifacts.each {
|
||||
@@ -75,7 +75,7 @@ public class Util {
|
||||
url = "https://maven.minecraftforge.net/${path}"
|
||||
}
|
||||
//TODO remove when Mojang launcher is updated
|
||||
if (!classifiers && art.classifier != null) {
|
||||
if (!classifiers && art.classifier != null) {
|
||||
//Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
|
||||
// However, keep the path normal so that our mirror system works.
|
||||
art.version = "${art.version}-${art.classifier}"
|
||||
@@ -96,14 +96,14 @@ public class Util {
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
public static def getMavenPath(task) {
|
||||
|
||||
public static def getMavenPath(task) {
|
||||
def classifier = task.archiveClassifier.get()
|
||||
def dep = "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
|
||||
return "${task.project.group.replace('.', '/')}/${task.project.name}/${task.project.version}/${task.project.name}-${task.project.version}".toString() + (classifier == '' ? '' : '-' + classifier) + '.jar'
|
||||
}
|
||||
|
||||
public static def getMavenDep(task) {
|
||||
|
||||
public static def getMavenDep(task) {
|
||||
def classifier = task.archiveClassifier.get()
|
||||
return "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class Util {
|
||||
def files = cfg.resolve()
|
||||
return getArtifacts(project, cfg, true)
|
||||
}
|
||||
|
||||
|
||||
private static boolean checkExists(url) {
|
||||
try {
|
||||
def code = new URL(url).openConnection().with {
|
||||
@@ -142,4 +142,9 @@ public class Util {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLatestForgeVersion(mcVersion) {
|
||||
def json = new JsonSlurper().parseText(new URL("https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json").getText("UTF-8"))
|
||||
return json.promos["$mcVersion-latest"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TupleConstructor
|
||||
import net.minecraftforge.forge.tasks.InheritanceData
|
||||
import net.minecraftforge.srgutils.IMappingFile
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFile
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckATs extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getAts()
|
||||
@InputFile @Optional abstract RegularFileProperty getMappings()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final IMappingFile mappings = mappings.map { RegularFile it -> IMappingFile.load(it.asFile) }.getOrNull()
|
||||
final inheritance = InheritanceData.parse(this.inheritance.get().asFile)
|
||||
|
||||
ats.each {
|
||||
final lines = process(it, reporter, inheritance)
|
||||
if (fix) {
|
||||
it.text = joinBack(lines, inheritance, mappings).join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static TreeMap<String, ATParser.Entry> process(File file, Reporter reporter, Map<String, InheritanceData> inheritance) {
|
||||
final TreeMap<String, ATParser.Entry> lines = ATParser.parse(file.readLines(), reporter)
|
||||
final Map<String, ATParser.Entry> constructorGroups = [:]
|
||||
|
||||
final itr = lines.entrySet().iterator()
|
||||
final toRemove = []
|
||||
while (itr.hasNext()) {
|
||||
final next = itr.next()
|
||||
String key = next.key
|
||||
final entry = next.value
|
||||
if (entry === null) continue
|
||||
|
||||
final binaryName = entry.cls.replaceAll('\\.', '/')
|
||||
|
||||
// Process Groups, this will remove any entries outside the group that is covered by the group
|
||||
if (entry.group) {
|
||||
final jcls = inheritance[binaryName]
|
||||
if (jcls === null) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group: $key")
|
||||
} else if ('*' == entry.desc) {
|
||||
if (!jcls.fields) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group, class has no fields: $key")
|
||||
} else {
|
||||
jcls.fields.each { field, value ->
|
||||
final fkey = entry.cls + ' ' + field
|
||||
if (accessLevel(value.access) < accessStr(entry.modifier)) {
|
||||
if (lines.containsKey(fkey)) {
|
||||
toRemove.add(fkey)
|
||||
} else if (!entry.existing.contains(fkey)) {
|
||||
reporter.report("Missing group entry: $fkey")
|
||||
}
|
||||
entry.children.add(fkey)
|
||||
} else if (lines.containsKey(fkey)) {
|
||||
toRemove.add(fkey)
|
||||
reporter.report("Found invalid group entry: $fkey")
|
||||
}
|
||||
}
|
||||
entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('*()' == entry.desc) {
|
||||
if (!jcls.methods) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group, class has no methods: $key")
|
||||
} else {
|
||||
jcls.methods.each { mtd, value ->
|
||||
if (mtd.startsWith('<clinit>') || mtd.startsWith('lambda$')) return
|
||||
key = entry.cls + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel(value.access) < accessStr(entry.modifier)) {
|
||||
if (lines.containsKey(key)) {
|
||||
toRemove.add(key)
|
||||
} else if (!entry.existing.contains(key)) {
|
||||
reporter.report("Missing group entry: $key")
|
||||
}
|
||||
entry.children.add(key)
|
||||
} else if (lines.containsKey(key)) {
|
||||
toRemove.add(key)
|
||||
reporter.report("Found invalid group entry: $key")
|
||||
}
|
||||
}
|
||||
entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('<init>' == entry.desc) { //Make all public non-abstract subclasses
|
||||
constructorGroups.put(binaryName, entry)
|
||||
}
|
||||
}
|
||||
|
||||
// Process normal lines, remove invalid and remove narrowing
|
||||
else {
|
||||
def jcls = inheritance.get(binaryName)
|
||||
if (jcls === null) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else if (entry.desc == '') {
|
||||
if (accessLevel(jcls.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key")
|
||||
}
|
||||
} else if (!entry.desc.contains('(')) {
|
||||
if (!jcls.fields || !jcls.fields.containsKey(entry.desc)) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else {
|
||||
final value = jcls.fields[entry.desc]
|
||||
if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key - ${entry.comment}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final jdesc = entry.desc.replace('(', ' (')
|
||||
if (!jcls.methods || !jcls.methods.containsKey(jdesc)) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else {
|
||||
final value = jcls.methods[jdesc]
|
||||
if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inheritance.each { tcls, value ->
|
||||
if (!value.methods || ((value.access & Opcodes.ACC_ABSTRACT) !== 0)) return
|
||||
String parent = tcls
|
||||
while (parent !== null) {
|
||||
constructorGroups[parent]?.tap { entry ->
|
||||
value.methods.each { mtd, v ->
|
||||
if (mtd.startsWith('<init>')) {
|
||||
final child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel(v.access) < 3) {
|
||||
if (lines.containsKey(child)) {
|
||||
toRemove.add(child)
|
||||
} else if (child !in entry.existing) {
|
||||
reporter.report("Missing group entry: $child")
|
||||
}
|
||||
entry.children.add(child)
|
||||
} else if (lines.containsKey(child)) {
|
||||
toRemove.add(child)
|
||||
reporter.report("Found invalid group entry: $child")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parent = inheritance[parent]?.superName
|
||||
}
|
||||
}
|
||||
constructorGroups.values().each { entry -> entry.existing.findAll { it !in entry.children }.each{ reporter.report("Found invalid group entry: $it") } }
|
||||
|
||||
toRemove.each(lines.&remove)
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
private static List<String> joinBack(TreeMap<String, ATParser.Entry> lines, Map<String, InheritanceData> inheritance, IMappingFile mappings) {
|
||||
final data = []
|
||||
final remapComment = { ATParser.Entry entry ->
|
||||
if (!mappings || !entry || !entry.desc) return null
|
||||
final comment = entry.comment?.substring(1)?.trim()
|
||||
final jsonCls = inheritance.get(entry.cls.replaceAll('\\.', '/'))
|
||||
final mappingsClass = mappings?.getClass(jsonCls.name)
|
||||
if (mappingsClass === null) return entry.comment
|
||||
final idx = entry.desc.indexOf('(')
|
||||
|
||||
String mappedName = idx == -1
|
||||
? mappingsClass.remapField(entry.desc)
|
||||
: mappingsClass.remapMethod(entry.desc.substring(0, idx), entry.desc.substring(idx))
|
||||
if (!mappedName) return entry.comment
|
||||
if (mappedName == '<init>')
|
||||
mappedName = 'constructor'
|
||||
|
||||
if (comment?.startsWith(mappedName))
|
||||
return '# ' + comment
|
||||
if (comment && comment.indexOf(' ') !== -1) {
|
||||
def split = comment.split(' - ').toList()
|
||||
if (split[0].indexOf(' ') !== -1)
|
||||
// The first string is more than one word, so append before it
|
||||
return "# ${mappedName} - ${comment}"
|
||||
split.remove(0)
|
||||
return "# ${mappedName} - ${String.join(' - ', split)}"
|
||||
}
|
||||
return '# ' + mappedName
|
||||
}
|
||||
lines.each { key, value ->
|
||||
if (!value.group) {
|
||||
def comment = remapComment.call(value)
|
||||
data.add(value.modifier + ' ' + key + (comment ? ' ' + comment : ''))
|
||||
} else {
|
||||
data.add(('#group ' + value.modifier + ' ' + key + ' ' + (value.comment ?: '')).trim())
|
||||
value.children.each {
|
||||
final line = value.modifier + ' ' + it
|
||||
final entry = ATParser.parseEntry(line)
|
||||
final comment = remapComment(entry)
|
||||
data.add(line + (comment ? ' ' + comment : ''))
|
||||
}
|
||||
data.add('#endgroup')
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
static int accessStr(String access) {
|
||||
if (access.endsWith('-f') || access.endsWith('+f')) return 4
|
||||
switch (access.toLowerCase()) {
|
||||
case 'public': return 3
|
||||
case 'protected': return 2
|
||||
case 'default': return 1
|
||||
case 'private': return 0
|
||||
default: return -1
|
||||
}
|
||||
}
|
||||
|
||||
static int accessLevel(int access) {
|
||||
if ((access & Opcodes.ACC_PUBLIC) !== 0) return 3
|
||||
if ((access & Opcodes.ACC_PROTECTED) !== 0) return 2
|
||||
if ((access & Opcodes.ACC_PRIVATE) !== 0) return 0
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
class ATParser {
|
||||
static TreeMap<String, Entry> parse(List<String> lines, CheckTask.Reporter reporter) {
|
||||
TreeMap<String, Entry> outLines = new TreeMap<>()
|
||||
Entry group = null
|
||||
for (final line : lines) {
|
||||
if (line.isEmpty()) continue
|
||||
if (line.startsWith('#group ')) {
|
||||
final entry = parseEntry(line.substring(7))
|
||||
|
||||
if (entry.desc != '*' && entry.desc != '*()' && entry.desc != '<init>') {
|
||||
reporter.report("Invalid group: $line", false)
|
||||
}
|
||||
|
||||
entry.group = true
|
||||
entry.children = []
|
||||
entry.existing = []
|
||||
|
||||
group = entry
|
||||
|
||||
if (outLines.containsKey(entry.key)) {
|
||||
reporter.report("Duplicate group: $line", false)
|
||||
}
|
||||
|
||||
outLines[entry.key] = group
|
||||
} else if (group !== null) {
|
||||
if (line.startsWith('#endgroup')) {
|
||||
group = null
|
||||
} else {
|
||||
final key = parseEntry(line).key
|
||||
group.existing.add(key)
|
||||
}
|
||||
} else if (line.startsWith('#endgroup')) {
|
||||
reporter.report("Invalid group ending: $line", false)
|
||||
} else if (line.startsWith('#')) {
|
||||
//Nom
|
||||
} else {
|
||||
final entry = parseEntry(line)
|
||||
if (outLines.containsKey(entry.key)) {
|
||||
reporter.report("Found duplicate: $line")
|
||||
continue
|
||||
}
|
||||
outLines[entry.key] = entry
|
||||
}
|
||||
}
|
||||
return outLines
|
||||
}
|
||||
|
||||
static Entry parseEntry(String line) {
|
||||
final idx = line.indexOf('#')
|
||||
final String comment = idx === -1 ? null : line.substring(idx)
|
||||
if (idx !== -1) line = line.substring(0, idx - 1)
|
||||
final data = (line.trim() + ' ').split(' ', -1)
|
||||
new Entry(data[0], data[1], data[2], comment)
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Entry {
|
||||
String modifier, cls, desc, comment
|
||||
|
||||
Set<String> existing
|
||||
TreeSet<String> children
|
||||
boolean group = false
|
||||
|
||||
@Lazy
|
||||
String key = {cls + (desc.isEmpty() ? '' : ' ' + desc)}()
|
||||
|
||||
Object getAt(String key) {
|
||||
return getProperty(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.ClassVisitor
|
||||
import org.objectweb.asm.MethodVisitor
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.Type
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
abstract class CheckExcs extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getBinary()
|
||||
@InputFiles abstract ConfigurableFileCollection getExcs()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final Set<String> known = []
|
||||
collectKnown(known)
|
||||
|
||||
excs.each { f ->
|
||||
final lines = []
|
||||
f.eachLine { line ->
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
|
||||
if (!line.contains('=')) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
|
||||
def (String key, String value) = line.split('=', 2)
|
||||
if (!known.contains(key)) {
|
||||
reporter.report("Unknown: $line")
|
||||
return
|
||||
}
|
||||
|
||||
String desc = key.split('\\.', 2)[1]
|
||||
if (!desc.contains('(')) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
desc = '(' + desc.split('\\(', 2)[1]
|
||||
|
||||
def (exceptions, String args) = value.contains('|') ? value.split('|', 2) : [value, '']
|
||||
|
||||
if (args.split(',').length !== Type.getArgumentTypes(desc).length) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
lines.add(line)
|
||||
}
|
||||
|
||||
if (fix) f.text = lines.sort().join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
private void collectKnown(Collection<String> known) {
|
||||
binary.get().asFile.withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
final visitor = new ClassVisitor(Opcodes.ASM9) {
|
||||
private String cls
|
||||
@Override
|
||||
void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||
this.cls = name
|
||||
}
|
||||
|
||||
@Override
|
||||
MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
known.add(this.cls + '.' + name + descriptor)
|
||||
super.visitMethod(access, name, descriptor, signature, exceptions)
|
||||
}
|
||||
}
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) !== null) {
|
||||
if (zein.name.endsWith('.class')) {
|
||||
ClassReader reader = new ClassReader(zin)
|
||||
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
enum CheckMode {
|
||||
CHECK,
|
||||
FIX
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.Optional
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckPatches extends CheckTask {
|
||||
|
||||
private static final Pattern HUNK_START_PATTERN = Pattern.compile('^@@ -[0-9,]* \\+[0-9,_]* @@$')
|
||||
private static final Pattern WHITESPACE_PATTERN = Pattern.compile('^[+\\-]\\s*$')
|
||||
private static final Pattern IMPORT_PATTERN = Pattern.compile('^[+\\-]\\s*import.*')
|
||||
private static final Pattern FIELD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$')
|
||||
private static final Pattern METHOD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$')
|
||||
private static final Pattern CLASS_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$')
|
||||
private static final Map<String, Integer> ACCESS_MAP = [private: 0, protected: 2, public: 3].tap { it.put(null, 1) }
|
||||
|
||||
@InputDirectory abstract DirectoryProperty getPatchDir()
|
||||
@Input @Optional abstract ListProperty<String> getPatchesWithS2SArtifact()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final patchDir = getPatchDir().get().asFile.toPath()
|
||||
Files.walk(patchDir).withCloseable {
|
||||
it.filter(Files.&isRegularFile).forEach { path ->
|
||||
final String relativeName = patchDir.relativize(path).toString()
|
||||
verifyPatch(path, reporter, fix, relativeName, patchesWithS2SArtifact.get().contains(relativeName.replace('\\', '/')))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void verifyPatch(Path patch, Reporter reporter, boolean fix, String patchPath, boolean hasS2SArtifact) {
|
||||
final oldFixedErrors = reporter.fixed.size()
|
||||
|
||||
final lines = Files.readAllLines(patch)
|
||||
|
||||
int hunksStart = 0
|
||||
boolean onlyWhiteSpace = false
|
||||
|
||||
final List<String> newLines = []
|
||||
|
||||
// First two lines are file name ++/-- and we do not care
|
||||
newLines.add(lines[0] + '\n')
|
||||
newLines.add(lines[1] + '\n')
|
||||
|
||||
int i
|
||||
for (i = 2; i < lines.size(); ++i) {
|
||||
def line = lines[i]
|
||||
newLines.add(line + '\n')
|
||||
|
||||
if (HUNK_START_PATTERN.matcher(line).find()) {
|
||||
if (onlyWhiteSpace) {
|
||||
if (!hasS2SArtifact)
|
||||
reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath")
|
||||
int toRemove = i - hunksStart
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
}
|
||||
hunksStart = i
|
||||
onlyWhiteSpace = true
|
||||
continue
|
||||
}
|
||||
|
||||
if (line.startsWithAny('+','-')) {
|
||||
def prefixChange = false
|
||||
def prevLine = lines[i - 1]
|
||||
|
||||
if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') {
|
||||
def prevTrim = prevLine.substring(1).replaceAll("\\s", "")
|
||||
def currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (prevTrim == currTrim) {
|
||||
prefixChange = true
|
||||
}
|
||||
|
||||
def pMatcher = FIELD_PATTERN.matcher(prevLine)
|
||||
def cMatcher = FIELD_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // = ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // field name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
|
||||
pMatcher = METHOD_PATTERN.matcher(prevLine)
|
||||
cMatcher = METHOD_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // params
|
||||
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
|
||||
pMatcher = CLASS_PATTERN.matcher(prevLine)
|
||||
cMatcher = CLASS_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // class | interface
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
|
||||
if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) {
|
||||
final nextLine = lines[i + 1]
|
||||
if (nextLine.charAt(0) == (char)'+') {
|
||||
final nextTrim = nextLine.substring(1).replaceAll("\\s", "")
|
||||
final currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (nextTrim == currTrim) {
|
||||
prefixChange = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final isWhiteSpaceChange = WHITESPACE_PATTERN.matcher(line).find()
|
||||
|
||||
if (!prefixChange && !isWhiteSpaceChange) {
|
||||
onlyWhiteSpace = hasS2SArtifact && IMPORT_PATTERN.matcher(line).find()
|
||||
} else if (isWhiteSpaceChange) {
|
||||
final prevLineChange = prevLine.startsWithAny('+','-')
|
||||
final nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
|
||||
|
||||
if (!prevLineChange && !nextLineChange) {
|
||||
reporter.report("Patch contains white space change in valid hunk at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
|
||||
if (line.contains('\t')) {
|
||||
reporter.report("Patch contains tabs on line ${i + 1}, file: $patchPath")
|
||||
line = line.replaceAll('\t', ' ')
|
||||
newLines.remove(newLines.size() - 1)
|
||||
newLines.add(line + '\n')
|
||||
}
|
||||
|
||||
if (IMPORT_PATTERN.matcher(line).find() && !hasS2SArtifact) {
|
||||
reporter.report("Patch contains import change on line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (onlyWhiteSpace) {
|
||||
if (!hasS2SArtifact)
|
||||
reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath")
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
}
|
||||
|
||||
if ((reporter.fixed.size() > oldFixedErrors && fix) || hasS2SArtifact) {
|
||||
if (newLines.size() <= 2) {
|
||||
logger.lifecycle("Patch is now empty removing, file: {}", patchPath)
|
||||
Files.delete(patch)
|
||||
}
|
||||
else {
|
||||
if (!hasS2SArtifact)
|
||||
logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***")
|
||||
Files.newBufferedWriter(patch).withCloseable {
|
||||
newLines.each { l -> it.write(l) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import net.minecraftforge.forge.tasks.Annotatable
|
||||
import net.minecraftforge.forge.tasks.InheritanceData
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckSAS extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getSass()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final inheritance = InheritanceData.parse(this.inheritance.get().asFile)
|
||||
|
||||
sass.each { f ->
|
||||
final lines = []
|
||||
f.eachLine { line ->
|
||||
if (line[0] == '\t') return // Skip any tabbed lines, those are ones we add
|
||||
final idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
lines.add(line)
|
||||
return
|
||||
}
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
final spl = (line.trim().replace('(', ' (') + ' ').split(' ', -1)
|
||||
def (String cls, String name, String desc) = [spl[0], spl[1], spl[2]]
|
||||
cls = cls.replaceAll('\\.', '/')
|
||||
|
||||
if (inheritance[cls] === null) {
|
||||
reporter.report("Invalid: $line")
|
||||
} else if (name.isEmpty()) { //Class SAS
|
||||
final toAdd = []
|
||||
final clsSided = isSided(inheritance[cls])
|
||||
boolean sided = clsSided
|
||||
|
||||
/* TODO: MergeTool doesn't do fields
|
||||
if (json[cls]['fields'] != null) {
|
||||
for (entry in json[cls]['fields']) {
|
||||
if (isSided(entry.value)) {
|
||||
sided = true
|
||||
toAdd.add('\t' + cls + ' ' + entry.key)
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
final clsInh = inheritance[cls]
|
||||
if (clsInh.methods) {
|
||||
for (entry in clsInh.methods) {
|
||||
if (isSided(entry.value)) {
|
||||
sided = true
|
||||
toAdd.add('\t' + cls + ' ' + entry.key.replaceAll(' ', ''))
|
||||
findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) }
|
||||
findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) }
|
||||
} else if (clsSided) {
|
||||
findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) }
|
||||
findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sided) {
|
||||
lines.add(cls + (comment == null ? '' : ' ' + comment))
|
||||
lines.addAll(toAdd.sort())
|
||||
} else {
|
||||
reporter.report("Invalid: $line")
|
||||
}
|
||||
|
||||
} else if (desc.isEmpty()) { // Fields
|
||||
/* TODO: MergeTool doesn't do fields
|
||||
if (json[cls]['fields'] != null && isSided(json[cls]['fields'][name]))
|
||||
lines.add(cls + ' ' + name + (comment == null ? '' : ' ' + comment))
|
||||
else */
|
||||
reporter.report("Invalid: $line")
|
||||
} else { // Methods
|
||||
final clsInh = inheritance[cls]
|
||||
if (clsInh.methods === null || !isSided(clsInh.methods[name + ' ' + desc]))
|
||||
reporter.report("Invalid: $line")
|
||||
else {
|
||||
lines.add(cls + ' ' + name + desc + (comment == null ? '' : ' ' + comment))
|
||||
findChildMethods(inheritance, cls, name + ' ' + desc).each { println(line + ' -- ' + it) }
|
||||
findChildMethods(inheritance, cls, name + ' ' + desc).each { lines.add('\t' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fix) f.text = lines.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
protected static isSided(Annotatable annotatable) {
|
||||
if (annotatable === null) return false
|
||||
for (ann in annotatable.annotations) {
|
||||
if ('Lnet/minecraftforge/api/distmarker/OnlyIn;' == ann.desc)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
protected static findChildMethods(Map<String, InheritanceData> json, String cls, String desc) {
|
||||
return json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls && isSided(it.methods[desc]) }
|
||||
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import net.minecraftforge.forge.tasks.Util
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.TaskContainer
|
||||
import org.gradle.api.tasks.VerificationTask
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckTask extends DefaultTask implements VerificationTask {
|
||||
@Input
|
||||
abstract Property<CheckMode> getMode()
|
||||
|
||||
private boolean ignoreFailures = false
|
||||
|
||||
@Input
|
||||
@Override
|
||||
boolean getIgnoreFailures() {
|
||||
return ignoreFailures
|
||||
}
|
||||
|
||||
@Override
|
||||
void setIgnoreFailures(boolean ignoreFailures) {
|
||||
this.ignoreFailures = ignoreFailures
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
Util.init()
|
||||
|
||||
final doFix = getMode().get() === CheckMode.FIX
|
||||
final Reporter reporter = new Reporter(doFix)
|
||||
check(reporter, doFix)
|
||||
|
||||
if (reporter.messages) {
|
||||
if (getMode().get() === CheckMode.CHECK) {
|
||||
logger.error("Check task '{}' found errors:\n{}", name, reporter.messages.join('\n'))
|
||||
if (!ignoreFailures) {
|
||||
throw new IllegalArgumentException("${reporter.messages.size()} errors were found!")
|
||||
}
|
||||
} else {
|
||||
if (logger.isEnabled(LogLevel.DEBUG)) {
|
||||
logger.warn("Check task '{}' found {} errors and fixed {}:\n{}", name, reporter.messages.size(), reporter.fixed.size(), reporter.fixed.join('\n'))
|
||||
} else {
|
||||
logger.warn("Check task '{}' found {} errors and fixed {}.", name, reporter.messages.size(), reporter.fixed.size())
|
||||
}
|
||||
|
||||
if (reporter.notFixed) {
|
||||
logger.error('{} errors could not be fixed:\n{}', reporter.notFixed.size(), reporter.notFixed.join('\n'))
|
||||
if (!ignoreFailures) {
|
||||
throw new IllegalArgumentException("${reporter.notFixed.size()} errors which cannot be fixed were found!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract void check(Reporter reporter, boolean fix)
|
||||
|
||||
@CompileStatic
|
||||
static final class Reporter {
|
||||
final boolean trackFixed
|
||||
Reporter(boolean trackFixed) {
|
||||
this.trackFixed = trackFixed
|
||||
}
|
||||
|
||||
public final List<String> messages = []
|
||||
|
||||
public final List<String> fixed = []
|
||||
public final List<String> notFixed = []
|
||||
|
||||
void report(String message, boolean canBeFixed = true) {
|
||||
messages.add(message)
|
||||
|
||||
if (trackFixed) {
|
||||
if (canBeFixed) {
|
||||
fixed.add(message)
|
||||
} else {
|
||||
notFixed.add(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static <T extends CheckTask> void registerTask(TaskContainer tasks, String taskName, @DelegatesTo.Target('type') Class<T> clazz,
|
||||
@DelegatesTo(genericTypeIndex = 0, target = 'type') Closure configuration) {
|
||||
taskName = taskName.capitalize()
|
||||
tasks.register("check$taskName", clazz) { CheckTask task ->
|
||||
configuration.setDelegate((T) task)
|
||||
configuration.call(task)
|
||||
task.mode.set(CheckMode.CHECK)
|
||||
task.group = 'checks'
|
||||
}
|
||||
tasks.named('checkAll').configure { it.dependsOn("check$taskName") }
|
||||
|
||||
tasks.register("checkAndFix$taskName", clazz) { CheckTask task ->
|
||||
configuration.setDelegate((T) task)
|
||||
configuration.call(task)
|
||||
task.mode.set(CheckMode.FIX)
|
||||
task.group = 'checks'
|
||||
}
|
||||
tasks.named('checkAllAndFix').configure { it.dependsOn("checkAndFix$taskName") }
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net) [](https://discord.gg/UvedJ9m) [](https://www.patreon.com/LexManos)
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
@@ -22,13 +22,7 @@ import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.Executor;
|
||||
@@ -256,10 +250,22 @@ public class ModLoader
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
if (containers.size() != modInfoMap.size()) {
|
||||
var modIds = modInfoMap.values().stream().map(IModInfo::getModId).sorted().collect(Collectors.toList());
|
||||
var containerIds = containers.stream().map(c -> c != null ? c.getModId() : "(null)").sorted().collect(Collectors.toList());
|
||||
|
||||
LOGGER.fatal(LOADING,"File {} constructed {} mods: {}, but had {} mods specified: {}",
|
||||
modFile.getFilePath(),
|
||||
containers.size(), containers.stream().map(c -> c != null ? c.getModId() : "(null)").sorted().collect(Collectors.toList()),
|
||||
modInfoMap.size(), modInfoMap.values().stream().map(IModInfo::getModId).sorted().collect(Collectors.toList()));
|
||||
containers.size(), containerIds,
|
||||
modInfoMap.size(), modIds);
|
||||
|
||||
var missingClasses = new ArrayList<>(modIds);
|
||||
missingClasses.removeAll(containerIds);
|
||||
LOGGER.fatal(LOADING, "The following classes are missing, but are reported in the mods.toml: {}", missingClasses);
|
||||
|
||||
var missingMods = new ArrayList<>(containerIds);
|
||||
missingMods.removeAll(modIds);
|
||||
LOGGER.fatal(LOADING, "The following mods are missing, but have classes in the jar: {}", missingMods);
|
||||
|
||||
loadingExceptions.add(new ModLoadingException(null, ModLoadingStage.CONSTRUCT, "fml.modloading.missingclasses", null, modFile.getFilePath()));
|
||||
}
|
||||
// remove errored mod containers
|
||||
@@ -305,6 +311,14 @@ public class ModLoader
|
||||
}
|
||||
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(e));
|
||||
}
|
||||
public <T extends Event & IModBusEvent> T postEventWithReturn(T e) {
|
||||
if (!loadingStateValid) {
|
||||
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
||||
return e;
|
||||
}
|
||||
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(e));
|
||||
return e;
|
||||
}
|
||||
public <T extends Event & IModBusEvent> void postEventWithWrapInModOrder(T e, BiConsumer<ModContainer, T> pre, BiConsumer<ModContainer, T> post) {
|
||||
if (!loadingStateValid) {
|
||||
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
|
||||
package net.minecraftforge.fml;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraftforge.fml.config.IConfigSpec;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModLoadingContext
|
||||
{
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
|
||||
private Object languageExtension;
|
||||
private ModLoadingStage stage;
|
||||
@@ -46,10 +51,24 @@ public class ModLoadingContext
|
||||
}
|
||||
|
||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
|
||||
if (spec.isEmpty())
|
||||
{
|
||||
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getActiveContainer().getModId());
|
||||
return;
|
||||
}
|
||||
|
||||
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer()));
|
||||
}
|
||||
|
||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
|
||||
if (spec.isEmpty())
|
||||
{
|
||||
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getActiveContainer().getModId(), fileName);
|
||||
return;
|
||||
}
|
||||
|
||||
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer(), fileName));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ dependencies {
|
||||
api("cpw.mods:modlauncher:${MODLAUNCHER_VERSION}")
|
||||
api("net.minecraftforge:coremods:${COREMODS_VERSION}")
|
||||
api("com.mojang:logging:${MOJANG_LOGGING_VERSION}")
|
||||
api "net.minecraftforge:JarJar:${JARJAR_VERSION}"
|
||||
api "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}"
|
||||
api "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}"
|
||||
|
||||
implementation("net.sf.jopt-simple:jopt-simple:${JOPT_SIMPLE_VERSION}")
|
||||
implementation("cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}")
|
||||
|
||||
@@ -8,6 +8,7 @@ package net.minecraftforge.fml.loading;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.Files;
|
||||
@@ -53,4 +54,16 @@ public class FileUtils
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean matchFileName(String path, String... matches) {
|
||||
// Extract file name from path
|
||||
String name = path.substring(Math.min(path.lastIndexOf(File.separatorChar) + 1, path.length()));
|
||||
// Check if it contains any of the desired keywords
|
||||
for (String match : matches) {
|
||||
if (name.contains(match)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+14
-11
@@ -6,21 +6,27 @@
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import cpw.mods.modlauncher.api.NamedPath;
|
||||
import cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.module.ModuleDescriptor;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.Set;
|
||||
|
||||
public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final Set<String> SERVICES = Set.of(
|
||||
"cpw.mods.modlauncher.api.ITransformationService",
|
||||
"net.minecraftforge.forgespi.locating.IModLocator",
|
||||
"net.minecraftforge.forgespi.locating.IDependencyLocator"
|
||||
);
|
||||
|
||||
@Override
|
||||
public List<NamedPath> candidates(final Path gameDirectory) {
|
||||
@@ -51,14 +57,11 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
|
||||
if (!Files.isRegularFile(path)) return;
|
||||
if (!path.toString().endsWith(".jar")) return;
|
||||
if (LamdbaExceptionUtils.uncheck(() -> Files.size(path)) == 0) return;
|
||||
try (ZipFile zf = new ZipFile(new File(path.toUri()))) {
|
||||
if (zf.getEntry("META-INF/services/cpw.mods.modlauncher.api.ITransformationService") != null) {
|
||||
found.add(new NamedPath(zf.getName(), path));
|
||||
} else if (zf.getEntry("META-INF/services/net.minecraftforge.forgespi.locating.IModLocator") != null) {
|
||||
found.add(new NamedPath(zf.getName(), path));
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.error("Zip Error when loading jar file {}", path, ioe);
|
||||
}
|
||||
|
||||
SecureJar jar = SecureJar.from(path);
|
||||
jar.moduleDataProvider().descriptor().provides().stream()
|
||||
.map(ModuleDescriptor.Provides::service)
|
||||
.filter(SERVICES::contains)
|
||||
.forEach(s -> found.add(new NamedPath(s, path)));
|
||||
}
|
||||
}
|
||||
@@ -210,10 +210,24 @@ public class ModSorter
|
||||
|
||||
if (!missingVersions.isEmpty()) {
|
||||
if (mandatoryMissing > 0) {
|
||||
LOGGER.error(LOADING, "Missing mandatory dependencies: {}", missingVersions.stream().filter(IModInfo.ModVersion::isMandatory).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
|
||||
LOGGER.error(
|
||||
LOADING,
|
||||
"Missing or unsupported mandatory dependencies:\n{}",
|
||||
missingVersions.stream()
|
||||
.filter(IModInfo.ModVersion::isMandatory)
|
||||
.map(ver -> formatDependencyError(ver, modVersions))
|
||||
.collect(Collectors.joining("\n"))
|
||||
);
|
||||
}
|
||||
if (missingVersions.size() - mandatoryMissing > 0) {
|
||||
LOGGER.error(LOADING, "Unsupported installed optional dependencies: {}", missingVersions.stream().filter(ver -> !ver.isMandatory()).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
|
||||
LOGGER.error(
|
||||
LOADING,
|
||||
"Unsupported installed optional dependencies:\n{}",
|
||||
missingVersions.stream()
|
||||
.filter(ver -> !ver.isMandatory())
|
||||
.map(ver -> formatDependencyError(ver, modVersions))
|
||||
.collect(Collectors.joining("\n"))
|
||||
);
|
||||
}
|
||||
|
||||
return missingVersions.stream()
|
||||
@@ -225,6 +239,18 @@ public class ModSorter
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private static String formatDependencyError(IModInfo.ModVersion dependency, Map<String, ArtifactVersion> modVersions)
|
||||
{
|
||||
ArtifactVersion installed = modVersions.get(dependency.getModId());
|
||||
return String.format(
|
||||
"\tMod ID: '%s', Requested by: '%s', Expected range: '%s', Actual version: '%s'",
|
||||
dependency.getModId(),
|
||||
dependency.getOwner().getModId(),
|
||||
dependency.getVersionRange(),
|
||||
installed != null ? installed.toString() : "[MISSING]"
|
||||
);
|
||||
}
|
||||
|
||||
private boolean modVersionNotContained(final IModInfo.ModVersion mv, final Map<String, ArtifactVersion> modVersions)
|
||||
{
|
||||
return !(VersionSupportMatrix.testVersionSupportMatrix(mv.getVersionRange(), mv.getModId(), "mod", (modId, range) -> modVersions.containsKey(modId) &&
|
||||
|
||||
@@ -106,16 +106,17 @@ public class UniqueModListBuilder
|
||||
if (modInfoList.size() > 1) {
|
||||
LOGGER.debug("Found {} mods for first modid {}, selecting most recent based on version data", modInfoList.size(), fullList.getKey());
|
||||
modInfoList.sort(Comparator.comparing(this::getVersion).reversed());
|
||||
LOGGER.debug("Selected file {} for modid {} with version {}", modInfoList.get(0).getFileName(), fullList.getKey(), modInfoList.get(0).getModInfos().get(0).getVersion());
|
||||
LOGGER.debug("Selected file {} for modid {} with version {}", modInfoList.get(0).getFileName(), fullList.getKey(), this.getVersion(modInfoList.get(0)));
|
||||
}
|
||||
return modInfoList.get(0);
|
||||
}
|
||||
|
||||
private ArtifactVersion getVersion(final ModFile mf)
|
||||
{
|
||||
if (mf.getModFileInfo() == null) {
|
||||
if (mf.getModFileInfo() == null || mf.getModInfos() == null || mf.getModInfos().isEmpty()) {
|
||||
return mf.getJarVersion();
|
||||
}
|
||||
|
||||
return mf.getModInfos().get(0).getVersion();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import net.minecraftforge.forgespi.language.MavenVersionAdapter;
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
@@ -18,16 +19,12 @@ public class VersionSupportMatrix {
|
||||
private static final HashMap<String, List<ArtifactVersion>> overrideVersions = new HashMap<>();
|
||||
static {
|
||||
final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion());
|
||||
// if (MavenVersionAdapter.createFromVersionSpec("[1.16.4,1.16.5]").containsVersion(version)) {
|
||||
// // 1.16.4 is Compatible with 1.16.3
|
||||
// add("languageloader.javafml", "34");
|
||||
// add("mod.minecraft", "1.16.3");
|
||||
// add("mod.forge", "34.1.42");
|
||||
// // 1.16.5 is Compatible with 1.16.4, and thus 1.16.3
|
||||
// add("languageloader.javafml", "35");
|
||||
// add("mod.minecraft", "1.16.4");
|
||||
// add("mod.forge", "35.1.37");
|
||||
// }
|
||||
if (MavenVersionAdapter.createFromVersionSpec("[1.19.2]").containsVersion(version)) {
|
||||
// 1.19.2 is Compatible with 1.19.1
|
||||
add("languageloader.javafml", "42");
|
||||
add("mod.minecraft", "1.19.1");
|
||||
add("mod.forge", "42.0.9");
|
||||
}
|
||||
}
|
||||
private static void add(String key, String value) {
|
||||
overrideVersions.computeIfAbsent(key, k -> new ArrayList<>()).add(new DefaultArtifactVersion(value));
|
||||
|
||||
-1
@@ -46,7 +46,6 @@ public class JarInJarDependencyLocator extends AbstractJarFileDependencyLocator
|
||||
final List<IModFile> sources = Lists.newArrayList();
|
||||
loadedMods.forEach(sources::add);
|
||||
|
||||
|
||||
final List<IModFile> dependenciesToLoad = JarSelector.detectAndSelect(sources, this::loadResourceFromModFile, this::loadModFileFrom, this::identifyMod, this::exception);
|
||||
|
||||
if (dependenciesToLoad.isEmpty())
|
||||
|
||||
+11
-3
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import net.minecraftforge.fml.loading.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
@@ -29,8 +30,7 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
|
||||
|
||||
// The extra jar is on the classpath, so try and pull it out of the legacy classpath
|
||||
var legacyCP = Objects.requireNonNull(System.getProperty("legacyClassPath"), "Missing legacyClassPath, cannot find client-extra").split(File.pathSeparator);
|
||||
var extra = Paths.get(Arrays.stream(legacyCP).filter(e -> e.contains("client-extra")).findFirst().orElseThrow(() -> new IllegalStateException("Could not find client-extra in legacy classpath")));
|
||||
mcstream.add(extra);
|
||||
var extra = findJarOnClasspath(legacyCP, "client-extra");
|
||||
|
||||
// The MC code/Patcher edits are in exploded directories
|
||||
final var modstream = Stream.<List<Path>>builder();
|
||||
@@ -41,6 +41,7 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
|
||||
minecraft.stream().distinct().forEach(mcstream::add);
|
||||
mods.values().forEach(modstream::add);
|
||||
|
||||
mcstream.add(extra);
|
||||
var mcFilter = getMcFilter(extra, minecraft, modstream);
|
||||
return new LocatedPaths(mcstream.build().toList(), mcFilter, modstream.build().toList(), getFmlStuff(legacyCP));
|
||||
}
|
||||
@@ -77,11 +78,18 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
|
||||
protected List<Path> getFmlStuff(String[] classpath) {
|
||||
// We also want the FML things, fmlcore, javafmllanguage, mclanguage, I don't like hard coding these, but hey whatever works for now.
|
||||
return Arrays.stream(classpath)
|
||||
.filter(e -> e.contains("fmlcore") || e.contains("javafmllanguage") || e.contains("lowcodelanguage") || e.contains("mclanguage"))
|
||||
.filter(e -> FileUtils.matchFileName(e, "fmlcore", "javafmllanguage", "lowcodelanguage", "mclanguage"))
|
||||
.map(Paths::get)
|
||||
.toList();
|
||||
}
|
||||
|
||||
protected static Path findJarOnClasspath(String[] classpath, String match) {
|
||||
return Paths.get(Arrays.stream(classpath)
|
||||
.filter(e -> FileUtils.matchFileName(e, match))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("Could not find " + match + " in classpath")));
|
||||
}
|
||||
|
||||
protected BiPredicate<String, String> getMcFilter(Path extra, List<Path> minecraft, Stream.Builder<List<Path>> mods) {
|
||||
final var packages = getPackages();
|
||||
final var extraPath = extra.toString().replace('\\', '/');
|
||||
|
||||
-6
@@ -10,8 +10,6 @@ import net.minecraftforge.fml.loading.VersionInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -41,8 +39,4 @@ public abstract class CommonUserdevLaunchHandler extends CommonDevLaunchHandler
|
||||
}
|
||||
|
||||
protected abstract void processStreams(String[] classpath, VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods);
|
||||
|
||||
protected static Path findJarOnClasspath(String[] classpath, String match) {
|
||||
return Paths.get(Arrays.stream(classpath).filter(e -> e.contains(match)).findFirst().orElseThrow(() -> new IllegalStateException("Could not find " + match + " in classpath")));
|
||||
}
|
||||
}
|
||||
+1
@@ -19,6 +19,7 @@ public final class CyclePresentException extends IllegalArgumentException {
|
||||
* @param cycles the cycles present
|
||||
*/
|
||||
CyclePresentException(Set<Set<?>> cycles) {
|
||||
super("Cycles present in graph: " + cycles);
|
||||
this.cycles = cycles;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<MarkerFilter marker="REGISTRIES" onMatch="${sys:forge.logging.marker.registries:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="REGISTRYDUMP" onMatch="${sys:forge.logging.marker.registrydump:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="SPLASH" onMatch="${sys:forge.logging.marker.splash:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="RESOURCE-CACHE" onMatch="${sys:forge.logging.marker.resource.cache:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="FORGEMOD" onMatch="${sys:forge.logging.marker.forgemod:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="LOADING" onMatch="${sys:forge.logging.marker.loading:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="CORE" onMatch="${sys:forge.logging.marker.core:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class FMLModContainer extends ModContainer
|
||||
LOGGER.debug(LOADING,"Creating FMLModContainer instance for {}", className);
|
||||
this.scanResults = modFileScanResults;
|
||||
activityMap.put(ModLoadingStage.CONSTRUCT, this::constructMod);
|
||||
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).build();
|
||||
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).useModLauncher().build();
|
||||
this.configHandler = Optional.of(ce->this.eventBus.post(ce.self()));
|
||||
final FMLJavaModLoadingContext contextExtension = new FMLJavaModLoadingContext(this);
|
||||
this.contextExtension = () -> contextExtension;
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class LowCodeModLanguageProvider implements IModLanguageProvider
|
||||
throw new ModLoadingException(info, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmodclass", e);
|
||||
}
|
||||
} catch (NoSuchMethodException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
LOGGER.fatal(LOADING, "Unable to load FMLModContainer, wut?", e);
|
||||
LOGGER.fatal(LOADING, "Unable to load LowCodeModContainer, wut?", e);
|
||||
final Class<RuntimeException> mle = (Class<RuntimeException>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingException", true, Thread.currentThread().getContextClassLoader()));
|
||||
final Class<ModLoadingStage> mls = (Class<ModLoadingStage>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingStage", true, Thread.currentThread().getContextClassLoader()));
|
||||
throw LamdbaExceptionUtils.uncheck(() -> LamdbaExceptionUtils.uncheck(() -> mle.getConstructor(IModInfo.class, mls, String.class, Throwable.class)).newInstance(info, Enum.valueOf(mls, "CONSTRUCT"), "fml.modloading.failedtoloadmodclass", e));
|
||||
|
||||
+1
-3
@@ -22,7 +22,7 @@ minecraft {
|
||||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
//
|
||||
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
||||
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
|
||||
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
|
||||
//
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
@@ -132,8 +132,6 @@ dependencies {
|
||||
minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
|
||||
|
||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
|
||||
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
|
||||
|
||||
// Examples using mod jars from ./libs
|
||||
|
||||
@@ -3,22 +3,21 @@ package com.example.examplemod;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.CreativeModeTabEvent;
|
||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -41,7 +40,7 @@ public class ExampleMod
|
||||
// Creates a new Block with the id "examplemod:example_block", combining the namespace and path
|
||||
public static final RegistryObject<Block> EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE)));
|
||||
// Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path
|
||||
public static final RegistryObject<Item> EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS)));
|
||||
public static final RegistryObject<Item> EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties()));
|
||||
|
||||
public ExampleMod()
|
||||
{
|
||||
@@ -57,6 +56,9 @@ public class ExampleMod
|
||||
|
||||
// Register ourselves for server and other game events we are interested in
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
// Register the item to a creative tab
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event)
|
||||
@@ -66,6 +68,12 @@ public class ExampleMod
|
||||
LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT));
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(EXAMPLE_BLOCK_ITEM);
|
||||
}
|
||||
|
||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(ServerStartingEvent event)
|
||||
@@ -75,7 +83,7 @@ public class ExampleMod
|
||||
}
|
||||
|
||||
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
|
||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public static class ClientModEvents
|
||||
{
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -22,7 +22,7 @@ modId="examplemod" #mandatory
|
||||
version="${file.jarVersion}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="Example Mod" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||
# 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "examplemod resources",
|
||||
"pack_format": 9,
|
||||
"forge:resource_pack_format": 9,
|
||||
"pack_format": 12,
|
||||
"forge:resource_pack_format": 12,
|
||||
"forge:data_pack_format": 10
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
@@ -539,9 +_,16 @@
|
||||
@@ -510,9 +_,16 @@
|
||||
f_84077_[f_84076_].f_84800_ = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
if (monitor != null) {
|
||||
VideoMode videomode = monitor.m_84948_(this.f_85355_ ? this.f_85354_ : Optional.empty());
|
||||
this.f_85350_ = this.f_85357_ = monitor.m_84951_() + videomode.m_85332_() / 2 - this.f_85359_ / 2;
|
||||
@@ -303,6 +_,7 @@
|
||||
@@ -263,6 +_,7 @@
|
||||
GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1);
|
||||
this.f_85361_ = aint[0] > 0 ? aint[0] : 1;
|
||||
this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||
@@ -486,4 +_,14 @@
|
||||
this.f_166822_ = p_166829_;
|
||||
this.f_166822_ = p_254368_;
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/com/mojang/blaze3d/vertex/PoseStack.java
|
||||
+++ b/com/mojang/blaze3d/vertex/PoseStack.java
|
||||
@@ -11,7 +_,7 @@
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class PoseStack {
|
||||
+public class PoseStack implements net.minecraftforge.client.extensions.IForgePoseStack {
|
||||
private final Deque<PoseStack.Pose> f_85834_ = Util.m_137469_(Queues.newArrayDeque(), (p_85848_) -> {
|
||||
Matrix4f matrix4f = new Matrix4f();
|
||||
Matrix3f matrix3f = new Matrix3f();
|
||||
@@ -20,7 +20,7 @@
|
||||
float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]};
|
||||
int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]};
|
||||
int[] aint1 = p_85997_.m_111303_();
|
||||
@@ -101,12 +_,14 @@
|
||||
@@ -99,11 +_,13 @@
|
||||
f5 = afloat[k] * p_86001_;
|
||||
}
|
||||
|
||||
@@ -28,12 +28,11 @@
|
||||
+ int l = applyBakedLighting(p_86002_[k], bytebuffer);
|
||||
float f9 = bytebuffer.getFloat(16);
|
||||
float f10 = bytebuffer.getFloat(20);
|
||||
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
|
||||
vector4f.m_123607_(matrix4f);
|
||||
- this.m_5954_(vector4f.m_123601_(), vector4f.m_123615_(), vector4f.m_123616_(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.m_122239_(), vector3f.m_122260_(), vector3f.m_122269_());
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_85864_());
|
||||
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
|
||||
- this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_252943_());
|
||||
+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha;
|
||||
+ this.m_5954_(vector4f.m_123601_(), vector4f.m_123615_(), vector4f.m_123616_(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.m_122239_(), vector3f.m_122260_(), vector3f.m_122269_());
|
||||
+ this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
}
|
||||
} catch (Throwable throwable1) {
|
||||
if (memorystack != null) {
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--- a/com/mojang/math/Matrix3f.java
|
||||
+++ b/com/mojang/math/Matrix3f.java
|
||||
@@ -588,4 +_,10 @@
|
||||
public Matrix3f m_8183_() {
|
||||
return new Matrix3f(this);
|
||||
}
|
||||
+
|
||||
+ public void multiplyBackward(Matrix3f other) {
|
||||
+ Matrix3f copy = other.m_8183_();
|
||||
+ copy.m_8178_(this);
|
||||
+ this.m_8169_(copy);
|
||||
+ }
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
--- a/com/mojang/math/Matrix4f.java
|
||||
+++ b/com/mojang/math/Matrix4f.java
|
||||
@@ -559,4 +_,40 @@
|
||||
matrix4f.f_27614_ = p_27656_;
|
||||
return matrix4f;
|
||||
}
|
||||
+
|
||||
+ // Forge start
|
||||
+ public Matrix4f(float[] values) {
|
||||
+ f_27603_ = values[0];
|
||||
+ f_27604_ = values[1];
|
||||
+ f_27605_ = values[2];
|
||||
+ f_27606_ = values[3];
|
||||
+ f_27607_ = values[4];
|
||||
+ f_27608_ = values[5];
|
||||
+ f_27609_ = values[6];
|
||||
+ f_27610_ = values[7];
|
||||
+ f_27611_ = values[8];
|
||||
+ f_27612_ = values[9];
|
||||
+ f_27613_ = values[10];
|
||||
+ f_27614_ = values[11];
|
||||
+ f_27615_ = values[12];
|
||||
+ f_27616_ = values[13];
|
||||
+ f_27617_ = values[14];
|
||||
+ f_27618_ = values[15];
|
||||
+ }
|
||||
+
|
||||
+ public void multiplyBackward(Matrix4f other) {
|
||||
+ Matrix4f copy = other.m_27658_();
|
||||
+ copy.m_27644_(this);
|
||||
+ this.m_162210_(copy);
|
||||
+ }
|
||||
+
|
||||
+ public void setTranslation(float x, float y, float z) {
|
||||
+ this.f_27603_ = 1.0F;
|
||||
+ this.f_27608_ = 1.0F;
|
||||
+ this.f_27613_ = 1.0F;
|
||||
+ this.f_27618_ = 1.0F;
|
||||
+ this.f_27606_ = x;
|
||||
+ this.f_27610_ = y;
|
||||
+ this.f_27614_ = z;
|
||||
+ }
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/com/mojang/math/Transformation.java
|
||||
+++ b/com/mojang/math/Transformation.java
|
||||
@@ -6,7 +_,7 @@
|
||||
import net.minecraft.Util;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
@@ -12,7 +_,7 @@
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector3fc;
|
||||
|
||||
-public final class Transformation {
|
||||
+public final class Transformation implements net.minecraftforge.client.extensions.IForgeTransformation {
|
||||
private final Matrix4f f_121078_;
|
||||
private boolean f_121079_;
|
||||
@Nullable
|
||||
@@ -145,6 +_,19 @@
|
||||
@@ -139,6 +_,19 @@
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.f_121078_);
|
||||
}
|
||||
@@ -22,10 +22,10 @@
|
||||
+ private void checkNormalTransform() {
|
||||
+ if (normalTransform == null) {
|
||||
+ normalTransform = new Matrix3f(f_121078_);
|
||||
+ normalTransform.m_8187_();
|
||||
+ normalTransform.m_8155_();
|
||||
+ normalTransform.invert();
|
||||
+ normalTransform.transpose();
|
||||
+ }
|
||||
+ }
|
||||
|
||||
public Transformation m_175937_(Transformation p_175938_, float p_175939_) {
|
||||
Vector3f vector3f = this.m_175940_();
|
||||
Vector3f vector3f = this.m_252829_();
|
||||
@@ -1,28 +0,0 @@
|
||||
--- a/com/mojang/math/Vector3f.java
|
||||
+++ b/com/mojang/math/Vector3f.java
|
||||
@@ -138,7 +_,7 @@
|
||||
|
||||
public boolean m_122278_() {
|
||||
float f = this.f_122228_ * this.f_122228_ + this.f_122229_ * this.f_122229_ + this.f_122230_ * this.f_122230_;
|
||||
- if ((double)f < 1.0E-5D) {
|
||||
+ if (f < Float.MIN_NORMAL) { //Forge: Fix MC-239212
|
||||
return false;
|
||||
} else {
|
||||
float f1 = Mth.m_14195_(f);
|
||||
@@ -207,4 +_,16 @@
|
||||
public String toString() {
|
||||
return "[" + this.f_122228_ + ", " + this.f_122229_ + ", " + this.f_122230_ + "]";
|
||||
}
|
||||
+
|
||||
+ public Vector3f(float[] values) {
|
||||
+ set(values);
|
||||
+ }
|
||||
+ public void set(float[] values) {
|
||||
+ this.f_122228_ = values[0];
|
||||
+ this.f_122229_ = values[1];
|
||||
+ this.f_122230_ = values[2];
|
||||
+ }
|
||||
+ public void setX(float x) { this.f_122228_ = x; }
|
||||
+ public void setY(float y) { this.f_122229_ = y; }
|
||||
+ public void setZ(float z) { this.f_122230_ = z; }
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
--- a/com/mojang/math/Vector4f.java
|
||||
+++ b/com/mojang/math/Vector4f.java
|
||||
@@ -147,4 +_,15 @@
|
||||
public String toString() {
|
||||
return "[" + this.f_123589_ + ", " + this.f_123590_ + ", " + this.f_123591_ + ", " + this.f_123592_ + "]";
|
||||
}
|
||||
+
|
||||
+ public void set(float[] values) {
|
||||
+ this.f_123589_ = values[0];
|
||||
+ this.f_123590_ = values[1];
|
||||
+ this.f_123591_ = values[2];
|
||||
+ this.f_123592_ = values[3];
|
||||
+ }
|
||||
+ public void setX(float x) { this.f_123589_ = x; }
|
||||
+ public void setY(float y) { this.f_123590_ = y; }
|
||||
+ public void setZ(float z) { this.f_123591_ = z; }
|
||||
+ public void setW(float w) { this.f_123592_ = w; }
|
||||
}
|
||||
+1
-1
@@ -13,6 +13,6 @@
|
||||
+ return super.m_7933_(key, scanCode, modifiers);
|
||||
+ }
|
||||
+
|
||||
public void m_6305_(PoseStack p_88679_, int p_88680_, int p_88681_, float p_88682_) {
|
||||
public void m_86412_(PoseStack p_88679_, int p_88680_, int p_88681_, float p_88682_) {
|
||||
this.m_7333_(p_88679_);
|
||||
m_93215_(p_88679_, this.f_96547_, this.f_200947_.getFirst(), this.f_96543_ / 2, 80, 16777215);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -211,6 +_,7 @@
|
||||
@@ -214,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public static ExecutorService m_183988_() {
|
||||
return f_137443_;
|
||||
}
|
||||
@@ -248,7 +_,7 @@
|
||||
@@ -242,7 +_,7 @@
|
||||
try {
|
||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
|
||||
} catch (IllegalArgumentException illegalargumentexception) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/advancements/critereon/ItemPredicate.java
|
||||
+++ b/net/minecraft/advancements/critereon/ItemPredicate.java
|
||||
@@ -28,6 +_,8 @@
|
||||
@@ -29,6 +_,8 @@
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
||||
public class ItemPredicate {
|
||||
@@ -9,7 +9,7 @@
|
||||
public static final ItemPredicate f_45028_ = new ItemPredicate();
|
||||
@Nullable
|
||||
private final TagKey<Item> f_45029_;
|
||||
@@ -80,7 +_,7 @@
|
||||
@@ -81,7 +_,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (this.f_45033_.length > 0) {
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
for(EnchantmentPredicate enchantmentpredicate : this.f_45033_) {
|
||||
if (!enchantmentpredicate.m_30476_(map)) {
|
||||
@@ -107,6 +_,11 @@
|
||||
@@ -108,6 +_,11 @@
|
||||
public static ItemPredicate m_45051_(@Nullable JsonElement p_45052_) {
|
||||
if (p_45052_ != null && !p_45052_.isJsonNull()) {
|
||||
JsonObject jsonobject = GsonHelper.m_13918_(p_45052_, "item");
|
||||
@@ -30,7 +30,7 @@
|
||||
MinMaxBounds.Ints minmaxbounds$ints = MinMaxBounds.Ints.m_55373_(jsonobject.get("count"));
|
||||
MinMaxBounds.Ints minmaxbounds$ints1 = MinMaxBounds.Ints.m_55373_(jsonobject.get("durability"));
|
||||
if (jsonobject.has("data")) {
|
||||
@@ -214,6 +_,14 @@
|
||||
@@ -215,6 +_,14 @@
|
||||
} else {
|
||||
return new ItemPredicate[0];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Camera.java
|
||||
+++ b/net/minecraft/client/Camera.java
|
||||
@@ -211,6 +_,18 @@
|
||||
@@ -206,6 +_,18 @@
|
||||
this.f_90549_ = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
--- a/net/minecraft/client/ClientRecipeBook.java
|
||||
+++ b/net/minecraft/client/ClientRecipeBook.java
|
||||
@@ -103,6 +_,8 @@
|
||||
} else if (recipetype == RecipeType.f_44113_) {
|
||||
return RecipeBookCategories.SMITHING;
|
||||
} else {
|
||||
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_90647_);
|
||||
+ if (categories != null) return categories;
|
||||
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
|
||||
return Registry.f_122864_.m_7981_(p_90647_.m_6671_());
|
||||
}), LogUtils.defer(p_90647_::m_6423_));
|
||||
@@ -51,7 +_,7 @@
|
||||
for(Recipe<?> recipe : p_90643_) {
|
||||
if (!recipe.m_5598_() && !recipe.m_142505_()) {
|
||||
RecipeBookCategories recipebookcategories = m_90646_(recipe);
|
||||
- String s = recipe.m_6076_();
|
||||
+ String s = recipe.m_6076_().isEmpty() ? recipe.m_6423_().toString() : recipe.m_6076_(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
|
||||
if (s.isEmpty()) {
|
||||
map.computeIfAbsent(recipebookcategories, (p_90645_) -> {
|
||||
return Lists.newArrayList();
|
||||
@@ -138,6 +_,8 @@
|
||||
} else if (recipetype == RecipeType.f_44113_) {
|
||||
return RecipeBookCategories.SMITHING;
|
||||
} else {
|
||||
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_90647_);
|
||||
+ if (categories != null) return categories;
|
||||
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
|
||||
return BuiltInRegistries.f_256990_.m_7981_(p_90647_.m_6671_());
|
||||
}), LogUtils.defer(p_90647_::m_6423_));
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/KeyboardHandler.java
|
||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||
@@ -299,7 +_,9 @@
|
||||
@@ -298,7 +_,9 @@
|
||||
}
|
||||
|
||||
Screen screen = this.f_90867_.f_91080_;
|
||||
@@ -11,7 +11,7 @@
|
||||
if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) {
|
||||
this.f_90867_.m_91268_().m_85438_();
|
||||
this.f_90867_.f_91066_.m_231829_().m_231514_(this.f_90867_.m_91268_().m_85440_());
|
||||
@@ -317,6 +_,8 @@
|
||||
@@ -316,6 +_,8 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -20,9 +20,9 @@
|
||||
}
|
||||
|
||||
if (this.f_90867_.m_240477_().m_93316_()) {
|
||||
@@ -339,11 +_,15 @@
|
||||
@@ -338,11 +_,15 @@
|
||||
Screen.m_96579_(() -> {
|
||||
if (p_90897_ != 1 && (p_90897_ != 2 || !this.f_90868_)) {
|
||||
if (p_90897_ != 1 && p_90897_ != 2) {
|
||||
if (p_90897_ == 0) {
|
||||
- aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_);
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||
@@ -396,22 +_,26 @@
|
||||
@@ -395,22 +_,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -243,7 +_,7 @@
|
||||
@@ -245,7 +_,7 @@
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -9,16 +9,7 @@
|
||||
static Minecraft f_90981_;
|
||||
private static final Logger f_90982_ = LogUtils.getLogger();
|
||||
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
||||
@@ -397,7 +_,7 @@
|
||||
this.f_91029_ = p_91084_.f_101908_.f_101928_;
|
||||
this.f_90986_ = p_91084_.f_101905_.f_101944_;
|
||||
this.f_91037_ = new ClientPackSource(new File(this.f_91069_, "server-resource-packs"), p_91084_.f_101907_.m_101925_());
|
||||
- this.f_91038_ = new PackRepository(Minecraft::m_167933_, this.f_91037_, new FolderRepositorySource(this.f_90985_, PackSource.f_10527_));
|
||||
+ this.f_91038_ = new PackRepository(Minecraft::createClientPackAdapter, this.f_91037_, new FolderRepositorySource(this.f_90985_, PackSource.f_10527_));
|
||||
this.f_91030_ = p_91084_.f_101905_.f_101945_;
|
||||
this.f_231338_ = new YggdrasilAuthenticationService(this.f_91030_);
|
||||
this.f_91048_ = this.f_231338_.createMinecraftSessionService();
|
||||
@@ -405,7 +_,6 @@
|
||||
@@ -410,7 +_,6 @@
|
||||
this.f_231339_ = SignatureValidator.m_216358_(this.f_231338_.getServicesKey());
|
||||
this.f_90998_ = p_91084_.f_101905_.f_101942_;
|
||||
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
|
||||
@@ -26,7 +17,7 @@
|
||||
this.f_91033_ = p_91084_.f_101908_.f_101926_;
|
||||
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
|
||||
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
|
||||
@@ -457,7 +_,7 @@
|
||||
@@ -459,7 +_,7 @@
|
||||
|
||||
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
|
||||
this.f_91067_ = new MouseHandler(this);
|
||||
@@ -35,28 +26,30 @@
|
||||
this.f_91068_ = new KeyboardHandler(this);
|
||||
this.f_91068_.m_90887_(this.f_90990_.m_85439_());
|
||||
RenderSystem.m_69580_(this.f_91066_.f_92035_, false);
|
||||
@@ -465,6 +_,7 @@
|
||||
@@ -467,6 +_,7 @@
|
||||
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.f_91042_.m_83954_(f_91002_);
|
||||
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_, this.f_91037_);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_);
|
||||
this.f_91038_.m_10506_();
|
||||
this.f_91066_.m_92145_(this.f_91038_);
|
||||
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
|
||||
@@ -509,10 +_,12 @@
|
||||
@@ -511,10 +_,13 @@
|
||||
this.f_91063_ = new GameRenderer(this, this.f_90994_.m_234586_(), this.f_91036_, this.f_90993_);
|
||||
this.f_91036_.m_7217_(this.f_91063_);
|
||||
this.f_91036_.m_7217_(this.f_91063_.m_247116_());
|
||||
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_);
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
|
||||
this.f_91036_.m_7217_(this.f_91060_);
|
||||
this.m_91271_();
|
||||
- this.m_91271_();
|
||||
+ // Forge: We delay this to allow registration of modded creative mode tabs
|
||||
+ // this.createSearchTrees();
|
||||
this.f_91036_.m_7217_(this.f_90997_);
|
||||
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(f_91061_);
|
||||
this.f_91036_.m_7217_(this.f_91061_);
|
||||
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
|
||||
this.f_91036_.m_7217_(this.f_91053_);
|
||||
@@ -521,7 +_,9 @@
|
||||
@@ -523,7 +_,9 @@
|
||||
this.f_91047_ = new GpuWarnlistManager();
|
||||
this.f_91036_.m_7217_(this.f_91047_);
|
||||
this.f_91036_.m_7217_(this.f_205120_);
|
||||
@@ -67,7 +60,7 @@
|
||||
this.f_91064_ = new DebugRenderer(this);
|
||||
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
|
||||
RenderSystem.m_69900_(this::m_91113_);
|
||||
@@ -540,6 +_,19 @@
|
||||
@@ -542,6 +_,21 @@
|
||||
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
||||
}
|
||||
|
||||
@@ -83,18 +76,21 @@
|
||||
+ net.minecraftforge.client.gui.overlay.GuiOverlayManager.init();
|
||||
+ net.minecraftforge.client.DimensionSpecialEffectsManager.init();
|
||||
+ net.minecraftforge.client.NamedRenderTypeManager.init();
|
||||
+ net.minecraftforge.client.ColorResolverManager.init();
|
||||
+ net.minecraftforge.client.ItemDecoratorHandler.init();
|
||||
+
|
||||
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
|
||||
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
|
||||
this.f_90990_.m_85426_();
|
||||
@@ -562,23 +_,23 @@
|
||||
@@ -565,24 +_,24 @@
|
||||
}
|
||||
|
||||
this.f_167847_.m_168556_();
|
||||
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
|
||||
+ // FORGE: Move opening initial screen to after startup and events are enabled.
|
||||
+ if (s != null) {
|
||||
+ ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
|
||||
+ ServerAddress serveraddress = new ServerAddress(s, i);
|
||||
+ ConnectScreen.m_169267_(new TitleScreen(), this, serveraddress, new ServerData(I18n.m_118938_("selectServer.defaultName"), serveraddress.toString(), false));
|
||||
+ } else if (this.m_239929_()) {
|
||||
+ this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
|
||||
+ if (p_238185_) {
|
||||
@@ -109,8 +105,9 @@
|
||||
});
|
||||
}, false));
|
||||
- if (s != null) {
|
||||
- ServerAddress serveraddress = new ServerAddress(s, i);
|
||||
- reloadinstance.m_7237_().thenRunAsync(() -> {
|
||||
- ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
|
||||
- ConnectScreen.m_169267_(new TitleScreen(), this, serveraddress, new ServerData(I18n.m_118938_("selectServer.defaultName"), serveraddress.toString(), false));
|
||||
- }, this);
|
||||
- } else if (this.m_239929_()) {
|
||||
- this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
|
||||
@@ -126,7 +123,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -621,6 +_,8 @@
|
||||
@@ -634,6 +_,8 @@
|
||||
|
||||
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
try {
|
||||
@@ -135,7 +132,7 @@
|
||||
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
|
||||
} catch (AuthenticationException authenticationexception) {
|
||||
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
|
||||
@@ -633,7 +_,7 @@
|
||||
@@ -646,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void m_91239_(Throwable p_91240_) {
|
||||
@@ -144,7 +141,45 @@
|
||||
this.m_91241_(p_91240_, (Component)null);
|
||||
} else {
|
||||
Util.m_137559_(p_91240_);
|
||||
@@ -791,13 +_,13 @@
|
||||
@@ -723,7 +_,10 @@
|
||||
}
|
||||
|
||||
public void m_91271_() {
|
||||
- this.f_90997_.m_235232_(SearchRegistry.f_119941_, (p_231451_) -> {
|
||||
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
|
||||
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
|
||||
+ for (var nameSearchKey : nameSearchKeys.values())
|
||||
+ this.f_90997_.m_235232_(nameSearchKey, (p_231451_) -> {
|
||||
return new FullTextSearchTree<>((p_210797_) -> {
|
||||
return p_210797_.m_41651_((Player)null, TooltipFlag.Default.f_256752_.m_257777_()).stream().map((p_210807_) -> {
|
||||
return ChatFormatting.m_126649_(p_210807_.getString()).trim();
|
||||
@@ -734,7 +_,8 @@
|
||||
return Stream.of(BuiltInRegistries.f_257033_.m_7981_(p_91317_.m_41720_()));
|
||||
}, p_231451_);
|
||||
});
|
||||
- this.f_90997_.m_235232_(SearchRegistry.f_119942_, (p_231430_) -> {
|
||||
+ for (var tagSearchKey : tagSearchKeys.values())
|
||||
+ this.f_90997_.m_235232_(tagSearchKey, (p_231430_) -> {
|
||||
return new IdSearchTree<>((p_231353_) -> {
|
||||
return p_231353_.m_204131_().map(TagKey::f_203868_);
|
||||
}, p_231430_);
|
||||
@@ -754,9 +_,12 @@
|
||||
});
|
||||
}, p_231389_);
|
||||
});
|
||||
- CreativeModeTabs.m_258007_().m_257882_((p_255439_) -> {
|
||||
- this.m_231374_(SearchRegistry.f_119941_, p_255439_);
|
||||
- this.m_231374_(SearchRegistry.f_119942_, p_255439_);
|
||||
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
|
||||
+ var tagSearchKey = tagSearchKeys.get(tab);
|
||||
+ tab.m_257882_(contents -> {
|
||||
+ this.m_231374_(nameSearchKey, contents);
|
||||
+ this.m_231374_(tagSearchKey, contents);
|
||||
+ });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -808,13 +_,13 @@
|
||||
Bootstrap.m_135875_(p_91333_.m_127526_());
|
||||
if (p_91333_.m_127527_() != null) {
|
||||
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
|
||||
@@ -161,7 +196,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -921,10 +_,6 @@
|
||||
@@ -932,10 +_,6 @@
|
||||
f_90982_.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
@@ -172,7 +207,7 @@
|
||||
if (p_91153_ == null && this.f_91073_ == null) {
|
||||
p_91153_ = new TitleScreen();
|
||||
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
|
||||
@@ -935,6 +_,19 @@
|
||||
@@ -946,6 +_,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +227,7 @@
|
||||
this.f_91080_ = p_91153_;
|
||||
BufferUploader.m_166835_();
|
||||
if (p_91153_ != null) {
|
||||
@@ -1078,11 +_,14 @@
|
||||
@@ -1091,11 +_,14 @@
|
||||
RenderSystem.m_69481_();
|
||||
this.f_91026_.m_7238_();
|
||||
if (!this.f_91079_) {
|
||||
@@ -207,7 +242,7 @@
|
||||
}
|
||||
|
||||
if (this.f_91056_ != null) {
|
||||
@@ -1209,10 +_,12 @@
|
||||
@@ -1223,10 +_,12 @@
|
||||
this.f_90990_.m_85378_((double)i);
|
||||
if (this.f_91080_ != null) {
|
||||
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
||||
@@ -220,7 +255,7 @@
|
||||
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
||||
this.f_91067_.m_91599_();
|
||||
}
|
||||
@@ -1490,6 +_,7 @@
|
||||
@@ -1499,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_91395_() {
|
||||
@@ -228,7 +263,7 @@
|
||||
this.f_91019_ = false;
|
||||
}
|
||||
|
||||
@@ -1519,10 +_,18 @@
|
||||
@@ -1528,10 +_,18 @@
|
||||
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||
BlockPos blockpos = blockhitresult.m_82425_();
|
||||
@@ -250,41 +285,41 @@
|
||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1547,14 +_,20 @@
|
||||
return false;
|
||||
} else {
|
||||
boolean flag = false;
|
||||
- switch (this.f_91077_.m_6662_()) {
|
||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
||||
+ HitResult.Type hitType = this.f_91077_.m_6662_();
|
||||
+ if(this.f_91077_ instanceof EntityHitResult entityHit) { // Forge: Perform attack range checks here, instead of in GameRenderer#pick, so extended-reach interactions work.
|
||||
+ if(!f_91074_.canHit(entityHit.m_82443_(), 0)) hitType = HitResult.Type.MISS; // No padding in client code.
|
||||
+ }
|
||||
+ if (!inputEvent.isCanceled())
|
||||
+ switch(hitType) {
|
||||
case ENTITY:
|
||||
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
|
||||
break;
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||
BlockPos blockpos = blockhitresult.m_82425_();
|
||||
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
||||
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
|
||||
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||
flag = true;
|
||||
@@ -1567,8 +_,10 @@
|
||||
}
|
||||
@@ -1560,14 +_,20 @@
|
||||
return false;
|
||||
} else {
|
||||
boolean flag = false;
|
||||
- switch (this.f_91077_.m_6662_()) {
|
||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
||||
+ HitResult.Type hitType = this.f_91077_.m_6662_();
|
||||
+ if (this.f_91077_ instanceof EntityHitResult entityHit) { // Forge: Perform attack range checks here, instead of in GameRenderer#pick, so extended-reach interactions work.
|
||||
+ if (!f_91074_.canHit(entityHit.m_82443_(), 0)) hitType = HitResult.Type.MISS; // No padding in client code.
|
||||
+ }
|
||||
+ if (!inputEvent.isCanceled())
|
||||
+ switch(hitType) {
|
||||
case ENTITY:
|
||||
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
|
||||
break;
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||
BlockPos blockpos = blockhitresult.m_82425_();
|
||||
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
||||
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
|
||||
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||
flag = true;
|
||||
@@ -1580,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.f_91074_.m_36334_();
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
|
||||
this.f_91074_.m_36334_();
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
|
||||
}
|
||||
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||
return flag;
|
||||
}
|
||||
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||
return flag;
|
||||
}
|
||||
@@ -1583,6 +_,11 @@
|
||||
@@ -1597,6 +_,11 @@
|
||||
}
|
||||
|
||||
for(InteractionHand interactionhand : InteractionHand.values()) {
|
||||
@@ -294,33 +329,34 @@
|
||||
+ return;
|
||||
+ }
|
||||
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
|
||||
if (this.f_91077_ != null) {
|
||||
switch (this.f_91077_.m_6662_()) {
|
||||
@@ -1593,6 +_,7 @@
|
||||
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) {
|
||||
return;
|
||||
@@ -1611,13 +_,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
|
||||
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) break; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
|
||||
InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand);
|
||||
if (!interactionresult.m_19077_()) {
|
||||
interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand);
|
||||
@@ -1600,6 +_,7 @@
|
||||
}
|
||||
|
||||
if (interactionresult.m_19077_()) {
|
||||
if (interactionresult.m_19080_()) {
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
- if (interactionresult.m_19080_()) {
|
||||
+ if (interactionresult.m_19080_() && inputEvent.shouldSwingHand()) {
|
||||
this.f_91074_.m_6674_(interactionhand);
|
||||
}
|
||||
|
||||
@@ -1612,6 +_,7 @@
|
||||
@@ -1629,7 +_,7 @@
|
||||
int i = itemstack.m_41613_();
|
||||
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
|
||||
if (interactionresult1.m_19077_()) {
|
||||
if (interactionresult1.m_19080_()) {
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
- if (interactionresult1.m_19080_()) {
|
||||
+ if (interactionresult1.m_19080_() && inputEvent.shouldSwingHand()) {
|
||||
this.f_91074_.m_6674_(interactionhand);
|
||||
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
|
||||
this.f_91063_.f_109055_.m_109320_(interactionhand);
|
||||
@@ -1627,6 +_,9 @@
|
||||
@@ -1645,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +366,7 @@
|
||||
if (!itemstack.m_41619_()) {
|
||||
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
|
||||
if (interactionresult2.m_19077_()) {
|
||||
@@ -1653,6 +_,8 @@
|
||||
@@ -1671,6 +_,8 @@
|
||||
--this.f_91011_;
|
||||
}
|
||||
|
||||
@@ -339,7 +375,7 @@
|
||||
this.f_91026_.m_6180_("gui");
|
||||
this.f_240378_.m_240688_();
|
||||
this.f_91065_.m_193832_(this.f_91012_);
|
||||
@@ -1782,6 +_,8 @@
|
||||
@@ -1800,6 +_,8 @@
|
||||
this.f_91026_.m_6182_("keyboard");
|
||||
this.f_91068_.m_90931_();
|
||||
this.f_91026_.m_7238_();
|
||||
@@ -348,7 +384,7 @@
|
||||
}
|
||||
|
||||
private boolean m_91278_() {
|
||||
@@ -1976,6 +_,7 @@
|
||||
@@ -1996,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_91156_(ClientLevel p_91157_) {
|
||||
@@ -356,7 +392,7 @@
|
||||
ProgressScreen progressscreen = new ProgressScreen(true);
|
||||
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
|
||||
this.m_91362_(progressscreen);
|
||||
@@ -2009,10 +_,12 @@
|
||||
@@ -2029,10 +_,12 @@
|
||||
IntegratedServer integratedserver = this.f_91007_;
|
||||
this.f_91007_ = null;
|
||||
this.f_91063_.m_109150_();
|
||||
@@ -369,15 +405,15 @@
|
||||
if (integratedserver != null) {
|
||||
this.f_91026_.m_6180_("waitForServer");
|
||||
|
||||
@@ -2027,6 +_,7 @@
|
||||
@@ -2046,6 +_,7 @@
|
||||
this.f_243981_.m_246151_();
|
||||
this.f_91065_.m_93089_();
|
||||
this.f_91008_ = null;
|
||||
this.f_91010_ = false;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(f_91073_);
|
||||
this.f_91004_.m_90740_();
|
||||
}
|
||||
|
||||
@@ -2122,6 +_,7 @@
|
||||
@@ -2153,6 +_,7 @@
|
||||
|
||||
private void m_91280_() {
|
||||
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
|
||||
@@ -385,7 +421,7 @@
|
||||
boolean flag = this.f_91074_.m_150110_().f_35937_;
|
||||
BlockEntity blockentity = null;
|
||||
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
|
||||
@@ -2134,10 +_,7 @@
|
||||
@@ -2165,10 +_,7 @@
|
||||
}
|
||||
|
||||
Block block = blockstate.m_60734_();
|
||||
@@ -397,7 +433,7 @@
|
||||
|
||||
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
|
||||
blockentity = this.f_91073_.m_7702_(blockpos);
|
||||
@@ -2148,7 +_,7 @@
|
||||
@@ -2179,7 +_,7 @@
|
||||
}
|
||||
|
||||
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
|
||||
@@ -406,30 +442,12 @@
|
||||
if (itemstack == null) {
|
||||
return;
|
||||
}
|
||||
@@ -2686,8 +_,8 @@
|
||||
return this.f_90993_;
|
||||
}
|
||||
@@ -2721,6 +_,19 @@
|
||||
|
||||
- private static Pack m_167933_(String p_167934_, Component p_167935_, boolean p_167936_, Supplier<PackResources> p_167937_, PackMetadataSection p_167938_, Pack.Position p_167939_, PackSource p_167940_) {
|
||||
- int i = p_167938_.m_10374_();
|
||||
+ private static Pack createClientPackAdapter(String p_167934_, Component p_167935_, boolean p_167936_, Supplier<PackResources> p_167937_, PackMetadataSection p_167938_, Pack.Position p_167939_, PackSource p_167940_, boolean hidden) {
|
||||
+ int i = p_167938_.getPackFormat(PackType.CLIENT_RESOURCES);
|
||||
Supplier<PackResources> supplier = p_167937_;
|
||||
if (i <= 3) {
|
||||
supplier = m_91330_(p_167937_);
|
||||
@@ -2697,7 +_,7 @@
|
||||
supplier = m_91352_(supplier);
|
||||
}
|
||||
|
||||
- return new Pack(p_167934_, p_167935_, p_167936_, supplier, p_167938_, PackType.CLIENT_RESOURCES, p_167939_, p_167940_);
|
||||
+ return new Pack(p_167934_, p_167935_, p_167936_, supplier, p_167938_, PackType.CLIENT_RESOURCES, p_167939_, p_167940_, hidden);
|
||||
}
|
||||
|
||||
private static Supplier<PackResources> m_91330_(Supplier<PackResources> p_91331_) {
|
||||
@@ -2716,6 +_,14 @@
|
||||
public void m_91312_(int p_91313_) {
|
||||
this.f_91051_.m_119410_(p_91313_);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public ItemColors getItemColors() {
|
||||
+ return this.f_91041_;
|
||||
+ }
|
||||
@@ -438,18 +456,9 @@
|
||||
+ return this.f_90997_;
|
||||
+ }
|
||||
+
|
||||
public EntityModelSet m_167973_() {
|
||||
return this.f_167844_;
|
||||
}
|
||||
@@ -2789,4 +_,11 @@
|
||||
|
||||
public abstract boolean m_142594_(boolean p_168035_);
|
||||
}
|
||||
+
|
||||
+ // FORGE START
|
||||
+ private float realPartialTick;
|
||||
+ public float getPartialTick() {
|
||||
+ return realPartialTick;
|
||||
+ }
|
||||
+ // FORGE END
|
||||
}
|
||||
}
|
||||
|
||||
public EntityModelSet m_167973_() {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -539,7 +_,8 @@
|
||||
@@ -507,7 +_,8 @@
|
||||
}, new OptionInstance.LazyEnum<>(() -> {
|
||||
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList();
|
||||
}, (p_232011_) -> {
|
||||
@@ -10,7 +10,7 @@
|
||||
}, Codec.STRING), "", (p_231994_) -> {
|
||||
SoundManager soundmanager = Minecraft.m_91087_().m_91106_();
|
||||
soundmanager.m_194526_();
|
||||
@@ -796,6 +_,7 @@
|
||||
@@ -788,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Options(Minecraft p_92138_, File p_92139_) {
|
||||
@@ -18,9 +18,9 @@
|
||||
this.f_92060_ = p_92138_;
|
||||
this.f_92110_ = new File(p_92139_, "options.txt");
|
||||
boolean flag = p_92138_.m_91103_();
|
||||
@@ -910,11 +_,20 @@
|
||||
p_168428_.m_213982_("chatPreview", this.f_231796_);
|
||||
p_168428_.m_213982_("onlyShowSecureChat", this.f_231798_);
|
||||
@@ -904,11 +_,20 @@
|
||||
p_168428_.m_213982_("panoramaScrollSpeed", this.f_244402_);
|
||||
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_);
|
||||
|
||||
+ processOptionsForge(p_168428_);
|
||||
+ }
|
||||
@@ -41,7 +41,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -935,6 +_,9 @@
|
||||
@@ -927,6 +_,9 @@
|
||||
}
|
||||
|
||||
public void m_92140_() {
|
||||
@@ -51,7 +51,7 @@
|
||||
try {
|
||||
if (!this.f_92110_.exists()) {
|
||||
return;
|
||||
@@ -979,7 +_,8 @@
|
||||
@@ -955,7 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,15 +61,15 @@
|
||||
@Nullable
|
||||
private String m_168458_(String p_168459_) {
|
||||
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null;
|
||||
@@ -1082,6 +_,7 @@
|
||||
@@ -1118,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_92169_() {
|
||||
public void m_92172_() {
|
||||
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
||||
try {
|
||||
final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8));
|
||||
if (this.f_92060_.f_91074_ != null) {
|
||||
int i = 0;
|
||||
|
||||
@@ -1229,6 +_,23 @@
|
||||
@@ -1182,6 +_,23 @@
|
||||
}
|
||||
|
||||
p_92146_.m_10509_(set);
|
||||
|
||||
@@ -18,14 +18,16 @@
|
||||
private final List<ItemStack> f_92261_;
|
||||
|
||||
private RecipeBookCategories(ItemStack... p_92267_) {
|
||||
@@ -54,11 +_,15 @@
|
||||
case SMOKER:
|
||||
return f_92256_;
|
||||
@@ -59,7 +_,7 @@
|
||||
list = f_92256_;
|
||||
break;
|
||||
default:
|
||||
- return ImmutableList.of();
|
||||
- throw new IncompatibleClassChangeError();
|
||||
+ return net.minecraftforge.client.RecipeBookManager.getCustomCategoriesOrEmpty(p_92270_);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -67,5 +_,9 @@
|
||||
|
||||
public List<ItemStack> m_92268_() {
|
||||
return this.f_92261_;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Screenshot.java
|
||||
+++ b/net/minecraft/client/Screenshot.java
|
||||
@@ -55,13 +_,23 @@
|
||||
@@ -56,13 +_,23 @@
|
||||
file2 = new File(file1, p_92307_);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
|
||||
public int m_92582_(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) {
|
||||
- BlockColor blockcolor = this.f_92571_.m_7942_(Registry.f_122824_.m_7447_(p_92583_.m_60734_()));
|
||||
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92583_.m_60734_()));
|
||||
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.m_60734_()));
|
||||
if (blockcolor != null) {
|
||||
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
|
||||
- BlockColor blockcolor = this.f_92571_.m_7942_(Registry.f_122824_.m_7447_(p_92578_.m_60734_()));
|
||||
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92578_.m_60734_()));
|
||||
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.m_60734_()));
|
||||
return blockcolor == null ? -1 : blockcolor.m_92566_(p_92578_, p_92579_, p_92580_, p_92581_);
|
||||
}
|
||||
@@ -37,7 +37,7 @@
|
||||
+ @Deprecated
|
||||
public void m_92589_(BlockColor p_92590_, Block... p_92591_) {
|
||||
for(Block block : p_92591_) {
|
||||
- this.f_92571_.m_122664_(p_92590_, Registry.f_122824_.m_7447_(block));
|
||||
- this.f_92571_.m_122664_(p_92590_, BuiltInRegistries.f_256975_.m_7447_(block));
|
||||
+ this.f_92571_.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
|
||||
public int m_92676_(ItemStack p_92677_, int p_92678_) {
|
||||
- ItemColor itemcolor = this.f_92674_.m_7942_(Registry.f_122827_.m_7447_(p_92677_.m_41720_()));
|
||||
- ItemColor itemcolor = this.f_92674_.m_7942_(BuiltInRegistries.f_257033_.m_7447_(p_92677_.m_41720_()));
|
||||
+ ItemColor itemcolor = this.f_92674_.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.m_41720_()));
|
||||
return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/Gui.java
|
||||
+++ b/net/minecraft/client/gui/Gui.java
|
||||
@@ -389,6 +_,7 @@
|
||||
@@ -392,6 +_,7 @@
|
||||
if (this.f_92986_.f_91076_ != null && this.f_92986_.f_91076_ instanceof LivingEntity && f >= 1.0F) {
|
||||
flag = this.f_92986_.f_91074_.m_36333_() > 5.0F;
|
||||
flag &= this.f_92986_.f_91076_.m_6084_();
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
|
||||
int j = this.f_92978_ / 2 - 7 + 16;
|
||||
@@ -441,6 +_,10 @@
|
||||
@@ -444,6 +_,10 @@
|
||||
|
||||
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||
MobEffect mobeffect = mobeffectinstance.m_19544_();
|
||||
@@ -19,7 +19,7 @@
|
||||
if (mobeffectinstance.m_19575_()) {
|
||||
int i = this.f_92977_;
|
||||
int j = 1;
|
||||
@@ -469,6 +_,7 @@
|
||||
@@ -472,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
|
||||
int l = i;
|
||||
int i1 = j;
|
||||
@@ -598,12 +_,13 @@
|
||||
@@ -603,12 +_,13 @@
|
||||
public void m_93069_(PoseStack p_93070_) {
|
||||
this.f_92986_.m_91307_().m_6180_("selectedItemName");
|
||||
if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) {
|
||||
@@ -43,7 +43,7 @@
|
||||
int j = (this.f_92977_ - i) / 2;
|
||||
int k = this.f_92978_ - 59;
|
||||
if (!this.f_92986_.f_91072_.m_105205_()) {
|
||||
@@ -619,7 +_,13 @@
|
||||
@@ -624,7 +_,13 @@
|
||||
RenderSystem.m_69478_();
|
||||
RenderSystem.m_69453_();
|
||||
m_93172_(p_93070_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
|
||||
@@ -58,7 +58,7 @@
|
||||
RenderSystem.m_69461_();
|
||||
}
|
||||
}
|
||||
@@ -1133,7 +_,7 @@
|
||||
@@ -1138,7 +_,7 @@
|
||||
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
|
||||
if (itemstack.m_41619_()) {
|
||||
this.f_92993_ = 0;
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
if (!p_93294_ || mapdecoration.m_77809_()) {
|
||||
+ if (mapdecoration.render(k)) { k++; continue; }
|
||||
p_93292_.m_85836_();
|
||||
p_93292_.m_85837_((double)(0.0F + (float)mapdecoration.m_77804_() / 2.0F + 64.0F), (double)(0.0F + (float)mapdecoration.m_77805_() / 2.0F + 64.0F), (double)-0.02F);
|
||||
p_93292_.m_85845_(Vector3f.f_122227_.m_122240_((float)(mapdecoration.m_77806_() * 360) / 16.0F));
|
||||
p_93292_.m_252880_(0.0F + (float)mapdecoration.m_77804_() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.m_77805_() / 2.0F + 64.0F, -0.02F);
|
||||
p_93292_.m_252781_(Axis.f_252403_.m_252977_((float)(mapdecoration.m_77806_() * 360) / 16.0F));
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/client/gui/components/AbstractWidget.java
|
||||
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
|
||||
@@ -85,7 +_,7 @@
|
||||
this.m_93228_(p_93676_, this.f_93620_, this.f_93621_, 0, 46 + i * 20, this.f_93618_ / 2, this.f_93619_);
|
||||
this.m_93228_(p_93676_, this.f_93620_ + this.f_93618_ / 2, this.f_93621_, 200 - this.f_93618_ / 2, 46 + i * 20, this.f_93618_ / 2, this.f_93619_);
|
||||
@@ -130,7 +_,7 @@
|
||||
this.m_93228_(p_93676_, this.m_252754_(), this.m_252907_(), 0, 46 + i * 20, this.f_93618_ / 2, this.f_93619_);
|
||||
this.m_93228_(p_93676_, this.m_252754_() + this.f_93618_ / 2, this.m_252907_(), 200 - this.f_93618_ / 2, 46 + i * 20, this.f_93618_ / 2, this.f_93619_);
|
||||
this.m_7906_(p_93676_, minecraft, p_93677_, p_93678_);
|
||||
- int j = this.f_93623_ ? 16777215 : 10526880;
|
||||
+ int j = getFGColor();
|
||||
m_93215_(p_93676_, font, this.m_6035_(), this.f_93620_ + this.f_93618_ / 2, this.f_93621_ + (this.f_93619_ - 8) / 2, j | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
|
||||
m_93215_(p_93676_, font, this.m_6035_(), this.m_252754_() + this.f_93618_ / 2, this.m_252907_() + (this.f_93619_ - 8) / 2, j | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
|
||||
}
|
||||
|
||||
@@ -180,6 +_,10 @@
|
||||
@@ -222,6 +_,10 @@
|
||||
this.f_93618_ = p_93675_;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
public void m_93650_(float p_93651_) {
|
||||
this.f_93625_ = p_93651_;
|
||||
}
|
||||
@@ -202,6 +_,19 @@
|
||||
@@ -244,6 +_,19 @@
|
||||
|
||||
protected void m_93692_(boolean p_93693_) {
|
||||
this.f_93616_ = p_93693_;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/client/gui/components/Button.java
|
||||
+++ b/net/minecraft/client/gui/components/Button.java
|
||||
@@ -29,6 +_,11 @@
|
||||
this.f_252416_ = p_259552_;
|
||||
}
|
||||
|
||||
+ protected Button(Builder builder) {
|
||||
+ this(builder.f_252538_, builder.f_252462_, builder.f_252510_, builder.f_252447_, builder.f_252401_, builder.f_252468_, builder.f_252431_);
|
||||
+ m_257544_(builder.f_256855_); // Forge: Make use of the Builder tooltip
|
||||
+ }
|
||||
+
|
||||
public void m_5691_() {
|
||||
this.f_93717_.m_93750_(this);
|
||||
}
|
||||
@@ -92,9 +_,11 @@
|
||||
}
|
||||
|
||||
public Button m_253136_() {
|
||||
- Button button = new Button(this.f_252538_, this.f_252462_, this.f_252510_, this.f_252447_, this.f_252401_, this.f_252468_, this.f_252431_);
|
||||
- button.m_257544_(this.f_256855_);
|
||||
- return button;
|
||||
+ return build(Button::new);
|
||||
+ }
|
||||
+
|
||||
+ public Button build(java.util.function.Function<Builder, Button> builder) {
|
||||
+ return builder.apply(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -409,6 +_,7 @@
|
||||
list.add("");
|
||||
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||
list.add(String.valueOf((Object)Registry.f_122826_.m_7981_(entity.m_6095_())));
|
||||
list.add(String.valueOf((Object)BuiltInRegistries.f_256780_.m_7981_(entity.m_6095_())));
|
||||
+ entity.m_6095_().m_204041_().m_203616_().forEach(t -> list.add("#" + t.f_203868_()));
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/client/gui/components/toasts/ToastComponent.java
|
||||
+++ b/net/minecraft/client/gui/components/toasts/ToastComponent.java
|
||||
@@ -103,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_94922_(Toast p_94923_) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onToastAdd(p_94923_)) return;
|
||||
this.f_94916_.add(p_94923_);
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/client/gui/screens/DeathScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/DeathScreen.java
|
||||
@@ -36,6 +_,7 @@
|
||||
})));
|
||||
this.f_169295_.add(this.m_142416_(new Button(this.f_96543_ / 2 - 100, this.f_96544_ / 4 + 96, 200, 20, Component.m_237115_("deathScreen.titleScreen"), (p_95925_) -> {
|
||||
if (this.f_95908_) {
|
||||
+ m_95931_(true);
|
||||
this.m_95934_();
|
||||
} else {
|
||||
ConfirmScreen confirmscreen = new ConfirmScreen(this::m_95931_, Component.m_237115_("deathScreen.quit.confirm"), CommonComponents.f_237098_, Component.m_237115_("deathScreen.titleScreen"), Component.m_237115_("deathScreen.respawn"));
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/LoadingOverlay.java
|
||||
+++ b/net/minecraft/client/gui/screens/LoadingOverlay.java
|
||||
@@ -119,6 +_,7 @@
|
||||
@@ -121,6 +_,7 @@
|
||||
int k1 = (int)((double)this.f_96163_.m_91268_().m_85446_() * 0.8325D);
|
||||
float f6 = this.f_96164_.m_7750_();
|
||||
this.f_96167_ = Mth.m_14036_(this.f_96167_ * 0.95F + f6 * 0.050000012F, 0.0F, 1.0F);
|
||||
@@ -8,7 +8,7 @@
|
||||
if (f < 1.0F) {
|
||||
this.m_96182_(p_96178_, i / 2 - j1, k1 - 5, i / 2 + j1, k1 + 5, 1.0F - Mth.m_14036_(f, 0.0F, 1.0F));
|
||||
}
|
||||
@@ -128,6 +_,7 @@
|
||||
@@ -130,6 +_,7 @@
|
||||
}
|
||||
|
||||
if (this.f_96168_ == -1L && this.f_96164_.m_7746_() && (!this.f_96166_ || f1 >= 2.0F)) {
|
||||
@@ -16,7 +16,7 @@
|
||||
try {
|
||||
this.f_96164_.m_7748_();
|
||||
this.f_96165_.accept(Optional.empty());
|
||||
@@ -135,7 +_,6 @@
|
||||
@@ -137,7 +_,6 @@
|
||||
this.f_96165_.accept(Optional.of(throwable));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
} else {
|
||||
@@ -47,9 +_,10 @@
|
||||
if (screenconstructor == null) {
|
||||
f_96195_.warn("Failed to create screen for menu type: {}", (Object)Registry.f_122863_.m_7981_(p_96202_));
|
||||
f_96195_.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.f_256818_.m_7981_(p_96202_));
|
||||
} else {
|
||||
- screenconstructor.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_);
|
||||
+ return java.util.Optional.of(screenconstructor);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
--- a/net/minecraft/client/gui/screens/OptionsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java
|
||||
@@ -140,4 +_,12 @@
|
||||
m_93215_(p_96249_, this.f_96547_, this.f_96539_, this.f_96543_ / 2, 15, 16777215);
|
||||
super.m_6305_(p_96249_, p_96250_, p_96251_, p_96252_);
|
||||
@@ -168,6 +_,14 @@
|
||||
super.m_86412_(p_96249_, p_96250_, p_96251_, p_96252_);
|
||||
}
|
||||
+
|
||||
|
||||
+ @Override
|
||||
+ public void m_7379_() {
|
||||
+ // We need to consider 2 potential parent screens here:
|
||||
@@ -12,4 +11,7 @@
|
||||
+ // 2. From the pause menu, in which case exit back to game
|
||||
+ this.f_96541_.m_91152_(this.f_96235_ instanceof PauseScreen ? null : this.f_96235_);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
private Button m_260993_(Component p_261565_, Supplier<Screen> p_262119_) {
|
||||
return Button.m_253074_(p_261565_, (p_261361_) -> {
|
||||
this.f_96541_.m_91152_(p_262119_.get());
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/Screen.java
|
||||
+++ b/net/minecraft/client/gui/screens/Screen.java
|
||||
@@ -126,7 +_,7 @@
|
||||
@@ -143,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_7379_() {
|
||||
@@ -8,8 +8,8 @@
|
||||
+ this.f_96541_.popGuiLayer();
|
||||
}
|
||||
|
||||
protected <T extends GuiEventListener & Widget & NarratableEntry> T m_142416_(T p_169406_) {
|
||||
@@ -163,15 +_,29 @@
|
||||
protected <T extends GuiEventListener & Renderable & NarratableEntry> T m_142416_(T p_169406_) {
|
||||
@@ -180,15 +_,29 @@
|
||||
this.f_169368_.clear();
|
||||
}
|
||||
|
||||
@@ -40,16 +40,16 @@
|
||||
- list.add(1, ClientTooltipComponent.m_169950_(p_169399_));
|
||||
- });
|
||||
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_169390_, p_169391_, p_169392_, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
|
||||
this.m_169383_(p_169389_, list, p_169392_, p_169393_);
|
||||
this.m_262809_(p_169389_, list, p_169392_, p_169393_, DefaultTooltipPositioner.f_262752_);
|
||||
}
|
||||
|
||||
@@ -184,20 +_,44 @@
|
||||
@@ -201,24 +_,48 @@
|
||||
}
|
||||
|
||||
public void m_96597_(PoseStack p_96598_, List<Component> p_96599_, int p_96600_, int p_96601_) {
|
||||
- this.m_96617_(p_96598_, Lists.transform(p_96599_, Component::m_7532_), p_96600_, p_96601_);
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_96599_, p_96600_, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
|
||||
+ this.m_169383_(p_96598_, components, p_96600_, p_96601_);
|
||||
+ this.m_262809_(p_96598_, components, p_96600_, p_96601_, DefaultTooltipPositioner.f_262752_);
|
||||
+ }
|
||||
+ public void renderComponentTooltip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
|
||||
+ this.renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, null, stack);
|
||||
@@ -62,13 +62,13 @@
|
||||
+ this.tooltipFont = font;
|
||||
+ this.tooltipStack = stack;
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
|
||||
+ this.m_169383_(poseStack, components, mouseX, mouseY);
|
||||
+ this.m_262809_(poseStack, components, mouseX, mouseY, DefaultTooltipPositioner.f_262752_);
|
||||
+ this.tooltipFont = null;
|
||||
+ this.tooltipStack = ItemStack.f_41583_;
|
||||
}
|
||||
|
||||
public void m_96617_(PoseStack p_96618_, List<? extends FormattedCharSequence> p_96619_, int p_96620_, int p_96621_) {
|
||||
this.m_169383_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_);
|
||||
this.m_262809_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_, DefaultTooltipPositioner.f_262752_);
|
||||
}
|
||||
|
||||
+ public void renderTooltip(PoseStack poseStack, List<? extends FormattedCharSequence> lines, int x, int y, Font font) {
|
||||
@@ -77,81 +77,68 @@
|
||||
+ this.tooltipFont = null;
|
||||
+ }
|
||||
+
|
||||
private void m_169383_(PoseStack p_169384_, List<ClientTooltipComponent> p_169385_, int p_169386_, int p_169387_) {
|
||||
if (!p_169385_.isEmpty()) {
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, p_169384_, p_169386_, p_169387_, f_96543_, f_96544_, p_169385_, this.tooltipFont, this.f_96547_);
|
||||
private void m_262835_(PoseStack p_263080_, Screen.DeferredTooltipRendering p_262968_, int p_263034_, int p_263076_) {
|
||||
this.m_262809_(p_263080_, p_262968_.f_262736_().stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_263034_, p_263076_, p_262968_.f_262758_());
|
||||
}
|
||||
|
||||
private void m_262809_(PoseStack p_263064_, List<ClientTooltipComponent> p_262990_, int p_263065_, int p_262996_, ClientTooltipPositioner p_262920_) {
|
||||
if (!p_262990_.isEmpty()) {
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, p_263064_, p_263065_, p_262996_, f_96543_, f_96544_, p_262990_, this.tooltipFont, this.f_96547_);
|
||||
+ if (preEvent.isCanceled()) return;
|
||||
int i = 0;
|
||||
int j = p_169385_.size() == 1 ? -2 : 0;
|
||||
int j = p_262990_.size() == 1 ? -2 : 0;
|
||||
|
||||
for(ClientTooltipComponent clienttooltipcomponent : p_169385_) {
|
||||
for(ClientTooltipComponent clienttooltipcomponent : p_262990_) {
|
||||
- int k = clienttooltipcomponent.m_142069_(this.f_96547_);
|
||||
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
@@ -205,8 +_,8 @@
|
||||
@@ -226,8 +_,8 @@
|
||||
j += clienttooltipcomponent.m_142103_();
|
||||
}
|
||||
|
||||
- int j2 = p_169386_ + 12;
|
||||
- int k2 = p_169387_ - 12;
|
||||
+ int j2 = preEvent.getX() + 12;
|
||||
+ int k2 = preEvent.getY() - 12;
|
||||
if (j2 + i > this.f_96543_) {
|
||||
j2 -= 28 + i;
|
||||
}
|
||||
@@ -227,15 +_,16 @@
|
||||
- int k1 = p_263065_ + 12;
|
||||
- int l1 = p_262996_ - 12;
|
||||
+ int k1 = preEvent.getX() + 12;
|
||||
+ int l1 = preEvent.getY() - 12;
|
||||
Vector2ic vector2ic = p_262920_.m_262814_(this, k1, l1, i, j);
|
||||
k1 = vector2ic.x();
|
||||
l1 = vector2ic.y();
|
||||
@@ -240,6 +_,8 @@
|
||||
RenderSystem.m_157427_(GameRenderer::m_172811_);
|
||||
bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_);
|
||||
Matrix4f matrix4f = p_169384_.m_85850_().m_85861_();
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 4, j2 + i + 3, k2 - 3, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 3, j2 + i + 3, k2 + j + 4, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 + j + 3, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 4, k2 - 3, j2 - 3, k2 + j + 3, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 + i + 3, k2 - 3, j2 + i + 4, k2 + j + 3, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + j + 3 - 1, 400, 1347420415, 1344798847);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 + i + 2, k2 - 3 + 1, j2 + i + 3, k2 + j + 3 - 1, 400, 1347420415, 1344798847);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 - 3 + 1, 400, 1347420415, 1347420415);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 2, j2 + i + 3, k2 + j + 3, 400, 1344798847, 1344798847);
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, p_169384_, j2, k2, preEvent.getFont(), p_169385_);
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 4, j2 + i + 3, k2 - 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundStart());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 3, j2 + i + 3, k2 + j + 4, 400, colorEvent.getBackgroundEnd(), colorEvent.getBackgroundEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 4, k2 - 3, j2 - 3, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 + i + 3, k2 - 3, j2 + i + 4, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + j + 3 - 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 + i + 2, k2 - 3 + 1, j2 + i + 3, k2 + j + 3 - 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 - 3 + 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderStart());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 2, j2 + i + 3, k2 + j + 3, 400, colorEvent.getBorderEnd(), colorEvent.getBorderEnd());
|
||||
RenderSystem.m_69482_();
|
||||
RenderSystem.m_69472_();
|
||||
RenderSystem.m_69478_();
|
||||
@@ -249,7 +_,7 @@
|
||||
Matrix4f matrix4f = p_263064_.m_85850_().m_252922_();
|
||||
+ // TODO 1.19.3: Tooltip rendering changed, rethink the color event.
|
||||
+ // net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, p_263064_, k1, l1, preEvent.getFont(), p_262990_);
|
||||
TooltipRenderUtil.m_262796_((p_262872_, p_262873_, p_262874_, p_262875_, p_262876_, p_262877_, p_262878_, p_262879_, p_262880_) -> {
|
||||
GuiComponent.m_93123_(p_262872_, p_262873_, p_262874_, p_262875_, p_262876_, p_262877_, p_262878_, p_262879_, p_262880_);
|
||||
}, matrix4f, bufferbuilder, k1, l1, i, j, 400);
|
||||
@@ -256,7 +_,7 @@
|
||||
|
||||
for(int i2 = 0; i2 < p_169385_.size(); ++i2) {
|
||||
ClientTooltipComponent clienttooltipcomponent1 = p_169385_.get(i2);
|
||||
- clienttooltipcomponent1.m_142440_(this.f_96547_, j2, l1, matrix4f, multibuffersource$buffersource);
|
||||
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), j2, l1, matrix4f, multibuffersource$buffersource);
|
||||
l1 += clienttooltipcomponent1.m_142103_() + (i2 == 0 ? 2 : 0);
|
||||
for(int j1 = 0; j1 < p_262990_.size(); ++j1) {
|
||||
ClientTooltipComponent clienttooltipcomponent1 = p_262990_.get(j1);
|
||||
- clienttooltipcomponent1.m_142440_(this.f_96547_, k1, i1, matrix4f, multibuffersource$buffersource);
|
||||
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), k1, i1, matrix4f, multibuffersource$buffersource);
|
||||
i1 += clienttooltipcomponent1.m_142103_() + (j1 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -259,7 +_,7 @@
|
||||
@@ -266,7 +_,7 @@
|
||||
|
||||
for(int l2 = 0; l2 < p_169385_.size(); ++l2) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_169385_.get(l2);
|
||||
- clienttooltipcomponent2.m_183452_(this.f_96547_, j2, l1, p_169384_, this.f_96542_, 400);
|
||||
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), j2, l1, p_169384_, this.f_96542_, 400);
|
||||
l1 += clienttooltipcomponent2.m_142103_() + (l2 == 0 ? 2 : 0);
|
||||
for(int i2 = 0; i2 < p_262990_.size(); ++i2) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_262990_.get(i2);
|
||||
- clienttooltipcomponent2.m_183452_(this.f_96547_, k1, i1, p_263064_, this.f_96542_, 400);
|
||||
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), k1, i1, p_263064_, this.f_96542_, 400);
|
||||
i1 += clienttooltipcomponent2.m_142103_() + (i2 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -361,9 +_,19 @@
|
||||
@@ -368,9 +_,19 @@
|
||||
this.f_96547_ = p_96607_.f_91062_;
|
||||
this.f_96543_ = p_96608_;
|
||||
this.f_96544_ = p_96609_;
|
||||
+ java.util.function.Consumer<GuiEventListener> add = (b) -> {
|
||||
+ if (b instanceof Widget w)
|
||||
+ this.f_169369_.add(w);
|
||||
+ if (b instanceof Renderable r)
|
||||
+ this.f_169369_.add(r);
|
||||
+ if (b instanceof NarratableEntry ne)
|
||||
+ this.f_169368_.add(ne);
|
||||
+ f_96540_.add(b);
|
||||
@@ -165,7 +152,7 @@
|
||||
}
|
||||
|
||||
protected void m_232761_() {
|
||||
@@ -392,6 +_,7 @@
|
||||
@@ -399,6 +_,7 @@
|
||||
public void m_96558_(PoseStack p_96559_, int p_96560_) {
|
||||
if (this.f_96541_.f_91073_ != null) {
|
||||
this.m_93179_(p_96559_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
|
||||
@@ -173,7 +160,7 @@
|
||||
} else {
|
||||
this.m_96626_(p_96560_);
|
||||
}
|
||||
@@ -411,6 +_,7 @@
|
||||
@@ -418,6 +_,7 @@
|
||||
bufferbuilder.m_5483_((double)this.f_96543_, 0.0D, 0.0D).m_7421_((float)this.f_96543_ / 32.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_();
|
||||
bufferbuilder.m_5483_(0.0D, 0.0D, 0.0D).m_7421_(0.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_();
|
||||
tesselator.m_85914_();
|
||||
@@ -181,7 +168,7 @@
|
||||
}
|
||||
|
||||
public boolean m_7043_() {
|
||||
@@ -496,6 +_,10 @@
|
||||
@@ -503,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void m_7400_(List<Path> p_96591_) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public TitleScreen() {
|
||||
this(false);
|
||||
@@ -112,11 +_,16 @@
|
||||
@@ -112,11 +_,15 @@
|
||||
int j = this.f_96543_ - i - 2;
|
||||
int k = 24;
|
||||
int l = this.f_96544_ / 4 + 48;
|
||||
@@ -17,32 +17,31 @@
|
||||
this.m_96772_(l, 24);
|
||||
} else {
|
||||
this.m_96763_(l, 24);
|
||||
+ modButton = this.m_142416_(new Button(this.f_96543_ / 2 - 100, l + 24 * 2, 98, 20, Component.m_237115_("fml.menu.mods"), button -> {
|
||||
+ this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this));
|
||||
+ }));
|
||||
+ modButton = this.m_142416_(Button.m_253074_(Component.m_237115_("fml.menu.mods"), button -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this)))
|
||||
+ .m_252794_(this.f_96543_ / 2 - 100, l + 24 * 2).m_253046_(98, 20).m_253136_());
|
||||
}
|
||||
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
|
||||
|
||||
this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_96791_) -> {
|
||||
this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_()));
|
||||
@@ -167,7 +_,7 @@
|
||||
Screen screen = (Screen)(this.f_96541_.f_91066_.f_92083_ ? new JoinMultiplayerScreen(this) : new SafetyScreen(this));
|
||||
this.f_96541_.m_91152_(screen);
|
||||
}, button$ontooltip))).f_93623_ = flag;
|
||||
- (this.m_142416_(new Button(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20, Component.m_237115_("menu.online"), (p_210872_) -> {
|
||||
+ (this.m_142416_(new Button(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20, Component.m_237115_("menu.online"), (p_96771_) -> {
|
||||
@@ -161,7 +_,7 @@
|
||||
}).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
|
||||
(this.m_142416_(Button.m_253074_(Component.m_237115_("menu.online"), (p_210872_) -> {
|
||||
this.m_96793_();
|
||||
}, button$ontooltip))).f_93623_ = flag;
|
||||
- }).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
|
||||
+ }).m_252987_(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
|
||||
}
|
||||
@@ -310,6 +_,7 @@
|
||||
|
||||
@Nullable
|
||||
@@ -267,6 +_,7 @@
|
||||
this.f_232768_.m_232790_(p_96739_, l);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_96739_, this.f_96547_, this.f_96543_, this.f_96544_, l);
|
||||
if (this.f_96721_ != null) {
|
||||
p_96739_.m_85836_();
|
||||
p_96739_.m_85837_((double)(this.f_96543_ / 2 + 90), 70.0D, 0.0D);
|
||||
@@ -332,7 +_,14 @@
|
||||
p_96739_.m_252880_((float)(this.f_96543_ / 2 + 90), 70.0F, 0.0F);
|
||||
@@ -289,7 +_,14 @@
|
||||
s = s + I18n.m_118938_("menu.modded");
|
||||
}
|
||||
|
||||
@@ -58,11 +57,11 @@
|
||||
|
||||
for(GuiEventListener guieventlistener : this.m_6702_()) {
|
||||
if (guieventlistener instanceof AbstractWidget) {
|
||||
@@ -345,6 +_,7 @@
|
||||
@@ -302,6 +_,7 @@
|
||||
RenderSystem.m_69482_();
|
||||
this.f_96726_.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||
this.f_96726_.m_86412_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||
}
|
||||
+ if (f1 >= 1.0f) modUpdateNotification.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||
+ if (f1 >= 1.0f) modUpdateNotification.m_86412_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -8,7 +8,7 @@
|
||||
|
||||
public AdvancementsScreen(ClientAdvancements p_97340_) {
|
||||
super(GameNarrator.f_93310_);
|
||||
@@ -57,7 +_,13 @@
|
||||
@@ -57,7 +_,15 @@
|
||||
} else {
|
||||
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true);
|
||||
}
|
||||
@@ -16,8 +16,10 @@
|
||||
+ if (this.f_97335_.size() > AdvancementTabType.MAX_TABS) {
|
||||
+ int guiLeft = (this.f_96543_ - 252) / 2;
|
||||
+ int guiTop = (this.f_96544_ - 140) / 2;
|
||||
+ m_142416_(new net.minecraft.client.gui.components.Button(guiLeft, guiTop - 50, 20, 20, Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 )));
|
||||
+ m_142416_(new net.minecraft.client.gui.components.Button(guiLeft + 252 - 20, guiTop - 50, 20, 20, Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)));
|
||||
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))
|
||||
+ .m_252794_(guiLeft, guiTop - 50).m_253046_(20, 20).m_253136_());
|
||||
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))
|
||||
+ .m_252794_(guiLeft + f_169556_ - 20, guiTop - 50).m_253046_(20, 20).m_253136_());
|
||||
+ maxPages = this.f_97335_.size() / AdvancementTabType.MAX_TABS;
|
||||
+ }
|
||||
}
|
||||
|
||||
+18
-22
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
|
||||
@@ -51,7 +_,7 @@
|
||||
@@ -50,7 +_,7 @@
|
||||
}
|
||||
|
||||
protected int m_5756_() {
|
||||
@@ -9,34 +9,30 @@
|
||||
}
|
||||
|
||||
public int m_5759_() {
|
||||
@@ -107,7 +_,7 @@
|
||||
KeyEntry(final KeyMapping p_193916_, final Component p_193917_) {
|
||||
this.f_193910_ = p_193916_;
|
||||
@@ -108,10 +_,11 @@
|
||||
this.f_193911_ = p_193917_;
|
||||
- this.f_193912_ = new Button(0, 0, 75, 20, p_193917_, (p_193939_) -> {
|
||||
+ this.f_193912_ = new Button(0, 0, 75 + 20 /* Forge: Add space */, 20, p_193917_, (p_193939_) -> {
|
||||
this.f_193912_ = Button.m_253074_(p_193917_, (p_193939_) -> {
|
||||
KeyBindsList.this.f_193858_.f_193975_ = p_193916_;
|
||||
}) {
|
||||
protected MutableComponent m_5646_() {
|
||||
@@ -115,6 +_,7 @@
|
||||
}
|
||||
};
|
||||
this.f_193913_ = new Button(0, 0, 50, 20, Component.m_237115_("controls.reset"), (p_193935_) -> {
|
||||
- }).m_252987_(0, 0, 75, 20).m_252778_((p_253311_) -> {
|
||||
+ }).m_252987_(0, 0, 75 + 20 /* Forge: Add space */, 20).m_252778_((p_253311_) -> {
|
||||
return p_193916_.m_90862_() ? Component.m_237110_("narrator.controls.unbound", p_193917_) : Component.m_237110_("narrator.controls.bound", p_193917_, p_253311_.get());
|
||||
}).m_253136_();
|
||||
this.f_193913_ = Button.m_253074_(Component.m_237115_("controls.reset"), (p_193935_) -> {
|
||||
+ this.f_193910_.setToDefault();
|
||||
KeyBindsList.this.f_93386_.f_91066_.m_92159_(p_193916_, p_193916_.m_90861_());
|
||||
KeyMapping.m_90854_();
|
||||
}) {
|
||||
@@ -128,7 +_,7 @@
|
||||
}).m_252987_(0, 0, 50, 20).m_252778_((p_253313_) -> {
|
||||
@@ -123,7 +_,7 @@
|
||||
boolean flag = KeyBindsList.this.f_193858_.f_193975_ == this.f_193910_;
|
||||
float f = (float)(p_193926_ + 90 - KeyBindsList.this.f_193859_);
|
||||
KeyBindsList.this.f_93386_.f_91062_.m_92889_(p_193923_, this.f_193911_, f, (float)(p_193925_ + p_193928_ / 2 - 9 / 2), 16777215);
|
||||
- this.f_193913_.f_93620_ = p_193926_ + 190;
|
||||
+ this.f_193913_.f_93620_ = p_193926_ + 190 + 20;
|
||||
this.f_193913_.f_93621_ = p_193925_;
|
||||
- this.f_193913_.m_252865_(p_193926_ + 190);
|
||||
+ this.f_193913_.m_252865_(p_193926_ + 190 + 20);
|
||||
this.f_193913_.m_252888_(p_193925_);
|
||||
this.f_193913_.f_93623_ = !this.f_193910_.m_90864_();
|
||||
this.f_193913_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_);
|
||||
@@ -136,11 +_,12 @@
|
||||
this.f_193912_.f_93621_ = p_193925_;
|
||||
this.f_193913_.m_86412_(p_193923_, p_193929_, p_193930_, p_193932_);
|
||||
@@ -131,11 +_,12 @@
|
||||
this.f_193912_.m_252888_(p_193925_);
|
||||
this.f_193912_.m_93666_(this.f_193910_.m_90863_());
|
||||
boolean flag1 = false;
|
||||
+ boolean keyCodeModifierConflict = true; // gracefully handle conflicts like SHIFT vs SHIFT+G
|
||||
@@ -49,7 +45,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,7 +_,7 @@
|
||||
@@ -143,7 +_,7 @@
|
||||
if (flag) {
|
||||
this.f_193912_.m_93666_(Component.m_237113_("> ").m_7220_(this.f_193912_.m_6035_().m_6881_().m_130940_(ChatFormatting.YELLOW)).m_130946_(" <").m_130940_(ChatFormatting.YELLOW));
|
||||
} else if (flag1) {
|
||||
@@ -57,4 +53,4 @@
|
||||
+ this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(keyCodeModifierConflict ? ChatFormatting.GOLD : ChatFormatting.RED));
|
||||
}
|
||||
|
||||
this.f_193912_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_);
|
||||
this.f_193912_.m_86412_(p_193923_, p_193929_, p_193930_, p_193932_);
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
|
||||
@@ -31,7 +_,7 @@
|
||||
this.m_7787_(this.f_193977_);
|
||||
this.f_193978_ = this.m_142416_(new Button(this.f_96543_ / 2 - 155, this.f_96544_ - 29, 150, 20, Component.m_237115_("controls.resetAll"), (p_193999_) -> {
|
||||
this.f_193978_ = this.m_142416_(Button.m_253074_(Component.m_237115_("controls.resetAll"), (p_193999_) -> {
|
||||
for(KeyMapping keymapping : this.f_96282_.f_92059_) {
|
||||
- keymapping.m_90848_(keymapping.m_90861_());
|
||||
+ keymapping.setToDefault();
|
||||
|
||||
+14
-14
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||
@@ -90,6 +_,7 @@
|
||||
@@ -89,6 +_,7 @@
|
||||
int i = this.f_97735_;
|
||||
int j = this.f_97736_;
|
||||
this.m_7286_(p_97795_, p_97798_, p_97796_, p_97797_);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Background(this, p_97795_, p_97796_, p_97797_));
|
||||
RenderSystem.m_69465_();
|
||||
super.m_6305_(p_97795_, p_97796_, p_97797_, p_97798_);
|
||||
super.m_86412_(p_97795_, p_97796_, p_97797_, p_97798_);
|
||||
PoseStack posestack = RenderSystem.m_157191_();
|
||||
@@ -111,11 +_,12 @@
|
||||
@@ -110,11 +_,12 @@
|
||||
this.f_97734_ = slot;
|
||||
int l = slot.f_40220_;
|
||||
int i1 = slot.f_40221_;
|
||||
@@ -22,7 +22,7 @@
|
||||
ItemStack itemstack = this.f_97711_.m_41619_() ? this.f_97732_.m_142621_() : this.f_97711_;
|
||||
if (!itemstack.m_41619_()) {
|
||||
int l1 = 8;
|
||||
@@ -155,9 +_,13 @@
|
||||
@@ -154,9 +_,13 @@
|
||||
}
|
||||
|
||||
public static void m_169606_(PoseStack p_169607_, int p_169608_, int p_169609_, int p_169610_) {
|
||||
@@ -37,7 +37,7 @@
|
||||
RenderSystem.m_69444_(true, true, true, true);
|
||||
RenderSystem.m_69482_();
|
||||
}
|
||||
@@ -175,8 +_,10 @@
|
||||
@@ -174,8 +_,10 @@
|
||||
RenderSystem.m_157182_();
|
||||
this.m_93250_(200);
|
||||
this.f_96542_.f_115093_ = 200.0F;
|
||||
@@ -49,7 +49,7 @@
|
||||
this.m_93250_(0);
|
||||
this.f_96542_.f_115093_ = 0.0F;
|
||||
}
|
||||
@@ -286,7 +_,8 @@
|
||||
@@ -285,7 +_,8 @@
|
||||
if (super.m_6375_(p_97748_, p_97749_, p_97750_)) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -59,7 +59,7 @@
|
||||
Slot slot = this.m_97744_(p_97748_, p_97749_);
|
||||
long i = Util.m_137550_();
|
||||
this.f_97723_ = this.f_97709_ == slot && i - this.f_97721_ < 250L && this.f_97722_ == p_97750_;
|
||||
@@ -297,6 +_,7 @@
|
||||
@@ -296,6 +_,7 @@
|
||||
int j = this.f_97735_;
|
||||
int k = this.f_97736_;
|
||||
boolean flag1 = this.m_7467_(p_97748_, p_97749_, j, k, p_97750_);
|
||||
@@ -67,7 +67,7 @@
|
||||
int l = -1;
|
||||
if (slot != null) {
|
||||
l = slot.f_40219_;
|
||||
@@ -322,7 +_,7 @@
|
||||
@@ -321,7 +_,7 @@
|
||||
}
|
||||
} else if (!this.f_97738_) {
|
||||
if (this.f_97732_.m_142621_().m_41619_()) {
|
||||
@@ -76,7 +76,7 @@
|
||||
this.m_6597_(slot, l, p_97750_, ClickType.CLONE);
|
||||
} else {
|
||||
boolean flag2 = l != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344));
|
||||
@@ -346,7 +_,7 @@
|
||||
@@ -345,7 +_,7 @@
|
||||
this.f_97717_ = 0;
|
||||
} else if (p_97750_ == 1) {
|
||||
this.f_97717_ = 1;
|
||||
@@ -85,7 +85,7 @@
|
||||
this.f_97717_ = 2;
|
||||
}
|
||||
}
|
||||
@@ -415,10 +_,13 @@
|
||||
@@ -414,10 +_,13 @@
|
||||
}
|
||||
|
||||
public boolean m_6348_(double p_97812_, double p_97813_, int p_97814_) {
|
||||
@@ -99,7 +99,7 @@
|
||||
int k = -1;
|
||||
if (slot != null) {
|
||||
k = slot.f_40219_;
|
||||
@@ -432,7 +_,7 @@
|
||||
@@ -431,7 +_,7 @@
|
||||
if (m_96638_()) {
|
||||
if (!this.f_97724_.m_41619_()) {
|
||||
for(Slot slot2 : this.f_97732_.f_38839_) {
|
||||
@@ -108,7 +108,7 @@
|
||||
this.m_6597_(slot2, slot2.f_40219_, p_97814_, ClickType.QUICK_MOVE);
|
||||
}
|
||||
}
|
||||
@@ -495,7 +_,7 @@
|
||||
@@ -494,7 +_,7 @@
|
||||
|
||||
this.m_6597_((Slot)null, -999, AbstractContainerMenu.m_38930_(2, this.f_97717_), ClickType.QUICK_CRAFT);
|
||||
} else if (!this.f_97732_.m_142621_().m_41619_()) {
|
||||
@@ -117,7 +117,7 @@
|
||||
this.m_6597_(slot, k, p_97814_, ClickType.CLONE);
|
||||
} else {
|
||||
boolean flag1 = k != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344));
|
||||
@@ -542,34 +_,39 @@
|
||||
@@ -541,34 +_,39 @@
|
||||
}
|
||||
|
||||
public boolean m_7933_(int p_97765_, int p_97766_, int p_97767_) {
|
||||
@@ -164,7 +164,7 @@
|
||||
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, i, ClickType.SWAP);
|
||||
return true;
|
||||
}
|
||||
@@ -604,6 +_,18 @@
|
||||
@@ -603,6 +_,18 @@
|
||||
|
||||
public T m_6262_() {
|
||||
return this.f_97732_;
|
||||
|
||||
+208
-181
@@ -1,257 +1,284 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
|
||||
@@ -72,6 +_,8 @@
|
||||
private Slot f_98512_;
|
||||
private CreativeInventoryListener f_98513_;
|
||||
private boolean f_98514_;
|
||||
+ private static int tabPage = 0;
|
||||
+ private int maxPages = 0;
|
||||
@@ -75,6 +_,8 @@
|
||||
private boolean f_98515_;
|
||||
private final Set<TagKey<Item>> f_98516_ = new HashSet<>();
|
||||
private final boolean f_256872_;
|
||||
+ private final List<net.minecraftforge.client.gui.CreativeTabsScreenPage> pages = new java.util.ArrayList<>();
|
||||
+ private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
|
||||
|
||||
@@ -231,6 +_,12 @@
|
||||
public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) {
|
||||
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.m_150109_(), CommonComponents.f_237098_);
|
||||
@@ -109,7 +_,7 @@
|
||||
private void m_257687_(Collection<ItemStack> p_261591_) {
|
||||
int i = this.f_97732_.m_257485_(this.f_98508_);
|
||||
(this.f_97732_).f_98639_.clear();
|
||||
- if (f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH) {
|
||||
+ if (f_98507_.hasSearchBar()) {
|
||||
this.m_98630_();
|
||||
} else {
|
||||
(this.f_97732_).f_98639_.addAll(p_261591_);
|
||||
@@ -273,6 +_,34 @@
|
||||
protected void m_7856_() {
|
||||
if (this.f_96541_.f_91072_.m_105290_()) {
|
||||
super.m_7856_();
|
||||
+ int tabCount = CreativeModeTab.f_40748_.length;
|
||||
+ if (tabCount > 12) {
|
||||
+ m_142416_(new net.minecraft.client.gui.components.Button(f_97735_, f_97736_ - 50, 20, 20, Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 )));
|
||||
+ m_142416_(new net.minecraft.client.gui.components.Button(f_97735_ + f_97726_ - 20, f_97736_ - 50, 20, 20, Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)));
|
||||
+ maxPages = (int) Math.ceil((tabCount - 12) / 10D);
|
||||
+ this.pages.clear();
|
||||
+ int tabIndex = 0;
|
||||
+ List<CreativeModeTab> currentPage = new java.util.ArrayList<>();
|
||||
+ for (CreativeModeTab sortedCreativeModeTab : net.minecraftforge.common.CreativeModeTabRegistry.getSortedCreativeModeTabs()) {
|
||||
+ currentPage.add(sortedCreativeModeTab);
|
||||
+ tabIndex++;
|
||||
+ if (tabIndex == 10) {
|
||||
+ this.pages.add(new net.minecraftforge.client.gui.CreativeTabsScreenPage(currentPage));
|
||||
+ currentPage = new java.util.ArrayList<>();
|
||||
+ tabIndex = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ if (tabIndex != 0) {
|
||||
+ this.pages.add(new net.minecraftforge.client.gui.CreativeTabsScreenPage(currentPage));
|
||||
+ }
|
||||
+ if (this.pages.isEmpty()) {
|
||||
+ this.currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
|
||||
+ } else {
|
||||
+ this.currentPage = this.pages.get(0);
|
||||
+ }
|
||||
+ if (this.pages.size() > 1) {
|
||||
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_("<"), b -> setCurrentPage(this.pages.get(Math.max(this.pages.indexOf(this.currentPage) - 1, 0)))).m_252794_(f_97735_, f_97736_ - 50).m_253046_(20, 20).m_253136_());
|
||||
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_(">"), b -> setCurrentPage(this.pages.get(Math.min(this.pages.indexOf(this.currentPage) + 1, this.pages.size() - 1)))).m_252794_(f_97735_ + f_97726_ - 20, f_97736_ - 50).m_253046_(20, 20).m_253136_());
|
||||
+ }
|
||||
+ this.currentPage = this.pages.stream().filter(page -> page.getVisibleTabs().contains(f_98507_)).findFirst().orElse(this.currentPage);
|
||||
+ if (!this.currentPage.getVisibleTabs().contains(f_98507_)) {
|
||||
+ f_98507_ = this.currentPage.getVisibleTabs().get(0);
|
||||
+ }
|
||||
this.f_96541_.f_91068_.m_90926_(true);
|
||||
this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, Component.m_237115_("itemGroup.search"));
|
||||
this.f_98510_.m_94199_(50);
|
||||
@@ -272,7 +_,7 @@
|
||||
this.f_98510_.m_94182_(false);
|
||||
@@ -318,7 +_,7 @@
|
||||
public boolean m_5534_(char p_98521_, int p_98522_) {
|
||||
if (this.f_98514_) {
|
||||
return false;
|
||||
- } else if (f_98507_ != CreativeModeTab.f_40754_.m_40775_()) {
|
||||
+ } else if (!CreativeModeTab.f_40748_[f_98507_].hasSearchBar()) {
|
||||
- } else if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) {
|
||||
+ } else if (!f_98507_.hasSearchBar()) {
|
||||
return false;
|
||||
} else {
|
||||
String s = this.f_98510_.m_94155_();
|
||||
@@ -290,7 +_,7 @@
|
||||
@@ -336,7 +_,7 @@
|
||||
|
||||
public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) {
|
||||
this.f_98514_ = false;
|
||||
- if (f_98507_ != CreativeModeTab.f_40754_.m_40775_()) {
|
||||
+ if (!CreativeModeTab.f_40748_[f_98507_].hasSearchBar()) {
|
||||
- if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) {
|
||||
+ if (!f_98507_.hasSearchBar()) {
|
||||
if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) {
|
||||
this.f_98514_ = true;
|
||||
this.m_98560_(CreativeModeTab.f_40754_);
|
||||
@@ -327,6 +_,32 @@
|
||||
this.m_98560_(CreativeModeTabs.m_258007_());
|
||||
@@ -371,6 +_,7 @@
|
||||
}
|
||||
|
||||
private void m_98630_() {
|
||||
+ if (!f_98507_.hasSearchBar()) return;
|
||||
(this.f_97732_).f_98639_.clear();
|
||||
this.f_98516_.clear();
|
||||
+
|
||||
+ CreativeModeTab tab = CreativeModeTab.f_40748_[f_98507_];
|
||||
+ if (tab.hasSearchBar() && tab != CreativeModeTab.f_40754_) {
|
||||
+ tab.m_6151_(f_97732_.f_98639_);
|
||||
+ if (!this.f_98510_.m_94155_().isEmpty()) {
|
||||
+ //TODO: Make this a SearchTree not a manual search
|
||||
+ String search = this.f_98510_.m_94155_().toLowerCase(Locale.ROOT);
|
||||
+ java.util.Iterator<ItemStack> itr = f_97732_.f_98639_.iterator();
|
||||
+ while (itr.hasNext()) {
|
||||
+ ItemStack stack = itr.next();
|
||||
+ boolean matches = false;
|
||||
+ for (Component line : stack.m_41651_(this.f_96541_.f_91074_, this.f_96541_.f_91066_.f_92125_ ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL)) {
|
||||
+ if (ChatFormatting.m_126649_(line.getString()).toLowerCase(Locale.ROOT).contains(search)) {
|
||||
+ matches = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!matches)
|
||||
+ itr.remove();
|
||||
+ }
|
||||
+ }
|
||||
+ this.f_98508_ = 0.0F;
|
||||
+ f_97732_.m_98642_(0.0F);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
String s = this.f_98510_.m_94155_();
|
||||
if (s.isEmpty()) {
|
||||
for(Item item : Registry.f_122827_) {
|
||||
@@ -371,9 +_,9 @@
|
||||
@@ -380,10 +_,10 @@
|
||||
SearchTree<ItemStack> searchtree;
|
||||
if (s.startsWith("#")) {
|
||||
s = s.substring(1);
|
||||
- searchtree = this.f_96541_.m_231372_(SearchRegistry.f_119942_);
|
||||
+ searchtree = this.f_96541_.m_231372_(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(f_98507_));
|
||||
this.m_98619_(s);
|
||||
} else {
|
||||
- searchtree = this.f_96541_.m_231372_(SearchRegistry.f_119941_);
|
||||
+ searchtree = this.f_96541_.m_231372_(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(f_98507_));
|
||||
}
|
||||
|
||||
(this.f_97732_).f_98639_.addAll(searchtree.m_6293_(s.toLowerCase(Locale.ROOT)));
|
||||
@@ -416,7 +_,7 @@
|
||||
protected void m_7027_(PoseStack p_98616_, int p_98617_, int p_98618_) {
|
||||
CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_];
|
||||
- if (creativemodetab.m_40789_()) {
|
||||
+ if (creativemodetab != null && creativemodetab.m_40789_()) {
|
||||
if (f_98507_.m_40789_()) {
|
||||
RenderSystem.m_69461_();
|
||||
- this.f_96547_.m_92889_(p_98616_, creativemodetab.m_40786_(), 8.0F, 6.0F, 4210752);
|
||||
+ this.f_96547_.m_92889_(p_98616_, creativemodetab.m_40786_(), 8.0F, 6.0F, creativemodetab.getLabelColor());
|
||||
- this.f_96547_.m_92889_(p_98616_, f_98507_.m_40786_(), 8.0F, 6.0F, 4210752);
|
||||
+ this.f_96547_.m_92889_(p_98616_, f_98507_.m_40786_(), 8.0F, 6.0F, f_98507_.getLabelColor());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -384,7 +_,7 @@
|
||||
@@ -426,7 +_,7 @@
|
||||
double d0 = p_98531_ - (double)this.f_97735_;
|
||||
double d1 = p_98532_ - (double)this.f_97736_;
|
||||
|
||||
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
|
||||
- if (this.m_98562_(creativemodetab, d0, d1)) {
|
||||
+ if (creativemodetab != null && this.m_98562_(creativemodetab, d0, d1)) {
|
||||
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
|
||||
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (this.m_98562_(creativemodetab, d0, d1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -405,7 +_,7 @@
|
||||
@@ -447,7 +_,7 @@
|
||||
double d1 = p_98623_ - (double)this.f_97736_;
|
||||
this.f_98509_ = false;
|
||||
|
||||
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
|
||||
- if (this.m_98562_(creativemodetab, d0, d1)) {
|
||||
+ if (creativemodetab != null && this.m_98562_(creativemodetab, d0, d1)) {
|
||||
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
|
||||
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (this.m_98562_(creativemodetab, d0, d1)) {
|
||||
this.m_98560_(creativemodetab);
|
||||
return true;
|
||||
}
|
||||
@@ -416,12 +_,15 @@
|
||||
}
|
||||
|
||||
private boolean m_98631_() {
|
||||
+ if (CreativeModeTab.f_40748_[f_98507_] == null) return false;
|
||||
return f_98507_ != CreativeModeTab.f_40761_.m_40775_() && CreativeModeTab.f_40748_[f_98507_].m_40791_() && this.f_97732_.m_98654_();
|
||||
}
|
||||
|
||||
@@ -465,6 +_,7 @@
|
||||
private void m_98560_(CreativeModeTab p_98561_) {
|
||||
+ if (p_98561_ == null) return;
|
||||
int i = f_98507_;
|
||||
f_98507_ = p_98561_.m_40775_();
|
||||
CreativeModeTab creativemodetab = f_98507_;
|
||||
f_98507_ = p_98561_;
|
||||
+ slotColor = p_98561_.getSlotColor();
|
||||
this.f_97737_.clear();
|
||||
(this.f_97732_).f_98639_.clear();
|
||||
this.m_238391_();
|
||||
@@ -499,13 +_,15 @@
|
||||
@@ -541,13 +_,15 @@
|
||||
this.f_98511_ = null;
|
||||
}
|
||||
|
||||
if (this.f_98510_ != null) {
|
||||
- if (p_98561_ == CreativeModeTab.f_40754_) {
|
||||
+ if (p_98561_.hasSearchBar()) {
|
||||
this.f_98510_.m_94194_(true);
|
||||
this.f_98510_.m_94190_(false);
|
||||
this.f_98510_.m_94178_(true);
|
||||
if (i != p_98561_.m_40775_()) {
|
||||
this.f_98510_.m_94144_("");
|
||||
}
|
||||
+ this.f_98510_.m_93674_(p_98561_.getSearchbarWidth());
|
||||
+ this.f_98510_.f_93620_ = this.f_97735_ + (82 /*default left*/ + 89 /*default width*/) - this.f_98510_.m_5711_();
|
||||
- if (f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH) {
|
||||
+ if (f_98507_.hasSearchBar()) {
|
||||
this.f_98510_.m_94194_(true);
|
||||
this.f_98510_.m_94190_(false);
|
||||
this.f_98510_.m_94178_(true);
|
||||
if (creativemodetab != p_98561_) {
|
||||
this.f_98510_.m_94144_("");
|
||||
}
|
||||
+ this.f_98510_.m_93674_(f_98507_.getSearchBarWidth());
|
||||
+ this.f_98510_.m_252865_(this.f_97735_ + (82 /*default left*/ + 89 /*default width*/) - this.f_98510_.m_5711_());
|
||||
|
||||
this.m_98630_();
|
||||
} else {
|
||||
@@ -565,16 +_,34 @@
|
||||
this.m_98630_();
|
||||
} else {
|
||||
@@ -604,7 +_,7 @@
|
||||
this.m_7333_(p_98577_);
|
||||
super.m_6305_(p_98577_, p_98578_, p_98579_, p_98580_);
|
||||
super.m_86412_(p_98577_, p_98578_, p_98579_, p_98580_);
|
||||
|
||||
- for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
|
||||
- if (this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
|
||||
+ int start = tabPage * 10;
|
||||
+ int end = Math.min(CreativeModeTab.f_40748_.length, ((tabPage + 1) * 10) + 2);
|
||||
+ if (tabPage != 0) start += 2;
|
||||
+ boolean rendered = false;
|
||||
+
|
||||
+ for (int x = start; x < end; x++) {
|
||||
+ CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[x];
|
||||
+ if (creativemodetab != null && this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
|
||||
+ rendered = true;
|
||||
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
|
||||
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
+ if (!rendered && !this.m_98584_(p_98577_, CreativeModeTab.f_40754_, p_98578_, p_98579_))
|
||||
+ this.m_98584_(p_98577_, CreativeModeTab.f_40761_, p_98578_, p_98579_);
|
||||
|
||||
if (this.f_98512_ != null && f_98507_ == CreativeModeTab.f_40761_.m_40775_() && this.m_6774_(this.f_98512_.f_40220_, this.f_98512_.f_40221_, 16, 16, (double)p_98578_, (double)p_98579_)) {
|
||||
@@ -614,6 +_,15 @@
|
||||
this.m_96602_(p_98577_, f_98506_, p_98578_, p_98579_);
|
||||
}
|
||||
|
||||
+ if (maxPages != 0) {
|
||||
+ Component page = Component.m_237113_(String.format("%d / %d", tabPage + 1, maxPages + 1));
|
||||
+ this.m_93250_(300);
|
||||
+ this.f_96542_.f_115093_ = 300.0F;
|
||||
+ f_96547_.m_92744_(p_98577_, page.m_7532_(), f_97735_ + (f_97726_ / 2) - (f_96547_.m_92852_(page) / 2), f_97736_ - 44, -1);
|
||||
+ this.m_93250_(0);
|
||||
+ this.f_96542_.f_115093_ = 0.0F;
|
||||
+ if (this.pages.size() != 1) {
|
||||
+ Component page = Component.m_237113_(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
|
||||
+ this.m_93250_(300);
|
||||
+ this.f_96542_.f_115093_ = 300.0F;
|
||||
+ f_96547_.m_92744_(p_98577_, page.m_7532_(), f_97735_ + (f_97726_ / 2f) - (f_96547_.m_92852_(page) / 2f), f_97736_ - 44, -1);
|
||||
+ this.m_93250_(0);
|
||||
+ this.f_96542_.f_115093_ = 0.0F;
|
||||
+ }
|
||||
+
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.m_7025_(p_98577_, p_98578_, p_98579_);
|
||||
}
|
||||
@@ -609,7 +_,7 @@
|
||||
list1.add(1, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
|
||||
}
|
||||
@@ -621,7 +_,7 @@
|
||||
protected void m_6057_(PoseStack p_98590_, ItemStack p_98591_, int p_98592_, int p_98593_) {
|
||||
boolean flag = this.f_97734_ != null && this.f_97734_ instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||
boolean flag1 = f_98507_.m_257962_() == CreativeModeTab.Type.CATEGORY;
|
||||
- boolean flag2 = f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH;
|
||||
+ boolean flag2 = f_98507_.hasSearchBar();
|
||||
TooltipFlag.Default tooltipflag$default = this.f_96541_.f_91066_.f_92125_ ? TooltipFlag.Default.f_256730_ : TooltipFlag.Default.f_256752_;
|
||||
TooltipFlag tooltipflag = flag ? tooltipflag$default.m_257777_() : tooltipflag$default;
|
||||
List<Component> list = p_98591_.m_41651_(this.f_96541_.f_91074_, tooltipflag);
|
||||
@@ -641,20 +_,20 @@
|
||||
|
||||
- this.m_169388_(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_);
|
||||
+ this.renderTooltip(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_, p_98591_);
|
||||
} else {
|
||||
super.m_6057_(p_98590_, p_98591_, p_98592_, p_98593_);
|
||||
}
|
||||
@@ -620,16 +_,32 @@
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_];
|
||||
int i = 1;
|
||||
|
||||
- for(CreativeModeTab creativemodetab1 : CreativeModeTab.f_40748_) {
|
||||
+ int start = tabPage * 10;
|
||||
+ int end = Math.min(CreativeModeTab.f_40748_.length, ((tabPage + 1) * 10 + 2));
|
||||
+ if (tabPage != 0) start += 2;
|
||||
+
|
||||
+ for (int idx = start; idx < end; idx++) {
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
- RenderSystem.m_157456_(0, f_98504_);
|
||||
- if (creativemodetab1.m_40775_() != f_98507_) {
|
||||
+ CreativeModeTab creativemodetab1 = CreativeModeTab.f_40748_[idx];
|
||||
+ if (creativemodetab1 != null && creativemodetab1.m_40775_() != f_98507_) {
|
||||
+ RenderSystem.m_157456_(0, creativemodetab1.getTabsImage());
|
||||
this.m_98581_(p_98572_, creativemodetab1);
|
||||
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
|
||||
- if (creativemodetab.m_257962_() != CreativeModeTab.Type.SEARCH && creativemodetab.m_257694_(p_98591_)) {
|
||||
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
+ if (!creativemodetab.hasSearchBar() && creativemodetab.m_257694_(p_98591_)) {
|
||||
list1.add(i++, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
- RenderSystem.m_157456_(0, new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativemodetab.m_40788_()));
|
||||
+ if (tabPage != 0) {
|
||||
+ if (creativemodetab != CreativeModeTab.f_40754_) {
|
||||
+ RenderSystem.m_157456_(0, CreativeModeTab.f_40754_.getTabsImage());
|
||||
+ m_98581_(p_98572_, CreativeModeTab.f_40754_);
|
||||
+ }
|
||||
+ if (creativemodetab != CreativeModeTab.f_40761_) {
|
||||
+ RenderSystem.m_157456_(0, CreativeModeTab.f_40761_.getTabsImage());
|
||||
+ m_98581_(p_98572_, CreativeModeTab.f_40761_);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ RenderSystem.m_157456_(0, creativemodetab.getBackgroundImage());
|
||||
this.m_93228_(p_98572_, this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
|
||||
this.f_98510_.m_6305_(p_98572_, p_98574_, p_98575_, p_98573_);
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -637,11 +_,14 @@
|
||||
int j = this.f_97736_ + 18;
|
||||
int k = j + 112;
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
- RenderSystem.m_157456_(0, f_98504_);
|
||||
+ RenderSystem.m_157456_(0, creativemodetab.getTabsImage());
|
||||
if (creativemodetab.m_40791_()) {
|
||||
this.m_93228_(p_98572_, i, j + (int)((float)(k - j - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
|
||||
}
|
||||
|
||||
+ if ((creativemodetab == null || creativemodetab.getTabPage() != tabPage) && (creativemodetab != CreativeModeTab.f_40754_ && creativemodetab != CreativeModeTab.f_40761_))
|
||||
+ return;
|
||||
+
|
||||
this.m_98581_(p_98572_, creativemodetab);
|
||||
if (creativemodetab == CreativeModeTab.f_40761_) {
|
||||
InventoryScreen.m_98850_(this.f_97735_ + 88, this.f_97736_ + 45, 20, (float)(this.f_97735_ + 88 - p_98574_), (float)(this.f_97736_ + 45 - 30 - p_98575_), this.f_96541_.f_91074_);
|
||||
@@ -650,6 +_,7 @@
|
||||
- this.m_169388_(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_);
|
||||
+ this.renderTooltip(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_, null, p_98591_);
|
||||
}
|
||||
|
||||
protected boolean m_98562_(CreativeModeTab p_98563_, double p_98564_, double p_98565_) {
|
||||
+ if (p_98563_.getTabPage() != tabPage && p_98563_ != CreativeModeTab.f_40754_ && p_98563_ != CreativeModeTab.f_40761_) return false;
|
||||
int i = p_98563_.m_40793_();
|
||||
int j = 28 * i;
|
||||
protected void m_7286_(PoseStack p_98572_, float p_98573_, int p_98574_, int p_98575_) {
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
|
||||
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
RenderSystem.m_157456_(0, f_98504_);
|
||||
if (creativemodetab != f_98507_) {
|
||||
@@ -663,7 +_,7 @@
|
||||
}
|
||||
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
- RenderSystem.m_157456_(0, new ResourceLocation("textures/gui/container/creative_inventory/tab_" + f_98507_.m_40788_()));
|
||||
+ RenderSystem.m_157456_(0, f_98507_.getBackgroundLocation());
|
||||
this.m_93228_(p_98572_, this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
|
||||
this.f_98510_.m_86412_(p_98572_, p_98574_, p_98575_, p_98573_);
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -671,11 +_,12 @@
|
||||
int k = this.f_97736_ + 18;
|
||||
int i = k + 112;
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
- RenderSystem.m_157456_(0, f_98504_);
|
||||
+ RenderSystem.m_157456_(0, f_98507_.getTabsImage());
|
||||
if (f_98507_.m_40791_()) {
|
||||
this.m_93228_(p_98572_, j, k + (int)((float)(i - k - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
|
||||
}
|
||||
|
||||
+ if (currentPage.getVisibleTabs().contains(f_98507_)) //Forge: only display tab selection when the selected tab is on the current page
|
||||
this.m_98581_(p_98572_, f_98507_);
|
||||
if (f_98507_.m_257962_() == CreativeModeTab.Type.INVENTORY) {
|
||||
InventoryScreen.m_98850_(this.f_97735_ + 88, this.f_97736_ + 45, 20, (float)(this.f_97735_ + 88 - p_98574_), (float)(this.f_97736_ + 45 - 30 - p_98575_), this.f_96541_.f_91074_);
|
||||
@@ -684,7 +_,7 @@
|
||||
}
|
||||
|
||||
private int m_258094_(CreativeModeTab p_260136_) {
|
||||
- int i = p_260136_.m_257903_();
|
||||
+ int i = currentPage.getColumn(p_260136_);
|
||||
int j = 27;
|
||||
int k = 27 * i;
|
||||
if (p_260136_.m_6563_()) {
|
||||
@@ -696,7 +_,7 @@
|
||||
|
||||
private int m_257995_(CreativeModeTab p_260181_) {
|
||||
int i = 0;
|
||||
- if (p_260181_.m_258064_() == CreativeModeTab.Row.TOP) {
|
||||
+ if (currentPage.isTop(p_260181_)) {
|
||||
i -= 32;
|
||||
} else {
|
||||
i += this.f_97727_;
|
||||
@@ -724,8 +_,8 @@
|
||||
|
||||
protected void m_98581_(PoseStack p_98582_, CreativeModeTab p_98583_) {
|
||||
boolean flag = p_98583_ == f_98507_;
|
||||
- boolean flag1 = p_98583_.m_258064_() == CreativeModeTab.Row.TOP;
|
||||
- int i = p_98583_.m_257903_();
|
||||
+ boolean flag1 = currentPage.isTop(p_98583_);
|
||||
+ int i = currentPage.getColumn(p_98583_);
|
||||
int j = i * 26;
|
||||
int k = 0;
|
||||
@@ -718,6 +_,7 @@
|
||||
int l = this.f_97735_ + this.m_258094_(p_98583_);
|
||||
@@ -742,6 +_,7 @@
|
||||
i1 += this.f_97727_ - 4;
|
||||
}
|
||||
|
||||
+ RenderSystem.m_69478_(); //Forge: Make sure blend is enabled else tabs show a white border.
|
||||
this.m_93228_(p_98582_, l, i1, j, k, 28, 32);
|
||||
this.m_93228_(p_98582_, l, i1, j, k, 26, 32);
|
||||
this.f_96542_.f_115093_ = 100.0F;
|
||||
l += 6;
|
||||
@@ -909,6 +_,22 @@
|
||||
l += 5;
|
||||
@@ -784,6 +_,14 @@
|
||||
|
||||
}
|
||||
|
||||
+ public net.minecraftforge.client.gui.CreativeTabsScreenPage getCurrentPage() {
|
||||
+ return currentPage;
|
||||
+ }
|
||||
+
|
||||
+ public void setCurrentPage(net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage) {
|
||||
+ this.currentPage = currentPage;
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
static class CustomCreativeSlot extends Slot {
|
||||
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
|
||||
@@ -947,6 +_,22 @@
|
||||
|
||||
public boolean m_8010_(Player p_98665_) {
|
||||
return this.f_98655_.m_8010_(p_98665_);
|
||||
|
||||
+6
-5
@@ -1,12 +1,13 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||
@@ -42,12 +_,16 @@
|
||||
@@ -42,12 +_,17 @@
|
||||
if (!collection.isEmpty() && j >= 32) {
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
boolean flag = j >= 120;
|
||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag);
|
||||
+ if (event == 0) return; // 0 = cancel rendering
|
||||
+ flag = event == 2; // 2 = full-size / 1 = compact
|
||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag, i);
|
||||
+ if (event.isCanceled()) return;
|
||||
+ flag = !event.isCompact();
|
||||
+ i = event.getHorizontalOffset();
|
||||
int k = 33;
|
||||
if (collection.size() > 5) {
|
||||
k = 132 / (collection.size() - 1);
|
||||
@@ -29,7 +30,7 @@
|
||||
+ }
|
||||
MobEffect mobeffect = mobeffectinstance.m_19544_();
|
||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
|
||||
RenderSystem.m_157456_(0, textureatlassprite.m_118414_().m_118330_());
|
||||
RenderSystem.m_157456_(0, textureatlassprite.m_247685_());
|
||||
@@ -108,6 +_,11 @@
|
||||
int i = this.f_97736_;
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
@@ -150,7 +_,7 @@
|
||||
@@ -147,7 +_,7 @@
|
||||
int i2 = 86 - this.f_96547_.m_92895_(s);
|
||||
FormattedText formattedtext = EnchantmentNames.m_98734_().m_98737_(this.f_96547_, i2);
|
||||
int j2 = 6839882;
|
||||
@@ -9,7 +9,7 @@
|
||||
this.m_93228_(p_98762_, j1, j + 14 + 19 * i1, 0, 185, 108, 19);
|
||||
this.m_93228_(p_98762_, j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16);
|
||||
this.f_96547_.m_92857_(formattedtext, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1);
|
||||
@@ -189,10 +_,13 @@
|
||||
@@ -186,10 +_,13 @@
|
||||
Enchantment enchantment = Enchantment.m_44697_((this.f_97732_).f_39447_[j]);
|
||||
int l = (this.f_97732_).f_39448_[j];
|
||||
int i1 = j + 1;
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
|
||||
@@ -99,6 +_,11 @@
|
||||
public static void m_98850_(int p_98851_, int p_98852_, int p_98853_, float p_98854_, float p_98855_, LivingEntity p_98856_) {
|
||||
float f = (float)Math.atan((double)(p_98854_ / 40.0F));
|
||||
float f1 = (float)Math.atan((double)(p_98855_ / 40.0F));
|
||||
+ renderEntityInInventoryRaw(p_98851_, p_98852_, p_98853_, f, f1, p_98856_);
|
||||
+ }
|
||||
+ public static void renderEntityInInventoryRaw(int p_98851_, int p_98852_, int p_98853_, float angleXComponent, float angleYComponent, LivingEntity p_98856_) {
|
||||
+ float f = angleXComponent;
|
||||
+ float f1 = angleYComponent;
|
||||
PoseStack posestack = RenderSystem.m_157191_();
|
||||
posestack.m_85836_();
|
||||
posestack.m_252880_((float)p_98851_, (float)p_98852_, 1050.0F);
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
+ PoseStack posestack = new PoseStack();
|
||||
+ posestack.m_85837_(0.0D, 0.0D, (f_96542_.f_115093_ + 200.0F));
|
||||
+ net.minecraft.client.renderer.MultiBufferSource.BufferSource bufferSource = net.minecraft.client.renderer.MultiBufferSource.m_109898_(com.mojang.blaze3d.vertex.Tesselator.m_85913_().m_85915_());
|
||||
+ f_96547_.m_92811_(String.valueOf(p_99164_.m_41613_()), (p_99166_ + 14) + 19 - 2 - f_96547_.m_92895_(String.valueOf(p_99164_.m_41613_())), p_99167_ + 6 + 3, 0xFFFFFF, true, posestack.m_85850_().m_85861_(), bufferSource, false, 0, 15728880);
|
||||
+ f_96547_.m_252905_(String.valueOf(p_99164_.m_41613_()), (p_99166_ + 14) + 19 - 2 - f_96547_.m_92895_(String.valueOf(p_99164_.m_41613_())), p_99167_ + 6 + 3, 0xFFFFFF, true, posestack.m_85850_().m_252922_(), bufferSource, false, 0, 15728880);
|
||||
+ bufferSource.m_109911_();
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
RenderSystem.m_157456_(0, f_99113_);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
|
||||
@@ -263,6 +_,11 @@
|
||||
@@ -259,6 +_,11 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
|
||||
@@ -137,7 +_,7 @@
|
||||
|
||||
@@ -130,7 +_,7 @@
|
||||
private void m_100013_(TransferableSelectionList p_100014_, Stream<PackSelectionModel.Entry> p_100015_) {
|
||||
p_100014_.m_6702_().clear();
|
||||
p_100014_.m_6987_((TransferableSelectionList.PackEntry)null);
|
||||
- p_100015_.forEach((p_170000_) -> {
|
||||
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach((p_170000_) -> {
|
||||
p_100014_.m_6702_().add(new TransferableSelectionList.PackEntry(this.f_96541_, p_100014_, this, p_170000_));
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
|
||||
@@ -106,7 +_,7 @@
|
||||
@@ -108,7 +_,7 @@
|
||||
this.m_5674_();
|
||||
this.f_100279_.clear();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
this.f_100279_.add(new RecipeBookTabButton(recipebookcategories));
|
||||
}
|
||||
|
||||
@@ -318,7 +_,7 @@
|
||||
@@ -305,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (itemstack != null && this.f_100272_.f_91080_ != null) {
|
||||
|
||||
+24
-23
@@ -1,39 +1,40 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -112,7 +_,7 @@
|
||||
@@ -113,7 +_,8 @@
|
||||
public static void m_232896_(Minecraft p_232897_, @Nullable Screen p_232898_) {
|
||||
m_232899_(p_232897_, f_232866_);
|
||||
PackRepository packrepository = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource());
|
||||
- WorldLoader.InitConfig worldloader$initconfig = m_232872_(packrepository, DataPackConfig.f_45842_);
|
||||
+ WorldLoader.InitConfig worldloader$initconfig = m_232872_(packrepository, new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of())); // FORGE: Load vanilla fallback with vanilla datapacks.
|
||||
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.m_214362_(worldloader$initconfig, (p_232935_, p_232936_) -> {
|
||||
RegistryAccess.Frozen registryaccess$frozen = RegistryAccess.m_206197_().m_203557_();
|
||||
WorldGenSettings worldgensettings = WorldPresets.m_226449_(registryaccess$frozen);
|
||||
@@ -122,7 +_,10 @@
|
||||
return new WorldCreationContext(p_232884_, Lifecycle.stable(), p_232883_, p_232882_);
|
||||
PackRepository packrepository = new PackRepository(new ServerPacksSource());
|
||||
- WorldLoader.InitConfig worldloader$initconfig = m_245574_(packrepository, WorldDataConfiguration.f_244649_);
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.event.AddPackFindersEvent(net.minecraft.server.packs.PackType.SERVER_DATA, packrepository::addPackFinder));
|
||||
+ WorldLoader.InitConfig worldloader$initconfig = m_245574_(packrepository, new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_)); // FORGE: Load vanilla fallback with vanilla datapacks.
|
||||
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.m_214362_(worldloader$initconfig, (p_247792_) -> {
|
||||
return new WorldLoader.DataLoadOutput<>(new CreateWorldScreen.DataPackReloadCookie(new WorldGenSettings(WorldOptions.m_247394_(), WorldPresets.m_246552_(p_247792_.f_244104_())), p_247792_.f_244127_()), p_247792_.f_243759_());
|
||||
}, (p_247798_, p_247799_, p_247800_, p_247801_) -> {
|
||||
@@ -121,7 +_,10 @@
|
||||
return new WorldCreationContext(p_247801_.f_243966_(), p_247800_, p_247799_, p_247801_.f_243979_());
|
||||
}, Util.m_183991_(), p_232897_);
|
||||
p_232897_.m_18701_(completablefuture::isDone);
|
||||
- p_232897_.m_91152_(new CreateWorldScreen(p_232898_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty())));
|
||||
- p_232897_.m_91152_(new CreateWorldScreen(p_232898_, WorldDataConfiguration.f_244649_, new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty())));
|
||||
+ // FORGE: Force load mods' datapacks after setting screen and ensure datapack selection reverts to vanilla if invalid.
|
||||
+ CreateWorldScreen createWorldScreen = new CreateWorldScreen(p_232898_, new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty()));
|
||||
+ CreateWorldScreen createWorldScreen = new CreateWorldScreen(p_232898_, new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_), new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty()));
|
||||
+ p_232897_.m_91152_(createWorldScreen);
|
||||
+ createWorldScreen.m_100878_(packrepository);
|
||||
}
|
||||
|
||||
public static CreateWorldScreen m_205426_(@Nullable Screen p_205427_, WorldStem p_205428_, @Nullable Path p_205429_) {
|
||||
@@ -478,7 +_,7 @@
|
||||
if (p_232949_) {
|
||||
this.m_100975_();
|
||||
} else {
|
||||
- this.f_100846_ = DataPackConfig.f_45842_;
|
||||
+ this.f_100846_ = new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()); // FORGE: Revert to *actual* vanilla data
|
||||
this.f_96541_.m_91152_(this);
|
||||
}
|
||||
public static CreateWorldScreen m_247077_(@Nullable Screen p_249522_, LevelSettings p_249091_, WorldCreationContext p_249742_, @Nullable Path p_252076_) {
|
||||
@@ -491,7 +_,7 @@
|
||||
if (p_232949_) {
|
||||
this.m_100975_();
|
||||
} else {
|
||||
- this.f_244371_ = WorldDataConfiguration.f_244649_;
|
||||
+ this.f_244371_ = new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_); // FORGE: Revert to *actual* vanilla data
|
||||
this.f_96541_.m_91152_(this);
|
||||
}
|
||||
|
||||
@@ -653,6 +_,7 @@
|
||||
File file1 = path.toFile();
|
||||
@@ -612,6 +_,7 @@
|
||||
if (path != null) {
|
||||
if (this.f_100832_ == null) {
|
||||
this.f_100832_ = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource(), new FolderRepositorySource(file1, PackSource.f_10527_));
|
||||
this.f_100832_ = ServerPacksSource.m_245786_(path);
|
||||
+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.server.ServerLifecycleHooks::buildPackFinder);
|
||||
this.f_100832_.m_10506_();
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||
@@ -132,13 +_,23 @@
|
||||
@@ -158,13 +_,23 @@
|
||||
}
|
||||
|
||||
private void m_233145_(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_) {
|
||||
@@ -12,7 +12,7 @@
|
||||
+ private void doLoadLevel(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_, boolean confirmExperimentalWarning) {
|
||||
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = this.m_233155_(p_233147_);
|
||||
if (levelstoragesource$levelstorageaccess != null) {
|
||||
PackRepository packrepository = m_233105_(levelstoragesource$levelstorageaccess);
|
||||
PackRepository packrepository = ServerPacksSource.m_247728_(levelstoragesource$levelstorageaccess);
|
||||
|
||||
WorldStem worldstem;
|
||||
try {
|
||||
@@ -22,20 +22,20 @@
|
||||
+ pld.withConfirmedWarning(true);
|
||||
+ }
|
||||
} catch (Exception exception) {
|
||||
f_233088_.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception);
|
||||
f_233088_.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception);
|
||||
this.f_233089_.m_91152_(new DatapackLoadFailureScreen(() -> {
|
||||
@@ -151,7 +_,9 @@
|
||||
@@ -177,7 +_,9 @@
|
||||
WorldData worlddata = worldstem.f_206895_();
|
||||
boolean flag = worlddata.m_5961_().m_64670_();
|
||||
boolean flag = worlddata.m_246337_().m_247070_();
|
||||
boolean flag1 = worlddata.m_5754_() != Lifecycle.stable();
|
||||
- if (!p_233149_ || !flag && !flag1) {
|
||||
+ // Forge: Skip confirmation if it has been done already for this world
|
||||
+ boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning();
|
||||
+ if (skipConfirmation || !p_233149_ || !flag && !flag1) {
|
||||
this.f_233089_.m_91100_().m_235003_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
|
||||
this.f_233089_.m_247489_().m_247400_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
|
||||
return true;
|
||||
}).exceptionallyComposeAsync((p_233183_) -> {
|
||||
@@ -173,9 +_,11 @@
|
||||
@@ -199,9 +_,11 @@
|
||||
return null;
|
||||
});
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_101729_) {
|
||||
RenderSystem.m_157456_(0, WorldSelectionList.f_101648_);
|
||||
GuiComponent.m_93172_(p_101721_, p_101724_, p_101723_, p_101724_ + 32, p_101723_ + 32, -1601138544);
|
||||
@@ -646,6 +_,21 @@
|
||||
@@ -560,6 +_,21 @@
|
||||
|
||||
public boolean m_214209_() {
|
||||
return !this.f_101695_.m_164916_();
|
||||
@@ -24,7 +24,7 @@
|
||||
+
|
||||
+ // FORGE: Patch in experimental warning icon for worlds in the world selection screen
|
||||
+ private void renderExperimentalWarning(PoseStack stack, int mouseX, int mouseY, int top, int left) {
|
||||
+ if (this.f_101695_.isExperimental()) {
|
||||
+ if (this.f_101695_.isLifecycleExperimental()) {
|
||||
+ int leftStart = left + WorldSelectionList.this.m_5759_();
|
||||
+ RenderSystem.m_157456_(0, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON);
|
||||
+ GuiComponent.m_93133_(stack, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
--- a/net/minecraft/client/model/HumanoidModel.java
|
||||
+++ b/net/minecraft/client/model/HumanoidModel.java
|
||||
@@ -264,6 +_,8 @@
|
||||
case TOOT_HORN:
|
||||
this.f_102811_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F;
|
||||
this.f_102811_.f_104204_ = this.f_102808_.f_104204_ - ((float)Math.PI / 6F);
|
||||
+ default:
|
||||
+ this.f_102816_.applyTransform(this, p_102876_, net.minecraft.world.entity.HumanoidArm.RIGHT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -304,6 +_,8 @@
|
||||
case TOOT_HORN:
|
||||
this.f_102812_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F;
|
||||
this.f_102812_.f_104204_ = this.f_102808_.f_104204_ + ((float)Math.PI / 6F);
|
||||
+ default:
|
||||
+ this.f_102815_.applyTransform(this, p_102879_, net.minecraft.world.entity.HumanoidArm.LEFT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -396,7 +_,7 @@
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
- public static enum ArmPose {
|
||||
+ public static enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
|
||||
EMPTY(false),
|
||||
ITEM(false),
|
||||
BLOCK(false),
|
||||
@@ -411,10 +_,29 @@
|
||||
|
||||
private ArmPose(boolean p_102896_) {
|
||||
this.f_102890_ = p_102896_;
|
||||
+ this.forgeArmPose = null;
|
||||
}
|
||||
|
||||
public boolean m_102897_() {
|
||||
return this.f_102890_;
|
||||
}
|
||||
+ // FORGE START
|
||||
+ @javax.annotation.Nullable
|
||||
+ private final net.minecraftforge.client.IArmPoseTransformer forgeArmPose;
|
||||
+
|
||||
+ private ArmPose(boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
|
||||
+ this.f_102890_ = twoHanded;
|
||||
+ 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) {
|
||||
+ throw new IllegalStateException("Enum not extended");
|
||||
+ }
|
||||
+
|
||||
+ public <T extends LivingEntity> void applyTransform(HumanoidModel<T> model, T entity, net.minecraft.world.entity.HumanoidArm arm) {
|
||||
+ if (this.forgeArmPose != null) this.forgeArmPose.applyTransform(model, entity, arm);
|
||||
+ }
|
||||
+ // FORGE END
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
@@ -293,6 +_,7 @@
|
||||
WoodType.m_61843_().forEach((p_171114_) -> {
|
||||
builder.put(ModelLayers.m_171291_(p_171114_), layerdefinition20);
|
||||
@@ -313,6 +_,7 @@
|
||||
WoodType.m_61843_().forEach((p_247864_) -> {
|
||||
builder.put(ModelLayers.m_247439_(p_247864_), layerdefinition24);
|
||||
});
|
||||
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder);
|
||||
ImmutableMap<ModelLayerLocation, LayerDefinition> immutablemap = builder.build();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/model/geom/ModelLayers.java
|
||||
+++ b/net/minecraft/client/model/geom/ModelLayers.java
|
||||
@@ -207,7 +_,8 @@
|
||||
@@ -217,11 +_,13 @@
|
||||
}
|
||||
|
||||
public static ModelLayerLocation m_171291_(WoodType p_171292_) {
|
||||
@@ -9,4 +9,10 @@
|
||||
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "sign/" + location.m_135815_()), "main");
|
||||
}
|
||||
|
||||
public static ModelLayerLocation m_247439_(WoodType p_252225_) {
|
||||
- return m_171300_("hanging_sign/" + p_252225_.m_61846_(), "main");
|
||||
+ ResourceLocation location = new ResourceLocation(p_252225_.m_61846_());
|
||||
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "hanging_sign/" + location.m_135815_()), "main");
|
||||
}
|
||||
|
||||
public static Stream<ModelLayerLocation> m_171288_() {
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java
|
||||
+++ b/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java
|
||||
@@ -75,6 +_,8 @@
|
||||
this.m_253216_(profilekeypair);
|
||||
return Optional.of(profilekeypair);
|
||||
} catch (CryptException | MinecraftClientException | IOException ioexception) {
|
||||
+ // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev
|
||||
+ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.f_252526_ != UserApiService.OFFLINE)
|
||||
f_252448_.error("Failed to retrieve profile key pair", (Throwable)ioexception);
|
||||
this.m_253216_((ProfileKeyPair)null);
|
||||
return p_254074_;
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||
@@ -130,6 +_,7 @@
|
||||
@@ -127,6 +_,7 @@
|
||||
this.f_104521_.accept(Component.m_237115_("connect.joining"));
|
||||
this.f_104523_ = p_104547_.m_134774_();
|
||||
this.f_104522_.m_129498_(ConnectionProtocol.PLAY);
|
||||
+ net.minecraftforge.network.NetworkHooks.handleClientLoginSuccess(this.f_104522_);
|
||||
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_104523_, this.f_104519_.m_193590_()));
|
||||
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_243717_, this.f_104523_, this.f_104519_.m_261007_().m_260825_(this.f_260722_, this.f_260612_)));
|
||||
}
|
||||
|
||||
@@ -137,7 +_,7 @@
|
||||
@@ -134,7 +_,7 @@
|
||||
if (this.f_104520_ != null && this.f_104520_ instanceof RealmsScreen) {
|
||||
this.f_104519_.m_91152_(new DisconnectedRealmsScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
|
||||
} else {
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -158,6 +_,7 @@
|
||||
@@ -155,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_7254_(ClientboundCustomQueryPacket p_104545_) {
|
||||
|
||||
Loaded 100 of 967 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user