Compare commits

..
24 Commits
Author SHA1 Message Date
LexManos bc2d0d1b25 1.19.2 RB 3 2023-09-21 11:59:41 -07:00
Paint_Ninja e2c1da98be Fix Level leak in debug HUD (#9701) 2023-09-03 11:03:37 -07:00
Paint_Ninjaanddhyces 0f6d11b1ee Keep order of sources in PackRepository (#9704)
Co-authored-by: dhyces <[email protected]>
2023-09-02 16:21:33 -07:00
Jonathan Colmenares 340d332e19 Fix parameter names in IForgeDimensionSpecialEffects.adjustLightmapColors to better describe what they are. (#9658) 2023-07-17 09:45:45 -07:00
Jonathan Colmenares 56f19dd53d Re-add in-game mod menu (#9655) 2023-07-17 08:51:03 -07:00
brandon3055 1fe420e4ab Fixed FluidUtil#tryFillContainer returning invalid result when simulating (#9358) 2023-07-15 10:52:57 -07:00
bconlon 945209c283 AlterGroundEvent for modifying block placement performed by AlterGroundDecorator (#9635) 2023-07-13 17:32:31 -07:00
embeddedt 3e5c3cabd5 Bump ASM to 9.5 (#9516) 2023-07-11 09:26:12 -07:00
Paint_Ninja b0f5a13f52 Improve logging for server connections (#9623) 2023-07-11 09:25:56 -07:00
Paint_Ninja 15fe8441f0 Log a proper duplicate mod(s) error message (#9625) 2023-07-11 09:25:42 -07:00
Brennan Ward babef71616 Fix erroneous getLevel call when firing SpecialSpawn (#9520) 2023-06-07 13:22:00 +00:00
Brennan Ward 1dd18ca27c [1.19.2] Fix the rest of the spawn event calls (#9482) 2023-05-31 11:52:38 +00:00
TelepathicGrunt 65c7390874 Loosen access for BucketItem's canBlockContainFluid (#9429) 2023-05-29 19:16:05 +00:00
Brennan WardandBrennan Ward fe3ad3b8f2 Fix event result being ignored (#9484)
Co-authored-by: Brennan Ward <[email protected]>
2023-05-08 22:52:15 +01:00
Brennan WardandBrennan Ward d05e76f7c4 Fix incorrect SpecialSpawn fire location (#9480)
Co-authored-by: Brennan Ward <[email protected]>
2023-05-03 07:08:07 +01:00
SizableShrimp bfa97bf097 [1.19.2] Fix forge grindstone hooks allowing stacks of non-stackable items (#9466) 2023-05-01 18:39:56 -05:00
Dennis C 469e9a6c1a Fix JSON model root transforms (#9411) 2023-03-22 11:09:58 +01:00
ferriarnus 58456c85af Fix StemBlock not checking canSustainPlant for the correct block
It now checks for Melons/Pumpkins instead of the stem itself.
2023-03-15 11:50:31 -07:00
cech12 7fe5b02ef3 Fix of inconsistent vaporization in BucketItem & FluidType (#9340) 2023-02-24 13:18:43 -08:00
SizableShrimp 184392e02e Backport ClientChatReceivedEvent.System for 1.19.2. Fixes #9352 (#9355) 2023-02-24 10:47:07 -08:00
Jonathan Colmenares d25a5466db Fire TickEvent.LevelTickEvent on ClientLevel tick (#9302) 2023-01-25 13:41:46 -08:00
Dennis C b5073c10ef Disable guiLight3d for generated item models (#9231) 2022-12-30 17:59:43 +01:00
sciwhiz12 16bc7cf783 Fix config key used by resource cache (#9253)
This bring it in line with the config key defined in the spec and
default config file in ResourceManagerBootCacheConfigurationHandler.

Fixes #9252
2022-12-26 13:20:27 -08:00
sciwhiz12 2d714f034f [1.19.2] Fix compatibility checker task configuration (#9233)
* Fix compatibility checker task configuration

The setupCheckJarCompatibility task exists to configure the main
compatibility checker task, checkJarCompatibility, because certain
configuration steps for that task could not be done until after the
configuration phase of Gradle.

However, that setup task previously held all the configuration for the
main check task in its task action. This caused problems because the
main check task's inputs are linked to other tasks, and the previous
situation made it so its configuration (by the setup task) happened
_after_ Gradle built the task dependency model/tree.

This meant that certain tasks which the main check task depended on did
not run before that task, because Gradle was unaware of this inter-task
dependency until it was too late (when it was already executing tasks).

This fixes the issue by moving the bulk of the configuration for the
main check task from the action of the setup task to the main
buildscript, therefore allowing Gradle to know about those task
dependencies and factor them in to its process of determining what tasks
to run and in what order.

The remaining configuration step in the setup task for the main check
task is linked to the setup task, and does not affect the task's
dependencies (because it uses a configuration which it resolves
immediately), so it stays in the setup task.

* Force checker setup task to never be up-to-date

The setup task configures the main check task, so it should always run
before that task. However, because it has an input and output, the setup
task is affected by Gradle's incremental build feature, which leads to
the possibility that Gradle considers the setup task as up-to-date,
therefore not executing its action and causing errors with the main
check task down the line.
2022-12-17 18:50:26 +01:00
808 changed files with 9097 additions and 12293 deletions

No files matched your search

-16
View File
@@ -1,16 +0,0 @@
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 }}
-16
View File
@@ -1,16 +0,0 @@
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 }}
-16
View File
@@ -1,16 +0,0 @@
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 }}
-16
View File
@@ -1,16 +0,0 @@
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 }}
-16
View File
@@ -1,16 +0,0 @@
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 }}
+42
View File
@@ -0,0 +1,42 @@
name: 'Spam label'
on:
issues:
types: [labeled]
pull_request:
types: [labeled]
discussion:
types: [labeled]
permissions:
contents: read
issues: write
pull-requests: write
discussions: write
jobs:
lock:
if: ${{ (github.event.label.name == 'spam') && (github.event.action == 'labeled') }}
runs-on: ubuntu-latest
steps:
- uses: peter-evans/close-issue@v2
name: Close Issue
with:
close-reason: 'not_planned'
if: ${{ github.event_name != 'pull_request' }}
- run: gh pr close ${{ github.event.pull_request.html_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Close PR
if: ${{ github.event_name == 'pull_request' }}
- uses: maxkomarychev/[email protected]
name: Lock PR
if: ${{ github.event_name == 'pull_request' }}
with:
token: "${{ secrets.GITHUB_TOKEN }}"
issue_number: ${{ github.event.number }}
- uses: OSDKDev/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
name: Lock issue
if: ${{ github.event_name != 'pull_request' }}
+27
View File
@@ -0,0 +1,27 @@
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
+3 -3
View File
@@ -37,7 +37,7 @@ project {
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.5.1", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", 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.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*)
@@ -155,7 +155,7 @@ object PullRequestChecks : BuildType({
enableStacktrace = true
dockerImage = "%docker_gradle_image%"
dockerRunParameters = """
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
--network=host
-u 1000:1000
@@ -189,7 +189,7 @@ object PullRequestCompatibility : BuildType({
enableStacktrace = true
dockerImage = "%docker_gradle_image%"
dockerRunParameters = """
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
--network=host
-u 1000:1000
+24 -39
View File
@@ -1,10 +1,4 @@
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
@@ -42,10 +36,10 @@ ext {
]
}
MAPPING_CHANNEL = 'official'
MAPPING_VERSION = '1.19.3'
MC_VERSION = '1.19.3'
MAPPING_VERSION = '1.19.2'
MC_VERSION = '1.19.2'
MC_NEXT_VERSION = '1.20'
MCP_VERSION = '20221207.122022'
MCP_VERSION = '20220805.130853'
SPI_VERSION = '6.0.0'
ACCESSTRANSFORMERS_VERSION = '8.0.4'
COREMODS_VERSION = '5.0.1'
@@ -53,7 +47,7 @@ ext {
MODLAUNCHER_VERSION = '10.0.8'
SECUREJARHANDLER_VERSION = '2.1.4'
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
ASM_VERSION = '9.3'
ASM_VERSION = '9.5'
INSTALLER_VERSION = '2.1.+'
MIXIN_VERSION = '0.8.5'
TERMINALCONSOLEAPPENDER_VERSION = '1.2.0'
@@ -62,17 +56,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.1.1'
LOG4J_VERSION = '2.19.0'
GUAVA_VERSION = '31.1-jre'
GSON_VERSION = '2.10'
MOJANG_LOGGING_VERSION = '1.0.0'
LOG4J_VERSION = '2.17.0'
GUAVA_VERSION = '31.0.1-jre'
GSON_VERSION = '2.8.9'
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
JOPT_SIMPLE_VERSION = '5.0.4'
COMMONS_IO_VERSION = '2.11.0'
JARJAR_VERSION = '0.3.16'
GIT_INFO = gradleutils.gitInfo
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
@@ -1174,45 +1168,34 @@ project(':forge') {
}
}
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
task checkATs(type: CheckATs, dependsOn: [extractInheritance, createSrg2Mcp]) {
inheritance = extractInheritance.output
ats.from patcher.accessTransformers
mappings = createSrg2Mcp.output
}
CheckTask.registerTask(tasks, 'SAS', CheckSAS) {
dependsOn extractInheritance
sass.from patcher.sideAnnotationStrippers
task checkSAS(type: CheckSAS, dependsOn: extractInheritance) {
inheritance = extractInheritance.output
sass.from patcher.sideAnnotationStrippers
}
CheckTask.registerTask(tasks, 'Excs', CheckExcs) {
dependsOn jar
task checkExcs(type: CheckExcs, dependsOn: jar) {
binary = jar.archiveFile.get().asFile
excs.from patcher.excs
}
CheckTask.registerTask(tasks, 'Patches', CheckPatches) {
dependsOn genPatches
task checkPatchesAndFix(type: CheckPatches, dependsOn: genPatches) {
patchDir = file("$rootDir/patches")
patchesWithS2SArtifact = [
'minecraft/net/minecraft/client/renderer/ViewArea.java.patch',
'minecraft/net/minecraft/data/models/blockstates/Variant.java.patch',
]
autoFix = true
}
task checkPatches(type: CheckPatches, dependsOn: genPatches) {
patchDir = file("$rootDir/patches")
autoFix = false
}
genPatches {
finalizedBy checkAndFixPatches
finalizedBy checkPatches
autoHeader true
lineEnding = '\n'
}
@@ -1268,6 +1251,8 @@ project(':forge') {
commonLibraries.from(project.configurations.moduleonly)
}
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks, checkPatches, checkLicenses]){}
task launcherJson(type: LauncherJson) {
packedDependencies = [':fmlloader:jar']
doFirst {
+3 -4
View File
@@ -4,9 +4,8 @@ repositories {
}
dependencies {
implementation 'org.ow2.asm:asm:9.3'
implementation 'org.ow2.asm:asm-tree:9.3'
implementation 'net.minecraftforge:srgutils:0.4.+'
implementation 'org.ow2.asm:asm:9.5'
implementation 'org.ow2.asm:asm-tree:9.5'
implementation 'net.minecraftforge:srgutils:0.5.+'
implementation 'commons-io:commons-io:2.8.0'
implementation 'com.google.code.gson:gson:2.10'
}
@@ -0,0 +1,267 @@
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')
}
}
}
@@ -0,0 +1,94 @@
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')
}
}
}
@@ -0,0 +1,219 @@
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
}
}
@@ -0,0 +1,107 @@
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
}
}
@@ -1,49 +0,0 @@
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()
}
@@ -1,310 +0,0 @@
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)
}
}
}
@@ -1,93 +0,0 @@
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)
}
}
}
}
}
}
@@ -1,9 +0,0 @@
package net.minecraftforge.forge.tasks.checks
import groovy.transform.CompileStatic
@CompileStatic
enum CheckMode {
CHECK,
FIX
}
@@ -1,177 +0,0 @@
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) }
}
}
}
}
}
@@ -1,110 +0,0 @@
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
}
}
@@ -1,109 +0,0 @@
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") }
}
}
+5 -4
View File
@@ -2,16 +2,17 @@
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.19.3-&query=$.promos["1.19.3-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://files.minecraftforge.net)
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.19.3-&query=$.promos["1.19.3-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.19-&query=$.promos["1.19.2-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://files.minecraftforge.net)
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.19.2-&query=$.promos["1.19.2-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)](https://files.minecraftforge.net) [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)](https://discord.gg/UvedJ9m) [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)](https://www.patreon.com/LexManos)
Forge is a free, open-source modding API all of your favourite mods use!
| Version | Support |
|---------| ------------- |
| 1.19.x | Active |
| 1.18.x | LTS |
| 1.20.x | Active |
| 1.19.4 | Legacy |
| 1.19.2 | Legacy |
* [Download]
* [Forum]
@@ -22,7 +22,13 @@ import net.minecraftforge.forgespi.locating.IModFile;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.*;
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.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
@@ -250,22 +256,10 @@ 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(), 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);
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()));
loadingExceptions.add(new ModLoadingException(null, ModLoadingStage.CONSTRUCT, "fml.modloading.missingclasses", null, modFile.getFilePath()));
}
// remove errored mod containers
@@ -311,14 +305,6 @@ 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());
@@ -11,11 +11,17 @@ import net.minecraftforge.forgespi.language.IModInfo;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.slf4j.Logger;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.*;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.joining;
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
public class UniqueModListBuilder
{
@@ -66,28 +72,34 @@ public class UniqueModListBuilder
// Its theoretically possible that some mod has somehow moved an id to a secondary place, thus causing a dupe.
// We can't handle this
final List<IModInfo> dupedMods = modIds.values().stream()
final List<String> dupedModErrors = modIds.values().stream()
.filter(modInfos -> modInfos.size() > 1)
.map(modInfos -> modInfos.get(0))
.toList();
.map(mods -> String.format("\tMod ID: '%s' from mod files: %s",
mods.get(0).getModId(),
mods.stream()
.map(modInfo -> modInfo.getOwningFile().getFile().getFileName()).collect(joining(", "))
)).toList();
if (!dupedMods.isEmpty()) {
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods.stream()
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm, Objects.toString(dm)))
.toList();
throw new EarlyLoadingException("Duplicate mods found", null, duplicateModErrors);
if (!dupedModErrors.isEmpty()) {
LOGGER.error(LOADING, "Found duplicate mods:\n{}", dupedModErrors.stream().collect(joining("\n")));
throw new EarlyLoadingException("Duplicate mods found", null, dupedModErrors.stream()
.map(s -> new EarlyLoadingException.ExceptionData(s))
.toList());
}
final List<ModFile> dupedLibs = versionedLibIds.values().stream()
final List<String> dupedLibErrors = versionedLibIds.values().stream()
.filter(modFiles -> modFiles.size() > 1)
.map(modFiles -> modFiles.get(0))
.toList();
.map(mods -> String.format("\tLibrary: '%s' from files: %s",
getModId(mods.get(0)),
mods.stream()
.map(modFile -> modFile.getFileName()).collect(joining(", "))
)).toList();
if (!dupedLibs.isEmpty()) {
final List<EarlyLoadingException.ExceptionData> duplicateLibErrors = dupedLibs.stream()
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedlib.versioned", dm, Objects.toString(dm)))
.toList();
throw new EarlyLoadingException("Duplicate plugins or libraries found", null, duplicateLibErrors);
if (!dupedLibErrors.isEmpty()) {
LOGGER.error(LOADING, "Found duplicate plugins or libraries:\n{}", dupedLibErrors.stream().collect(joining("\n")));
throw new EarlyLoadingException("Duplicate plugins or libraries found", null, dupedLibErrors.stream()
.map(s -> new EarlyLoadingException.ExceptionData(s))
.toList());
}
// Collect unique mod files by module name. This will be used for deduping purposes
@@ -31,6 +31,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 = findJarOnClasspath(legacyCP, "client-extra");
mcstream.add(extra);
// The MC code/Patcher edits are in exploded directories
final var modstream = Stream.<List<Path>>builder();
@@ -41,7 +42,6 @@ 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));
}
@@ -19,7 +19,6 @@ public final class CyclePresentException extends IllegalArgumentException {
* @param cycles the cycles present
*/
CyclePresentException(Set<Set<?>> cycles) {
super("Cycles present in graph: " + cycles);
this.cycles = cycles;
}
+3 -1
View File
@@ -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://parchmentmc.org/docs/getting-started
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/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,6 +132,8 @@ 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,7 +3,7 @@ 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.CreativeModeTabs;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
@@ -11,13 +11,15 @@ 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;
@@ -40,7 +42,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()));
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 ExampleMod()
{
@@ -56,9 +58,6 @@ 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)
@@ -68,12 +67,6 @@ 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)
+1 -1
View File
@@ -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://docs.minecraftforge.net/en/latest/misc/updatechecker/
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
#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
+2 -2
View File
@@ -1,8 +1,8 @@
{
"pack": {
"description": "examplemod resources",
"pack_format": 12,
"forge:resource_pack_format": 12,
"pack_format": 9,
"forge:resource_pack_format": 9,
"forge:data_pack_format": 10
}
}
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -510,9 +_,16 @@
@@ -539,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;
@@ -263,6 +_,7 @@
@@ -303,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_254368_;
this.f_166822_ = p_166829_;
}
}
+
@@ -1,11 +1,11 @@
--- a/com/mojang/blaze3d/vertex/PoseStack.java
+++ b/com/mojang/blaze3d/vertex/PoseStack.java
@@ -11,7 +_,7 @@
import org.joml.Quaternionf;
import net.minecraftforge.api.distmarker.OnlyIn;
@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();
matrix4f.m_27624_();
@@ -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_();
@@ -99,11 +_,13 @@
@@ -101,12 +_,14 @@
f5 = afloat[k] * p_86001_;
}
@@ -28,11 +28,12 @@
+ int l = applyBakedLighting(p_86002_[k], bytebuffer);
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
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_());
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_());
+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha;
+ this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
+ 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_());
}
}
} catch (Throwable throwable1) {
if (memorystack != null) {
@@ -0,0 +1,13 @@
--- 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);
+ }
}
@@ -0,0 +1,43 @@
--- 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
@@ -12,7 +_,7 @@
import org.joml.Vector3f;
import org.joml.Vector3fc;
@@ -6,7 +_,7 @@
import net.minecraft.Util;
import org.apache.commons.lang3.tuple.Triple;
-public final class Transformation {
+public final class Transformation implements net.minecraftforge.client.extensions.IForgeTransformation {
private final Matrix4f f_121078_;
private boolean f_121079_;
@Nullable
@@ -139,6 +_,19 @@
@@ -145,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.invert();
+ normalTransform.transpose();
+ normalTransform.m_8187_();
+ normalTransform.m_8155_();
+ }
+ }
public Transformation m_175937_(Transformation p_175938_, float p_175939_) {
Vector3f vector3f = this.m_252829_();
Vector3f vector3f = this.m_175940_();
@@ -0,0 +1,28 @@
--- 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; }
}
@@ -0,0 +1,18 @@
--- 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; }
}
@@ -13,6 +13,6 @@
+ return super.m_7933_(key, scanCode, modifiers);
+ }
+
public void m_86412_(PoseStack p_88679_, int p_88680_, int p_88681_, float p_88682_) {
public void m_6305_(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
@@ -214,6 +_,7 @@
@@ -211,6 +_,7 @@
}
static {
@@ -12,7 +12,7 @@
public static ExecutorService m_183988_() {
return f_137443_;
}
@@ -242,7 +_,7 @@
@@ -248,7 +_,7 @@
try {
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) {
@@ -21,3 +21,13 @@
if (SharedConstants.f_136183_) {
throw illegalargumentexception;
}
@@ -692,7 +_,8 @@
public static <T, R> Function<T, R> m_143827_(final Function<T, R> p_143828_) {
return new Function<T, R>() {
- private final Map<T, R> f_211548_ = Maps.newHashMap();
+ // FORGE: Allow using memoized functions from multiple threads.
+ private final Map<T, R> f_211548_ = Maps.newConcurrentMap();
public R apply(T p_214691_) {
return this.f_211548_.computeIfAbsent(p_214691_, p_143828_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/critereon/ItemPredicate.java
+++ b/net/minecraft/advancements/critereon/ItemPredicate.java
@@ -29,6 +_,8 @@
@@ -28,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_;
@@ -81,7 +_,7 @@
@@ -80,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)) {
@@ -108,6 +_,11 @@
@@ -107,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")) {
@@ -215,6 +_,14 @@
@@ -214,6 +_,14 @@
} else {
return new ItemPredicate[0];
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java
@@ -206,6 +_,18 @@
@@ -211,6 +_,18 @@
this.f_90549_ = false;
}
@@ -9,12 +9,12 @@
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_));
@@ -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_));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -298,7 +_,9 @@
@@ -299,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_());
@@ -316,6 +_,8 @@
@@ -317,6 +_,8 @@
});
return;
}
@@ -20,9 +20,9 @@
}
if (this.f_90867_.m_240477_().m_93316_()) {
@@ -338,11 +_,15 @@
@@ -339,11 +_,15 @@
Screen.m_96579_(() -> {
if (p_90897_ != 1 && p_90897_ != 2) {
if (p_90897_ != 1 && (p_90897_ != 2 || !this.f_90868_)) {
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());
@@ -395,22 +_,26 @@
@@ -396,22 +_,26 @@
}
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -245,7 +_,7 @@
@@ -244,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
@@ -9,7 +9,16 @@
static Minecraft f_90981_;
private static final Logger f_90982_ = LogUtils.getLogger();
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
@@ -410,7 +_,6 @@
@@ -398,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();
@@ -406,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_());
@@ -17,7 +26,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_;
@@ -459,7 +_,7 @@
@@ -458,7 +_,7 @@
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
this.f_91067_ = new MouseHandler(this);
@@ -26,30 +35,28 @@
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);
@@ -467,6 +_,7 @@
@@ -466,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_);
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_, this.f_91037_);
this.f_91038_.m_10506_();
this.f_91066_.m_92145_(this.f_91038_);
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
@@ -511,10 +_,13 @@
@@ -510,10 +_,12 @@
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_.m_247116_());
this.f_91036_.m_7217_(this.f_91063_);
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_();
+ // Forge: We delay this to allow registration of modded creative mode tabs
+ // this.createSearchTrees();
this.m_91271_();
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_);
@@ -523,7 +_,9 @@
@@ -522,7 +_,9 @@
this.f_91047_ = new GpuWarnlistManager();
this.f_91036_.m_7217_(this.f_91047_);
this.f_91036_.m_7217_(this.f_205120_);
@@ -60,7 +67,7 @@
this.f_91064_ = new DebugRenderer(this);
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
RenderSystem.m_69900_(this::m_91113_);
@@ -542,6 +_,21 @@
@@ -541,6 +_,21 @@
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
}
@@ -82,15 +89,14 @@
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_();
@@ -565,24 +_,24 @@
@@ -563,23 +_,23 @@
}
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) {
+ ServerAddress serveraddress = new ServerAddress(s, i);
+ ConnectScreen.m_169267_(new TitleScreen(), this, serveraddress, new ServerData(I18n.m_118938_("selectServer.defaultName"), serveraddress.toString(), false));
+ ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
+ } else if (this.m_239929_()) {
+ this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
+ if (p_238185_) {
@@ -105,9 +111,8 @@
});
}, false));
- if (s != null) {
- ServerAddress serveraddress = new ServerAddress(s, i);
- reloadinstance.m_7237_().thenRunAsync(() -> {
- ConnectScreen.m_169267_(new TitleScreen(), this, serveraddress, new ServerData(I18n.m_118938_("selectServer.defaultName"), serveraddress.toString(), false));
- ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
- }, this);
- } else if (this.m_239929_()) {
- this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
@@ -123,7 +128,7 @@
}
@@ -634,6 +_,8 @@
@@ -622,6 +_,8 @@
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
try {
@@ -132,7 +137,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);
@@ -646,7 +_,7 @@
@@ -634,7 +_,7 @@
}
private void m_91239_(Throwable p_91240_) {
@@ -141,45 +146,7 @@
this.m_91241_(p_91240_, (Component)null);
} else {
Util.m_137559_(p_91240_);
@@ -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 @@
@@ -792,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_());
@@ -196,7 +163,7 @@
}
}
@@ -932,10 +_,6 @@
@@ -922,10 +_,6 @@
f_90982_.error("setScreen called from non-game thread");
}
@@ -207,7 +174,7 @@
if (p_91153_ == null && this.f_91073_ == null) {
p_91153_ = new TitleScreen();
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
@@ -946,6 +_,19 @@
@@ -936,6 +_,19 @@
}
}
@@ -227,7 +194,7 @@
this.f_91080_ = p_91153_;
BufferUploader.m_166835_();
if (p_91153_ != null) {
@@ -1091,11 +_,14 @@
@@ -1079,11 +_,14 @@
RenderSystem.m_69481_();
this.f_91026_.m_7238_();
if (!this.f_91079_) {
@@ -242,7 +209,7 @@
}
if (this.f_91056_ != null) {
@@ -1223,10 +_,12 @@
@@ -1210,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_());
@@ -255,7 +222,7 @@
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
this.f_91067_.m_91599_();
}
@@ -1499,6 +_,7 @@
@@ -1491,6 +_,7 @@
}
public void m_91395_() {
@@ -263,7 +230,7 @@
this.f_91019_ = false;
}
@@ -1528,10 +_,18 @@
@@ -1520,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_();
@@ -285,41 +252,41 @@
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
}
}
@@ -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 @@
}
@@ -1548,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;
@@ -1568,8 +_,10 @@
}
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;
this.f_91074_.m_36334_();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
}
@@ -1597,6 +_,11 @@
+ if (inputEvent.shouldSwingHand())
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1584,6 +_,11 @@
}
for(InteractionHand interactionhand : InteractionHand.values()) {
@@ -329,9 +296,9 @@
+ return;
+ }
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) {
return;
@@ -1611,13 +_,14 @@
if (this.f_91077_ != null) {
switch (this.f_91077_.m_6662_()) {
@@ -1594,13 +_,14 @@
return;
}
@@ -347,7 +314,7 @@
this.f_91074_.m_6674_(interactionhand);
}
@@ -1629,7 +_,7 @@
@@ -1612,7 +_,7 @@
int i = itemstack.m_41613_();
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
if (interactionresult1.m_19077_()) {
@@ -356,7 +323,7 @@
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);
@@ -1645,6 +_,9 @@
@@ -1628,6 +_,9 @@
}
}
@@ -366,7 +333,7 @@
if (!itemstack.m_41619_()) {
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
if (interactionresult2.m_19077_()) {
@@ -1671,6 +_,8 @@
@@ -1654,6 +_,8 @@
--this.f_91011_;
}
@@ -375,7 +342,23 @@
this.f_91026_.m_6180_("gui");
this.f_240378_.m_240688_();
this.f_91065_.m_193832_(this.f_91012_);
@@ -1800,6 +_,8 @@
@@ -1749,6 +_,7 @@
this.f_91005_.m_120596_();
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.f_91073_, () -> true);
try {
this.f_91073_.m_104726_(() -> {
return true;
@@ -1764,6 +_,7 @@
throw new ReportedException(crashreport);
}
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.f_91073_, () -> true);
}
this.f_91026_.m_6182_("animateTick");
@@ -1783,6 +_,8 @@
this.f_91026_.m_6182_("keyboard");
this.f_91068_.m_90931_();
this.f_91026_.m_7238_();
@@ -384,7 +367,7 @@
}
private boolean m_91278_() {
@@ -1996,6 +_,7 @@
@@ -1978,6 +_,7 @@
}
public void m_91156_(ClientLevel p_91157_) {
@@ -392,7 +375,7 @@
ProgressScreen progressscreen = new ProgressScreen(true);
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
this.m_91362_(progressscreen);
@@ -2029,10 +_,12 @@
@@ -2011,10 +_,12 @@
IntegratedServer integratedserver = this.f_91007_;
this.f_91007_ = null;
this.f_91063_.m_109150_();
@@ -405,15 +388,15 @@
if (integratedserver != null) {
this.f_91026_.m_6180_("waitForServer");
@@ -2046,6 +_,7 @@
this.f_243981_.m_246151_();
@@ -2029,6 +_,7 @@
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_();
}
@@ -2153,6 +_,7 @@
@@ -2124,6 +_,7 @@
private void m_91280_() {
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
@@ -421,7 +404,7 @@
boolean flag = this.f_91074_.m_150110_().f_35937_;
BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
@@ -2165,10 +_,7 @@
@@ -2136,10 +_,7 @@
}
Block block = blockstate.m_60734_();
@@ -433,7 +416,7 @@
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
blockentity = this.f_91073_.m_7702_(blockpos);
@@ -2179,7 +_,7 @@
@@ -2150,7 +_,7 @@
}
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
@@ -442,7 +425,27 @@
if (itemstack == null) {
return;
}
@@ -2721,6 +_,19 @@
@@ -2688,8 +_,8 @@
return this.f_90993_;
}
- 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_);
@@ -2699,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 +_,19 @@
public void m_91312_(int p_91313_) {
this.f_91051_.m_119410_(p_91313_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -507,7 +_,8 @@
@@ -539,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_();
@@ -788,6 +_,7 @@
@@ -796,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_();
@@ -904,11 +_,20 @@
p_168428_.m_213982_("panoramaScrollSpeed", this.f_244402_);
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_);
@@ -910,11 +_,20 @@
p_168428_.m_213982_("chatPreview", this.f_231796_);
p_168428_.m_213982_("onlyShowSecureChat", this.f_231798_);
+ processOptionsForge(p_168428_);
+ }
@@ -41,7 +41,7 @@
}
}
@@ -927,6 +_,9 @@
@@ -935,6 +_,9 @@
}
public void m_92140_() {
@@ -51,7 +51,7 @@
try {
if (!this.f_92110_.exists()) {
return;
@@ -955,7 +_,8 @@
@@ -979,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;
@@ -1118,6 +_,7 @@
@@ -1082,6 +_,7 @@
}
public void m_92172_() {
public void m_92169_() {
+ 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.
if (this.f_92060_.f_91074_ != null) {
int i = 0;
try {
final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8));
@@ -1182,6 +_,23 @@
@@ -1229,6 +_,23 @@
}
p_92146_.m_10509_(set);
@@ -18,16 +18,14 @@
private final List<ItemStack> f_92261_;
private RecipeBookCategories(ItemStack... p_92267_) {
@@ -59,7 +_,7 @@
list = f_92256_;
break;
@@ -54,11 +_,15 @@
case SMOKER:
return f_92256_;
default:
- throw new IncompatibleClassChangeError();
- return ImmutableList.of();
+ 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
@@ -56,13 +_,23 @@
@@ -55,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_(BuiltInRegistries.f_256975_.m_7447_(p_92583_.m_60734_()));
- BlockColor blockcolor = this.f_92571_.m_7942_(Registry.f_122824_.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_(BuiltInRegistries.f_256975_.m_7447_(p_92578_.m_60734_()));
- BlockColor blockcolor = this.f_92571_.m_7942_(Registry.f_122824_.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_, BuiltInRegistries.f_256975_.m_7447_(block));
- this.f_92571_.m_122664_(p_92590_, Registry.f_122824_.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_(BuiltInRegistries.f_257033_.m_7447_(p_92677_.m_41720_()));
- ItemColor itemcolor = this.f_92674_.m_7942_(Registry.f_122827_.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
@@ -392,6 +_,7 @@
@@ -389,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;
@@ -444,6 +_,10 @@
@@ -441,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;
@@ -472,6 +_,7 @@
@@ -469,6 +_,7 @@
}
}
@@ -27,7 +27,7 @@
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
int l = i;
int i1 = j;
@@ -603,12 +_,13 @@
@@ -598,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_()) {
@@ -624,7 +_,13 @@
@@ -619,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_();
}
}
@@ -1138,7 +_,7 @@
@@ -1133,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_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));
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));
@@ -1,15 +1,15 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -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_);
@@ -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_);
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.m_252754_() + this.f_93618_ / 2, this.m_252907_() + (this.f_93619_ - 8) / 2, j | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
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);
}
@@ -222,6 +_,10 @@
@@ -180,6 +_,10 @@
this.f_93618_ = p_93675_;
}
@@ -20,7 +20,7 @@
public void m_93650_(float p_93651_) {
this.f_93625_ = p_93651_;
}
@@ -244,6 +_,19 @@
@@ -202,6 +_,19 @@
protected void m_93692_(boolean p_93693_) {
this.f_93616_ = p_93693_;
@@ -1,29 +0,0 @@
--- 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)BuiltInRegistries.f_256780_.m_7981_(entity.m_6095_())));
list.add(String.valueOf((Object)Registry.f_122826_.m_7981_(entity.m_6095_())));
+ entity.m_6095_().m_204041_().m_203616_().forEach(t -> list.add("#" + t.f_203868_()));
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
@@ -73,6 +_,8 @@
}
if (!optional.isPresent()) {
+ ConnectScreen.f_95683_.error("Couldn't connect to server: Unknown host \"{}\"", p_169266_.m_171863_());
+ net.minecraftforge.network.DualStackUtils.logInitialPreferences();
p_169265_.execute(() -> {
p_169265_.m_91152_(new DisconnectedScreen(ConnectScreen.this.f_95686_, CommonComponents.f_130661_, ConnectScreen.f_169260_));
});
@@ -0,0 +1,10 @@
--- 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
@@ -121,6 +_,7 @@
@@ -119,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));
}
@@ -130,6 +_,7 @@
@@ -128,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());
@@ -137,7 +_,6 @@
@@ -135,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)BuiltInRegistries.f_256818_.m_7981_(p_96202_));
f_96195_.warn("Failed to create screen for menu type: {}", (Object)Registry.f_122863_.m_7981_(p_96202_));
} else {
- screenconstructor.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_);
+ return java.util.Optional.of(screenconstructor);
@@ -1,9 +1,10 @@
--- a/net/minecraft/client/gui/screens/OptionsScreen.java
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java
@@ -168,6 +_,14 @@
super.m_86412_(p_96249_, p_96250_, p_96251_, p_96252_);
@@ -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_);
}
+
+ @Override
+ public void m_7379_() {
+ // We need to consider 2 potential parent screens here:
@@ -11,7 +12,4 @@
+ // 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());
}
@@ -0,0 +1,14 @@
--- a/net/minecraft/client/gui/screens/PauseScreen.java
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -77,9 +_,10 @@
this.f_96541_.m_91152_(new SocialInteractionsScreen());
}));
}
+ this.m_142416_(new Button(this.f_96543_ / 2 - 102, this.f_96544_ / 4 + 120 - 16, 204, 20, Component.m_237115_("fml.menu.mods"), modButton -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this))));
Component component = this.f_96541_.m_91090_() ? Component.m_237115_("menu.returnToMenu") : Component.m_237115_("menu.disconnect");
- this.m_142416_(new Button(this.f_96543_ / 2 - 102, this.f_96544_ / 4 + 120 + -16, 204, 20, component, (p_96315_) -> {
+ this.m_142416_(new Button(this.f_96543_ / 2 - 102, this.f_96544_ / 4 + 144 + -16, 204, 20, component, (p_96315_) -> {
boolean flag = this.f_96541_.m_91090_();
boolean flag1 = this.f_96541_.m_91294_();
p_96315_.f_93623_ = false;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/Screen.java
+++ b/net/minecraft/client/gui/screens/Screen.java
@@ -143,7 +_,7 @@
@@ -126,7 +_,7 @@
}
public void m_7379_() {
@@ -8,8 +8,8 @@
+ this.f_96541_.popGuiLayer();
}
protected <T extends GuiEventListener & Renderable & NarratableEntry> T m_142416_(T p_169406_) {
@@ -180,15 +_,29 @@
protected <T extends GuiEventListener & Widget & NarratableEntry> T m_142416_(T p_169406_) {
@@ -163,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_262809_(p_169389_, list, p_169392_, p_169393_, DefaultTooltipPositioner.f_262752_);
this.m_169383_(p_169389_, list, p_169392_, p_169393_);
}
@@ -201,24 +_,48 @@
@@ -184,20 +_,44 @@
}
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_262809_(p_96598_, components, p_96600_, p_96601_, DefaultTooltipPositioner.f_262752_);
+ this.m_169383_(p_96598_, components, p_96600_, p_96601_);
+ }
+ 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_262809_(poseStack, components, mouseX, mouseY, DefaultTooltipPositioner.f_262752_);
+ this.m_169383_(poseStack, components, mouseX, mouseY);
+ 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_262809_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_, DefaultTooltipPositioner.f_262752_);
this.m_169383_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_);
}
+ public void renderTooltip(PoseStack poseStack, List<? extends FormattedCharSequence> lines, int x, int y, Font font) {
@@ -77,68 +77,81 @@
+ this.tooltipFont = null;
+ }
+
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_);
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_);
+ if (preEvent.isCanceled()) return;
int i = 0;
int j = p_262990_.size() == 1 ? -2 : 0;
int j = p_169385_.size() == 1 ? -2 : 0;
for(ClientTooltipComponent clienttooltipcomponent : p_262990_) {
for(ClientTooltipComponent clienttooltipcomponent : p_169385_) {
- int k = clienttooltipcomponent.m_142069_(this.f_96547_);
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
if (k > i) {
i = k;
}
@@ -226,8 +_,8 @@
@@ -205,8 +_,8 @@
j += clienttooltipcomponent.m_142103_();
}
- 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 @@
- 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 @@
RenderSystem.m_157427_(GameRenderer::m_172811_);
bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_);
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 @@
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 @@
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);
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);
}
@@ -266,7 +_,7 @@
@@ -259,7 +_,7 @@
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);
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);
}
@@ -368,9 +_,19 @@
@@ -361,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 Renderable r)
+ this.f_169369_.add(r);
+ if (b instanceof Widget w)
+ this.f_169369_.add(w);
+ if (b instanceof NarratableEntry ne)
+ this.f_169368_.add(ne);
+ f_96540_.add(b);
@@ -152,7 +165,7 @@
}
protected void m_232761_() {
@@ -399,6 +_,7 @@
@@ -392,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);
@@ -160,7 +173,7 @@
} else {
this.m_96626_(p_96560_);
}
@@ -418,6 +_,7 @@
@@ -411,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_();
@@ -168,7 +181,7 @@
}
public boolean m_7043_() {
@@ -503,6 +_,10 @@
@@ -496,6 +_,10 @@
}
public void m_7400_(List<Path> p_96591_) {
@@ -8,7 +8,7 @@
public TitleScreen() {
this(false);
@@ -112,11 +_,15 @@
@@ -112,11 +_,16 @@
int j = this.f_96543_ - i - 2;
int k = 24;
int l = this.f_96544_ / 4 + 48;
@@ -17,31 +17,32 @@
this.m_96772_(l, 24);
} else {
this.m_96763_(l, 24);
+ 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_());
+ 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));
+ }));
}
+ 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_()));
@@ -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_) -> {
@@ -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_) -> {
this.m_96793_();
- }).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;
}, button$ontooltip))).f_93623_ = flag;
}
@Nullable
@@ -267,6 +_,7 @@
@@ -310,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_252880_((float)(this.f_96543_ / 2 + 90), 70.0F, 0.0F);
@@ -289,7 +_,14 @@
p_96739_.m_85837_((double)(this.f_96543_ / 2 + 90), 70.0D, 0.0D);
@@ -332,7 +_,14 @@
s = s + I18n.m_118938_("menu.modded");
}
@@ -57,11 +58,11 @@
for(GuiEventListener guieventlistener : this.m_6702_()) {
if (guieventlistener instanceof AbstractWidget) {
@@ -302,6 +_,7 @@
@@ -345,6 +_,7 @@
RenderSystem.m_69482_();
this.f_96726_.m_86412_(p_96739_, p_96740_, p_96741_, p_96742_);
this.f_96726_.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_);
+ if (f1 >= 1.0f) modUpdateNotification.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
}
}
@@ -8,7 +8,7 @@
public AdvancementsScreen(ClientAdvancements p_97340_) {
super(GameNarrator.f_93310_);
@@ -57,7 +_,15 @@
@@ -57,7 +_,13 @@
} else {
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true);
}
@@ -16,10 +16,8 @@
+ if (this.f_97335_.size() > AdvancementTabType.MAX_TABS) {
+ int guiLeft = (this.f_96543_ - 252) / 2;
+ int guiTop = (this.f_96544_ - 140) / 2;
+ 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_());
+ 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)));
+ maxPages = this.f_97335_.size() / AdvancementTabType.MAX_TABS;
+ }
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
@@ -50,7 +_,7 @@
@@ -51,7 +_,7 @@
}
protected int m_5756_() {
@@ -9,30 +9,34 @@
}
public int m_5759_() {
@@ -108,10 +_,11 @@
@@ -107,7 +_,7 @@
KeyEntry(final KeyMapping p_193916_, final Component p_193917_) {
this.f_193910_ = p_193916_;
this.f_193911_ = p_193917_;
this.f_193912_ = Button.m_253074_(p_193917_, (p_193939_) -> {
- 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_) -> {
KeyBindsList.this.f_193858_.f_193975_ = p_193916_;
- }).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_) -> {
}) {
protected MutableComponent m_5646_() {
@@ -115,6 +_,7 @@
}
};
this.f_193913_ = new Button(0, 0, 50, 20, 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_();
}).m_252987_(0, 0, 50, 20).m_252778_((p_253313_) -> {
@@ -123,7 +_,7 @@
}) {
@@ -128,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_.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_93620_ = p_193926_ + 190;
+ this.f_193913_.f_93620_ = p_193926_ + 190 + 20;
this.f_193913_.f_93621_ = p_193925_;
this.f_193913_.f_93623_ = !this.f_193910_.m_90864_();
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_193913_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_);
@@ -136,11 +_,12 @@
this.f_193912_.f_93621_ = 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
@@ -45,7 +49,7 @@
}
}
}
@@ -143,7 +_,7 @@
@@ -148,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) {
@@ -53,4 +57,4 @@
+ this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(keyCodeModifierConflict ? ChatFormatting.GOLD : ChatFormatting.RED));
}
this.f_193912_.m_86412_(p_193923_, p_193929_, p_193930_, p_193932_);
this.f_193912_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_);
@@ -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_(Button.m_253074_(Component.m_237115_("controls.resetAll"), (p_193999_) -> {
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_) -> {
for(KeyMapping keymapping : this.f_96282_.f_92059_) {
- keymapping.m_90848_(keymapping.m_90861_());
+ keymapping.setToDefault();
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -89,6 +_,7 @@
@@ -90,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_86412_(p_97795_, p_97796_, p_97797_, p_97798_);
super.m_6305_(p_97795_, p_97796_, p_97797_, p_97798_);
PoseStack posestack = RenderSystem.m_157191_();
@@ -110,11 +_,12 @@
@@ -111,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;
@@ -154,9 +_,13 @@
@@ -155,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_();
}
@@ -174,8 +_,10 @@
@@ -175,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;
}
@@ -285,7 +_,8 @@
@@ -286,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_;
@@ -296,6 +_,7 @@
@@ -297,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_;
@@ -321,7 +_,7 @@
@@ -322,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));
@@ -345,7 +_,7 @@
@@ -346,7 +_,7 @@
this.f_97717_ = 0;
} else if (p_97750_ == 1) {
this.f_97717_ = 1;
@@ -85,7 +85,7 @@
this.f_97717_ = 2;
}
}
@@ -414,10 +_,13 @@
@@ -415,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_;
@@ -431,7 +_,7 @@
@@ -432,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);
}
}
@@ -494,7 +_,7 @@
@@ -495,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));
@@ -541,34 +_,39 @@
@@ -542,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;
}
@@ -603,6 +_,18 @@
@@ -604,6 +_,18 @@
public T m_6262_() {
return this.f_97732_;
@@ -1,284 +1,257 @@
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
@@ -75,6 +_,8 @@
@@ -72,6 +_,8 @@
private Slot f_98512_;
private CreativeInventoryListener f_98513_;
private boolean f_98514_;
+ private static int tabPage = 0;
+ private int maxPages = 0;
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<>());
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 @@
@@ -231,6 +_,12 @@
protected void m_7856_() {
if (this.f_96541_.f_91072_.m_105290_()) {
super.m_7856_();
+ 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);
+ 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.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);
this.f_98510_.m_94182_(false);
@@ -318,7 +_,7 @@
@@ -272,7 +_,7 @@
public boolean m_5534_(char p_98521_, int p_98522_) {
if (this.f_98514_) {
return false;
- } else if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) {
+ } else if (!f_98507_.hasSearchBar()) {
- } else if (f_98507_ != CreativeModeTab.f_40754_.m_40775_()) {
+ } else if (!CreativeModeTab.f_40748_[f_98507_].hasSearchBar()) {
return false;
} else {
String s = this.f_98510_.m_94155_();
@@ -336,7 +_,7 @@
@@ -290,7 +_,7 @@
public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) {
this.f_98514_ = false;
- if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) {
+ if (!f_98507_.hasSearchBar()) {
- if (f_98507_ != CreativeModeTab.f_40754_.m_40775_()) {
+ if (!CreativeModeTab.f_40748_[f_98507_].hasSearchBar()) {
if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) {
this.f_98514_ = true;
this.m_98560_(CreativeModeTabs.m_258007_());
@@ -371,6 +_,7 @@
}
this.m_98560_(CreativeModeTab.f_40754_);
@@ -327,6 +_,32 @@
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_();
@@ -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_));
}
if (s.isEmpty()) {
for(Item item : Registry.f_122827_) {
@@ -371,9 +_,9 @@
(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_) {
if (f_98507_.m_40789_()) {
CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_];
- if (creativemodetab.m_40789_()) {
+ if (creativemodetab != null && creativemodetab.m_40789_()) {
RenderSystem.m_69461_();
- 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());
- 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());
}
}
@@ -426,7 +_,7 @@
double d0 = p_98531_ - (double)this.f_97735_;
@@ -384,7 +_,7 @@
double d1 = p_98532_ - (double)this.f_97736_;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98562_(creativemodetab, d0, d1)) {
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
- if (this.m_98562_(creativemodetab, d0, d1)) {
+ if (creativemodetab != null && this.m_98562_(creativemodetab, d0, d1)) {
return true;
}
@@ -447,7 +_,7 @@
double d1 = p_98623_ - (double)this.f_97736_;
}
@@ -405,7 +_,7 @@
this.f_98509_ = false;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98562_(creativemodetab, d0, d1)) {
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
- if (this.m_98562_(creativemodetab, d0, d1)) {
+ if (creativemodetab != null && this.m_98562_(creativemodetab, d0, d1)) {
this.m_98560_(creativemodetab);
return true;
@@ -465,6 +_,7 @@
}
@@ -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_();
}
private void m_98560_(CreativeModeTab p_98561_) {
CreativeModeTab creativemodetab = f_98507_;
f_98507_ = p_98561_;
+ if (p_98561_ == null) return;
int i = f_98507_;
f_98507_ = p_98561_.m_40775_();
+ slotColor = p_98561_.getSlotColor();
this.f_97737_.clear();
(this.f_97732_).f_98639_.clear();
this.m_238391_();
@@ -541,13 +_,15 @@
this.f_98511_ = null;
@@ -499,13 +_,15 @@
}
- 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_());
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_();
this.m_98630_();
} else {
@@ -604,7 +_,7 @@
this.m_98630_();
} else {
@@ -565,16 +_,34 @@
this.m_7333_(p_98577_);
super.m_86412_(p_98577_, p_98578_, p_98579_, p_98580_);
super.m_6305_(p_98577_, p_98578_, p_98579_, p_98580_);
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
- 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;
break;
}
@@ -614,6 +_,15 @@
}
+ 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_)) {
this.m_96602_(p_98577_, f_98506_, p_98578_, p_98579_);
}
+ 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;
+ 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;
+ }
+
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
this.m_7025_(p_98577_, p_98578_, p_98579_);
}
@@ -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 @@
@@ -609,7 +_,7 @@
list1.add(1, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
}
int i = 1;
- 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_];
- 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));
}
- 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);
}
}
- 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 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());
- 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_86412_(p_98572_, p_98574_, p_98575_, p_98573_);
this.f_98510_.m_6305_(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;
@@ -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, 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);
+ 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 (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) {
+ 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_);
@@ -684,7 +_,7 @@
@@ -650,6 +_,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;
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;
int k = 0;
int l = this.f_97735_ + this.m_258094_(p_98583_);
@@ -742,6 +_,7 @@
@@ -718,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, 26, 32);
this.m_93228_(p_98582_, l, i1, j, k, 28, 32);
this.f_96542_.f_115093_ = 100.0F;
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 @@
l += 6;
@@ -909,6 +_,22 @@
public boolean m_8010_(Player p_98665_) {
return this.f_98655_.m_8010_(p_98665_);
@@ -30,7 +30,7 @@
+ }
MobEffect mobeffect = mobeffectinstance.m_19544_();
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
RenderSystem.m_157456_(0, textureatlassprite.m_247685_());
RenderSystem.m_157456_(0, textureatlassprite.m_118414_().m_118330_());
@@ -108,6 +_,11 @@
int i = this.f_97736_;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -147,7 +_,7 @@
@@ -150,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);
@@ -186,10 +_,13 @@
@@ -189,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;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
@@ -99,6 +_,11 @@
@@ -100,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));
@@ -11,4 +11,4 @@
+ float f1 = angleYComponent;
PoseStack posestack = RenderSystem.m_157191_();
posestack.m_85836_();
posestack.m_252880_((float)p_98851_, (float)p_98852_, 1050.0F);
posestack.m_85837_((double)p_98851_, (double)p_98852_, 1050.0D);
@@ -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_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);
+ 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);
+ bufferSource.m_109911_();
RenderSystem.m_157427_(GameRenderer::m_172817_);
RenderSystem.m_157456_(0, f_99113_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
@@ -259,6 +_,11 @@
@@ -263,6 +_,11 @@
}
@@ -1,9 +1,9 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
@@ -130,7 +_,7 @@
@@ -137,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_));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
@@ -108,7 +_,7 @@
@@ -106,7 +_,7 @@
this.m_5674_();
this.f_100279_.clear();
@@ -9,7 +9,7 @@
this.f_100279_.add(new RecipeBookTabButton(recipebookcategories));
}
@@ -305,7 +_,7 @@
@@ -318,7 +_,7 @@
}
if (itemstack != null && this.f_100272_.f_91080_ != null) {
@@ -1,40 +1,39 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -113,7 +_,8 @@
@@ -112,7 +_,7 @@
public static void m_232896_(Minecraft p_232897_, @Nullable Screen p_232898_) {
m_232899_(p_232897_, f_232866_);
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_());
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_);
}, Util.m_183991_(), p_232897_);
p_232897_.m_18701_(completablefuture::isDone);
- p_232897_.m_91152_(new CreateWorldScreen(p_232898_, WorldDataConfiguration.f_244649_, new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty())));
- p_232897_.m_91152_(new CreateWorldScreen(p_232898_, DataPackConfig.f_45842_, 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 WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_), new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty()));
+ CreateWorldScreen createWorldScreen = new CreateWorldScreen(p_232898_, new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty()));
+ p_232897_.m_91152_(createWorldScreen);
+ createWorldScreen.m_100878_(packrepository);
}
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);
}
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);
}
@@ -612,6 +_,7 @@
if (path != null) {
@@ -653,6 +_,7 @@
File file1 = path.toFile();
if (this.f_100832_ == null) {
this.f_100832_ = ServerPacksSource.m_245786_(path);
this.f_100832_ = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource(), new FolderRepositorySource(file1, PackSource.f_10527_));
+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.server.ServerLifecycleHooks::buildPackFinder);
this.f_100832_.m_10506_();
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -158,13 +_,23 @@
@@ -132,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 = ServerPacksSource.m_247728_(levelstoragesource$levelstorageaccess);
PackRepository packrepository = m_233105_(levelstoragesource$levelstorageaccess);
WorldStem worldstem;
try {
@@ -22,20 +22,20 @@
+ pld.withConfirmedWarning(true);
+ }
} catch (Exception exception) {
f_233088_.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception);
f_233088_.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception);
this.f_233089_.m_91152_(new DatapackLoadFailureScreen(() -> {
@@ -177,7 +_,9 @@
@@ -151,7 +_,9 @@
WorldData worlddata = worldstem.f_206895_();
boolean flag = worlddata.m_246337_().m_247070_();
boolean flag = worlddata.m_5961_().m_64670_();
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_247489_().m_247400_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
this.f_233089_.m_91100_().m_235003_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
return true;
}).exceptionallyComposeAsync((p_233183_) -> {
@@ -199,9 +_,11 @@
@@ -173,9 +_,11 @@
return null;
});
} else {
@@ -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);
@@ -560,6 +_,21 @@
@@ -646,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_.isLifecycleExperimental()) {
+ if (this.f_101695_.isExperimental()) {
+ 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);
@@ -1,8 +1,8 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -313,6 +_,7 @@
WoodType.m_61843_().forEach((p_247864_) -> {
builder.put(ModelLayers.m_247439_(p_247864_), layerdefinition24);
@@ -293,6 +_,7 @@
WoodType.m_61843_().forEach((p_171114_) -> {
builder.put(ModelLayers.m_171291_(p_171114_), layerdefinition20);
});
+ 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
@@ -217,11 +_,13 @@
@@ -207,7 +_,8 @@
}
public static ModelLayerLocation m_171291_(WoodType p_171292_) {
@@ -9,10 +9,4 @@
+ 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_() {
@@ -1,11 +0,0 @@
--- 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_;
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
@@ -127,6 +_,7 @@
@@ -130,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_243717_, this.f_104523_, this.f_104519_.m_261007_().m_260825_(this.f_260722_, this.f_260612_)));
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_104523_, this.f_104519_.m_193590_()));
}
@@ -134,7 +_,7 @@
@@ -137,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 @@
}
}
@@ -155,6 +_,7 @@
@@ -158,6 +_,7 @@
}
public void m_7254_(ClientboundCustomQueryPacket p_104545_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientLevel.java
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
@@ -117,12 +_,15 @@
@@ -115,12 +_,15 @@
p_194170_.put(BiomeColors.f_108791_, new BlockTintCache((p_194168_) -> {
return this.m_104762_(p_194168_, BiomeColors.f_108791_);
}));
@@ -16,7 +16,7 @@
public void m_233651_(int p_233652_) {
this.f_233599_.m_233856_(p_233652_, this);
@@ -176,6 +_,8 @@
@@ -174,6 +_,8 @@
this.f_194123_ = p_205510_;
this.m_46465_();
this.m_46466_();
@@ -25,15 +25,15 @@
}
public void m_194171_(Runnable p_194172_) {
@@ -262,6 +_,7 @@
@@ -260,6 +_,7 @@
this.m_46473_().m_6521_(() -> {
return BuiltInRegistries.f_256780_.m_7981_(p_104640_.m_6095_()).toString();
return Registry.f_122826_.m_7981_(p_104640_.m_6095_()).toString();
});
+ if (p_104640_.canUpdate())
p_104640_.m_8119_();
this.m_46473_().m_7238_();
@@ -324,8 +_,10 @@
@@ -322,8 +_,10 @@
}
private void m_104739_(int p_104740_, Entity p_104741_) {
@@ -44,33 +44,33 @@
}
public void m_171642_(int p_171643_, Entity.RemovalReason p_171644_) {
@@ -452,6 +_,12 @@
@@ -450,6 +_,12 @@
}
public void m_262808_(@Nullable Player p_263381_, double p_263372_, double p_263404_, double p_263365_, Holder<SoundEvent> p_263335_, SoundSource p_263417_, float p_263416_, float p_263349_, long p_263408_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_263372_, p_263404_, p_263365_, p_263335_, p_263417_, p_263416_, p_263349_);
public void m_214150_(@Nullable Player p_233621_, double p_233622_, double p_233623_, double p_233624_, SoundEvent p_233625_, SoundSource p_233626_, float p_233627_, float p_233628_, long p_233629_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_233622_, p_233623_, p_233624_, p_233625_, p_233626_, p_233627_, p_233628_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_263335_ = event.getSound();
+ p_263417_ = event.getSource();
+ p_263416_ = event.getNewVolume();
+ p_263349_ = event.getNewPitch();
if (p_263381_ == this.f_104565_.f_91074_) {
this.m_233602_(p_263372_, p_263404_, p_263365_, p_263335_.m_203334_(), p_263417_, p_263416_, p_263349_, false, p_263408_);
+ p_233625_ = event.getSound();
+ p_233626_ = event.getSource();
+ p_233627_ = event.getNewVolume();
+ p_233628_ = event.getNewPitch();
if (p_233621_ == this.f_104565_.f_91074_) {
this.m_233602_(p_233622_, p_233623_, p_233624_, p_233625_, p_233626_, p_233627_, p_233628_, false, p_233629_);
}
@@ -459,6 +_,12 @@
@@ -457,6 +_,12 @@
}
public void m_213890_(@Nullable Player p_263514_, Entity p_263536_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
public void m_213890_(@Nullable Player p_233631_, Entity p_233632_, SoundEvent p_233633_, SoundSource p_233634_, float p_233635_, float p_233636_, long p_233637_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_233632_, p_233633_, p_233634_, p_233635_, p_233636_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_263518_ = event.getSound();
+ p_263487_ = event.getSource();
+ p_263538_ = event.getNewVolume();
+ p_263524_ = event.getNewPitch();
if (p_263514_ == this.f_104565_.f_91074_) {
this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_263518_.m_203334_(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_));
+ p_233633_ = event.getSound();
+ p_233634_ = event.getSource();
+ p_233635_ = event.getNewVolume();
+ p_233636_ = event.getNewPitch();
if (p_233631_ == this.f_104565_.f_91074_) {
this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_233633_, p_233634_, p_233635_, p_233636_, p_233632_, p_233637_));
}
@@ -907,6 +_,7 @@
@@ -902,6 +_,7 @@
}
public void m_104851_(Difficulty p_104852_) {
@@ -78,7 +78,7 @@
this.f_104840_ = p_104852_;
}
@@ -944,14 +_,46 @@
@@ -939,14 +_,46 @@
ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -398,6 +_,7 @@
@@ -375,6 +_,7 @@
this.f_104888_.f_91064_.m_113434_();
this.f_104888_.f_91074_.m_172530_();
@@ -8,15 +8,15 @@
int i = p_105030_.f_132360_();
this.f_104888_.f_91074_.m_20234_(i);
this.f_104889_.m_104630_(i, this.f_104888_.f_91074_);
@@ -410,6 +_,7 @@
@@ -387,6 +_,7 @@
this.f_104888_.f_91074_.m_219749_(p_105030_.f_238174_());
this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_());
this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_());
+ net.minecraftforge.network.NetworkHooks.sendMCRegistryPackets(f_104885_, "PLAY_TO_SERVER");
this.f_104888_.f_91066_.m_92172_();
this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.m_129629_())));
this.f_244346_ = new LastSeenMessagesTracker(20);
@@ -1003,8 +_,10 @@
this.f_104888_.m_91309_().m_90739_();
@@ -941,8 +_,10 @@
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
}
@@ -27,7 +27,7 @@
this.f_104889_.m_104630_(i, localplayer1);
localplayer1.m_146922_(-180.0F);
localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_);
@@ -1109,10 +_,7 @@
@@ -1046,10 +_,7 @@
PacketUtils.m_131363_(p_104976_, this, this.f_104888_);
BlockPos blockpos = p_104976_.m_131704_();
this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> {
@@ -39,18 +39,18 @@
if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) {
((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_();
@@ -1257,7 +_,9 @@
@@ -1194,7 +_,9 @@
public void m_7443_(ClientboundCommandsPacket p_104990_) {
PacketUtils.m_131363_(p_104990_, this, this.f_104888_);
- this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(CommandBuildContext.m_255418_(this.f_104903_.m_247579_(), this.f_244039_)));
+ var context = CommandBuildContext.m_255418_(this.f_104903_.m_247579_(), this.f_244039_);
- this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(new CommandBuildContext(this.f_104903_)));
+ var context = new CommandBuildContext(this.f_104903_);
+ this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(context));
+ this.f_104899_ = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.f_104899_, context);
}
public void m_7183_(ClientboundStopSoundPacket p_105116_) {
@@ -1276,6 +_,7 @@
@@ -1213,6 +_,7 @@
ClientRecipeBook clientrecipebook = this.f_104888_.f_91074_.m_108631_();
clientrecipebook.m_90625_(this.f_104900_.m_44051_());
this.f_104888_.m_231374_(SearchRegistry.f_119943_, clientrecipebook.m_90639_());
@@ -58,17 +58,15 @@
}
public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) {
@@ -1368,7 +_,8 @@
Blocks.m_50758_();
}
@@ -1314,6 +_,7 @@
- CreativeModeTabs.m_258007_().m_257466_();
+ CreativeModeTabs.m_257478_().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::m_257466_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.f_104903_.m_247579_(), true, f_104885_.m_129531_()));
this.f_104888_.m_231374_(SearchRegistry.f_119941_, nonnulllist);
this.f_104888_.m_231374_(SearchRegistry.f_119942_, nonnulllist);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.f_104903_, true, f_104885_.m_129531_()));
}
public void m_241155_(ClientboundUpdateEnabledFeaturesPacket p_251591_) {
@@ -1753,6 +_,7 @@
private <T> void m_205560_(ResourceKey<? extends Registry<? extends T>> p_205561_, TagNetworkSerialization.NetworkPayload p_205562_) {
@@ -1666,6 +_,7 @@
}
public void m_7413_(ClientboundCustomPayloadPacket p_105004_) {
@@ -76,7 +74,7 @@
PacketUtils.m_131363_(p_105004_, this, this.f_104888_);
ResourceLocation resourcelocation = p_105004_.m_132042_();
FriendlyByteBuf friendlybytebuf = null;
@@ -1950,7 +_,7 @@
@@ -1863,7 +_,7 @@
int j5 = friendlybytebuf.m_130242_();
this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, j5);
} else {
@@ -85,20 +83,3 @@
}
} finally {
if (friendlybytebuf != null) {
@@ -2284,6 +_,8 @@
}
public void m_246175_(String p_249888_) {
+ p_249888_ = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(p_249888_);
+ if (p_249888_.isEmpty()) return;
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_();
@@ -2292,6 +_,7 @@
}
public void m_246623_(String p_250092_) {
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_250092_)) return;
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_();
@@ -79,7 +79,7 @@
if (this.f_105193_ >= 1.0F) {
this.f_105196_ = false;
this.m_233729_(this.f_105189_.f_91073_, (p_233739_) -> {
@@ -247,7 +_,7 @@
@@ -263,7 +_,7 @@
}
public float m_105286_() {
@@ -88,7 +88,7 @@
}
public void m_105287_() {
@@ -264,7 +_,7 @@
@@ -280,7 +_,7 @@
ItemStack itemstack = this.f_105189_.f_91074_.m_21205_();
boolean flag = this.f_105192_.m_41619_() && itemstack.m_41619_();
if (!this.f_105192_.m_41619_() && !itemstack.m_41619_()) {
@@ -97,7 +97,7 @@
}
return p_105282_.equals(this.f_105191_) && flag;
@@ -296,25 +_,38 @@
@@ -312,20 +_,33 @@
private InteractionResult m_233746_(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
BlockPos blockpos = p_233749_.m_82425_();
ItemStack itemstack = p_233747_.m_21120_(p_233748_);
@@ -119,13 +119,8 @@
+ boolean flag = !p_233747_.m_21205_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_) || !p_233747_.m_21206_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_);
boolean flag1 = p_233747_.m_36341_() && flag;
- if (!flag1) {
BlockState blockstate = this.f_105189_.f_91073_.m_8055_(blockpos);
if (!this.f_105190_.m_246351_(blockstate.m_60734_().m_245183_())) {
return InteractionResult.FAIL;
}
+ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) {
InteractionResult interactionresult = blockstate.m_60664_(this.f_105189_.f_91073_, p_233747_, p_233748_, p_233749_);
InteractionResult interactionresult = this.f_105189_.f_91073_.m_8055_(blockpos).m_60664_(this.f_105189_.f_91073_, p_233747_, p_233748_, p_233749_);
if (interactionresult.m_19077_()) {
return interactionresult;
}
@@ -140,7 +135,7 @@
InteractionResult interactionresult1;
if (this.f_105197_.m_46408_()) {
int i = itemstack.m_41613_();
@@ -345,10 +_,17 @@
@@ -356,10 +_,17 @@
mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket;
} else {
@@ -158,7 +153,7 @@
}
mutableobject.setValue(interactionresultholder.m_19089_());
@@ -387,6 +_,9 @@
@@ -398,6 +_,9 @@
this.m_105297_();
Vec3 vec3 = p_105233_.m_82450_().m_82492_(p_105232_.m_20185_(), p_105232_.m_20186_(), p_105232_.m_20189_());
this.f_105190_.m_104955_(ServerboundInteractPacket.m_179612_(p_105232_, p_105231_.m_6144_(), p_105234_, vec3));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/PlayerInfo.java
+++ b/net/minecraft/client/multiplayer/PlayerInfo.java
@@ -74,6 +_,7 @@
@@ -82,6 +_,7 @@
}
protected void m_105317_(GameType p_105318_) {
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/multiplayer/ProfileKeyPairManager.java
+++ b/net/minecraft/client/multiplayer/ProfileKeyPairManager.java
@@ -76,6 +_,8 @@
this.m_233776_(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_243348_ != UserApiService.OFFLINE)
f_233765_.error("Failed to retrieve profile key pair", (Throwable)ioexception);
this.m_233776_((ProfileKeyPair)null);
return p_243401_;
@@ -1,8 +1,8 @@
--- a/net/minecraft/client/multiplayer/ServerData.java
+++ b/net/minecraft/client/multiplayer/ServerData.java
@@ -26,6 +_,7 @@
private String f_105372_;
private boolean f_105373_;
@@ -36,6 +_,7 @@
private ServerData.ChatPreview f_233800_;
private boolean f_233801_ = true;
private boolean f_242950_;
+ public net.minecraftforge.client.ExtendedServerListData forgeData = null;
@@ -1,32 +1,41 @@
--- a/net/minecraft/client/multiplayer/chat/ChatListener.java
+++ b/net/minecraft/client/multiplayer/chat/ChatListener.java
@@ -104,7 +_,9 @@
Instant instant = Instant.now();
this.m_246163_((MessageSignature)null, () -> {
Component component = p_251256_.m_240977_(p_250375_);
- this.f_240348_.f_91065_.m_93076_().m_93785_(component);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_251256_, component, Util.f_137441_);
+ if (forgeComponent == null) return false;
+ this.f_240348_.f_91065_.m_93076_().m_93785_(forgeComponent);
this.m_241119_(p_251256_, p_250375_);
this.m_240498_(component, instant);
this.f_240659_ = Util.m_137550_();
@@ -121,12 +_,16 @@
MessageSignature messagesignature = p_249430_.f_244279_();
FilterMask filtermask = p_249430_.f_242992_();
@@ -175,12 +_,16 @@
MessageSignature messagesignature = p_242317_.f_240893_();
FilterMask filtermask = p_242317_.f_242992_();
if (filtermask.m_243095_()) {
- this.f_240348_.f_91065_.m_93076_().m_240964_(p_249231_, messagesignature, guimessagetag);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(p_251766_, p_249231_, p_249430_, p_249430_.m_245167_());
- this.f_240348_.f_91065_.m_93076_().m_240964_(p_243337_, messagesignature, guimessagetag);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_242290_, p_243337_, p_242317_, p_242317_.m_241067_());
+ if (forgeComponent == null) return false;
+ this.f_240348_.f_91065_.m_93076_().m_240964_(forgeComponent, messagesignature, guimessagetag);
this.m_241119_(p_251766_, p_249430_.m_245692_());
this.m_241119_(p_242290_, p_242317_.m_237220_());
} else {
Component component = filtermask.m_246134_(p_249430_.m_245728_());
Component component = filtermask.m_243081_(p_242317_.m_241775_());
if (component != null) {
- this.f_240348_.f_91065_.m_93076_().m_240964_(p_251766_.m_240977_(component), messagesignature, guimessagetag);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(p_251766_, p_251766_.m_240977_(component), p_249430_, p_249430_.m_245167_());
- this.f_240348_.f_91065_.m_93076_().m_240964_(p_242290_.m_240977_(component), messagesignature, guimessagetag);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_242290_, p_242290_.m_240977_(component), p_242317_, p_242317_.m_241067_());
+ if (forgeComponent == null) return false;
+ this.f_240348_.f_91065_.m_93076_().m_240964_(forgeComponent, messagesignature, guimessagetag);
this.m_241119_(p_251766_, component);
this.m_241119_(p_242290_, component);
}
}
@@ -194,7 +_,9 @@
}
boolean m_241171_(ChatType.Bound p_241518_, PlayerChatMessage p_241542_, Component p_241510_) {
- this.f_240348_.f_91065_.m_93076_().m_93785_(p_241510_);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_241518_, p_241510_, p_241542_, p_241542_.m_241067_());
+ if (forgeComponent == null) return false;
+ this.f_240348_.f_91065_.m_93076_().m_93785_(forgeComponent);
this.m_241119_(p_241518_, p_241542_.m_237220_());
this.m_240498_(p_241510_, p_241542_.m_241109_());
this.f_240659_ = Util.m_137550_();
@@ -263,6 +_,8 @@
public void m_240494_(Component p_240522_, boolean p_240642_) {
if (!this.f_240348_.f_91066_.m_231833_().m_231551_() || !this.f_240348_.m_91246_(this.m_240473_(p_240522_))) {
+ p_240522_ = net.minecraftforge.client.ForgeHooksClient.onClientSystemChat(p_240522_, p_240642_);
+ if (p_240522_ == null) return;
if (p_240642_) {
this.f_240348_.f_91065_.m_93063_(p_240522_, false);
} else {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/particle/ParticleEngine.java
+++ b/net/minecraft/client/particle/ParticleEngine.java
@@ -74,11 +_,11 @@
@@ -63,11 +_,11 @@
private static final int f_172264_ = 16384;
private static final List<ParticleRenderType> f_107288_ = ImmutableList.of(ParticleRenderType.f_107429_, ParticleRenderType.f_107430_, ParticleRenderType.f_107432_, ParticleRenderType.f_107431_, ParticleRenderType.f_107433_);
protected ClientLevel f_107287_;
@@ -14,37 +14,37 @@
private final Queue<Particle> f_107294_ = Queues.newArrayDeque();
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> f_107295_ = Maps.newHashMap();
private final TextureAtlas f_107296_;
@@ -188,14 +_,18 @@
@@ -177,14 +_,18 @@
this.m_107378_(ParticleTypes.f_235901_, ShriekParticle.Provider::new);
}
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */
+ @Deprecated
public <T extends ParticleOptions> void m_107381_(ParticleType<T> p_107382_, ParticleProvider<T> p_107383_) {
- this.f_107293_.put(BuiltInRegistries.f_257034_.m_7447_(p_107382_), p_107383_);
+ this.f_107293_.put(BuiltInRegistries.f_257034_.m_7981_(p_107382_), p_107383_);
- this.f_107293_.put(Registry.f_122829_.m_7447_(p_107382_), p_107383_);
+ this.f_107293_.put(Registry.f_122829_.m_7981_(p_107382_), p_107383_);
}
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */
+ @Deprecated
public <T extends ParticleOptions> void m_107378_(ParticleType<T> p_107379_, ParticleEngine.SpriteParticleRegistration<T> p_107380_) {
ParticleEngine.MutableSpriteSet particleengine$mutablespriteset = new ParticleEngine.MutableSpriteSet();
this.f_107295_.put(BuiltInRegistries.f_257034_.m_7981_(p_107379_), particleengine$mutablespriteset);
- this.f_107293_.put(BuiltInRegistries.f_257034_.m_7447_(p_107379_), p_107380_.m_107419_(particleengine$mutablespriteset));
+ this.f_107293_.put(BuiltInRegistries.f_257034_.m_7981_(p_107379_), p_107380_.m_107419_(particleengine$mutablespriteset));
this.f_107295_.put(Registry.f_122829_.m_7981_(p_107379_), particleengine$mutablespriteset);
- this.f_107293_.put(Registry.f_122829_.m_7447_(p_107379_), p_107380_.m_107419_(particleengine$mutablespriteset));
+ this.f_107293_.put(Registry.f_122829_.m_7981_(p_107379_), p_107380_.m_107419_(particleengine$mutablespriteset));
}
public CompletableFuture<Void> m_5540_(PreparableReloadListener.PreparationBarrier p_107305_, ResourceManager p_107306_, ProfilerFiller p_107307_, ProfilerFiller p_107308_, Executor p_107309_, Executor p_107310_) {
@@ -313,7 +_,7 @@
@@ -288,7 +_,7 @@
@Nullable
private <T extends ParticleOptions> Particle m_107395_(T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_) {
- ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.f_107293_.get(BuiltInRegistries.f_257034_.m_7447_(p_107396_.m_6012_()));
+ ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.f_107293_.get(BuiltInRegistries.f_257034_.m_7981_(p_107396_.m_6012_()));
- ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.f_107293_.get(Registry.f_122829_.m_7447_(p_107396_.m_6012_()));
+ ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.f_107293_.get(Registry.f_122829_.m_7981_(p_107396_.m_6012_()));
return particleprovider == null ? null : particleprovider.m_6966_(p_107396_, this.f_107287_, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
}
@@ -394,15 +_,25 @@
@@ -369,15 +_,25 @@
}
}
@@ -62,7 +62,7 @@
+ RenderSystem.m_69388_(org.lwjgl.opengl.GL13.GL_TEXTURE0);
PoseStack posestack = RenderSystem.m_157191_();
posestack.m_85836_();
posestack.m_252931_(p_107337_.m_85850_().m_252922_());
posestack.m_166854_(p_107337_.m_85850_().m_85861_());
RenderSystem.m_157182_();
- for(ParticleRenderType particlerendertype : f_107288_) {
@@ -71,7 +71,7 @@
Iterable<Particle> iterable = this.f_107289_.get(particlerendertype);
if (iterable != null) {
RenderSystem.m_157427_(GameRenderer::m_172829_);
@@ -412,6 +_,7 @@
@@ -387,6 +_,7 @@
particlerendertype.m_6505_(bufferbuilder, this.f_107291_);
for(Particle particle : iterable) {
@@ -79,16 +79,16 @@
try {
particle.m_5744_(bufferbuilder, p_107340_, p_107341_);
} catch (Throwable throwable) {
@@ -441,7 +_,7 @@
@@ -417,7 +_,7 @@
}
public void m_107355_(BlockPos p_107356_, BlockState p_107357_) {
- if (!p_107357_.m_60795_() && p_107357_.m_245147_()) {
- if (!p_107357_.m_60795_()) {
+ if (!p_107357_.m_60795_() && !net.minecraftforge.client.extensions.common.IClientBlockExtensions.of(p_107357_).addDestroyEffects(p_107357_, this.f_107287_, p_107356_, this)) {
VoxelShape voxelshape = p_107357_.m_60808_(this.f_107287_, p_107356_);
double d0 = 0.25D;
voxelshape.m_83286_((p_172273_, p_172274_, p_172275_, p_172276_, p_172277_, p_172278_) -> {
@@ -461,7 +_,7 @@
@@ -437,7 +_,7 @@
double d7 = d4 * d1 + p_172273_;
double d8 = d5 * d2 + p_172274_;
double d9 = d6 * d3 + p_172275_;
@@ -97,7 +97,7 @@
}
}
}
@@ -505,12 +_,18 @@
@@ -481,12 +_,18 @@
d0 = (double)i + aabb.f_82291_ + (double)0.1F;
}
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/particle/VibrationSignalParticle.java
+++ b/net/minecraft/client/particle/VibrationSignalParticle.java
@@ -105,6 +_,7 @@
@@ -100,6 +_,7 @@
this.f_107212_ = Mth.m_14139_(d0, this.f_107212_, vec3.m_7096_());
this.f_107213_ = Mth.m_14139_(d0, this.f_107213_, vec3.m_7098_());
this.f_107214_ = Mth.m_14139_(d0, this.f_107214_, vec3.m_7094_());
+ this.m_107264_(this.f_107212_, this.f_107213_, this.f_107214_); // FORGE: Update the particle's bounding box
double d1 = this.f_107212_ - vec3.m_7096_();
double d2 = this.f_107213_ - vec3.m_7098_();
double d3 = this.f_107214_ - vec3.m_7094_();
+ this.m_107264_(this.f_107212_, this.f_107213_, this.f_107214_); // FORGE: update the particle's bounding box
this.f_172460_ = this.f_172462_;
this.f_172462_ = (float)Mth.m_14136_(this.f_107212_ - vec3.m_7096_(), this.f_107214_ - vec3.m_7094_());
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/AbstractClientPlayer.java
+++ b/net/minecraft/client/player/AbstractClientPlayer.java
@@ -136,6 +_,6 @@
@@ -137,6 +_,6 @@
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/LocalPlayer.java
+++ b/net/minecraft/client/player/LocalPlayer.java
@@ -150,6 +_,7 @@
@@ -162,6 +_,7 @@
}
public boolean m_6469_(DamageSource p_108662_, float p_108663_) {
@@ -8,15 +8,31 @@
return false;
}
@@ -462,7 +_,14 @@
@@ -289,6 +_,8 @@
}
public void m_240287_(String p_240288_, @Nullable Component p_240289_) {
+ p_240288_ = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(p_240288_);
+ if (p_240288_.isEmpty()) return;
this.m_240966_(p_240288_, p_240289_);
}
@@ -333,6 +_,7 @@
}
private void m_241110_(String p_241331_, @Nullable Component p_241563_) {
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_241331_)) return;
ParseResults<SharedSuggestionProvider> parseresults = this.f_108617_.m_105146_().parse(p_241331_, this.f_108617_.m_105137_());
MessageSigner messagesigner = this.m_241001_();
LastSeenMessages.Update lastseenmessages$update = this.f_108617_.m_241918_();
@@ -547,7 +_,13 @@
}
public void m_5496_(SoundEvent p_108651_, float p_108652_, float p_108653_) {
- this.f_19853_.m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, this.m_5720_(), p_108652_, p_108653_, false);
+ net.minecraft.core.Holder<SoundEvent> holder = net.minecraft.core.registries.BuiltInRegistries.f_256894_.m_263177_(p_108651_);
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, holder, this.m_5720_(), p_108652_, p_108653_);
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_108651_, this.m_5720_(), p_108652_, p_108653_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_108651_ = event.getSound().get();
+ p_108651_ = event.getSound();
+ SoundSource source = event.getSource();
+ p_108652_ = event.getNewVolume();
+ p_108653_ = event.getNewPitch();
@@ -24,7 +40,7 @@
}
public void m_6330_(SoundEvent p_108655_, SoundSource p_108656_, float p_108657_, float p_108658_) {
@@ -634,6 +_,7 @@
@@ -703,6 +_,7 @@
this.f_108601_ = !this.m_150110_().f_35935_ && !this.m_6069_() && this.m_20175_(Pose.CROUCHING) && (this.m_6144_() || !this.m_5803_() && !this.m_20175_(Pose.STANDING));
float f = Mth.m_14036_(0.3F + EnchantmentHelper.m_220302_(this), 0.0F, 1.0F);
this.f_108618_.m_214106_(this.m_108635_(), f);
@@ -32,16 +48,16 @@
this.f_108619_.m_91301_().m_120586_(this.f_108618_);
if (this.m_6117_() && !this.m_20159_()) {
this.f_108618_.f_108566_ *= 0.2F;
@@ -660,7 +_,7 @@
@@ -729,7 +_,7 @@
}
boolean flag4 = this.m_255269_();
- if ((this.f_19861_ || this.m_5842_() || this.m_20159_() && this.m_20202_().m_20096_()) && !flag1 && !flag2 && this.m_108733_() && !this.m_20142_() && flag4 && !this.m_6117_() && !this.m_21023_(MobEffects.f_19610_)) {
+ if ((this.f_19861_ || this.m_5842_() || this.m_20159_() && this.m_20202_().m_20096_() || this.canStartSwimming()) && !flag1 && !flag2 && this.m_108733_() && !this.m_20142_() && flag4 && !this.m_6117_() && !this.m_21023_(MobEffects.f_19610_)) {
boolean flag4 = (float)this.m_36324_().m_38702_() > 6.0F || this.m_150110_().f_35936_;
- if ((this.f_19861_ || this.m_5842_()) && !flag1 && !flag2 && this.m_108733_() && !this.m_20142_() && flag4 && !this.m_6117_() && !this.m_21023_(MobEffects.f_19610_)) {
+ if ((this.f_19861_ || this.m_5842_() || this.canStartSwimming()) && !flag1 && !flag2 && this.m_108733_() && !this.m_20142_() && flag4 && !this.m_6117_() && !this.m_21023_(MobEffects.f_19610_)) {
if (this.f_108583_ <= 0 && !this.f_108619_.f_91066_.f_92091_.m_90857_()) {
this.f_108583_ = 7;
} else {
@@ -668,15 +_,15 @@
@@ -737,15 +_,15 @@
}
}
@@ -60,7 +76,7 @@
this.m_6858_(false);
}
} else if (flag6) {
@@ -706,14 +_,15 @@
@@ -775,14 +_,15 @@
if (this.f_108618_.f_108572_ && !flag7 && !flag && !this.m_150110_().f_35935_ && !this.m_20159_() && !this.m_6147_()) {
ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST);
@@ -79,7 +95,7 @@
}
if (this.m_204029_(FluidTags.f_13131_)) {
@@ -824,6 +_,7 @@
@@ -893,6 +_,7 @@
public void m_6083_() {
super.m_6083_();
@@ -87,7 +103,7 @@
this.f_108611_ = false;
if (this.m_20202_() instanceof Boat) {
Boat boat = (Boat)this.m_20202_();
@@ -1041,6 +_,18 @@
@@ -1106,6 +_,18 @@
} else {
return super.m_7398_(p_108758_);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/RemotePlayer.java
+++ b/net/minecraft/client/player/RemotePlayer.java
@@ -28,6 +_,7 @@
@@ -30,6 +_,7 @@
}
public boolean m_6469_(DamageSource p_108772_, float p_108773_) {
@@ -10,7 +10,7 @@
this.f_108932_ = p_108942_;
Resource resource = p_108941_.m_215593_(resourcelocation);
@@ -150,7 +_,8 @@
@@ -168,7 +_,8 @@
} else {
EffectProgram effectprogram;
if (program == null) {
@@ -18,5 +18,5 @@
+ ResourceLocation rl = ResourceLocation.m_135820_(p_172569_);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.m_135827_(), "shaders/program/" + rl.m_135815_() + p_172568_.m_85569_());
Resource resource = p_172567_.m_215593_(resourcelocation);
InputStream inputstream = resource.m_215507_();
try (InputStream inputstream = resource.m_215507_()) {
@@ -6,9 +6,9 @@
+ Vector3f fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(p_109019_, p_109020_, p_109021_, p_109022_, p_109023_, f_109010_, f_109011_, f_109012_);
+
+ f_109010_ = fogColor.x();
+ f_109011_ = fogColor.y();
+ f_109012_ = fogColor.z();
+ f_109010_ = fogColor.m_122239_();
+ f_109011_ = fogColor.m_122260_();
+ f_109012_ = fogColor.m_122269_();
+
RenderSystem.m_69424_(f_109010_, f_109011_, f_109012_, 0.0F);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/GameRenderer.java
+++ b/net/minecraft/client/renderer/GameRenderer.java
@@ -299,6 +_,8 @@
@@ -290,6 +_,8 @@
this.m_109128_(new ResourceLocation("shaders/post/spider.json"));
} else if (p_109107_ instanceof EnderMan) {
this.m_109128_(new ResourceLocation("shaders/post/invert.json"));
@@ -9,15 +9,15 @@
}
}
@@ -586,6 +_,7 @@
list1.add(Pair.of(new ShaderInstance(p_250719_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_234230_) -> {
@@ -549,6 +_,7 @@
list1.add(Pair.of(new ShaderInstance(p_172768_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_234230_) -> {
f_172607_ = p_234230_;
}));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterShadersEvent(p_250719_, list1));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterShadersEvent(p_172768_, list1));
} catch (IOException ioexception) {
list1.forEach((p_172729_) -> {
p_172729_.getFirst().close();
@@ -667,19 +_,21 @@
@@ -630,19 +_,21 @@
boolean flag = false;
int i = 3;
double d1 = d0;
@@ -42,7 +42,7 @@
d1 = this.f_109059_.f_91077_.m_82450_().m_82557_(vec3);
}
@@ -694,7 +_,7 @@
@@ -657,7 +_,7 @@
Entity entity1 = entityhitresult.m_82443_();
Vec3 vec33 = entityhitresult.m_82450_();
double d2 = vec3.m_82557_(vec33);
@@ -51,7 +51,7 @@
this.f_109059_.f_91077_ = BlockHitResult.m_82426_(vec33, Direction.m_122366_(vec31.f_82479_, vec31.f_82480_, vec31.f_82481_), new BlockPos(vec33));
} else if (d2 < d1 || this.f_109059_.f_91077_ == null) {
this.f_109059_.f_91077_ = entityhitresult;
@@ -748,7 +_,7 @@
@@ -711,7 +_,7 @@
d0 *= Mth.m_14139_(this.f_109059_.f_91066_.m_231925_().m_231551_(), 1.0D, (double)0.85714287F);
}
@@ -60,43 +60,44 @@
}
}
@@ -883,11 +_,11 @@
@@ -848,11 +_,11 @@
Window window = this.f_109059_.m_91268_();
RenderSystem.m_69421_(256, Minecraft.f_91002_);
- Matrix4f matrix4f = (new Matrix4f()).setOrtho(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), (float)((double)window.m_85442_() / window.m_85449_()), 0.0F, 1000.0F, 3000.0F);
+ Matrix4f matrix4f = (new Matrix4f()).setOrtho(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), (float)((double)window.m_85442_() / window.m_85449_()), 0.0F, 1000.0F, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_252934_(matrix4f);
- Matrix4f matrix4f = Matrix4f.m_162203_(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), 0.0F, (float)((double)window.m_85442_() / window.m_85449_()), 1000.0F, 3000.0F);
+ Matrix4f matrix4f = Matrix4f.m_162203_(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), 0.0F, (float)((double)window.m_85442_() / window.m_85449_()), 1000.0F, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_157425_(matrix4f);
PoseStack posestack = RenderSystem.m_157191_();
posestack.m_166856_();
- posestack.m_252880_(0.0F, 0.0F, -2000.0F);
- posestack.m_85837_(0.0D, 0.0D, -2000.0D);
+ posestack.m_85837_(0.0D, 0.0D, 1000F-net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_157182_();
Lighting.m_84931_();
PoseStack posestack1 = new PoseStack();
@@ -923,7 +_,7 @@
@@ -888,7 +_,7 @@
}
} else if (this.f_109059_.f_91080_ != null) {
try {
- this.f_109059_.f_91080_.m_257612_(posestack1, i, j, this.f_109059_.m_91297_());
- this.f_109059_.f_91080_.m_6305_(posestack1, i, j, this.f_109059_.m_91297_());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.f_109059_.f_91080_, posestack1, i, j, this.f_109059_.m_91297_());
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.m_127521_(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.m_127514_("Screen render details");
@@ -1068,12 +_,19 @@
Matrix4f matrix4f = posestack.m_85850_().m_252922_();
this.m_252879_(matrix4f);
@@ -1047,6 +_,11 @@
Matrix4f matrix4f = posestack.m_85850_().m_85861_();
this.m_109111_(matrix4f);
camera.m_90575_(this.f_109059_.f_91073_, (Entity)(this.f_109059_.m_91288_() == null ? this.f_109059_.f_91074_ : this.f_109059_.m_91288_()), !this.f_109059_.f_91066_.m_92176_().m_90612_(), this.f_109059_.f_91066_.m_92176_().m_90613_(), p_109090_);
+
+ net.minecraftforge.client.event.ViewportEvent.ComputeCameraAngles cameraSetup = net.minecraftforge.client.ForgeHooksClient.onCameraSetup(this, camera, p_109090_);
+ camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch());
+ p_109092_.m_252781_(Axis.f_252403_.m_252977_(cameraSetup.getRoll()));
+ p_109092_.m_85845_(Vector3f.f_122227_.m_122240_(cameraSetup.getRoll()));
+
p_109092_.m_252781_(Axis.f_252529_.m_252977_(camera.m_90589_()));
p_109092_.m_252781_(Axis.f_252436_.m_252977_(camera.m_90590_() + 180.0F));
Matrix3f matrix3f = (new Matrix3f(p_109092_.m_85850_().m_252943_())).invert();
RenderSystem.m_253212_(matrix3f);
this.f_109059_.f_91060_.m_253210_(p_109092_, camera.m_90583_(), this.m_253088_(Math.max(d0, (double)this.f_109059_.f_91066_.m_231837_().m_231551_().intValue())));
p_109092_.m_85845_(Vector3f.f_122223_.m_122240_(camera.m_90589_()));
p_109092_.m_85845_(Vector3f.f_122225_.m_122240_(camera.m_90590_() + 180.0F));
Matrix3f matrix3f = p_109092_.m_85850_().m_85864_().m_8183_();
@@ -1056,6 +_,8 @@
this.f_109059_.f_91060_.m_172961_(p_109092_, camera.m_90583_(), this.m_172716_(Math.max(d0, (double)this.f_109059_.f_91066_.m_231837_().m_231551_().intValue())));
this.f_109059_.f_91060_.m_109599_(p_109092_, p_109090_, p_109091_, flag, camera, this, this.f_109074_, matrix4f);
+ this.f_109059_.m_91307_().m_6182_("forge_render_last");
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(this.f_109059_.f_91060_, p_109092_, p_109090_, matrix4f, p_109091_);
Loaded 100 of 808 files, more files were not shown because too many files have changed in this diff. Show more