mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
617ecb7ad3 | ||
|
|
dd8239c255 | ||
|
|
bdddc8c5d4 | ||
|
|
c1c619a109 | ||
|
|
f7eea35cb9 | ||
|
|
a2434e1607 | ||
|
|
b806ecd0ff | ||
|
|
8358b800e9 | ||
|
|
b25a092cf1 | ||
|
|
d812fdd0a3 | ||
|
|
2d3ee8a228 | ||
|
|
97a9ca65f1 | ||
|
|
f043fbbc51 | ||
|
|
a19ab3a8d4 | ||
|
|
bc0517a404 | ||
|
|
dc9c0d7e35 | ||
|
|
1a2207b3b2 | ||
|
|
84ab9764e3 | ||
|
|
bef68991f0 | ||
|
|
526c13d662 | ||
|
|
67ffb78c23 | ||
|
|
8f407c3a22 | ||
|
|
8980252e16 | ||
|
|
3baee80485 | ||
|
|
ca9599bb4d | ||
|
|
051db7907a | ||
|
|
bdba5ef2d3 | ||
|
|
838b9c0eda | ||
|
|
be584c54aa | ||
|
|
1b3640b42d | ||
|
|
be5dab5801 | ||
|
|
aae628cd18 | ||
|
|
e7bd08649f | ||
|
|
e1017a4c7e | ||
|
|
6f8ba9d295 | ||
|
|
ac94478ae7 | ||
|
|
515c6082e0 | ||
|
|
a753598113 | ||
|
|
bc6c4be4e4 | ||
|
|
98823a8f07 | ||
|
|
ecd8f1e54d | ||
|
|
b0caea8e20 | ||
|
|
e0477f8776 | ||
|
|
94e1e54b53 | ||
|
|
9ce72331b7 | ||
|
|
1c31f42dae | ||
|
|
0978a94358 | ||
|
|
e956a9c9f3 | ||
|
|
82026d11a4 | ||
|
|
6d233ac75c | ||
|
|
73c1934e7e | ||
|
|
bf1194ec75 | ||
|
|
22d2740725 | ||
|
|
02f26dc7a1 | ||
|
|
db14cbb0e0 | ||
|
|
a2b35cae92 | ||
|
|
aab0e4c82e | ||
|
|
6609708d14 | ||
|
|
ed198f062c | ||
|
|
4e2d656e9d | ||
|
|
2a4230868f | ||
|
|
cf778b1759 | ||
|
|
1b6daddd40 | ||
|
|
d7b137d144 | ||
|
|
b5d5855559 | ||
|
|
c0aa8dd808 | ||
|
|
4f2f5c02a0 | ||
|
|
7a6843fa4a | ||
|
|
f0ecf16c6b | ||
|
|
8998fa71b2 | ||
|
|
4e677a7558 | ||
|
|
07254b36d7 | ||
|
|
a51b8d256d | ||
|
|
75fcd9448e | ||
|
|
6b45999702 | ||
|
|
a4f52f4057 | ||
|
|
b8b3201372 | ||
|
|
41deadc1e2 | ||
|
|
82e8d06e54 | ||
|
|
51db5f2ff7 | ||
|
|
2ec9e515ff | ||
|
|
0579572148 | ||
|
|
83f4e6353c | ||
|
|
130953e519 | ||
|
|
7981093591 | ||
|
|
79112d6208 | ||
|
|
a3eb6263f4 | ||
|
|
d91bc9c73d | ||
|
|
c807665ab9 |
No files matched your search
@@ -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' }}
|
||||||
Vendored
+73
-1
@@ -1,5 +1,7 @@
|
|||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues
|
import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues
|
||||||
|
import jetbrains.buildServer.configs.kotlin.*
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The settings script is an entry point for defining a TeamCity
|
The settings script is an entry point for defining a TeamCity
|
||||||
@@ -30,11 +32,13 @@ project {
|
|||||||
buildType(Build)
|
buildType(Build)
|
||||||
buildType(BuildSecondaryBranches)
|
buildType(BuildSecondaryBranches)
|
||||||
buildType(PullRequests)
|
buildType(PullRequests)
|
||||||
|
buildType(PullRequestChecks)
|
||||||
|
buildType(PullRequestCompatibility)
|
||||||
|
|
||||||
params {
|
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_jdk_version", "17", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||||
text("docker_gradle_version", "7.4", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
text("docker_gradle_version", "7.4", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||||
text("git_main_branch", "1.18.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
text("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", """
|
text("git_branch_spec", """
|
||||||
+:refs/heads/(main*)
|
+:refs/heads/(main*)
|
||||||
+:refs/heads/(master*)
|
+:refs/heads/(master*)
|
||||||
@@ -134,3 +138,71 @@ object PullRequests : BuildType({
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
object PullRequestChecks : BuildType({
|
||||||
|
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
|
||||||
|
id("MinecraftForge_MinecraftForge__PullRequestChecks")
|
||||||
|
name = "Pull Requests (Checks)"
|
||||||
|
description = "Checks pull requests for the project"
|
||||||
|
|
||||||
|
steps {
|
||||||
|
gradle {
|
||||||
|
name = "Check"
|
||||||
|
id = "RUNNER_10_Check"
|
||||||
|
|
||||||
|
tasks = "checkAll"
|
||||||
|
gradleParams = "--continue %gradle_custom_args%"
|
||||||
|
enableStacktrace = true
|
||||||
|
dockerImage = "%docker_gradle_image%"
|
||||||
|
dockerRunParameters = """
|
||||||
|
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
|
||||||
|
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
|
||||||
|
--network=host
|
||||||
|
-u 1000:1000
|
||||||
|
%docker_additional_args%
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vcs {
|
||||||
|
branchFilter = """
|
||||||
|
+:*
|
||||||
|
-:1.*
|
||||||
|
-:<default>
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
object PullRequestCompatibility : BuildType({
|
||||||
|
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
|
||||||
|
id("MinecraftForge_MinecraftForge__PullRequestCompatibility")
|
||||||
|
name = "Pull Requests (Compatibility)"
|
||||||
|
description = "Validates binary compatibility for pull requests made to the project"
|
||||||
|
|
||||||
|
steps {
|
||||||
|
gradle {
|
||||||
|
name = "Validate"
|
||||||
|
id = "RUNNER_10_Compatibility"
|
||||||
|
|
||||||
|
tasks = "checkJarCompatibility"
|
||||||
|
gradleParams = "--continue %gradle_custom_args%"
|
||||||
|
enableStacktrace = true
|
||||||
|
dockerImage = "%docker_gradle_image%"
|
||||||
|
dockerRunParameters = """
|
||||||
|
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
|
||||||
|
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
|
||||||
|
--network=host
|
||||||
|
-u 1000:1000
|
||||||
|
%docker_additional_args%
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vcs {
|
||||||
|
branchFilter = """
|
||||||
|
+:*
|
||||||
|
-:1.*
|
||||||
|
-:<default>
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
})
|
||||||
+31
-39
@@ -19,7 +19,7 @@ plugins {
|
|||||||
id 'com.github.ben-manes.versions' version '0.36.0'
|
id 'com.github.ben-manes.versions' version '0.36.0'
|
||||||
id 'net.minecraftforge.gradleutils' version '2.+'
|
id 'net.minecraftforge.gradleutils' version '2.+'
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'de.undercouch.download' version '4.1.2'
|
id 'de.undercouch.download' version '5.1.3'
|
||||||
id 'net.minecraftforge.gradle.patcher' version '[5.1.50,5.2.0)' apply false
|
id 'net.minecraftforge.gradle.patcher' version '[5.1.50,5.2.0)' apply false
|
||||||
id 'net.minecraftforge.gradle.mcp' version '[5.1.50,5.2.0)' apply false
|
id 'net.minecraftforge.gradle.mcp' version '[5.1.50,5.2.0)' apply false
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ ext {
|
|||||||
SPI_VERSION = '6.0.0'
|
SPI_VERSION = '6.0.0'
|
||||||
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
||||||
COREMODS_VERSION = '5.0.1'
|
COREMODS_VERSION = '5.0.1'
|
||||||
EVENTBUS_VERSION = '6.0.0'
|
EVENTBUS_VERSION = '6.0.3'
|
||||||
MODLAUNCHER_VERSION = '10.0.8'
|
MODLAUNCHER_VERSION = '10.0.8'
|
||||||
SECUREJARHANDLER_VERSION = '2.1.4'
|
SECUREJARHANDLER_VERSION = '2.1.4'
|
||||||
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
|
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
|
||||||
@@ -77,7 +77,7 @@ ext {
|
|||||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
||||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
|
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
|
||||||
MIN_TAG_FOR_CHANGELOG = "41.0"
|
MIN_TAG_FOR_CHANGELOG = '41.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
println('Version: ' + VERSION +
|
println('Version: ' + VERSION +
|
||||||
@@ -1184,8 +1184,6 @@ project(':forge') {
|
|||||||
excs.from patcher.excs
|
excs.from patcher.excs
|
||||||
}
|
}
|
||||||
|
|
||||||
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks]){}
|
|
||||||
|
|
||||||
task checkPatchesAndFix(type: CheckPatches, dependsOn: genPatches) {
|
task checkPatchesAndFix(type: CheckPatches, dependsOn: genPatches) {
|
||||||
patchDir = file("$rootDir/patches")
|
patchDir = file("$rootDir/patches")
|
||||||
autoFix = true
|
autoFix = true
|
||||||
@@ -1202,57 +1200,51 @@ project(':forge') {
|
|||||||
lineEnding = '\n'
|
lineEnding = '\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
def baseForgeVersion = System.getProperty("forge.compatibility_check_version")
|
def baseForgeVersionProperty = project.objects.property(String)
|
||||||
if (baseForgeVersion == null)
|
baseForgeVersionProperty.set(project.provider { getLatestForgeVersion(MC_VERSION) }.map { MC_VERSION + '-' + it })
|
||||||
baseForgeVersion = "${MC_VERSION}-${GIT_INFO.tag}.0"
|
baseForgeVersionProperty.finalizeValueOnRead()
|
||||||
if (baseForgeVersion == "null")
|
|
||||||
baseForgeVersion = null // Allow disabling from system property if not wanted
|
|
||||||
def baseForgeUniversal = null
|
|
||||||
if (baseForgeVersion != null)
|
|
||||||
baseForgeUniversal = project.dependencies.create("net.minecraftforge:forge:${baseForgeVersion}:universal")
|
|
||||||
def jarCompatibilityTaskSetup = { task ->
|
def jarCompatibilityTaskSetup = { task ->
|
||||||
task.group = 'jar compatibility'
|
task.group = 'jar compatibility'
|
||||||
task.onlyIf {
|
task.onlyIf {
|
||||||
baseForgeVersion != null
|
baseForgeVersionProperty.getOrNull() != null
|
||||||
}
|
}
|
||||||
task.inputs.property 'baseForgeVersion', baseForgeVersion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task downloadBaseCompatibilityBinPatches(type: DownloadBaseCompatibilityBinPatches) {
|
tasks.register('setupCheckJarCompatibility', SetupCheckJarCompatibility) {
|
||||||
inputVersion = baseForgeVersion
|
inputVersion = baseForgeVersionProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
task applyBaseCompatibilityJarBinPatches(type: ApplyBinPatches) {
|
tasks.register('applyBaseCompatibilityJarBinPatches', ApplyBinPatches) {
|
||||||
jarCompatibilityTaskSetup(it)
|
jarCompatibilityTaskSetup(it)
|
||||||
|
|
||||||
clean = createJoinedSRG.output
|
clean = project.tasks.createJoinedSRG.output
|
||||||
patch = downloadBaseCompatibilityBinPatches.output
|
patch = project.tasks.named('setupCheckJarCompatibility').flatMap { it.baseBinPatchesOutput }
|
||||||
output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') }
|
output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') }
|
||||||
}
|
}
|
||||||
|
|
||||||
task checkJarCompatibility(type: CheckJarCompatibility) {
|
tasks.register('mergeBaseForgeJar', MergeJars) {
|
||||||
jarCompatibilityTaskSetup(it)
|
jarCompatibilityTaskSetup(it)
|
||||||
|
|
||||||
if (baseForgeVersion != null) {
|
inputJars.from(project.tasks.named('applyBaseCompatibilityJarBinPatches').flatMap { it.output })
|
||||||
def fmlLibs = project.configurations.detachedConfiguration(PACKED_DEPS.collect {
|
inputJars.from(baseForgeVersionProperty.map { inputVersion ->
|
||||||
def artifactId = it.split(':')[1]
|
def output = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-universal.jar") }.get().asFile
|
||||||
return project.dependencies.create("net.minecraftforge:${artifactId}:${baseForgeVersion}")
|
project.rootProject.extensions.download.run {
|
||||||
}.toArray(Dependency[]::new))
|
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-universal.jar"
|
||||||
|
dest output
|
||||||
baseJar = project.tasks.applyBaseCompatibilityJarBinPatches.output
|
}
|
||||||
baseLibraries.from(project.configurations.detachedConfiguration(baseForgeUniversal))
|
return output
|
||||||
baseLibraries.from(project.tasks.createJoinedSRG.output)
|
})
|
||||||
baseLibraries.from(fmlLibs)
|
|
||||||
|
|
||||||
inputJar = project.tasks.reobfJar.output
|
|
||||||
concreteLibraries.from(PACKED_DEPS.collect { rootProject.tasks.getByPath(it).archiveFile })
|
|
||||||
|
|
||||||
commonLibraries.from(project.configurations.minecraftImplementation)
|
|
||||||
commonLibraries.from(project.configurations.installer)
|
|
||||||
commonLibraries.from(project.configurations.moduleonly)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register('checkJarCompatibility', CheckJarCompatibility) {
|
||||||
|
jarCompatibilityTaskSetup(it)
|
||||||
|
dependsOn 'setupCheckJarCompatibility'
|
||||||
|
|
||||||
|
baseJar = project.tasks.named('mergeBaseForgeJar').flatMap { it.output }
|
||||||
|
}
|
||||||
|
|
||||||
|
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks, checkPatches, checkLicenses]){}
|
||||||
|
|
||||||
task launcherJson(type: LauncherJson) {
|
task launcherJson(type: LauncherJson) {
|
||||||
packedDependencies = [':fmlloader:jar']
|
packedDependencies = [':fmlloader:jar']
|
||||||
doFirst {
|
doFirst {
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ dependencies {
|
|||||||
implementation 'org.ow2.asm:asm:9.3'
|
implementation 'org.ow2.asm:asm:9.3'
|
||||||
implementation 'org.ow2.asm:asm-tree:9.3'
|
implementation 'org.ow2.asm:asm-tree:9.3'
|
||||||
implementation 'net.minecraftforge:srgutils:0.4.+'
|
implementation 'net.minecraftforge:srgutils:0.4.+'
|
||||||
|
implementation 'commons-io:commons-io:2.8.0'
|
||||||
}
|
}
|
||||||
-39
@@ -1,39 +0,0 @@
|
|||||||
package net.minecraftforge.forge.tasks
|
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask
|
|
||||||
import org.gradle.api.file.RegularFileProperty
|
|
||||||
import org.gradle.api.provider.Property
|
|
||||||
import org.gradle.api.tasks.Input
|
|
||||||
import org.gradle.api.tasks.Optional
|
|
||||||
import org.gradle.api.tasks.OutputFile
|
|
||||||
import org.gradle.api.tasks.TaskAction
|
|
||||||
|
|
||||||
import java.nio.file.Files
|
|
||||||
|
|
||||||
abstract class DownloadBaseCompatibilityBinPatches extends DefaultTask {
|
|
||||||
DownloadBaseCompatibilityBinPatches() {
|
|
||||||
group = 'jar compatibility'
|
|
||||||
onlyIf {
|
|
||||||
inputVersion.getOrNull() != null
|
|
||||||
}
|
|
||||||
|
|
||||||
output.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
|
|
||||||
}
|
|
||||||
|
|
||||||
@TaskAction
|
|
||||||
void run() {
|
|
||||||
def dep = project.dependencies.create("net.minecraftforge:forge:${inputVersion.get()}:userdev")
|
|
||||||
def baseForgeUserdev = project.configurations.detachedConfiguration(dep).resolve().iterator().next()
|
|
||||||
|
|
||||||
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
|
|
||||||
|
|
||||||
Files.copy(joinedLzma.toPath(), output.get().asFile.toPath())
|
|
||||||
}
|
|
||||||
|
|
||||||
@Input
|
|
||||||
@Optional
|
|
||||||
abstract Property<String> getInputVersion()
|
|
||||||
|
|
||||||
@OutputFile
|
|
||||||
abstract RegularFileProperty getOutput()
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package net.minecraftforge.forge.tasks
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.file.ConfigurableFileCollection
|
||||||
|
import org.gradle.api.file.RegularFileProperty
|
||||||
|
import org.gradle.api.tasks.InputFiles
|
||||||
|
import org.gradle.api.tasks.OutputFile
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
|
||||||
|
import java.util.zip.ZipEntry
|
||||||
|
import java.util.zip.ZipInputStream
|
||||||
|
import java.util.zip.ZipOutputStream
|
||||||
|
|
||||||
|
abstract class MergeJars extends DefaultTask {
|
||||||
|
MergeJars() {
|
||||||
|
output.convention(project.layout.buildDirectory.dir(name).map { it.file('output.jar') })
|
||||||
|
}
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
void run() {
|
||||||
|
def jars = inputJars.files
|
||||||
|
|
||||||
|
try (ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(output.get().asFile))) {
|
||||||
|
for (def jar : jars) {
|
||||||
|
try (ZipInputStream zin = new ZipInputStream(new FileInputStream(jar))) {
|
||||||
|
def entry
|
||||||
|
while ((entry = zin.getNextEntry()) != null) {
|
||||||
|
ZipEntry _new = new ZipEntry(entry.getName())
|
||||||
|
_new.setTime(0) //SHOULD be the same time as the main entry, but NOOOO _new.setTime(entry.getTime()) throws DateTimeException, so you get 0, screw you!
|
||||||
|
zout.putNextEntry(_new)
|
||||||
|
IOUtils.copy(zin, zout)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@InputFiles
|
||||||
|
abstract ConfigurableFileCollection getInputJars()
|
||||||
|
|
||||||
|
@OutputFile
|
||||||
|
abstract RegularFileProperty getOutput()
|
||||||
|
}
|
||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
package net.minecraftforge.forge.tasks
|
||||||
|
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.artifacts.Dependency
|
||||||
|
import org.gradle.api.file.RegularFileProperty
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
|
import org.gradle.api.tasks.Optional
|
||||||
|
import org.gradle.api.tasks.OutputFile
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.StandardCopyOption
|
||||||
|
|
||||||
|
abstract class SetupCheckJarCompatibility extends DefaultTask {
|
||||||
|
SetupCheckJarCompatibility() {
|
||||||
|
group = 'jar compatibility'
|
||||||
|
onlyIf {
|
||||||
|
inputVersion.getOrNull() != null
|
||||||
|
}
|
||||||
|
|
||||||
|
baseBinPatchesOutput.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
|
||||||
|
}
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
void run() {
|
||||||
|
def inputVersion = inputVersion.get()
|
||||||
|
def fmlLibs = project.configurations.detachedConfiguration(project.PACKED_DEPS.collect {
|
||||||
|
def artifactId = it.split(':')[1]
|
||||||
|
return project.dependencies.create("net.minecraftforge:${artifactId}:${inputVersion}")
|
||||||
|
}.toArray(Dependency[]::new))
|
||||||
|
|
||||||
|
project.tasks.named('checkJarCompatibility') {
|
||||||
|
baseLibraries.from(project.tasks.createJoinedSRG.output)
|
||||||
|
baseLibraries.from(project.provider {
|
||||||
|
fmlLibs.resolvedConfiguration.lenientConfiguration.files
|
||||||
|
})
|
||||||
|
|
||||||
|
inputJar = project.tasks.reobfJar.output
|
||||||
|
concreteLibraries.from(project.PACKED_DEPS.collect { project.rootProject.tasks.getByPath(it).archiveFile })
|
||||||
|
|
||||||
|
commonLibraries.from(project.configurations.minecraftImplementation)
|
||||||
|
commonLibraries.from(project.configurations.installer)
|
||||||
|
commonLibraries.from(project.configurations.moduleonly)
|
||||||
|
}
|
||||||
|
|
||||||
|
def baseForgeUserdev = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-userdev.jar") }.get().asFile
|
||||||
|
project.rootProject.extensions.download.run {
|
||||||
|
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-userdev.jar"
|
||||||
|
dest baseForgeUserdev
|
||||||
|
}
|
||||||
|
|
||||||
|
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
|
||||||
|
|
||||||
|
Files.copy(joinedLzma.toPath(), baseBinPatchesOutput.get().asFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Input
|
||||||
|
@Optional
|
||||||
|
abstract Property<String> getInputVersion()
|
||||||
|
|
||||||
|
@OutputFile
|
||||||
|
abstract RegularFileProperty getBaseBinPatchesOutput()
|
||||||
|
}
|
||||||
@@ -18,17 +18,17 @@ public class Util {
|
|||||||
return md.digest().collect {String.format "%02x", it}.join()
|
return md.digest().collect {String.format "%02x", it}.join()
|
||||||
}
|
}
|
||||||
File.metaClass.getSha1 = { !delegate.exists() ? null : delegate.sha1() }
|
File.metaClass.getSha1 = { !delegate.exists() ? null : delegate.sha1() }
|
||||||
|
|
||||||
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
|
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
|
||||||
File.metaClass.getJson = { return delegate.exists() ? new JsonSlurper().parse(delegate) : [:] }
|
File.metaClass.getJson = { return delegate.exists() ? new JsonSlurper().parse(delegate) : [:] }
|
||||||
File.metaClass.setJson = { json -> delegate.text = new JsonBuilder(json).toPrettyString() }
|
File.metaClass.setJson = { json -> delegate.text = new JsonBuilder(json).toPrettyString() }
|
||||||
|
|
||||||
Date.metaClass.iso8601 = { ->
|
Date.metaClass.iso8601 = { ->
|
||||||
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||||
def result = format.format(delegate)
|
def result = format.format(delegate)
|
||||||
return result[0..21] + ':' + result[22..-1]
|
return result[0..21] + ':' + result[22..-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
String.metaClass.rsplit = { String del, int limit = -1 ->
|
String.metaClass.rsplit = { String del, int limit = -1 ->
|
||||||
def lst = new ArrayList()
|
def lst = new ArrayList()
|
||||||
def x = 0, idx
|
def x = 0, idx
|
||||||
@@ -41,7 +41,7 @@ public class Util {
|
|||||||
return lst
|
return lst
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] getClasspath(project, libs, artifact) {
|
public static String[] getClasspath(project, libs, artifact) {
|
||||||
def ret = []
|
def ret = []
|
||||||
artifactTree(project, artifact).each { key, lib ->
|
artifactTree(project, artifact).each { key, lib ->
|
||||||
@@ -51,7 +51,7 @@ public class Util {
|
|||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
public static def getArtifacts(project, config, classifiers) {
|
public static def getArtifacts(project, config, classifiers) {
|
||||||
def ret = [:]
|
def ret = [:]
|
||||||
config.resolvedConfiguration.resolvedArtifacts.each {
|
config.resolvedConfiguration.resolvedArtifacts.each {
|
||||||
@@ -75,7 +75,7 @@ public class Util {
|
|||||||
url = "https://maven.minecraftforge.net/${path}"
|
url = "https://maven.minecraftforge.net/${path}"
|
||||||
}
|
}
|
||||||
//TODO remove when Mojang launcher is updated
|
//TODO remove when Mojang launcher is updated
|
||||||
if (!classifiers && art.classifier != null) {
|
if (!classifiers && art.classifier != null) {
|
||||||
//Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
|
//Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
|
||||||
// However, keep the path normal so that our mirror system works.
|
// However, keep the path normal so that our mirror system works.
|
||||||
art.version = "${art.version}-${art.classifier}"
|
art.version = "${art.version}-${art.classifier}"
|
||||||
@@ -96,14 +96,14 @@ public class Util {
|
|||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
public static def getMavenPath(task) {
|
public static def getMavenPath(task) {
|
||||||
def classifier = task.archiveClassifier.get()
|
def classifier = task.archiveClassifier.get()
|
||||||
def dep = "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
|
def dep = "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
|
||||||
return "${task.project.group.replace('.', '/')}/${task.project.name}/${task.project.version}/${task.project.name}-${task.project.version}".toString() + (classifier == '' ? '' : '-' + classifier) + '.jar'
|
return "${task.project.group.replace('.', '/')}/${task.project.name}/${task.project.version}/${task.project.name}-${task.project.version}".toString() + (classifier == '' ? '' : '-' + classifier) + '.jar'
|
||||||
}
|
}
|
||||||
|
|
||||||
public static def getMavenDep(task) {
|
public static def getMavenDep(task) {
|
||||||
def classifier = task.archiveClassifier.get()
|
def classifier = task.archiveClassifier.get()
|
||||||
return "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
|
return "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ public class Util {
|
|||||||
def files = cfg.resolve()
|
def files = cfg.resolve()
|
||||||
return getArtifacts(project, cfg, true)
|
return getArtifacts(project, cfg, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkExists(url) {
|
private static boolean checkExists(url) {
|
||||||
try {
|
try {
|
||||||
def code = new URL(url).openConnection().with {
|
def code = new URL(url).openConnection().with {
|
||||||
@@ -142,4 +142,9 @@ public class Util {
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getLatestForgeVersion(mcVersion) {
|
||||||
|
def json = new JsonSlurper().parseText(new URL("https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json").getText("UTF-8"))
|
||||||
|
return json.promos["$mcVersion-latest"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
MinecraftForge
|
MinecraftForge
|
||||||
=============
|
=============
|
||||||
[](https://files.minecraftforge.net)
|
[](https://files.minecraftforge.net)
|
||||||
[](https://files.minecraftforge.net) [](https://discord.gg/UvedJ9m) [](https://www.patreon.com/LexManos)
|
)](https://files.minecraftforge.net) [](https://discord.gg/UvedJ9m) [](https://www.patreon.com/LexManos)
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,18 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
import net.minecraftforge.fml.config.IConfigSpec;
|
import net.minecraftforge.fml.config.IConfigSpec;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ModLoadingContext
|
public class ModLoadingContext
|
||||||
{
|
{
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
|
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
|
||||||
private Object languageExtension;
|
private Object languageExtension;
|
||||||
private ModLoadingStage stage;
|
private ModLoadingStage stage;
|
||||||
@@ -46,10 +51,24 @@ public class ModLoadingContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
|
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
|
||||||
|
if (spec.isEmpty())
|
||||||
|
{
|
||||||
|
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||||
|
LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getActiveContainer().getModId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer()));
|
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
|
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
|
||||||
|
if (spec.isEmpty())
|
||||||
|
{
|
||||||
|
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||||
|
LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getActiveContainer().getModId(), fileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer(), fileName));
|
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer(), fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package net.minecraftforge.fml.loading;
|
|||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.FileAlreadyExistsException;
|
import java.nio.file.FileAlreadyExistsException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -53,4 +54,16 @@ public class FileUtils
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean matchFileName(String path, String... matches) {
|
||||||
|
// Extract file name from path
|
||||||
|
String name = path.substring(Math.min(path.lastIndexOf(File.separatorChar) + 1, path.length()));
|
||||||
|
// Check if it contains any of the desired keywords
|
||||||
|
for (String match : matches) {
|
||||||
|
if (name.contains(match)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+14
-11
@@ -6,21 +6,27 @@
|
|||||||
package net.minecraftforge.fml.loading;
|
package net.minecraftforge.fml.loading;
|
||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
|
import cpw.mods.jarhandling.SecureJar;
|
||||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||||
import cpw.mods.modlauncher.api.NamedPath;
|
import cpw.mods.modlauncher.api.NamedPath;
|
||||||
import cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService;
|
import cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.module.ModuleDescriptor;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService {
|
public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService {
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
private static final Set<String> SERVICES = Set.of(
|
||||||
|
"cpw.mods.modlauncher.api.ITransformationService",
|
||||||
|
"net.minecraftforge.forgespi.locating.IModLocator",
|
||||||
|
"net.minecraftforge.forgespi.locating.IDependencyLocator"
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NamedPath> candidates(final Path gameDirectory) {
|
public List<NamedPath> candidates(final Path gameDirectory) {
|
||||||
@@ -51,14 +57,11 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
|
|||||||
if (!Files.isRegularFile(path)) return;
|
if (!Files.isRegularFile(path)) return;
|
||||||
if (!path.toString().endsWith(".jar")) return;
|
if (!path.toString().endsWith(".jar")) return;
|
||||||
if (LamdbaExceptionUtils.uncheck(() -> Files.size(path)) == 0) return;
|
if (LamdbaExceptionUtils.uncheck(() -> Files.size(path)) == 0) return;
|
||||||
try (ZipFile zf = new ZipFile(new File(path.toUri()))) {
|
|
||||||
if (zf.getEntry("META-INF/services/cpw.mods.modlauncher.api.ITransformationService") != null) {
|
SecureJar jar = SecureJar.from(path);
|
||||||
found.add(new NamedPath(zf.getName(), path));
|
jar.moduleDataProvider().descriptor().provides().stream()
|
||||||
} else if (zf.getEntry("META-INF/services/net.minecraftforge.forgespi.locating.IModLocator") != null) {
|
.map(ModuleDescriptor.Provides::service)
|
||||||
found.add(new NamedPath(zf.getName(), path));
|
.filter(SERVICES::contains)
|
||||||
}
|
.forEach(s -> found.add(new NamedPath(s, path)));
|
||||||
} catch (IOException ioe) {
|
|
||||||
LOGGER.error("Zip Error when loading jar file {}", path, ioe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,10 +210,24 @@ public class ModSorter
|
|||||||
|
|
||||||
if (!missingVersions.isEmpty()) {
|
if (!missingVersions.isEmpty()) {
|
||||||
if (mandatoryMissing > 0) {
|
if (mandatoryMissing > 0) {
|
||||||
LOGGER.error(LOADING, "Missing mandatory dependencies: {}", missingVersions.stream().filter(IModInfo.ModVersion::isMandatory).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
|
LOGGER.error(
|
||||||
|
LOADING,
|
||||||
|
"Missing or unsupported mandatory dependencies:\n{}",
|
||||||
|
missingVersions.stream()
|
||||||
|
.filter(IModInfo.ModVersion::isMandatory)
|
||||||
|
.map(ver -> formatDependencyError(ver, modVersions))
|
||||||
|
.collect(Collectors.joining("\n"))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (missingVersions.size() - mandatoryMissing > 0) {
|
if (missingVersions.size() - mandatoryMissing > 0) {
|
||||||
LOGGER.error(LOADING, "Unsupported installed optional dependencies: {}", missingVersions.stream().filter(ver -> !ver.isMandatory()).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
|
LOGGER.error(
|
||||||
|
LOADING,
|
||||||
|
"Unsupported installed optional dependencies:\n{}",
|
||||||
|
missingVersions.stream()
|
||||||
|
.filter(ver -> !ver.isMandatory())
|
||||||
|
.map(ver -> formatDependencyError(ver, modVersions))
|
||||||
|
.collect(Collectors.joining("\n"))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return missingVersions.stream()
|
return missingVersions.stream()
|
||||||
@@ -225,6 +239,18 @@ public class ModSorter
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String formatDependencyError(IModInfo.ModVersion dependency, Map<String, ArtifactVersion> modVersions)
|
||||||
|
{
|
||||||
|
ArtifactVersion installed = modVersions.get(dependency.getModId());
|
||||||
|
return String.format(
|
||||||
|
"\tMod ID: '%s', Requested by: '%s', Expected range: '%s', Actual version: '%s'",
|
||||||
|
dependency.getModId(),
|
||||||
|
dependency.getOwner().getModId(),
|
||||||
|
dependency.getVersionRange(),
|
||||||
|
installed != null ? installed.toString() : "[MISSING]"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean modVersionNotContained(final IModInfo.ModVersion mv, final Map<String, ArtifactVersion> modVersions)
|
private boolean modVersionNotContained(final IModInfo.ModVersion mv, final Map<String, ArtifactVersion> modVersions)
|
||||||
{
|
{
|
||||||
return !(VersionSupportMatrix.testVersionSupportMatrix(mv.getVersionRange(), mv.getModId(), "mod", (modId, range) -> modVersions.containsKey(modId) &&
|
return !(VersionSupportMatrix.testVersionSupportMatrix(mv.getVersionRange(), mv.getModId(), "mod", (modId, range) -> modVersions.containsKey(modId) &&
|
||||||
|
|||||||
@@ -106,16 +106,17 @@ public class UniqueModListBuilder
|
|||||||
if (modInfoList.size() > 1) {
|
if (modInfoList.size() > 1) {
|
||||||
LOGGER.debug("Found {} mods for first modid {}, selecting most recent based on version data", modInfoList.size(), fullList.getKey());
|
LOGGER.debug("Found {} mods for first modid {}, selecting most recent based on version data", modInfoList.size(), fullList.getKey());
|
||||||
modInfoList.sort(Comparator.comparing(this::getVersion).reversed());
|
modInfoList.sort(Comparator.comparing(this::getVersion).reversed());
|
||||||
LOGGER.debug("Selected file {} for modid {} with version {}", modInfoList.get(0).getFileName(), fullList.getKey(), modInfoList.get(0).getModInfos().get(0).getVersion());
|
LOGGER.debug("Selected file {} for modid {} with version {}", modInfoList.get(0).getFileName(), fullList.getKey(), this.getVersion(modInfoList.get(0)));
|
||||||
}
|
}
|
||||||
return modInfoList.get(0);
|
return modInfoList.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArtifactVersion getVersion(final ModFile mf)
|
private ArtifactVersion getVersion(final ModFile mf)
|
||||||
{
|
{
|
||||||
if (mf.getModFileInfo() == null) {
|
if (mf.getModFileInfo() == null || mf.getModInfos() == null || mf.getModInfos().isEmpty()) {
|
||||||
return mf.getJarVersion();
|
return mf.getJarVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mf.getModInfos().get(0).getVersion();
|
return mf.getModInfos().get(0).getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading;
|
package net.minecraftforge.fml.loading;
|
||||||
|
|
||||||
|
import net.minecraftforge.forgespi.language.MavenVersionAdapter;
|
||||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.VersionRange;
|
import org.apache.maven.artifact.versioning.VersionRange;
|
||||||
@@ -18,16 +19,12 @@ public class VersionSupportMatrix {
|
|||||||
private static final HashMap<String, List<ArtifactVersion>> overrideVersions = new HashMap<>();
|
private static final HashMap<String, List<ArtifactVersion>> overrideVersions = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion());
|
final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion());
|
||||||
// if (MavenVersionAdapter.createFromVersionSpec("[1.16.4,1.16.5]").containsVersion(version)) {
|
if (MavenVersionAdapter.createFromVersionSpec("[1.19.2]").containsVersion(version)) {
|
||||||
// // 1.16.4 is Compatible with 1.16.3
|
// 1.19.2 is Compatible with 1.19.1
|
||||||
// add("languageloader.javafml", "34");
|
add("languageloader.javafml", "42");
|
||||||
// add("mod.minecraft", "1.16.3");
|
add("mod.minecraft", "1.19.1");
|
||||||
// add("mod.forge", "34.1.42");
|
add("mod.forge", "42.0.9");
|
||||||
// // 1.16.5 is Compatible with 1.16.4, and thus 1.16.3
|
}
|
||||||
// add("languageloader.javafml", "35");
|
|
||||||
// add("mod.minecraft", "1.16.4");
|
|
||||||
// add("mod.forge", "35.1.37");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
private static void add(String key, String value) {
|
private static void add(String key, String value) {
|
||||||
overrideVersions.computeIfAbsent(key, k -> new ArrayList<>()).add(new DefaultArtifactVersion(value));
|
overrideVersions.computeIfAbsent(key, k -> new ArrayList<>()).add(new DefaultArtifactVersion(value));
|
||||||
|
|||||||
+10
-2
@@ -6,6 +6,7 @@
|
|||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
import cpw.mods.jarhandling.SecureJar;
|
import cpw.mods.jarhandling.SecureJar;
|
||||||
|
import net.minecraftforge.fml.loading.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -29,7 +30,7 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
|
|||||||
|
|
||||||
// The extra jar is on the classpath, so try and pull it out of the legacy classpath
|
// 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 legacyCP = Objects.requireNonNull(System.getProperty("legacyClassPath"), "Missing legacyClassPath, cannot find client-extra").split(File.pathSeparator);
|
||||||
var extra = Paths.get(Arrays.stream(legacyCP).filter(e -> e.contains("client-extra")).findFirst().orElseThrow(() -> new IllegalStateException("Could not find client-extra in legacy classpath")));
|
var extra = findJarOnClasspath(legacyCP, "client-extra");
|
||||||
mcstream.add(extra);
|
mcstream.add(extra);
|
||||||
|
|
||||||
// The MC code/Patcher edits are in exploded directories
|
// The MC code/Patcher edits are in exploded directories
|
||||||
@@ -77,11 +78,18 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
|
|||||||
protected List<Path> getFmlStuff(String[] classpath) {
|
protected List<Path> getFmlStuff(String[] classpath) {
|
||||||
// We also want the FML things, fmlcore, javafmllanguage, mclanguage, I don't like hard coding these, but hey whatever works for now.
|
// We also want the FML things, fmlcore, javafmllanguage, mclanguage, I don't like hard coding these, but hey whatever works for now.
|
||||||
return Arrays.stream(classpath)
|
return Arrays.stream(classpath)
|
||||||
.filter(e -> e.contains("fmlcore") || e.contains("javafmllanguage") || e.contains("lowcodelanguage") || e.contains("mclanguage"))
|
.filter(e -> FileUtils.matchFileName(e, "fmlcore", "javafmllanguage", "lowcodelanguage", "mclanguage"))
|
||||||
.map(Paths::get)
|
.map(Paths::get)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static Path findJarOnClasspath(String[] classpath, String match) {
|
||||||
|
return Paths.get(Arrays.stream(classpath)
|
||||||
|
.filter(e -> FileUtils.matchFileName(e, match))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(() -> new IllegalStateException("Could not find " + match + " in classpath")));
|
||||||
|
}
|
||||||
|
|
||||||
protected BiPredicate<String, String> getMcFilter(Path extra, List<Path> minecraft, Stream.Builder<List<Path>> mods) {
|
protected BiPredicate<String, String> getMcFilter(Path extra, List<Path> minecraft, Stream.Builder<List<Path>> mods) {
|
||||||
final var packages = getPackages();
|
final var packages = getPackages();
|
||||||
final var extraPath = extra.toString().replace('\\', '/');
|
final var extraPath = extra.toString().replace('\\', '/');
|
||||||
|
|||||||
-6
@@ -10,8 +10,6 @@ import net.minecraftforge.fml.loading.VersionInfo;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -41,8 +39,4 @@ public abstract class CommonUserdevLaunchHandler extends CommonDevLaunchHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void processStreams(String[] classpath, VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods);
|
protected abstract void processStreams(String[] classpath, VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods);
|
||||||
|
|
||||||
protected static Path findJarOnClasspath(String[] classpath, String match) {
|
|
||||||
return Paths.get(Arrays.stream(classpath).filter(e -> e.contains(match)).findFirst().orElseThrow(() -> new IllegalStateException("Could not find " + match + " in classpath")));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
<MarkerFilter marker="REGISTRIES" onMatch="${sys:forge.logging.marker.registries:-DENY}" onMismatch="NEUTRAL"/>
|
<MarkerFilter marker="REGISTRIES" onMatch="${sys:forge.logging.marker.registries:-DENY}" onMismatch="NEUTRAL"/>
|
||||||
<MarkerFilter marker="REGISTRYDUMP" onMatch="${sys:forge.logging.marker.registrydump:-DENY}" onMismatch="NEUTRAL"/>
|
<MarkerFilter marker="REGISTRYDUMP" onMatch="${sys:forge.logging.marker.registrydump:-DENY}" onMismatch="NEUTRAL"/>
|
||||||
<MarkerFilter marker="SPLASH" onMatch="${sys:forge.logging.marker.splash:-DENY}" onMismatch="NEUTRAL"/>
|
<MarkerFilter marker="SPLASH" onMatch="${sys:forge.logging.marker.splash:-DENY}" onMismatch="NEUTRAL"/>
|
||||||
|
<MarkerFilter marker="RESOURCE-CACHE" onMatch="${sys:forge.logging.marker.resource.cache:-DENY}" onMismatch="NEUTRAL"/>
|
||||||
<MarkerFilter marker="FORGEMOD" onMatch="${sys:forge.logging.marker.forgemod:-ACCEPT}" onMismatch="NEUTRAL"/>
|
<MarkerFilter marker="FORGEMOD" onMatch="${sys:forge.logging.marker.forgemod:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||||
<MarkerFilter marker="LOADING" onMatch="${sys:forge.logging.marker.loading:-ACCEPT}" onMismatch="NEUTRAL"/>
|
<MarkerFilter marker="LOADING" onMatch="${sys:forge.logging.marker.loading:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||||
<MarkerFilter marker="CORE" onMatch="${sys:forge.logging.marker.core:-ACCEPT}" onMismatch="NEUTRAL"/>
|
<MarkerFilter marker="CORE" onMatch="${sys:forge.logging.marker.core:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
+1
-1
@@ -38,7 +38,7 @@ public class FMLModContainer extends ModContainer
|
|||||||
LOGGER.debug(LOADING,"Creating FMLModContainer instance for {}", className);
|
LOGGER.debug(LOADING,"Creating FMLModContainer instance for {}", className);
|
||||||
this.scanResults = modFileScanResults;
|
this.scanResults = modFileScanResults;
|
||||||
activityMap.put(ModLoadingStage.CONSTRUCT, this::constructMod);
|
activityMap.put(ModLoadingStage.CONSTRUCT, this::constructMod);
|
||||||
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).build();
|
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).useModLauncher().build();
|
||||||
this.configHandler = Optional.of(ce->this.eventBus.post(ce.self()));
|
this.configHandler = Optional.of(ce->this.eventBus.post(ce.self()));
|
||||||
final FMLJavaModLoadingContext contextExtension = new FMLJavaModLoadingContext(this);
|
final FMLJavaModLoadingContext contextExtension = new FMLJavaModLoadingContext(this);
|
||||||
this.contextExtension = () -> contextExtension;
|
this.contextExtension = () -> contextExtension;
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class LowCodeModLanguageProvider implements IModLanguageProvider
|
|||||||
throw new ModLoadingException(info, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmodclass", e);
|
throw new ModLoadingException(info, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmodclass", e);
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
} catch (NoSuchMethodException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||||
LOGGER.fatal(LOADING, "Unable to load FMLModContainer, wut?", e);
|
LOGGER.fatal(LOADING, "Unable to load LowCodeModContainer, wut?", e);
|
||||||
final Class<RuntimeException> mle = (Class<RuntimeException>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingException", true, Thread.currentThread().getContextClassLoader()));
|
final Class<RuntimeException> mle = (Class<RuntimeException>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingException", true, Thread.currentThread().getContextClassLoader()));
|
||||||
final Class<ModLoadingStage> mls = (Class<ModLoadingStage>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingStage", true, Thread.currentThread().getContextClassLoader()));
|
final Class<ModLoadingStage> mls = (Class<ModLoadingStage>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingStage", true, Thread.currentThread().getContextClassLoader()));
|
||||||
throw LamdbaExceptionUtils.uncheck(() -> LamdbaExceptionUtils.uncheck(() -> mle.getConstructor(IModInfo.class, mls, String.class, Throwable.class)).newInstance(info, Enum.valueOf(mls, "CONSTRUCT"), "fml.modloading.failedtoloadmodclass", e));
|
throw LamdbaExceptionUtils.uncheck(() -> LamdbaExceptionUtils.uncheck(() -> mle.getConstructor(IModInfo.class, mls, String.class, Throwable.class)).newInstance(info, Enum.valueOf(mls, "CONSTRUCT"), "fml.modloading.failedtoloadmodclass", e));
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.minecraft.world.level.block.Block;
|
|||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
@@ -75,7 +76,7 @@ public class ExampleMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
|
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
|
||||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||||
public static class ClientModEvents
|
public static class ClientModEvents
|
||||||
{
|
{
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--- a/com/mojang/blaze3d/vertex/PoseStack.java
|
||||||
|
+++ b/com/mojang/blaze3d/vertex/PoseStack.java
|
||||||
|
@@ -11,7 +_,7 @@
|
||||||
|
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();
|
||||||
|
matrix4f.m_27624_();
|
||||||
@@ -21,3 +21,13 @@
|
|||||||
if (SharedConstants.f_136183_) {
|
if (SharedConstants.f_136183_) {
|
||||||
throw illegalargumentexception;
|
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,5 +1,14 @@
|
|||||||
--- a/net/minecraft/client/ClientRecipeBook.java
|
--- a/net/minecraft/client/ClientRecipeBook.java
|
||||||
+++ b/net/minecraft/client/ClientRecipeBook.java
|
+++ b/net/minecraft/client/ClientRecipeBook.java
|
||||||
|
@@ -51,7 +_,7 @@
|
||||||
|
for(Recipe<?> recipe : p_90643_) {
|
||||||
|
if (!recipe.m_5598_() && !recipe.m_142505_()) {
|
||||||
|
RecipeBookCategories recipebookcategories = m_90646_(recipe);
|
||||||
|
- String s = recipe.m_6076_();
|
||||||
|
+ String s = recipe.m_6076_().isEmpty() ? recipe.m_6423_().toString() : recipe.m_6076_(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
|
||||||
|
if (s.isEmpty()) {
|
||||||
|
map.computeIfAbsent(recipebookcategories, (p_90645_) -> {
|
||||||
|
return Lists.newArrayList();
|
||||||
@@ -103,6 +_,8 @@
|
@@ -103,6 +_,8 @@
|
||||||
} else if (recipetype == RecipeType.f_44113_) {
|
} else if (recipetype == RecipeType.f_44113_) {
|
||||||
return RecipeBookCategories.SMITHING;
|
return RecipeBookCategories.SMITHING;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
this.f_91064_ = new DebugRenderer(this);
|
this.f_91064_ = new DebugRenderer(this);
|
||||||
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
|
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
|
||||||
RenderSystem.m_69900_(this::m_91113_);
|
RenderSystem.m_69900_(this::m_91113_);
|
||||||
@@ -541,6 +_,19 @@
|
@@ -541,6 +_,21 @@
|
||||||
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,6 +83,8 @@
|
|||||||
+ net.minecraftforge.client.gui.overlay.GuiOverlayManager.init();
|
+ net.minecraftforge.client.gui.overlay.GuiOverlayManager.init();
|
||||||
+ net.minecraftforge.client.DimensionSpecialEffectsManager.init();
|
+ net.minecraftforge.client.DimensionSpecialEffectsManager.init();
|
||||||
+ net.minecraftforge.client.NamedRenderTypeManager.init();
|
+ net.minecraftforge.client.NamedRenderTypeManager.init();
|
||||||
|
+ net.minecraftforge.client.ColorResolverManager.init();
|
||||||
|
+ net.minecraftforge.client.ItemDecoratorHandler.init();
|
||||||
+
|
+
|
||||||
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
|
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
|
||||||
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
|
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
|
||||||
@@ -300,7 +302,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
|
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) break; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
|
||||||
InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand);
|
InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand);
|
||||||
if (!interactionresult.m_19077_()) {
|
if (!interactionresult.m_19077_()) {
|
||||||
interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand);
|
interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand);
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
--- a/net/minecraft/client/gui/components/toasts/ToastComponent.java
|
||||||
|
+++ b/net/minecraft/client/gui/components/toasts/ToastComponent.java
|
||||||
|
@@ -103,6 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void m_94922_(Toast p_94923_) {
|
||||||
|
+ if (net.minecraftforge.client.ForgeHooksClient.onToastAdd(p_94923_)) return;
|
||||||
|
this.f_94916_.add(p_94923_);
|
||||||
|
}
|
||||||
|
|
||||||
+5
-4
@@ -1,12 +1,13 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||||
@@ -42,12 +_,16 @@
|
@@ -42,12 +_,17 @@
|
||||||
if (!collection.isEmpty() && j >= 32) {
|
if (!collection.isEmpty() && j >= 32) {
|
||||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
boolean flag = j >= 120;
|
boolean flag = j >= 120;
|
||||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag);
|
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag, i);
|
||||||
+ if (event == 0) return; // 0 = cancel rendering
|
+ if (event.isCanceled()) return;
|
||||||
+ flag = event == 2; // 2 = full-size / 1 = compact
|
+ flag = !event.isCompact();
|
||||||
|
+ i = event.getHorizontalOffset();
|
||||||
int k = 33;
|
int k = 33;
|
||||||
if (collection.size() > 5) {
|
if (collection.size() > 5) {
|
||||||
k = 132 / (collection.size() - 1);
|
k = 132 / (collection.size() - 1);
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
--- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
|
||||||
|
+++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
|
||||||
|
@@ -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));
|
||||||
|
+ renderEntityInInventoryRaw(p_98851_, p_98852_, p_98853_, f, f1, p_98856_);
|
||||||
|
+ }
|
||||||
|
+ public static void renderEntityInInventoryRaw(int p_98851_, int p_98852_, int p_98853_, float angleXComponent, float angleYComponent, LivingEntity p_98856_) {
|
||||||
|
+ float f = angleXComponent;
|
||||||
|
+ float f1 = angleYComponent;
|
||||||
|
PoseStack posestack = RenderSystem.m_157191_();
|
||||||
|
posestack.m_85836_();
|
||||||
|
posestack.m_85837_((double)p_98851_, (double)p_98852_, 1050.0D);
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
--- a/net/minecraft/client/model/HumanoidModel.java
|
||||||
|
+++ b/net/minecraft/client/model/HumanoidModel.java
|
||||||
|
@@ -264,6 +_,8 @@
|
||||||
|
case TOOT_HORN:
|
||||||
|
this.f_102811_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F;
|
||||||
|
this.f_102811_.f_104204_ = this.f_102808_.f_104204_ - ((float)Math.PI / 6F);
|
||||||
|
+ default:
|
||||||
|
+ this.f_102816_.applyTransform(this, p_102876_, net.minecraft.world.entity.HumanoidArm.RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -304,6 +_,8 @@
|
||||||
|
case TOOT_HORN:
|
||||||
|
this.f_102812_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F;
|
||||||
|
this.f_102812_.f_104204_ = this.f_102808_.f_104204_ + ((float)Math.PI / 6F);
|
||||||
|
+ default:
|
||||||
|
+ this.f_102815_.applyTransform(this, p_102879_, net.minecraft.world.entity.HumanoidArm.LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -396,7 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
- public static enum ArmPose {
|
||||||
|
+ public static enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
|
||||||
|
EMPTY(false),
|
||||||
|
ITEM(false),
|
||||||
|
BLOCK(false),
|
||||||
|
@@ -411,10 +_,29 @@
|
||||||
|
|
||||||
|
private ArmPose(boolean p_102896_) {
|
||||||
|
this.f_102890_ = p_102896_;
|
||||||
|
+ this.forgeArmPose = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean m_102897_() {
|
||||||
|
return this.f_102890_;
|
||||||
|
}
|
||||||
|
+ // FORGE START
|
||||||
|
+ @javax.annotation.Nullable
|
||||||
|
+ private final net.minecraftforge.client.IArmPoseTransformer forgeArmPose;
|
||||||
|
+
|
||||||
|
+ private ArmPose(boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
|
||||||
|
+ this.f_102890_ = twoHanded;
|
||||||
|
+ com.google.common.base.Preconditions.checkNotNull(forgeArmPose, "Cannot create new ArmPose with null transformer!");
|
||||||
|
+ this.forgeArmPose = forgeArmPose;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static ArmPose create(String name, boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
|
||||||
|
+ throw new IllegalStateException("Enum not extended");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public <T extends LivingEntity> void applyTransform(HumanoidModel<T> model, T entity, net.minecraft.world.entity.HumanoidArm arm) {
|
||||||
|
+ if (this.forgeArmPose != null) this.forgeArmPose.applyTransform(model, entity, arm);
|
||||||
|
+ }
|
||||||
|
+ // FORGE END
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,13 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientLevel.java
|
--- a/net/minecraft/client/multiplayer/ClientLevel.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
|
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
|
||||||
@@ -121,6 +_,8 @@
|
@@ -115,12 +_,15 @@
|
||||||
|
p_194170_.put(BiomeColors.f_108791_, new BlockTintCache((p_194168_) -> {
|
||||||
|
return this.m_104762_(p_194168_, BiomeColors.f_108791_);
|
||||||
|
}));
|
||||||
|
+ net.minecraftforge.client.ColorResolverManager.registerBlockTintCaches(ClientLevel.this, p_194170_);
|
||||||
|
});
|
||||||
|
private final ClientChunkCache f_104559_;
|
||||||
|
private final Deque<Runnable> f_194122_ = Queues.newArrayDeque();
|
||||||
private int f_194123_;
|
private int f_194123_;
|
||||||
private final BlockStatePredictionHandler f_233599_ = new BlockStatePredictionHandler();
|
private final BlockStatePredictionHandler f_233599_ = new BlockStatePredictionHandler();
|
||||||
private static final Set<Item> f_194124_ = Set.of(Items.f_42127_, Items.f_151033_);
|
private static final Set<Item> f_194124_ = Set.of(Items.f_42127_, Items.f_151033_);
|
||||||
|
|||||||
@@ -19,3 +19,14 @@
|
|||||||
this.m_241119_(p_242290_, 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_();
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--- a/net/minecraft/client/multiplayer/resolver/AddressCheck.java
|
||||||
|
+++ b/net/minecraft/client/multiplayer/resolver/AddressCheck.java
|
||||||
|
@@ -16,7 +_,7 @@
|
||||||
|
boolean m_142408_(ServerAddress p_171830_);
|
||||||
|
|
||||||
|
static AddressCheck m_171828_() {
|
||||||
|
- final ImmutableList<Predicate<String>> immutablelist = Streams.stream(ServiceLoader.load(BlockListSupplier.class)).map(BlockListSupplier::createBlockList).filter(Objects::nonNull).collect(ImmutableList.toImmutableList());
|
||||||
|
+ final ImmutableList<Predicate<String>> immutablelist = Streams.stream(ServiceLoader.load(BlockListSupplier.class, net.minecraftforge.fml.loading.FMLLoader.class.getClassLoader())).map(BlockListSupplier::createBlockList).filter(Objects::nonNull).collect(ImmutableList.toImmutableList());
|
||||||
|
return new AddressCheck() {
|
||||||
|
public boolean m_142649_(ResolvedServerAddress p_171835_) {
|
||||||
|
String s = p_171835_.m_142727_();
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
--- a/net/minecraft/client/particle/EnchantmentTableParticle.java
|
||||||
|
+++ b/net/minecraft/client/particle/EnchantmentTableParticle.java
|
||||||
|
@@ -73,6 +_,7 @@
|
||||||
|
this.f_107212_ = this.f_106461_ + this.f_107215_ * (double)f;
|
||||||
|
this.f_107213_ = this.f_106462_ + this.f_107216_ * (double)f - (double)(f1 * 1.2F);
|
||||||
|
this.f_107214_ = this.f_106460_ + this.f_107217_ * (double)f;
|
||||||
|
+ this.m_107264_(this.f_107212_, this.f_107213_, this.f_107214_); // FORGE: update the particle's bounding box
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
--- a/net/minecraft/client/particle/PortalParticle.java
|
||||||
|
+++ b/net/minecraft/client/particle/PortalParticle.java
|
||||||
|
@@ -75,6 +_,7 @@
|
||||||
|
this.f_107212_ = this.f_107548_ + this.f_107215_ * (double)f2;
|
||||||
|
this.f_107213_ = this.f_107549_ + this.f_107216_ * (double)f2 + (double)(1.0F - f);
|
||||||
|
this.f_107214_ = this.f_107547_ + this.f_107217_ * (double)f2;
|
||||||
|
+ this.m_107264_(this.f_107212_, this.f_107213_, this.f_107214_); // FORGE: update the particle's bounding box
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
--- a/net/minecraft/client/particle/ReversePortalParticle.java
|
||||||
|
+++ b/net/minecraft/client/particle/ReversePortalParticle.java
|
||||||
|
@@ -29,6 +_,7 @@
|
||||||
|
this.f_107212_ += this.f_107215_ * (double)f;
|
||||||
|
this.f_107213_ += this.f_107216_ * (double)f;
|
||||||
|
this.f_107214_ += this.f_107217_ * (double)f;
|
||||||
|
+ this.m_107264_(this.f_107212_, this.f_107213_, this.f_107214_); // FORGE: update the particle's bounding box
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
--- a/net/minecraft/client/particle/VibrationSignalParticle.java
|
||||||
|
+++ b/net/minecraft/client/particle/VibrationSignalParticle.java
|
||||||
|
@@ -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
|
||||||
|
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_());
|
||||||
|
}
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), layers);
|
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), layers);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static void setRenderLayer(Fluid fluid, RenderType type) {
|
+ public static synchronized void setRenderLayer(Fluid fluid, RenderType type) {
|
||||||
+ com.google.common.base.Preconditions.checkArgument(type.getChunkLayerId() >= 0, "The argument must be a valid chunk render type returned by RenderType#chunkBufferLayers().");
|
+ com.google.common.base.Preconditions.checkArgument(type.getChunkLayerId() >= 0, "The argument must be a valid chunk render type returned by RenderType#chunkBufferLayers().");
|
||||||
+ checkClientLoading();
|
+ checkClientLoading();
|
||||||
+ FLUID_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid), type);
|
+ FLUID_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid), type);
|
||||||
|
|||||||
@@ -24,6 +24,14 @@
|
|||||||
boolean flag1 = CrossbowItem.m_40932_(p_109377_);
|
boolean flag1 = CrossbowItem.m_40932_(p_109377_);
|
||||||
boolean flag2 = humanoidarm == HumanoidArm.RIGHT;
|
boolean flag2 = humanoidarm == HumanoidArm.RIGHT;
|
||||||
int i = flag2 ? 1 : -1;
|
int i = flag2 ? 1 : -1;
|
||||||
|
@@ -384,6 +_,7 @@
|
||||||
|
this.m_109322_(p_109372_, p_109377_, flag2 ? ItemTransforms.TransformType.FIRST_PERSON_RIGHT_HAND : ItemTransforms.TransformType.FIRST_PERSON_LEFT_HAND, !flag2, p_109379_, p_109380_, p_109381_);
|
||||||
|
} else {
|
||||||
|
boolean flag3 = humanoidarm == HumanoidArm.RIGHT;
|
||||||
|
+ if (!net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_109377_).applyForgeHandTransform(p_109379_, f_109299_.f_91074_, humanoidarm, p_109377_, p_109373_, p_109378_, p_109376_)) // FORGE: Allow items to define custom arm animation
|
||||||
|
if (p_109372_.m_6117_() && p_109372_.m_21212_() > 0 && p_109372_.m_7655_() == p_109375_) {
|
||||||
|
int k = flag3 ? 1 : -1;
|
||||||
|
switch (p_109377_.m_41780_()) {
|
||||||
@@ -487,8 +_,16 @@
|
@@ -487,8 +_,16 @@
|
||||||
this.f_109304_ = Mth.m_14036_(this.f_109304_ - 0.4F, 0.0F, 1.0F);
|
this.f_109304_ = Mth.m_14036_(this.f_109304_ - 0.4F, 0.0F, 1.0F);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -51,6 +51,16 @@
|
|||||||
++this.f_109439_;
|
++this.f_109439_;
|
||||||
if (entity.f_19797_ == 0) {
|
if (entity.f_19797_ == 0) {
|
||||||
entity.f_19790_ = entity.m_20185_();
|
entity.f_19790_ = entity.m_20185_();
|
||||||
|
@@ -1206,6 +_,9 @@
|
||||||
|
int i1 = i & 255;
|
||||||
|
outlinebuffersource.m_109929_(k, l, i1, 255);
|
||||||
|
} else {
|
||||||
|
+ if (this.m_109817_() && entity.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
|
||||||
|
+ flag3 = true;
|
||||||
|
+ }
|
||||||
|
multibuffersource = multibuffersource$buffersource;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1226,6 +_,7 @@
|
@@ -1226,6 +_,7 @@
|
||||||
List<BlockEntity> list = levelrenderer$renderchunkinfo.f_109839_.m_112835_().m_112773_();
|
List<BlockEntity> list = levelrenderer$renderchunkinfo.f_109839_.m_112835_().m_112773_();
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
@@ -59,7 +69,17 @@
|
|||||||
BlockPos blockpos4 = blockentity1.m_58899_();
|
BlockPos blockpos4 = blockentity1.m_58899_();
|
||||||
MultiBufferSource multibuffersource1 = multibuffersource$buffersource;
|
MultiBufferSource multibuffersource1 = multibuffersource$buffersource;
|
||||||
p_109600_.m_85836_();
|
p_109600_.m_85836_();
|
||||||
@@ -1251,6 +_,7 @@
|
@@ -1242,6 +_,9 @@
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ if (this.m_109817_() && blockentity1.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
|
||||||
|
+ flag3 = true;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
this.f_172946_.m_112267_(blockentity1, p_109601_, p_109600_, multibuffersource1);
|
||||||
|
p_109600_.m_85849_();
|
||||||
|
@@ -1251,9 +_,13 @@
|
||||||
|
|
||||||
synchronized(this.f_109468_) {
|
synchronized(this.f_109468_) {
|
||||||
for(BlockEntity blockentity : this.f_109468_) {
|
for(BlockEntity blockentity : this.f_109468_) {
|
||||||
@@ -67,6 +87,12 @@
|
|||||||
BlockPos blockpos3 = blockentity.m_58899_();
|
BlockPos blockpos3 = blockentity.m_58899_();
|
||||||
p_109600_.m_85836_();
|
p_109600_.m_85836_();
|
||||||
p_109600_.m_85837_((double)blockpos3.m_123341_() - d0, (double)blockpos3.m_123342_() - d1, (double)blockpos3.m_123343_() - d2);
|
p_109600_.m_85837_((double)blockpos3.m_123341_() - d0, (double)blockpos3.m_123342_() - d1, (double)blockpos3.m_123343_() - d2);
|
||||||
|
+ if (this.m_109817_() && blockentity.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
|
||||||
|
+ flag3 = true;
|
||||||
|
+ }
|
||||||
|
this.f_172946_.m_112267_(blockentity, p_109601_, p_109600_, multibuffersource$buffersource);
|
||||||
|
p_109600_.m_85849_();
|
||||||
|
}
|
||||||
@@ -1290,7 +_,8 @@
|
@@ -1290,7 +_,8 @@
|
||||||
p_109600_.m_85837_((double)blockpos2.m_123341_() - d0, (double)blockpos2.m_123342_() - d1, (double)blockpos2.m_123343_() - d2);
|
p_109600_.m_85837_((double)blockpos2.m_123341_() - d0, (double)blockpos2.m_123342_() - d1, (double)blockpos2.m_123343_() - d2);
|
||||||
PoseStack.Pose posestack$pose = p_109600_.m_85850_();
|
PoseStack.Pose posestack$pose = p_109600_.m_85850_();
|
||||||
|
|||||||
@@ -30,3 +30,28 @@
|
|||||||
InputStream inputstream = resource.m_215507_();
|
InputStream inputstream = resource.m_215507_();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@@ -232,11 +_,11 @@
|
||||||
|
private final Set<String> f_173369_ = Sets.newHashSet();
|
||||||
|
|
||||||
|
public String m_142138_(boolean p_173374_, String p_173375_) {
|
||||||
|
- p_173375_ = FileUtil.m_179924_((p_173374_ ? s1 : "shaders/include/") + p_173375_);
|
||||||
|
- if (!this.f_173369_.add(p_173375_)) {
|
||||||
|
+ // FORGE: use the mod's namespace to look up resources if specified
|
||||||
|
+ ResourceLocation resourcelocation = net.minecraftforge.client.ForgeHooksClient.getShaderImportLocation(s1, p_173374_, p_173375_);
|
||||||
|
+ if (!this.f_173369_.add(resourcelocation.toString())) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
- ResourceLocation resourcelocation = new ResourceLocation(p_173375_);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Reader reader = p_173341_.m_215597_(resourcelocation);
|
||||||
|
@@ -262,7 +_,8 @@
|
||||||
|
|
||||||
|
return s2;
|
||||||
|
} catch (IOException ioexception) {
|
||||||
|
- ShaderInstance.f_173323_.error("Could not open GLSL import {}: {}", p_173375_, ioexception.getMessage());
|
||||||
|
+ // FORGE: specify the namespace of the failed import in case of duplicates from multiple mods
|
||||||
|
+ ShaderInstance.f_173323_.error("Could not open GLSL import {}: {}", resourcelocation, ioexception.getMessage());
|
||||||
|
return "#error " + ioexception.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-2
@@ -9,7 +9,7 @@
|
|||||||
this.f_110901_ = new LiquidBlockRenderer();
|
this.f_110901_ = new LiquidBlockRenderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,19 +_,27 @@
|
@@ -45,19 +_,30 @@
|
||||||
return this.f_110899_;
|
return this.f_110899_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,11 +31,14 @@
|
|||||||
+ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
+ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||||
+ }
|
+ }
|
||||||
+ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
|
+ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
|
||||||
|
+ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, modelData, renderType, true);
|
||||||
|
+ }
|
||||||
|
+ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType, boolean queryModelSpecificData) { // TODO 1.20: Move to the signature above
|
||||||
try {
|
try {
|
||||||
RenderShape rendershape = p_234356_.m_60799_();
|
RenderShape rendershape = p_234356_.m_60799_();
|
||||||
if (rendershape == RenderShape.MODEL) {
|
if (rendershape == RenderShape.MODEL) {
|
||||||
- this.f_110900_.m_234379_(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_);
|
- this.f_110900_.m_234379_(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_);
|
||||||
+ this.f_110900_.tesselateBlock(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_, modelData, renderType);
|
+ this.f_110900_.tesselateBlock(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_, modelData, renderType, queryModelSpecificData); // TODO 1.20: Remove last argument
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
|
|||||||
+13
-2
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java
|
--- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java
|
||||||
+++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java
|
+++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java
|
||||||
@@ -40,72 +_,85 @@
|
@@ -40,72 +_,88 @@
|
||||||
this.f_110995_ = p_110999_;
|
this.f_110995_ = p_110999_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,10 +12,13 @@
|
|||||||
+ tesselateBlock(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
+ tesselateBlock(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||||
+ }
|
+ }
|
||||||
+ public void tesselateBlock(BlockAndTintGetter p_111048_, BakedModel p_111049_, BlockState p_111050_, BlockPos p_111051_, PoseStack p_111052_, VertexConsumer p_111053_, boolean p_111054_, RandomSource p_111055_, long p_111056_, int p_111057_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
|
+ public void tesselateBlock(BlockAndTintGetter p_111048_, BakedModel p_111049_, BlockState p_111050_, BlockPos p_111051_, PoseStack p_111052_, VertexConsumer p_111053_, boolean p_111054_, RandomSource p_111055_, long p_111056_, int p_111057_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
|
||||||
|
+ tesselateBlock(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, modelData, renderType, true);
|
||||||
|
+ }
|
||||||
|
+ public void tesselateBlock(BlockAndTintGetter p_111048_, BakedModel p_111049_, BlockState p_111050_, BlockPos p_111051_, PoseStack p_111052_, VertexConsumer p_111053_, boolean p_111054_, RandomSource p_111055_, long p_111056_, int p_111057_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType, boolean queryModelSpecificData) { // TODO 1.20: Move to the signature above
|
||||||
+ boolean flag = Minecraft.m_91086_() && p_111050_.getLightEmission(p_111048_, p_111051_) == 0 && p_111049_.useAmbientOcclusion(p_111050_, renderType);
|
+ boolean flag = Minecraft.m_91086_() && p_111050_.getLightEmission(p_111048_, p_111051_) == 0 && p_111049_.useAmbientOcclusion(p_111050_, renderType);
|
||||||
+ Vec3 vec3 = p_111050_.m_60824_(p_111048_, p_111051_);
|
+ Vec3 vec3 = p_111050_.m_60824_(p_111048_, p_111051_);
|
||||||
+ p_111052_.m_85837_(vec3.f_82479_, vec3.f_82480_, vec3.f_82481_);
|
+ p_111052_.m_85837_(vec3.f_82479_, vec3.f_82480_, vec3.f_82481_);
|
||||||
+ modelData = p_111049_.getModelData(p_111048_, p_111051_, p_111050_, modelData);
|
+ if (queryModelSpecificData) modelData = p_111049_.getModelData(p_111048_, p_111051_, p_111050_, modelData); // TODO 1.20: Remove this line entirely
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -111,6 +114,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -113,6 +_,7 @@
|
||||||
|
private void m_111012_(BlockAndTintGetter p_111013_, BlockState p_111014_, BlockPos p_111015_, PoseStack p_111016_, VertexConsumer p_111017_, List<BakedQuad> p_111018_, float[] p_111019_, BitSet p_111020_, ModelBlockRenderer.AmbientOcclusionFace p_111021_, int p_111022_) {
|
||||||
|
for(BakedQuad bakedquad : p_111018_) {
|
||||||
|
this.m_111039_(p_111013_, p_111014_, p_111015_, bakedquad.m_111303_(), bakedquad.m_111306_(), p_111019_, p_111020_);
|
||||||
|
+ if (!net.minecraftforge.client.ForgeHooksClient.calculateFaceWithoutAO(p_111013_, p_111014_, p_111015_, bakedquad, p_111020_.get(0), p_111021_.f_111149_, p_111021_.f_111150_))
|
||||||
|
p_111021_.m_111167_(p_111013_, p_111014_, p_111015_, bakedquad.m_111306_(), p_111019_, p_111020_, bakedquad.m_111307_());
|
||||||
|
this.m_111023_(p_111013_, p_111014_, p_111015_, p_111017_, p_111016_.m_85850_(), bakedquad, p_111021_.f_111149_[0], p_111021_.f_111149_[1], p_111021_.f_111149_[2], p_111021_.f_111149_[3], p_111021_.f_111150_[0], p_111021_.f_111150_[1], p_111021_.f_111150_[2], p_111021_.f_111150_[3], p_111022_);
|
||||||
|
}
|
||||||
@@ -217,17 +_,21 @@
|
@@ -217,17 +_,21 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
--- a/net/minecraft/client/renderer/block/model/BakedQuad.java
|
||||||
|
+++ b/net/minecraft/client/renderer/block/model/BakedQuad.java
|
||||||
|
@@ -12,13 +_,19 @@
|
||||||
|
protected final Direction f_111294_;
|
||||||
|
protected final TextureAtlasSprite f_111295_;
|
||||||
|
private final boolean f_111296_;
|
||||||
|
+ private final boolean hasAmbientOcclusion;
|
||||||
|
|
||||||
|
public BakedQuad(int[] p_111298_, int p_111299_, Direction p_111300_, TextureAtlasSprite p_111301_, boolean p_111302_) {
|
||||||
|
+ this(p_111298_, p_111299_, p_111300_, p_111301_, p_111302_, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public BakedQuad(int[] p_111298_, int p_111299_, Direction p_111300_, TextureAtlasSprite p_111301_, boolean p_111302_, boolean hasAmbientOcclusion) {
|
||||||
|
this.f_111292_ = p_111298_;
|
||||||
|
this.f_111293_ = p_111299_;
|
||||||
|
this.f_111294_ = p_111300_;
|
||||||
|
this.f_111295_ = p_111301_;
|
||||||
|
this.f_111296_ = p_111302_;
|
||||||
|
+ this.hasAmbientOcclusion = hasAmbientOcclusion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextureAtlasSprite m_173410_() {
|
||||||
|
@@ -43,5 +_,9 @@
|
||||||
|
|
||||||
|
public boolean m_111307_() {
|
||||||
|
return this.f_111296_;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean hasAmbientOcclusion() {
|
||||||
|
+ return this.hasAmbientOcclusion;
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-4
@@ -1,25 +1,31 @@
|
|||||||
--- a/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
--- a/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||||
+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||||
@@ -19,12 +_,18 @@
|
@@ -19,12 +_,24 @@
|
||||||
public final int f_111355_;
|
public final int f_111355_;
|
||||||
public final String f_111356_;
|
public final String f_111356_;
|
||||||
public final BlockFaceUV f_111357_;
|
public final BlockFaceUV f_111357_;
|
||||||
+ public final int emissivity;
|
+ public final int emissivity;
|
||||||
|
+ public final boolean hasAmbientOcclusion;
|
||||||
|
|
||||||
public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_) {
|
public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_) {
|
||||||
+ this(p_111359_, p_111360_, p_111361_, p_111362_, 0);
|
+ this(p_111359_, p_111360_, p_111361_, p_111362_, 0, true);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_, int emissivity) {
|
+ public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_, int emissivity) {
|
||||||
|
+ this(p_111359_, p_111360_, p_111361_, p_111362_, emissivity, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_, int emissivity, boolean hasAmbientOcclusion) {
|
||||||
this.f_111354_ = p_111359_;
|
this.f_111354_ = p_111359_;
|
||||||
this.f_111355_ = p_111360_;
|
this.f_111355_ = p_111360_;
|
||||||
this.f_111356_ = p_111361_;
|
this.f_111356_ = p_111361_;
|
||||||
this.f_111357_ = p_111362_;
|
this.f_111357_ = p_111362_;
|
||||||
+ this.emissivity = emissivity;
|
+ this.emissivity = emissivity;
|
||||||
|
+ this.hasAmbientOcclusion = hasAmbientOcclusion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@@ -37,7 +_,10 @@
|
@@ -37,7 +_,11 @@
|
||||||
int i = this.m_111368_(jsonobject);
|
int i = this.m_111368_(jsonobject);
|
||||||
String s = this.m_111370_(jsonobject);
|
String s = this.m_111370_(jsonobject);
|
||||||
BlockFaceUV blockfaceuv = p_111367_.deserialize(jsonobject, BlockFaceUV.class);
|
BlockFaceUV blockfaceuv = p_111367_.deserialize(jsonobject, BlockFaceUV.class);
|
||||||
@@ -27,7 +33,8 @@
|
|||||||
+ int emissivity = GsonHelper.m_13824_(jsonobject, "emissivity", 0);
|
+ int emissivity = GsonHelper.m_13824_(jsonobject, "emissivity", 0);
|
||||||
+ if (emissivity != net.minecraft.util.Mth.m_14045_(emissivity, 0, 15))
|
+ if (emissivity != net.minecraft.util.Mth.m_14045_(emissivity, 0, 15))
|
||||||
+ throw new JsonParseException("The emissivity value must be between 0 and 15. Found: " + emissivity);
|
+ throw new JsonParseException("The emissivity value must be between 0 and 15. Found: " + emissivity);
|
||||||
+ return new BlockElementFace(direction, i, s, blockfaceuv, emissivity);
|
+ boolean hasAmbientOcclusion = GsonHelper.m_13855_(jsonobject, "ambientocclusion", true);
|
||||||
|
+ return new BlockElementFace(direction, i, s, blockfaceuv, emissivity, hasAmbientOcclusion);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int m_111368_(JsonObject p_111369_) {
|
protected int m_111368_(JsonObject p_111369_) {
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
for(BlockElement blockelement : this.m_111436_()) {
|
for(BlockElement blockelement : this.m_111436_()) {
|
||||||
for(BlockElementFace blockelementface : blockelement.f_111310_.values()) {
|
for(BlockElementFace blockelementface : blockelement.f_111310_.values()) {
|
||||||
Material material = this.m_111480_(blockelementface.f_111356_);
|
Material material = this.m_111480_(blockelementface.f_111356_);
|
||||||
@@ -181,11 +_,17 @@
|
@@ -181,11 +_,18 @@
|
||||||
return set1;
|
return set1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,20 +62,12 @@
|
|||||||
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_111450_, p_111451_, p_111452_, p_111453_, p_111454_, p_111455_);
|
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_111450_, p_111451_, p_111452_, p_111453_, p_111454_, p_111455_);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Deprecated //Forge: exposed for our callbacks only. Use the above function.
|
+ @Deprecated(forRemoval = true, since = "1.19.2") // TODO: We cannot remove it since it's vanilla code, but make it private in 1.20
|
||||||
+ public BakedModel bakeVanilla(ModelBakery p_111450_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, ResourceLocation p_111454_, boolean p_111455_, net.minecraftforge.client.RenderTypeGroup renderTypes) {
|
+ public BakedModel bakeVanilla(ModelBakery p_111450_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, ResourceLocation p_111454_, boolean p_111455_, net.minecraftforge.client.RenderTypeGroup renderTypes) {
|
||||||
|
+ if (true) return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bakeVanilla(this, p_111450_, p_111451_, p_111452_, p_111453_, p_111454_); // Redirected, in case anyone actually uses this
|
||||||
TextureAtlasSprite textureatlassprite = p_111452_.apply(this.m_111480_("particle"));
|
TextureAtlasSprite textureatlassprite = p_111452_.apply(this.m_111480_("particle"));
|
||||||
if (this.m_111490_() == ModelBakery.f_119233_) {
|
if (this.m_111490_() == ModelBakery.f_119233_) {
|
||||||
return new BuiltInModel(this.m_111491_(), this.m_111446_(p_111450_, p_111451_), textureatlassprite, this.m_111479_().m_111526_());
|
return new BuiltInModel(this.m_111491_(), this.m_111446_(p_111450_, p_111451_), textureatlassprite, this.m_111479_().m_111526_());
|
||||||
@@ -204,7 +_,7 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- return simplebakedmodel$builder.m_119533_();
|
|
||||||
+ return simplebakedmodel$builder.build(renderTypes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -268,7 +_,18 @@
|
@@ -268,7 +_,18 @@
|
||||||
ItemTransform itemtransform5 = this.m_111444_(ItemTransforms.TransformType.GUI);
|
ItemTransform itemtransform5 = this.m_111444_(ItemTransforms.TransformType.GUI);
|
||||||
ItemTransform itemtransform6 = this.m_111444_(ItemTransforms.TransformType.GROUND);
|
ItemTransform itemtransform6 = this.m_111444_(ItemTransforms.TransformType.GROUND);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
- return new BakedQuad(aint, p_111603_.f_111355_, direction, p_111604_, p_111608_);
|
- return new BakedQuad(aint, p_111603_.f_111355_, direction, p_111604_, p_111608_);
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction);
|
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction);
|
||||||
+ var quad = new BakedQuad(aint, p_111603_.f_111355_, direction, p_111604_, p_111608_);
|
+ var quad = new BakedQuad(aint, p_111603_.f_111355_, direction, p_111604_, p_111608_, p_111603_.hasAmbientOcclusion);
|
||||||
+ net.minecraftforge.client.model.QuadTransformers.settingEmissivity(p_111603_.emissivity).processInPlace(quad);
|
+ net.minecraftforge.client.model.QuadTransformers.settingEmissivity(p_111603_.emissivity).processInPlace(quad);
|
||||||
+ return quad;
|
+ return quad;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -88,7 +88,7 @@
|
|||||||
if (blockstate.m_60799_() != RenderShape.INVISIBLE) {
|
if (blockstate.m_60799_() != RenderShape.INVISIBLE) {
|
||||||
- RenderType rendertype2 = ItemBlockRenderTypes.m_109282_(blockstate);
|
- RenderType rendertype2 = ItemBlockRenderTypes.m_109282_(blockstate);
|
||||||
+ var model = blockrenderdispatcher.m_110910_(blockstate);
|
+ var model = blockrenderdispatcher.m_110910_(blockstate);
|
||||||
+ var modelData = getModelData(blockpos2);
|
+ var modelData = model.getModelData(renderchunkregion, blockpos2, blockstate, getModelData(blockpos2));
|
||||||
+ randomsource.m_188584_(blockstate.m_60726_(blockpos2));
|
+ randomsource.m_188584_(blockstate.m_60726_(blockpos2));
|
||||||
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, modelData)) {
|
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, modelData)) {
|
||||||
BufferBuilder bufferbuilder2 = p_234471_.m_108839_(rendertype2);
|
BufferBuilder bufferbuilder2 = p_234471_.m_108839_(rendertype2);
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
posestack.m_85836_();
|
posestack.m_85836_();
|
||||||
posestack.m_85837_((double)(blockpos2.m_123341_() & 15), (double)(blockpos2.m_123342_() & 15), (double)(blockpos2.m_123343_() & 15));
|
posestack.m_85837_((double)(blockpos2.m_123341_() & 15), (double)(blockpos2.m_123342_() & 15), (double)(blockpos2.m_123343_() & 15));
|
||||||
- blockrenderdispatcher.m_234355_(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource);
|
- blockrenderdispatcher.m_234355_(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource);
|
||||||
+ blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource, modelData, rendertype2);
|
+ blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource, modelData, rendertype2, false);
|
||||||
posestack.m_85849_();
|
posestack.m_85849_();
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
--- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
||||||
+++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
+++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
||||||
@@ -66,4 +_,9 @@
|
@@ -66,4 +_,14 @@
|
||||||
public int m_141928_() {
|
public int m_141928_() {
|
||||||
return this.f_112908_.m_141928_();
|
return this.f_112908_.m_141928_();
|
||||||
}
|
}
|
||||||
@@ -8,5 +8,10 @@
|
|||||||
+ @Override
|
+ @Override
|
||||||
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) {
|
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) {
|
||||||
+ return this.f_112908_.getShade(normalX, normalY, normalZ, shade);
|
+ return this.f_112908_.getShade(normalX, normalY, normalZ, shade);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public net.minecraftforge.client.model.data.ModelDataManager getModelDataManager() {
|
||||||
|
+ return f_112908_.getModelDataManager();
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
@@ -60,6 +60,14 @@
|
|||||||
crashreportcategory.m_128165_("Item Damage", () -> {
|
crashreportcategory.m_128165_("Item Damage", () -> {
|
||||||
return String.valueOf(p_174237_.m_41773_());
|
return String.valueOf(p_174237_.m_41773_());
|
||||||
});
|
});
|
||||||
|
@@ -362,6 +_,7 @@
|
||||||
|
RenderSystem.m_69482_();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ net.minecraftforge.client.ItemDecoratorHandler.of(p_115176_).render(p_115175_, p_115176_, p_115177_, p_115178_, f_115093_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -377,5 +_,9 @@
|
@@ -377,5 +_,9 @@
|
||||||
|
|
||||||
public void m_6213_(ResourceManager p_115105_) {
|
public void m_6213_(ResourceManager p_115105_) {
|
||||||
|
|||||||
+7
-1
@@ -10,7 +10,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Vec3 m_7860_(AbstractClientPlayer p_117785_, float p_117786_) {
|
public Vec3 m_7860_(AbstractClientPlayer p_117785_, float p_117786_) {
|
||||||
@@ -126,7 +_,7 @@
|
@@ -126,10 +_,13 @@
|
||||||
if (useanim == UseAnim.TOOT_HORN) {
|
if (useanim == UseAnim.TOOT_HORN) {
|
||||||
return HumanoidModel.ArmPose.TOOT_HORN;
|
return HumanoidModel.ArmPose.TOOT_HORN;
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,12 @@
|
|||||||
return HumanoidModel.ArmPose.CROSSBOW_HOLD;
|
return HumanoidModel.ArmPose.CROSSBOW_HOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ HumanoidModel.ArmPose forgeArmPose = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(itemstack).getArmPose(p_117795_, p_117796_, itemstack);
|
||||||
|
+ if (forgeArmPose != null) return forgeArmPose;
|
||||||
|
+
|
||||||
|
return HumanoidModel.ArmPose.ITEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -161,10 +_,12 @@
|
@@ -161,10 +_,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,4 @@
|
|||||||
+public class CommandSourceStack implements SharedSuggestionProvider, net.minecraftforge.common.extensions.IForgeCommandSourceStack {
|
+public class CommandSourceStack implements SharedSuggestionProvider, net.minecraftforge.common.extensions.IForgeCommandSourceStack {
|
||||||
public static final SimpleCommandExceptionType f_81286_ = new SimpleCommandExceptionType(Component.m_237115_("permissions.requires.player"));
|
public static final SimpleCommandExceptionType f_81286_ = new SimpleCommandExceptionType(Component.m_237115_("permissions.requires.player"));
|
||||||
public static final SimpleCommandExceptionType f_81287_ = new SimpleCommandExceptionType(Component.m_237115_("permissions.requires.entity"));
|
public static final SimpleCommandExceptionType f_81287_ = new SimpleCommandExceptionType(Component.m_237115_("permissions.requires.entity"));
|
||||||
private final CommandSource f_81288_;
|
public final CommandSource f_81288_;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--- a/net/minecraft/commands/arguments/EntityArgument.java
|
||||||
|
+++ b/net/minecraft/commands/arguments/EntityArgument.java
|
||||||
|
@@ -115,7 +_,7 @@
|
||||||
|
if (s instanceof SharedSuggestionProvider sharedsuggestionprovider) {
|
||||||
|
StringReader stringreader = new StringReader(p_91483_.getInput());
|
||||||
|
stringreader.setCursor(p_91483_.getStart());
|
||||||
|
- EntitySelectorParser entityselectorparser = new EntitySelectorParser(stringreader, sharedsuggestionprovider.m_6761_(2));
|
||||||
|
+ EntitySelectorParser entityselectorparser = new EntitySelectorParser(stringreader, net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(sharedsuggestionprovider));
|
||||||
|
|
||||||
|
try {
|
||||||
|
entityselectorparser.m_121377_();
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--- a/net/minecraft/commands/arguments/MessageArgument.java
|
||||||
|
+++ b/net/minecraft/commands/arguments/MessageArgument.java
|
||||||
|
@@ -134,7 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
Component m_232196_(CommandSourceStack p_232197_) throws CommandSyntaxException {
|
||||||
|
- return this.m_96849_(p_232197_, p_232197_.m_6761_(2));
|
||||||
|
+ return this.m_96849_(p_232197_, net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(p_232197_));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Component m_96849_(CommandSourceStack p_96850_, boolean p_96851_) throws CommandSyntaxException {
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||||
|
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||||
|
@@ -87,7 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
private void m_121168_(CommandSourceStack p_121169_) throws CommandSyntaxException {
|
||||||
|
- if (this.f_121123_ && !p_121169_.m_6761_(2)) {
|
||||||
|
+ if (this.f_121123_ && !net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(p_121169_)) {
|
||||||
|
throw EntityArgument.f_91441_.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
--- a/net/minecraft/core/HolderSet.java
|
||||||
|
+++ b/net/minecraft/core/HolderSet.java
|
||||||
|
@@ -14,7 +_,7 @@
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
-public interface HolderSet<T> extends Iterable<Holder<T>> {
|
||||||
|
+public interface HolderSet<T> extends Iterable<Holder<T>>, net.minecraftforge.common.extensions.IForgeHolderSet<T> {
|
||||||
|
Stream<Holder<T>> m_203614_();
|
||||||
|
|
||||||
|
int m_203632_();
|
||||||
|
@@ -120,6 +_,9 @@
|
||||||
|
|
||||||
|
public void m_205835_(List<Holder<T>> p_205836_) {
|
||||||
|
this.f_205830_ = List.copyOf(p_205836_);
|
||||||
|
+ for (Runnable runnable : this.invalidationCallbacks) {
|
||||||
|
+ runnable.run(); // FORGE: invalidate listeners when tags rebind
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
public TagKey<T> m_205839_() {
|
||||||
|
@@ -144,6 +_,11 @@
|
||||||
|
|
||||||
|
public boolean m_207277_(Registry<T> p_211049_) {
|
||||||
|
return this.f_211044_ == p_211049_;
|
||||||
|
+ }
|
||||||
|
+ // FORGE: Keep a list of invalidation callbacks so they can be run when tags rebind
|
||||||
|
+ private List<Runnable> invalidationCallbacks = new java.util.ArrayList<>();
|
||||||
|
+ public void addInvalidationListener(Runnable runnable) {
|
||||||
|
+ invalidationCallbacks.add(runnable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-2
@@ -25,7 +25,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ClientboundCustomPayloadPacket(FriendlyByteBuf p_178836_) {
|
public ClientboundCustomPayloadPacket(FriendlyByteBuf p_178836_) {
|
||||||
@@ -43,6 +_,7 @@
|
@@ -43,15 +_,17 @@
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes");
|
throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes");
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void m_5779_(FriendlyByteBuf p_132044_) {
|
public void m_5779_(FriendlyByteBuf p_132044_) {
|
||||||
@@ -52,6 +_,7 @@
|
p_132044_.m_130085_(this.f_132029_);
|
||||||
|
- p_132044_.writeBytes(this.f_132030_.copy());
|
||||||
|
+ p_132044_.writeBytes(this.f_132030_.slice()); // Use Slice instead of copy, to not update the read index, allowing packet to be sent multiple times.
|
||||||
|
}
|
||||||
|
|
||||||
public void m_5797_(ClientGamePacketListener p_132041_) {
|
public void m_5797_(ClientGamePacketListener p_132041_) {
|
||||||
p_132041_.m_7413_(this);
|
p_132041_.m_7413_(this);
|
||||||
@@ -41,3 +44,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResourceLocation m_132042_() {
|
public ResourceLocation m_132042_() {
|
||||||
|
@@ -61,4 +_,8 @@
|
||||||
|
public FriendlyByteBuf m_132045_() {
|
||||||
|
return new FriendlyByteBuf(this.f_132030_.copy());
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Override public int getIndex() { return Integer.MAX_VALUE; }
|
||||||
|
+ @Override public ResourceLocation getName() { return m_132042_(); }
|
||||||
|
+ @Override public FriendlyByteBuf getInternalData() { return m_132045_(); }
|
||||||
|
}
|
||||||
+10
-1
@@ -14,7 +14,16 @@
|
|||||||
public void m_5779_(FriendlyByteBuf p_133994_) {
|
public void m_5779_(FriendlyByteBuf p_133994_) {
|
||||||
p_133994_.m_130085_(this.f_133980_);
|
p_133994_.m_130085_(this.f_133980_);
|
||||||
- p_133994_.writeBytes((ByteBuf)this.f_133981_);
|
- p_133994_.writeBytes((ByteBuf)this.f_133981_);
|
||||||
+ p_133994_.writeBytes((ByteBuf)this.f_133981_.copy()); //This may be access multiple times, from multiple threads, lets be safe like the S->C packet
|
+ p_133994_.writeBytes((ByteBuf)this.f_133981_.slice()); // Use Slice instead of copy, to not update the read index, allowing packet to be sent multiple times.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_5797_(ServerGamePacketListener p_133992_) {
|
public void m_5797_(ServerGamePacketListener p_133992_) {
|
||||||
|
@@ -43,4 +_,8 @@
|
||||||
|
public FriendlyByteBuf m_179590_() {
|
||||||
|
return this.f_133981_;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Override public int getIndex() { return Integer.MAX_VALUE; }
|
||||||
|
+ @Override public ResourceLocation getName() { return m_179589_(); }
|
||||||
|
+ @org.jetbrains.annotations.Nullable @Override public FriendlyByteBuf getInternalData() { return m_179590_(); }
|
||||||
|
}
|
||||||
+18
@@ -9,3 +9,21 @@
|
|||||||
private static final int f_179804_ = 1048576;
|
private static final int f_179804_ = 1048576;
|
||||||
private final int f_134745_;
|
private final int f_134745_;
|
||||||
private final ResourceLocation f_134746_;
|
private final ResourceLocation f_134746_;
|
||||||
|
@@ -30,7 +_,7 @@
|
||||||
|
public void m_5779_(FriendlyByteBuf p_134757_) {
|
||||||
|
p_134757_.m_130130_(this.f_134745_);
|
||||||
|
p_134757_.m_130085_(this.f_134746_);
|
||||||
|
- p_134757_.writeBytes(this.f_134747_.copy());
|
||||||
|
+ p_134757_.writeBytes(this.f_134747_.slice()); // Use Slice instead of copy, to not update the read index, allowing packet to be sent multiple times.
|
||||||
|
}
|
||||||
|
|
||||||
|
public void m_5797_(ClientLoginPacketListener p_134754_) {
|
||||||
|
@@ -48,4 +_,8 @@
|
||||||
|
public FriendlyByteBuf m_179812_() {
|
||||||
|
return this.f_134747_;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Override public int getIndex() { return m_134755_(); }
|
||||||
|
+ @Override public ResourceLocation getName() { return m_179811_(); }
|
||||||
|
+ @org.jetbrains.annotations.Nullable @Override public FriendlyByteBuf getInternalData() { return m_179812_(); }
|
||||||
|
}
|
||||||
+9
@@ -10,3 +10,12 @@
|
|||||||
private static final int f_179821_ = 1048576;
|
private static final int f_179821_ = 1048576;
|
||||||
private final int f_134825_;
|
private final int f_134825_;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@@ -46,4 +_,8 @@
|
||||||
|
public FriendlyByteBuf m_179825_() {
|
||||||
|
return this.f_134826_;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Override public int getIndex() { return m_179824_(); }
|
||||||
|
+ @Override public net.minecraft.resources.ResourceLocation getName() { return net.minecraftforge.network.LoginWrapper.WRAPPER; }
|
||||||
|
+ @org.jetbrains.annotations.Nullable @Override public FriendlyByteBuf getInternalData() { return m_179825_(); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
--- a/net/minecraft/resources/HolderSetCodec.java
|
||||||
|
+++ b/net/minecraft/resources/HolderSetCodec.java
|
||||||
|
@@ -20,6 +_,8 @@
|
||||||
|
private final Codec<Holder<E>> f_206656_;
|
||||||
|
private final Codec<List<Holder<E>>> f_206657_;
|
||||||
|
private final Codec<Either<TagKey<E>, List<Holder<E>>>> f_206658_;
|
||||||
|
+ private final Codec<net.minecraftforge.registries.holdersets.ICustomHolderSet<E>> forgeDispatchCodec;
|
||||||
|
+ private final Codec<Either<net.minecraftforge.registries.holdersets.ICustomHolderSet<E>, Either<TagKey<E>, List<Holder<E>>>>> combinedCodec;
|
||||||
|
|
||||||
|
private static <E> Codec<List<Holder<E>>> m_206667_(Codec<Holder<E>> p_206668_, boolean p_206669_) {
|
||||||
|
Function<List<Holder<E>>, DataResult<List<Holder<E>>>> function = ExtraCodecs.m_203984_(Holder::m_203376_);
|
||||||
|
@@ -42,6 +_,10 @@
|
||||||
|
this.f_206656_ = p_206661_;
|
||||||
|
this.f_206657_ = m_206667_(p_206661_, p_206662_);
|
||||||
|
this.f_206658_ = Codec.either(TagKey.m_203886_(p_206660_), this.f_206657_);
|
||||||
|
+ // FORGE: make registry-specific dispatch codec and make forge-or-vanilla either codec
|
||||||
|
+ this.forgeDispatchCodec = ExtraCodecs.m_184415_(() -> net.minecraftforge.registries.ForgeRegistries.HOLDER_SET_TYPES.get().getCodec())
|
||||||
|
+ .dispatch(net.minecraftforge.registries.holdersets.ICustomHolderSet::type, type -> type.makeCodec(p_206660_, p_206661_, p_206662_));
|
||||||
|
+ this.combinedCodec = new ExtraCodecs.EitherCodec<>(this.forgeDispatchCodec, this.f_206658_);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> DataResult<Pair<HolderSet<E>, T>> decode(DynamicOps<T> p_206696_, T p_206697_) {
|
||||||
|
@@ -49,9 +_,10 @@
|
||||||
|
Optional<? extends Registry<E>> optional = registryops.m_206826_(this.f_206655_);
|
||||||
|
if (optional.isPresent()) {
|
||||||
|
Registry<E> registry = optional.get();
|
||||||
|
- return this.f_206658_.decode(p_206696_, p_206697_).map((p_206682_) -> {
|
||||||
|
+ // FORGE: use the wrapped codec to decode custom/tag/list instead of just tag/list
|
||||||
|
+ return this.combinedCodec.decode(p_206696_, p_206697_).map((p_206682_) -> {
|
||||||
|
return p_206682_.mapFirst((p_206679_) -> {
|
||||||
|
- return p_206679_.map(registry::m_203561_, HolderSet::m_205800_);
|
||||||
|
+ return p_206679_.map(java.util.function.Function.identity(), tagOrList -> tagOrList.map(registry::m_203561_, HolderSet::m_205800_));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@@ -68,6 +_,9 @@
|
||||||
|
return DataResult.error("HolderSet " + p_206674_ + " is not valid in current registry set");
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // FORGE: use the dispatch codec to encode custom holdersets, otherwise fall back to vanilla tag/list
|
||||||
|
+ if (p_206674_ instanceof net.minecraftforge.registries.holdersets.ICustomHolderSet<E> customHolderSet)
|
||||||
|
+ return this.forgeDispatchCodec.encode(customHolderSet, p_206675_, p_206676_);
|
||||||
|
return this.f_206658_.encode(p_206674_.m_203440_().mapRight(List::copyOf), p_206675_, p_206676_);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
--- a/net/minecraft/resources/RegistryLoader.java
|
||||||
|
+++ b/net/minecraft/resources/RegistryLoader.java
|
||||||
|
@@ -26,7 +_,7 @@
|
||||||
|
Map<ResourceKey<E>, RegistryResourceAccess.EntryThunk<E>> map = this.f_206750_.m_214030_(p_206764_);
|
||||||
|
DataResult<WritableRegistry<E>> dataresult = DataResult.success(p_206763_, Lifecycle.stable());
|
||||||
|
|
||||||
|
- for(Map.Entry<ResourceKey<E>, RegistryResourceAccess.EntryThunk<E>> entry : map.entrySet()) {
|
||||||
|
+ for(Map.Entry<ResourceKey<E>, RegistryResourceAccess.EntryThunk<E>> entry : net.minecraftforge.common.ForgeHooks.filterThunks(map)) {
|
||||||
|
dataresult = dataresult.flatMap((p_214227_) -> {
|
||||||
|
return this.m_214228_(p_214227_, p_206764_, p_206765_, entry.getKey(), Optional.of(entry.getValue()), p_206766_).map((p_206761_) -> {
|
||||||
|
return p_214227_;
|
||||||
|
@@ -48,7 +_,12 @@
|
||||||
|
if (dataresult != null) {
|
||||||
|
return dataresult;
|
||||||
|
} else {
|
||||||
|
- Holder<E> holder = p_214229_.m_214121_(p_214232_);
|
||||||
|
+ // Prevents an exception from disrupting codec decoding when calling this with prematurely frozen registries - see comment in LevelStorageSource
|
||||||
|
+ DataResult<Holder<E>> maybeHolder = p_214229_.m_214185_(p_214232_);
|
||||||
|
+ if (maybeHolder.error().isPresent()) {
|
||||||
|
+ return maybeHolder;
|
||||||
|
+ }
|
||||||
|
+ Holder<E> holder = maybeHolder.result().get();
|
||||||
|
readcache.f_206803_.put(p_214232_, DataResult.success(holder));
|
||||||
|
DataResult<Holder<E>> dataresult1;
|
||||||
|
if (p_214233_.isEmpty()) {
|
||||||
@@ -20,11 +20,26 @@
|
|||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
AdvancementProgress advancementprogress = this.m_135996_(p_135989_);
|
AdvancementProgress advancementprogress = this.m_135996_(p_135989_);
|
||||||
boolean flag1 = advancementprogress.m_8193_();
|
boolean flag1 = advancementprogress.m_8193_();
|
||||||
@@ -248,6 +_,7 @@
|
@@ -243,11 +_,14 @@
|
||||||
|
this.m_136008_(p_135989_);
|
||||||
|
this.f_135967_.add(p_135989_);
|
||||||
|
flag = true;
|
||||||
|
+ net.minecraftforge.event.ForgeEventFactory.onAdvancementProgressedEvent(this.f_135968_, p_135989_, advancementprogress, p_135990_, net.minecraftforge.event.entity.player.AdvancementEvent.AdvancementProgressEvent.ProgressType.GRANT);
|
||||||
|
if (!flag1 && advancementprogress.m_8193_()) {
|
||||||
|
p_135989_.m_138321_().m_9989_(this.f_135968_);
|
||||||
if (p_135989_.m_138320_() != null && p_135989_.m_138320_().m_14996_() && this.f_135968_.f_19853_.m_46469_().m_46207_(GameRules.f_46153_)) {
|
if (p_135989_.m_138320_() != null && p_135989_.m_138320_().m_14996_() && this.f_135968_.f_19853_.m_46469_().m_46207_(GameRules.f_46153_)) {
|
||||||
this.f_135962_.m_240416_(Component.m_237110_("chat.type.advancement." + p_135989_.m_138320_().m_14992_().m_15548_(), this.f_135968_.m_5446_(), p_135989_.m_138330_()), false);
|
this.f_135962_.m_240416_(Component.m_237110_("chat.type.advancement." + p_135989_.m_138320_().m_14992_().m_15548_(), this.f_135968_.m_5446_(), p_135989_.m_138330_()), false);
|
||||||
}
|
}
|
||||||
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.f_135968_, p_135989_);
|
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.f_135968_, p_135989_);
|
||||||
|
+ net.minecraftforge.event.ForgeEventFactory.onAdvancementEarnedEvent(this.f_135968_, p_135989_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -265,6 +_,7 @@
|
||||||
|
this.m_136004_(p_135999_);
|
||||||
|
this.f_135967_.add(p_135999_);
|
||||||
|
flag = true;
|
||||||
|
+ net.minecraftforge.event.ForgeEventFactory.onAdvancementProgressedEvent(this.f_135968_, p_135999_, advancementprogress, p_136000_, net.minecraftforge.event.entity.player.AdvancementEvent.AdvancementProgressEvent.ProgressType.REVOKE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!advancementprogress.m_8206_()) {
|
||||||
+10
-5
@@ -76,7 +76,7 @@
|
|||||||
return !component.equals(p_238202_) ? p_238202_ : null;
|
return !component.equals(p_238202_) ? p_238202_ : null;
|
||||||
});
|
});
|
||||||
completablefuture.thenAcceptAsync((p_242747_) -> {
|
completablefuture.thenAcceptAsync((p_242747_) -> {
|
||||||
@@ -1532,11 +_,13 @@
|
@@ -1532,9 +_,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,11 +87,16 @@
|
|||||||
+ if(!ServerGamePacketListenerImpl.this.f_9743_.canInteractWith(entity, 1.5D)) return; //Forge: If the entity cannot be reached, do nothing. Original check was dist < 6, range is 4.5, so vanilla used padding=1.5
|
+ if(!ServerGamePacketListenerImpl.this.f_9743_.canInteractWith(entity, 1.5D)) return; //Forge: If the entity cannot be reached, do nothing. Original check was dist < 6, range is 4.5, so vanilla used padding=1.5
|
||||||
ItemStack itemstack = ServerGamePacketListenerImpl.this.f_9743_.m_21120_(p_143679_).m_41777_();
|
ItemStack itemstack = ServerGamePacketListenerImpl.this.f_9743_.m_21120_(p_143679_).m_41777_();
|
||||||
InteractionResult interactionresult = p_143680_.m_143694_(ServerGamePacketListenerImpl.this.f_9743_, entity, p_143679_);
|
InteractionResult interactionresult = p_143680_.m_143694_(ServerGamePacketListenerImpl.this.f_9743_, entity, p_143679_);
|
||||||
+ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(f_9743_, entity, entity.m_20182_(), p_143679_) != null) return;
|
|
||||||
if (interactionresult.m_19077_()) {
|
if (interactionresult.m_19077_()) {
|
||||||
CriteriaTriggers.f_10565_.m_61494_(ServerGamePacketListenerImpl.this.f_9743_, itemstack, entity);
|
@@ -1552,12 +_,16 @@
|
||||||
if (interactionresult.m_19080_()) {
|
|
||||||
@@ -1558,6 +_,8 @@
|
public void m_142143_(InteractionHand p_143682_, Vec3 p_143683_) {
|
||||||
|
this.m_143678_(p_143682_, (p_143686_, p_143687_, p_143688_) -> {
|
||||||
|
+ InteractionResult onInteractEntityAtResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(f_9743_, entity, p_143683_, p_143682_);
|
||||||
|
+ if (onInteractEntityAtResult != null) return onInteractEntityAtResult;
|
||||||
|
return p_143687_.m_7111_(p_143686_, p_143683_, p_143688_);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void m_141994_() {
|
public void m_141994_() {
|
||||||
if (!(entity instanceof ItemEntity) && !(entity instanceof ExperienceOrb) && !(entity instanceof AbstractArrow) && entity != ServerGamePacketListenerImpl.this.f_9743_) {
|
if (!(entity instanceof ItemEntity) && !(entity instanceof ExperienceOrb) && !(entity instanceof AbstractArrow) && entity != ServerGamePacketListenerImpl.this.f_9743_) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
};
|
};
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private final net.minecraftforge.resource.ResourceCacheManager cacheManager = new net.minecraftforge.resource.ResourceCacheManager(false, net.minecraftforge.common.ForgeConfig.COMMON.indexVanillaPackCachesOnThread, (packType, namespace) -> f_182296_.get(packType).resolve(namespace));
|
+ private final net.minecraftforge.resource.ResourceCacheManager cacheManager = new net.minecraftforge.resource.ResourceCacheManager(false, "indexVanillaPackCachesOnThread", (packType, namespace) -> f_182296_.get(packType).resolve(namespace));
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void initForNamespace(final String nameSpace) {
|
+ public void initForNamespace(final String nameSpace) {
|
||||||
|
|||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
--- a/net/minecraft/server/packs/resources/FallbackResourceManager.java
|
|
||||||
+++ b/net/minecraft/server/packs/resources/FallbackResourceManager.java
|
|
||||||
@@ -53,6 +_,9 @@
|
|
||||||
|
|
||||||
private void m_215395_(String p_215396_, @Nullable PackResources p_215397_, @Nullable Predicate<ResourceLocation> p_215398_) {
|
|
||||||
this.f_10599_.add(new FallbackResourceManager.PackEntry(p_215396_, p_215397_, p_215398_));
|
|
||||||
+ if (p_215397_ != null) {
|
|
||||||
+ p_215397_.initForNamespace(this.f_10602_);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> m_7187_() {
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
--- a/net/minecraft/util/datafix/schemas/V2832.java
|
||||||
|
+++ b/net/minecraft/util/datafix/schemas/V2832.java
|
||||||
|
@@ -19,7 +_,7 @@
|
||||||
|
return DSL.fields("Level", DSL.optionalFields("Entities", DSL.list(References.f_16785_.in(p_185234_)), "TileEntities", DSL.list(DSL.or(References.f_16781_.in(p_185234_), DSL.remainder())), "TileTicks", DSL.list(DSL.fields("i", References.f_16787_.in(p_185234_))), "Sections", DSL.list(DSL.optionalFields("biomes", DSL.optionalFields("palette", DSL.list(References.f_16794_.in(p_185234_))), "block_states", DSL.optionalFields("palette", DSL.list(References.f_16783_.in(p_185234_))))), "Structures", DSL.optionalFields("Starts", DSL.compoundList(References.f_16790_.in(p_185234_)))));
|
||||||
|
});
|
||||||
|
p_185234_.registerType(false, References.f_16795_, () -> {
|
||||||
|
- return DSL.fields("dimensions", DSL.compoundList(DSL.constType(m_17310_()), DSL.fields("generator", DSL.taggedChoiceLazy("type", DSL.string(), ImmutableMap.of("minecraft:debug", DSL::remainder, "minecraft:flat", () -> {
|
||||||
|
+ return DSL.fields("dimensions", DSL.compoundList(DSL.constType(m_17310_()), DSL.fields("generator", DSL.or(DSL.taggedChoiceLazy("type", DSL.string(), ImmutableMap.of("minecraft:debug", DSL::remainder, "minecraft:flat", () -> {
|
||||||
|
return DSL.optionalFields("settings", DSL.optionalFields("biome", References.f_16794_.in(p_185234_), "layers", DSL.list(DSL.optionalFields("block", References.f_16787_.in(p_185234_)))));
|
||||||
|
}, "minecraft:noise", () -> {
|
||||||
|
return DSL.optionalFields("biome_source", DSL.taggedChoiceLazy("type", DSL.string(), ImmutableMap.of("minecraft:fixed", () -> {
|
||||||
|
@@ -29,7 +_,7 @@
|
||||||
|
}, "minecraft:checkerboard", () -> {
|
||||||
|
return DSL.fields("biomes", DSL.list(References.f_16794_.in(p_185234_)));
|
||||||
|
}, "minecraft:the_end", DSL::remainder)), "settings", DSL.or(DSL.constType(DSL.string()), DSL.optionalFields("default_block", References.f_16787_.in(p_185234_), "default_fluid", References.f_16787_.in(p_185234_))));
|
||||||
|
- })))));
|
||||||
|
+ })), DSL.remainder()))));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -209,6 +209,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1175,7 +_,7 @@
|
||||||
|
|
||||||
|
for(InteractionHand interactionhand : InteractionHand.values()) {
|
||||||
|
ItemStack itemstack1 = this.m_21120_(interactionhand);
|
||||||
|
- if (itemstack1.m_150930_(Items.f_42747_)) {
|
||||||
|
+ if (itemstack1.m_150930_(Items.f_42747_) && net.minecraftforge.common.ForgeHooks.onLivingUseTotem(this, p_21263_, itemstack1, interactionhand)) {
|
||||||
|
itemstack = itemstack1.m_41777_();
|
||||||
|
itemstack1.m_41774_(1);
|
||||||
|
break;
|
||||||
@@ -1185,7 +_,7 @@
|
@@ -1185,7 +_,7 @@
|
||||||
if (itemstack != null) {
|
if (itemstack != null) {
|
||||||
if (this instanceof ServerPlayer) {
|
if (this instanceof ServerPlayer) {
|
||||||
@@ -590,6 +599,15 @@
|
|||||||
if (this.f_20935_.m_41781_()) {
|
if (this.f_20935_.m_41781_()) {
|
||||||
this.m_21329_();
|
this.m_21329_();
|
||||||
}
|
}
|
||||||
|
@@ -2989,7 +_,7 @@
|
||||||
|
public boolean m_21254_() {
|
||||||
|
if (this.m_6117_() && !this.f_20935_.m_41619_()) {
|
||||||
|
Item item = this.f_20935_.m_41720_();
|
||||||
|
- if (item.m_6164_(this.f_20935_) != UseAnim.BLOCK) {
|
||||||
|
+ if (item.m_6164_(this.f_20935_) != UseAnim.BLOCK && !this.f_20935_.canPerformAction(net.minecraftforge.common.ToolActions.SHIELD_BLOCK)) { // TODO 1.20 only use the tool action
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return item.m_8105_(this.f_20935_) - this.f_20936_ >= 5;
|
||||||
@@ -3115,8 +_,8 @@
|
@@ -3115,8 +_,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,7 +708,7 @@
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
|
||||||
+ if (this.m_6084_() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
+ if (this.m_6084_() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
|
||||||
+ if (facing == null) return handlers[2].cast();
|
+ if (facing == null) return handlers[2].cast();
|
||||||
+ else if (facing.m_122434_().m_122478_()) return handlers[0].cast();
|
+ else if (facing.m_122434_().m_122478_()) return handlers[0].cast();
|
||||||
+ else if (facing.m_122434_().m_122479_()) return handlers[1].cast();
|
+ else if (facing.m_122434_().m_122479_()) return handlers[1].cast();
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
--- a/net/minecraft/world/entity/Mob.java
|
--- a/net/minecraft/world/entity/Mob.java
|
||||||
+++ b/net/minecraft/world/entity/Mob.java
|
+++ b/net/minecraft/world/entity/Mob.java
|
||||||
@@ -211,6 +_,7 @@
|
@@ -210,7 +_,11 @@
|
||||||
|
}
|
||||||
|
|
||||||
public void m_6710_(@Nullable LivingEntity p_21544_) {
|
public void m_6710_(@Nullable LivingEntity p_21544_) {
|
||||||
this.f_21362_ = p_21544_;
|
- this.f_21362_ = p_21544_;
|
||||||
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_21544_);
|
+ net.minecraftforge.event.entity.living.LivingChangeTargetEvent changeTargetEvent = net.minecraftforge.common.ForgeHooks.onLivingChangeTarget(this, p_21544_, net.minecraftforge.event.entity.living.LivingChangeTargetEvent.LivingTargetType.MOB_TARGET);
|
||||||
|
+ if(!changeTargetEvent.isCanceled()) {
|
||||||
|
+ this.f_21362_ = changeTargetEvent.getNewTarget();
|
||||||
|
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, this.f_21362_); // TODO: Remove in 1.20
|
||||||
|
+ }
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean m_6549_(EntityType<?> p_21399_) {
|
public boolean m_6549_(EntityType<?> p_21399_) {
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
--- a/net/minecraft/world/entity/SpawnPlacements.java
|
--- a/net/minecraft/world/entity/SpawnPlacements.java
|
||||||
+++ b/net/minecraft/world/entity/SpawnPlacements.java
|
+++ b/net/minecraft/world/entity/SpawnPlacements.java
|
||||||
@@ -156,10 +_,26 @@
|
@@ -42,6 +_,7 @@
|
||||||
|
public class SpawnPlacements {
|
||||||
|
private static final Map<EntityType<?>, SpawnPlacements.Data> f_21750_ = Maps.newHashMap();
|
||||||
|
|
||||||
|
+ @Deprecated // FORGE: use SpawnPlacementRegisterEvent to register and modify spawn placements
|
||||||
|
public static <T extends Mob> void m_21754_(EntityType<T> p_21755_, SpawnPlacements.Type p_21756_, Heightmap.Types p_21757_, SpawnPlacements.SpawnPredicate<T> p_21758_) {
|
||||||
|
SpawnPlacements.Data spawnplacements$data = f_21750_.put(p_21755_, new SpawnPlacements.Data(p_21757_, p_21756_, p_21758_));
|
||||||
|
if (spawnplacements$data != null) {
|
||||||
|
@@ -156,10 +_,35 @@
|
||||||
boolean m_217080_(EntityType<T> p_217081_, ServerLevelAccessor p_217082_, MobSpawnType p_217083_, BlockPos p_217084_, RandomSource p_217085_);
|
boolean m_217080_(EntityType<T> p_217081_, ServerLevelAccessor p_217082_, MobSpawnType p_217083_, BlockPos p_217084_, RandomSource p_217085_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,5 +34,14 @@
|
|||||||
+ if (predicate == null) return net.minecraft.world.level.NaturalSpawner.canSpawnAtBody(this, world, pos, type);
|
+ if (predicate == null) return net.minecraft.world.level.NaturalSpawner.canSpawnAtBody(this, world, pos, type);
|
||||||
+ return predicate.test(world, pos, type);
|
+ return predicate.test(world, pos, type);
|
||||||
+ }
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // ******* FORGE START. INTERNAL USE ONLY! ****** //
|
||||||
|
+ public static void fireSpawnPlacementEvent()
|
||||||
|
+ {
|
||||||
|
+ Map<EntityType<?>, net.minecraftforge.event.entity.SpawnPlacementRegisterEvent.MergedSpawnPredicate<?>> map = Maps.newHashMap();
|
||||||
|
+ f_21750_.forEach((type, data) -> map.put(type, new net.minecraftforge.event.entity.SpawnPlacementRegisterEvent.MergedSpawnPredicate<>(data.f_21769_, data.f_21768_, data.f_21767_)));
|
||||||
|
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.event.entity.SpawnPlacementRegisterEvent(map));
|
||||||
|
+ map.forEach(((entityType, merged) -> f_21750_.put(entityType, new SpawnPlacements.Data(merged.getHeightmapType(), merged.getSpawnType(), merged.build()))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
--- a/net/minecraft/world/entity/ai/behavior/StartAttacking.java
|
||||||
|
+++ b/net/minecraft/world/entity/ai/behavior/StartAttacking.java
|
||||||
|
@@ -46,7 +_,11 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <E extends Mob> void m_24213_(E p_24214_, LivingEntity p_24215_) {
|
||||||
|
- p_24214_.m_6274_().m_21879_(MemoryModuleType.f_26372_, p_24215_);
|
||||||
|
- p_24214_.m_6274_().m_21936_(MemoryModuleType.f_26326_);
|
||||||
|
+ net.minecraftforge.event.entity.living.LivingChangeTargetEvent changeTargetEvent = net.minecraftforge.common.ForgeHooks.onLivingChangeTarget(p_24214_, p_24215_, net.minecraftforge.event.entity.living.LivingChangeTargetEvent.LivingTargetType.BEHAVIOR_TARGET);
|
||||||
|
+ if(!changeTargetEvent.isCanceled()) {
|
||||||
|
+ p_24214_.m_6274_().m_21879_(MemoryModuleType.f_26372_, changeTargetEvent.getNewTarget());
|
||||||
|
+ p_24214_.m_6274_().m_21936_(MemoryModuleType.f_26326_);
|
||||||
|
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(p_24214_, changeTargetEvent.getNewTarget(), net.minecraftforge.event.entity.living.LivingChangeTargetEvent.LivingTargetType.BEHAVIOR_TARGET); // TODO: Remove in 1.20
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
--- a/net/minecraft/world/entity/animal/Cat.java
|
--- a/net/minecraft/world/entity/animal/Cat.java
|
||||||
+++ b/net/minecraft/world/entity/animal/Cat.java
|
+++ b/net/minecraft/world/entity/animal/Cat.java
|
||||||
@@ -366,7 +_,7 @@
|
@@ -365,8 +_,8 @@
|
||||||
|
if (this.m_21830_(p_28153_)) {
|
||||||
if (!(item instanceof DyeItem)) {
|
if (!(item instanceof DyeItem)) {
|
||||||
if (item.m_41472_() && this.m_6898_(itemstack) && this.m_21223_() < this.m_21233_()) {
|
if (item.m_41472_() && this.m_6898_(itemstack) && this.m_21223_() < this.m_21233_()) {
|
||||||
|
+ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_());
|
||||||
this.m_142075_(p_28153_, p_28154_, itemstack);
|
this.m_142075_(p_28153_, p_28154_, itemstack);
|
||||||
- this.m_5634_((float)item.m_41473_().m_38744_());
|
- this.m_5634_((float)item.m_41473_().m_38744_());
|
||||||
+ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_());
|
|
||||||
return InteractionResult.CONSUME;
|
return InteractionResult.CONSUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
--- a/net/minecraft/world/entity/animal/Wolf.java
|
--- a/net/minecraft/world/entity/animal/Wolf.java
|
||||||
+++ b/net/minecraft/world/entity/animal/Wolf.java
|
+++ b/net/minecraft/world/entity/animal/Wolf.java
|
||||||
@@ -329,7 +_,8 @@
|
@@ -325,11 +_,12 @@
|
||||||
|
} else {
|
||||||
|
if (this.m_21824_()) {
|
||||||
|
if (this.m_6898_(itemstack) && this.m_21223_() < this.m_21233_()) {
|
||||||
|
+ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_());
|
||||||
|
if (!p_30412_.m_150110_().f_35937_) {
|
||||||
itemstack.m_41774_(1);
|
itemstack.m_41774_(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
- this.m_5634_((float)item.m_41473_().m_38744_());
|
- this.m_5634_((float)item.m_41473_().m_38744_());
|
||||||
+ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_());
|
|
||||||
+ this.m_146852_(GameEvent.f_157806_, this);
|
+ this.m_146852_(GameEvent.f_157806_, this);
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
|
||||||
+ if (this.m_6084_() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null)
|
+ if (this.m_6084_() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && itemHandler != null)
|
||||||
+ return itemHandler.cast();
|
+ return itemHandler.cast();
|
||||||
+ return super.getCapability(capability, facing);
|
+ return super.getCapability(capability, facing);
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
--- a/net/minecraft/world/entity/player/Inventory.java
|
--- a/net/minecraft/world/entity/player/Inventory.java
|
||||||
+++ b/net/minecraft/world/entity/player/Inventory.java
|
+++ b/net/minecraft/world/entity/player/Inventory.java
|
||||||
|
@@ -129,7 +_,7 @@
|
||||||
|
|
||||||
|
for(int k = 0; k < 9; ++k) {
|
||||||
|
int l = (this.f_35977_ + k) % 9;
|
||||||
|
- if (!this.f_35974_.get(l).m_41793_()) {
|
||||||
|
+ if (!this.f_35974_.get(l).isNotReplaceableByPickAction(this.f_35978_, l)) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -177,7 +_,8 @@
|
@@ -177,7 +_,8 @@
|
||||||
int i = p_36049_.m_41613_();
|
int i = p_36049_.m_41613_();
|
||||||
ItemStack itemstack = this.m_8020_(p_36048_);
|
ItemStack itemstack = this.m_8020_(p_36048_);
|
||||||
|
|||||||
@@ -215,7 +215,11 @@
|
|||||||
if (p_36347_.m_6097_()) {
|
if (p_36347_.m_6097_()) {
|
||||||
if (!p_36347_.m_7313_(this)) {
|
if (!p_36347_.m_7313_(this)) {
|
||||||
float f = (float)this.m_21133_(Attributes.f_22281_);
|
float f = (float)this.m_21133_(Attributes.f_22281_);
|
||||||
@@ -1086,7 +_,7 @@
|
@@ -1082,11 +_,10 @@
|
||||||
|
float f2 = this.m_36403_(0.5F);
|
||||||
|
f *= 0.2F + f2 * f2 * 0.8F;
|
||||||
|
f1 *= f2;
|
||||||
|
- this.m_36334_();
|
||||||
if (f > 0.0F || f1 > 0.0F) {
|
if (f > 0.0F || f1 > 0.0F) {
|
||||||
boolean flag = f2 > 0.9F;
|
boolean flag = f2 > 0.9F;
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
@@ -276,6 +280,14 @@
|
|||||||
this.m_21008_(InteractionHand.MAIN_HAND, ItemStack.f_41583_);
|
this.m_21008_(InteractionHand.MAIN_HAND, ItemStack.f_41583_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1212,6 +_,7 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ this.m_36334_(); // FORGE: Moved from beginning of attack() so that getAttackStrengthScale() returns an accurate value during all attack events
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1228,7 +_,7 @@
|
@@ -1228,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +443,7 @@
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
|
||||||
+ if (this.m_6084_() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
+ if (this.m_6084_() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
|
||||||
+ if (facing == null) return playerJoinedHandler.cast();
|
+ if (facing == null) return playerJoinedHandler.cast();
|
||||||
+ else if (facing.m_122434_().m_122478_()) return playerMainHandler.cast();
|
+ else if (facing.m_122434_().m_122478_()) return playerMainHandler.cast();
|
||||||
+ else if (facing.m_122434_().m_122479_()) return playerEquipmentHandler.cast();
|
+ else if (facing.m_122434_().m_122479_()) return playerEquipmentHandler.cast();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
if (!this.f_19853_.f_46443_) {
|
if (!this.f_19853_.f_46443_) {
|
||||||
Entity entity = this.m_37282_();
|
Entity entity = this.m_37282_();
|
||||||
- if (!(entity instanceof Mob) || this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) {
|
- if (!(entity instanceof Mob) || this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) {
|
||||||
+ if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this)) {
|
+ if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, entity)) {
|
||||||
BlockPos blockpos = p_37384_.m_82425_().m_121945_(p_37384_.m_82434_());
|
BlockPos blockpos = p_37384_.m_82425_().m_121945_(p_37384_.m_82434_());
|
||||||
if (this.f_19853_.m_46859_(blockpos)) {
|
if (this.f_19853_.m_46859_(blockpos)) {
|
||||||
this.f_19853_.m_46597_(blockpos, BaseFireBlock.m_49245_(this.f_19853_, blockpos));
|
this.f_19853_.m_46597_(blockpos, BaseFireBlock.m_49245_(this.f_19853_, blockpos));
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
if (entity instanceof ServerPlayer) {
|
if (entity instanceof ServerPlayer) {
|
||||||
ServerPlayer serverplayer = (ServerPlayer)entity;
|
ServerPlayer serverplayer = (ServerPlayer)entity;
|
||||||
if (serverplayer.f_8906_.m_6198_().m_129536_() && serverplayer.f_19853_ == this.f_19853_ && !serverplayer.m_5803_()) {
|
if (serverplayer.f_8906_.m_6198_().m_129536_() && serverplayer.f_19853_ == this.f_19853_ && !serverplayer.m_5803_()) {
|
||||||
+ net.minecraftforge.event.entity.EntityTeleportEvent.EnderPearl event = net.minecraftforge.event.ForgeEventFactory.onEnderPearlLand(serverplayer, this.m_20185_(), this.m_20186_(), this.m_20189_(), this, 5.0F);
|
+ net.minecraftforge.event.entity.EntityTeleportEvent.EnderPearl event = net.minecraftforge.event.ForgeEventFactory.onEnderPearlLand(serverplayer, this.m_20185_(), this.m_20186_(), this.m_20189_(), this, 5.0F, p_37504_);
|
||||||
+ if (!event.isCanceled()) { // Don't indent to lower patch size
|
+ if (!event.isCanceled()) { // Don't indent to lower patch size
|
||||||
if (this.f_19796_.m_188501_() < 0.05F && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) {
|
if (this.f_19796_.m_188501_() < 0.05F && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) {
|
||||||
Endermite endermite = EntityType.f_20567_.m_20615_(this.f_19853_);
|
Endermite endermite = EntityType.f_20567_.m_20615_(this.f_19853_);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -390,7 +_,8 @@
|
@@ -390,18 +_,19 @@
|
||||||
d1 = (double)p_38156_.m_123342_();
|
d1 = (double)p_38156_.m_123342_();
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
@@ -120,7 +120,11 @@
|
|||||||
flag = p_38157_.m_61143_(PoweredRailBlock.f_55215_);
|
flag = p_38157_.m_61143_(PoweredRailBlock.f_55215_);
|
||||||
flag1 = !flag;
|
flag1 = !flag;
|
||||||
}
|
}
|
||||||
@@ -401,22 +_,22 @@
|
|
||||||
|
- double d3 = 0.0078125D;
|
||||||
|
+ double d3 = getSlopeAdjustment();
|
||||||
|
if (this.m_20069_()) {
|
||||||
|
d3 *= 0.2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3 vec31 = this.m_20184_();
|
Vec3 vec31 = this.m_20184_();
|
||||||
@@ -128,26 +132,7 @@
|
|||||||
+ RailShape railshape = ((BaseRailBlock)p_38157_.m_60734_()).getRailDirection(p_38157_, this.f_19853_, p_38156_, this);
|
+ RailShape railshape = ((BaseRailBlock)p_38157_.m_60734_()).getRailDirection(p_38157_, this.f_19853_, p_38156_, this);
|
||||||
switch (railshape) {
|
switch (railshape) {
|
||||||
case ASCENDING_EAST:
|
case ASCENDING_EAST:
|
||||||
- this.m_20256_(vec31.m_82520_(-d3, 0.0D, 0.0D));
|
this.m_20256_(vec31.m_82520_(-d3, 0.0D, 0.0D));
|
||||||
+ this.m_20256_(vec31.m_82520_(-1 * getSlopeAdjustment(), 0.0D, 0.0D));
|
|
||||||
++d1;
|
|
||||||
break;
|
|
||||||
case ASCENDING_WEST:
|
|
||||||
- this.m_20256_(vec31.m_82520_(d3, 0.0D, 0.0D));
|
|
||||||
+ this.m_20256_(vec31.m_82520_(getSlopeAdjustment(), 0.0D, 0.0D));
|
|
||||||
++d1;
|
|
||||||
break;
|
|
||||||
case ASCENDING_NORTH:
|
|
||||||
- this.m_20256_(vec31.m_82520_(0.0D, 0.0D, d3));
|
|
||||||
+ this.m_20256_(vec31.m_82520_(0.0D, 0.0D, getSlopeAdjustment()));
|
|
||||||
++d1;
|
|
||||||
break;
|
|
||||||
case ASCENDING_SOUTH:
|
|
||||||
- this.m_20256_(vec31.m_82520_(0.0D, 0.0D, -d3));
|
|
||||||
+ this.m_20256_(vec31.m_82520_(0.0D, 0.0D, -1 * getSlopeAdjustment()));
|
|
||||||
++d1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -447,7 +_,7 @@
|
@@ -447,7 +_,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,8 +221,8 @@
|
|||||||
+ private float currentSpeedCapOnRail = getMaxCartSpeedOnRail();
|
+ private float currentSpeedCapOnRail = getMaxCartSpeedOnRail();
|
||||||
+ @Override public float getCurrentCartSpeedCapOnRail() { return currentSpeedCapOnRail; }
|
+ @Override public float getCurrentCartSpeedCapOnRail() { return currentSpeedCapOnRail; }
|
||||||
+ @Override public void setCurrentCartSpeedCapOnRail(float value) { currentSpeedCapOnRail = Math.min(value, getMaxCartSpeedOnRail()); }
|
+ @Override public void setCurrentCartSpeedCapOnRail(float value) { currentSpeedCapOnRail = Math.min(value, getMaxCartSpeedOnRail()); }
|
||||||
+ private float maxSpeedAirLateral = DEFAULT_MAX_SPEED_AIR_LATERAL;
|
+ @org.jetbrains.annotations.Nullable private Float maxSpeedAirLateral = null;
|
||||||
+ @Override public float getMaxSpeedAirLateral() { return maxSpeedAirLateral; }
|
+ @Override public float getMaxSpeedAirLateral() { return maxSpeedAirLateral == null ? (float) this.m_7097_() : maxSpeedAirLateral; }
|
||||||
+ @Override public void setMaxSpeedAirLateral(float value) { maxSpeedAirLateral = value; }
|
+ @Override public void setMaxSpeedAirLateral(float value) { maxSpeedAirLateral = value; }
|
||||||
+ private float maxSpeedAirVertical = DEFAULT_MAX_SPEED_AIR_VERTICAL;
|
+ private float maxSpeedAirVertical = DEFAULT_MAX_SPEED_AIR_VERTICAL;
|
||||||
+ @Override public float getMaxSpeedAirVertical() { return maxSpeedAirVertical; }
|
+ @Override public float getMaxSpeedAirVertical() { return maxSpeedAirVertical; }
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
|
||||||
+ if (this.m_6084_() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
+ if (this.m_6084_() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER)
|
||||||
+ return itemHandler.cast();
|
+ return itemHandler.cast();
|
||||||
+ return super.getCapability(capability, facing);
|
+ return super.getCapability(capability, facing);
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
|
||||||
+ if (this.m_6084_() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
+ if (this.m_6084_() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER)
|
||||||
+ return itemHandler.cast();
|
+ return itemHandler.cast();
|
||||||
+ return super.getCapability(capability, facing);
|
+ return super.getCapability(capability, facing);
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -12,6 +12,14 @@
|
|||||||
for(ContainerListener containerlistener : this.f_38848_) {
|
for(ContainerListener containerlistener : this.f_38848_) {
|
||||||
containerlistener.m_7934_(this, p_150408_, itemstack1);
|
containerlistener.m_7934_(this, p_150408_, itemstack1);
|
||||||
}
|
}
|
||||||
|
@@ -400,6 +_,7 @@
|
||||||
|
ItemStack itemstack11 = this.m_142621_();
|
||||||
|
p_150434_.m_141945_(itemstack11, slot7.m_7993_(), clickaction);
|
||||||
|
if (!itemstack11.m_150926_(slot7, clickaction, p_150434_) && !itemstack10.m_150932_(itemstack11, slot7, clickaction, p_150434_, this.m_150446_())) {
|
||||||
|
+ if (!net.minecraftforge.common.ForgeHooks.onItemStackedOn(itemstack11, itemstack10, slot7, clickaction, p_150434_, m_150446_()))
|
||||||
|
if (itemstack10.m_41619_()) {
|
||||||
|
if (!itemstack11.m_41619_()) {
|
||||||
|
int l2 = clickaction == ClickAction.PRIMARY ? itemstack11.m_41613_() : 1;
|
||||||
@@ -601,14 +_,15 @@
|
@@ -601,14 +_,15 @@
|
||||||
ItemStack itemstack = slot.m_7993_();
|
ItemStack itemstack = slot.m_7993_();
|
||||||
if (!itemstack.m_41619_() && ItemStack.m_150942_(p_38904_, itemstack)) {
|
if (!itemstack.m_41619_() && ItemStack.m_150942_(p_38904_, itemstack)) {
|
||||||
|
|||||||
@@ -24,9 +24,9 @@
|
|||||||
this.f_39000_ = 0;
|
this.f_39000_ = 0;
|
||||||
+ boolean flag = false;
|
+ boolean flag = false;
|
||||||
+
|
+
|
||||||
|
+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, f_39768_, f_39001_, j, this.f_39771_)) return;
|
||||||
if (!itemstack2.m_41619_()) {
|
if (!itemstack2.m_41619_()) {
|
||||||
- boolean flag = itemstack2.m_150930_(Items.f_42690_) && !EnchantedBookItem.m_41163_(itemstack2).isEmpty();
|
- boolean flag = itemstack2.m_150930_(Items.f_42690_) && !EnchantedBookItem.m_41163_(itemstack2).isEmpty();
|
||||||
+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, f_39768_, f_39001_, j, this.f_39771_)) return;
|
|
||||||
+ flag = itemstack2.m_41720_() == Items.f_42690_ && !EnchantedBookItem.m_41163_(itemstack2).isEmpty();
|
+ flag = itemstack2.m_41720_() == Items.f_42690_ && !EnchantedBookItem.m_41163_(itemstack2).isEmpty();
|
||||||
if (itemstack1.m_41763_() && itemstack1.m_41720_().m_6832_(itemstack, itemstack2)) {
|
if (itemstack1.m_41763_() && itemstack1.m_41720_().m_6832_(itemstack, itemstack2)) {
|
||||||
int l2 = Math.min(itemstack1.m_41773_(), itemstack1.m_41776_() / 4);
|
int l2 = Math.min(itemstack1.m_41773_(), itemstack1.m_41776_() / 4);
|
||||||
|
|||||||
@@ -1,5 +1,53 @@
|
|||||||
--- a/net/minecraft/world/inventory/GrindstoneMenu.java
|
--- a/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||||
+++ b/net/minecraft/world/inventory/GrindstoneMenu.java
|
+++ b/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||||
|
@@ -34,6 +_,7 @@
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private final ContainerLevelAccess f_39561_;
|
||||||
|
+ private int xp = -1;
|
||||||
|
|
||||||
|
public GrindstoneMenu(int p_39563_, Inventory p_39564_) {
|
||||||
|
this(p_39563_, p_39564_, ContainerLevelAccess.f_39287_);
|
||||||
|
@@ -44,12 +_,12 @@
|
||||||
|
this.f_39561_ = p_39568_;
|
||||||
|
this.m_38897_(new Slot(this.f_39560_, 0, 49, 19) {
|
||||||
|
public boolean m_5857_(ItemStack p_39607_) {
|
||||||
|
- return p_39607_.m_41763_() || p_39607_.m_150930_(Items.f_42690_) || p_39607_.m_41793_();
|
||||||
|
+ return true; //Allow all items in the slot, not just repairable
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.m_38897_(new Slot(this.f_39560_, 1, 49, 40) {
|
||||||
|
public boolean m_5857_(ItemStack p_39616_) {
|
||||||
|
- return p_39616_.m_41763_() || p_39616_.m_150930_(Items.f_42690_) || p_39616_.m_41793_();
|
||||||
|
+ return true; //Allow all items in the slot, not just repairable
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.m_38897_(new Slot(this.f_39559_, 2, 129, 34) {
|
||||||
|
@@ -58,6 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void m_142406_(Player p_150574_, ItemStack p_150575_) {
|
||||||
|
+ if (net.minecraftforge.common.ForgeHooks.onGrindstoneTake(GrindstoneMenu.this.f_39560_, p_39568_, this::m_39631_)) return;
|
||||||
|
p_39568_.m_39292_((p_39634_, p_39635_) -> {
|
||||||
|
if (p_39634_ instanceof ServerLevel) {
|
||||||
|
ExperienceOrb.m_147082_((ServerLevel)p_39634_, Vec3.m_82512_(p_39635_), this.m_39631_(p_39634_));
|
||||||
|
@@ -70,6 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
private int m_39631_(Level p_39632_) {
|
||||||
|
+ if (xp > -1) return xp;
|
||||||
|
int l = 0;
|
||||||
|
l += this.m_39636_(GrindstoneMenu.this.f_39560_.m_8020_(0));
|
||||||
|
l += this.m_39636_(GrindstoneMenu.this.f_39560_.m_8020_(1));
|
||||||
|
@@ -122,6 +_,8 @@
|
||||||
|
ItemStack itemstack1 = this.f_39560_.m_8020_(1);
|
||||||
|
boolean flag = !itemstack.m_41619_() || !itemstack1.m_41619_();
|
||||||
|
boolean flag1 = !itemstack.m_41619_() && !itemstack1.m_41619_();
|
||||||
|
+ this.xp = net.minecraftforge.common.ForgeHooks.onGrindstoneChange(itemstack, itemstack1, this.f_39559_, -1);
|
||||||
|
+ if (this.xp == Integer.MIN_VALUE)
|
||||||
|
if (!flag) {
|
||||||
|
this.f_39559_.m_6836_(0, ItemStack.f_41583_);
|
||||||
|
} else {
|
||||||
@@ -143,12 +_,13 @@
|
@@ -143,12 +_,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
--- a/net/minecraft/world/item/UseAnim.java
|
||||||
|
+++ b/net/minecraft/world/item/UseAnim.java
|
||||||
|
@@ -9,5 +_,10 @@
|
||||||
|
SPEAR,
|
||||||
|
CROSSBOW,
|
||||||
|
SPYGLASS,
|
||||||
|
- TOOT_HORN;
|
||||||
|
+ TOOT_HORN,
|
||||||
|
+ /**
|
||||||
|
+ * Items with custom arm animation should return this in `Item#getUseAnimation`
|
||||||
|
+ * to prevent vanilla from also trying to animate same item
|
||||||
|
+ */
|
||||||
|
+ CUSTOM
|
||||||
|
}
|
||||||
@@ -38,6 +38,22 @@
|
|||||||
}, p_44834_);
|
}, p_44834_);
|
||||||
return mutablefloat.floatValue();
|
return mutablefloat.floatValue();
|
||||||
}
|
}
|
||||||
|
@@ -168,6 +_,7 @@
|
||||||
|
m_44853_(enchantmenthelper$enchantmentvisitor, p_44824_.m_20158_());
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if(false) // Forge: Fix MC-248272
|
||||||
|
if (p_44825_ instanceof Player) {
|
||||||
|
m_44850_(enchantmenthelper$enchantmentvisitor, p_44824_.m_21205_());
|
||||||
|
}
|
||||||
|
@@ -182,6 +_,7 @@
|
||||||
|
m_44853_(enchantmenthelper$enchantmentvisitor, p_44897_.m_20158_());
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if(false) // Forge: Fix MC-248272
|
||||||
|
if (p_44897_ instanceof Player) {
|
||||||
|
m_44850_(enchantmenthelper$enchantmentvisitor, p_44897_.m_21205_());
|
||||||
|
}
|
||||||
@@ -302,7 +_,7 @@
|
@@ -302,7 +_,7 @@
|
||||||
|
|
||||||
public static int m_220287_(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) {
|
public static int m_220287_(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) {
|
||||||
|
|||||||
@@ -8,3 +8,12 @@
|
|||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
optional.get().m_77743_();
|
optional.get().m_77743_();
|
||||||
return;
|
return;
|
||||||
|
@@ -170,7 +_,7 @@
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
|
for(Direction direction : Direction.values()) {
|
||||||
|
- if (p_49270_.m_8055_(blockpos$mutableblockpos.m_122190_(p_49271_).m_122173_(direction)).m_60713_(Blocks.f_50080_)) {
|
||||||
|
+ if (p_49270_.m_8055_(blockpos$mutableblockpos.m_122190_(p_49271_).m_122173_(direction)).isPortalFrame(p_49270_, blockpos$mutableblockpos)) {
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
@@ -35,30 +35,31 @@
|
|||||||
p_49385_.m_46672_(p_49386_.m_7494_(), this);
|
p_49385_.m_46672_(p_49386_.m_7494_(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +_,7 @@
|
@@ -139,6 +_,11 @@
|
||||||
return blockstate.m_61124_(this.m_7978_(), flag1 ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH).m_61124_(f_152149_, Boolean.valueOf(flag));
|
return blockstate.m_61124_(this.m_7978_(), flag1 ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH).m_61124_(f_152149_, Boolean.valueOf(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
+ @Deprecated //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
|
+ /**
|
||||||
|
+ * @deprecated Forge: Use {@link BaseRailBlock#getRailDirection(BlockState, BlockGetter, BlockPos, net.minecraft.world.entity.vehicle.AbstractMinecart)} for enhanced ability
|
||||||
|
+ * If you do change this property be aware that other functions in this/subclasses may break as they can make assumptions about this property
|
||||||
|
+ */
|
||||||
|
+ @Deprecated
|
||||||
public abstract Property<RailShape> m_7978_();
|
public abstract Property<RailShape> m_7978_();
|
||||||
|
|
||||||
public BlockState m_7417_(BlockState p_152151_, Direction p_152152_, BlockState p_152153_, LevelAccessor p_152154_, BlockPos p_152155_, BlockPos p_152156_) {
|
public BlockState m_7417_(BlockState p_152151_, Direction p_152152_, BlockState p_152153_, LevelAccessor p_152154_, BlockPos p_152155_, BlockPos p_152156_) {
|
||||||
@@ -152,4 +_,18 @@
|
@@ -151,5 +_,15 @@
|
||||||
|
|
||||||
public FluidState m_5888_(BlockState p_152158_) {
|
public FluidState m_5888_(BlockState p_152158_) {
|
||||||
return p_152158_.m_61143_(f_152149_) ? Fluids.f_76193_.m_76068_(false) : super.m_5888_(p_152158_);
|
return p_152158_.m_61143_(f_152149_) ? Fluids.f_76193_.m_76068_(false) : super.m_5888_(p_152158_);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isFlexibleRail(BlockState state, BlockGetter world, BlockPos pos) {
|
||||||
|
+ return !this.f_49357_;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public RailShape getRailDirection(BlockState state, BlockGetter world, BlockPos pos, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.vehicle.AbstractMinecart cart) {
|
||||||
|
+ return state.m_61143_(m_7978_());
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ /* ======================================== FORGE START =====================================*/
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean isFlexibleRail(BlockState state, BlockGetter world, BlockPos pos)
|
|
||||||
+ {
|
|
||||||
+ return !this.f_49357_;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public RailShape getRailDirection(BlockState state, BlockGetter world, BlockPos pos, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.vehicle.AbstractMinecart cart) {
|
|
||||||
+ return state.m_61143_(m_7978_());
|
|
||||||
+ }
|
|
||||||
+ /* ========================================= FORGE END ======================================*/
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,16 @@
|
|||||||
--- a/net/minecraft/world/level/block/DetectorRailBlock.java
|
--- a/net/minecraft/world/level/block/DetectorRailBlock.java
|
||||||
+++ b/net/minecraft/world/level/block/DetectorRailBlock.java
|
+++ b/net/minecraft/world/level/block/DetectorRailBlock.java
|
||||||
|
@@ -31,6 +_,10 @@
|
||||||
|
|
||||||
|
public DetectorRailBlock(BlockBehaviour.Properties p_52431_) {
|
||||||
|
super(true, p_52431_);
|
||||||
|
+ this.registerDefaultState();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void registerDefaultState() {
|
||||||
|
this.m_49959_(this.f_49792_.m_61090_().m_61124_(f_52428_, Boolean.valueOf(false)).m_61124_(f_52427_, RailShape.NORTH_SOUTH).m_61124_(f_152149_, Boolean.valueOf(false)));
|
||||||
|
}
|
||||||
|
|
||||||
@@ -135,7 +_,9 @@
|
@@ -135,7 +_,9 @@
|
||||||
return list.get(0).m_38534_().m_45436_();
|
return list.get(0).m_38534_().m_45436_();
|
||||||
}
|
}
|
||||||
@@ -11,3 +22,11 @@
|
|||||||
if (!list1.isEmpty()) {
|
if (!list1.isEmpty()) {
|
||||||
return AbstractContainerMenu.m_38938_((Container)list1.get(0));
|
return AbstractContainerMenu.m_38938_((Container)list1.get(0));
|
||||||
}
|
}
|
||||||
|
@@ -270,6 +_,6 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void m_7926_(StateDefinition.Builder<Block, BlockState> p_52469_) {
|
||||||
|
- p_52469_.m_61104_(f_52427_, f_52428_, f_152149_);
|
||||||
|
+ p_52469_.m_61104_(m_7978_(), f_52428_, f_152149_);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
--- a/net/minecraft/world/level/block/FlowerBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/FlowerBlock.java
|
||||||
|
@@ -15,6 +_,17 @@
|
||||||
|
private final MobEffect f_53508_;
|
||||||
|
private final int f_53509_;
|
||||||
|
|
||||||
|
+ private final java.util.function.Supplier<MobEffect> suspiciousStewEffectSupplier;
|
||||||
|
+
|
||||||
|
+ public FlowerBlock(java.util.function.Supplier<MobEffect> effectSupplier, int p_53513_, BlockBehaviour.Properties p_53514_) {
|
||||||
|
+ super(p_53514_);
|
||||||
|
+ this.f_53508_ = null;
|
||||||
|
+ this.suspiciousStewEffectSupplier = effectSupplier;
|
||||||
|
+ this.f_53509_ = p_53513_;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /** @deprecated FORGE: Use supplier version instead */
|
||||||
|
+ @Deprecated
|
||||||
|
public FlowerBlock(MobEffect p_53512_, int p_53513_, BlockBehaviour.Properties p_53514_) {
|
||||||
|
super(p_53514_);
|
||||||
|
this.f_53508_ = p_53512_;
|
||||||
|
@@ -23,6 +_,7 @@
|
||||||
|
} else {
|
||||||
|
this.f_53509_ = p_53513_ * 20;
|
||||||
|
}
|
||||||
|
+ this.suspiciousStewEffectSupplier = net.minecraftforge.registries.ForgeRegistries.MOB_EFFECTS.getDelegateOrThrow(p_53512_);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -32,10 +_,12 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public MobEffect m_53521_() {
|
||||||
|
+ if (true) return this.suspiciousStewEffectSupplier.get();
|
||||||
|
return this.f_53508_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int m_53522_() {
|
||||||
|
+ if (this.f_53508_ == null && !this.suspiciousStewEffectSupplier.get().m_8093_()) return this.f_53509_ * 20;
|
||||||
|
return this.f_53509_;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--- a/net/minecraft/world/level/block/FungusBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/FungusBlock.java
|
||||||
|
@@ -44,6 +_,8 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void m_214148_(ServerLevel p_221243_, RandomSource p_221244_, BlockPos p_221245_, BlockState p_221246_) {
|
||||||
|
+ net.minecraftforge.event.level.SaplingGrowTreeEvent event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_221243_, p_221244_, p_221245_, this.f_53597_.get());
|
||||||
|
+ if (event.getResult().equals(net.minecraftforge.eventbus.api.Event.Result.DENY)) return;
|
||||||
|
this.f_53597_.get().m_203334_().m_224953_(p_221243_, p_221243_.m_7726_().m_8481_(), p_221244_, p_221245_);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/world/level/block/MushroomBlock.java
|
--- a/net/minecraft/world/level/block/MushroomBlock.java
|
||||||
+++ b/net/minecraft/world/level/block/MushroomBlock.java
|
+++ b/net/minecraft/world/level/block/MushroomBlock.java
|
||||||
@@ -70,7 +_,7 @@
|
@@ -70,13 +_,15 @@
|
||||||
if (blockstate.m_204336_(BlockTags.f_13057_)) {
|
if (blockstate.m_204336_(BlockTags.f_13057_)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -9,3 +9,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean m_221773_(ServerLevel p_221774_, BlockPos p_221775_, BlockState p_221776_, RandomSource p_221777_) {
|
||||||
|
+ net.minecraftforge.event.level.SaplingGrowTreeEvent event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_221774_, p_221777_, p_221775_, this.f_153981_.get());
|
||||||
|
+ if (event.getResult().equals(net.minecraftforge.eventbus.api.Event.Result.DENY)) return false;
|
||||||
|
p_221774_.m_7471_(p_221775_, false);
|
||||||
|
- if (this.f_153981_.get().m_203334_().m_224953_(p_221774_, p_221774_.m_7726_().m_8481_(), p_221777_, p_221775_)) {
|
||||||
|
+ if (event.getFeature().m_203334_().m_224953_(p_221774_, p_221774_.m_7726_().m_8481_(), p_221777_, p_221775_)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
p_221774_.m_7731_(p_221775_, p_221776_, 3);
|
||||||
@@ -1,54 +1,78 @@
|
|||||||
--- a/net/minecraft/world/level/block/PoweredRailBlock.java
|
--- a/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||||
+++ b/net/minecraft/world/level/block/PoweredRailBlock.java
|
+++ b/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||||
@@ -14,10 +_,16 @@
|
@@ -14,9 +_,19 @@
|
||||||
public class PoweredRailBlock extends BaseRailBlock {
|
public class PoweredRailBlock extends BaseRailBlock {
|
||||||
public static final EnumProperty<RailShape> f_55214_ = BlockStateProperties.f_61404_;
|
public static final EnumProperty<RailShape> f_55214_ = BlockStateProperties.f_61404_;
|
||||||
public static final BooleanProperty f_55215_ = BlockStateProperties.f_61448_;
|
public static final BooleanProperty f_55215_ = BlockStateProperties.f_61448_;
|
||||||
+ private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail
|
+ private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail
|
||||||
|
|
||||||
public PoweredRailBlock(BlockBehaviour.Properties p_55218_) {
|
public PoweredRailBlock(BlockBehaviour.Properties p_55218_) {
|
||||||
- super(true, p_55218_);
|
|
||||||
+ this(p_55218_, false);
|
+ this(p_55218_, false);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ protected PoweredRailBlock(BlockBehaviour.Properties builder, boolean isPoweredRail) {
|
+ protected PoweredRailBlock(BlockBehaviour.Properties p_55218_, boolean isPoweredRail) {
|
||||||
+ super(true, builder);
|
super(true, p_55218_);
|
||||||
this.m_49959_(this.f_49792_.m_61090_().m_61124_(f_55214_, RailShape.NORTH_SOUTH).m_61124_(f_55215_, Boolean.valueOf(false)).m_61124_(f_152149_, Boolean.valueOf(false)));
|
|
||||||
+ this.isActivator = !isPoweredRail;
|
+ this.isActivator = !isPoweredRail;
|
||||||
|
+ this.registerDefaultState();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void registerDefaultState() {
|
||||||
|
this.m_49959_(this.f_49792_.m_61090_().m_61124_(f_55214_, RailShape.NORTH_SOUTH).m_61124_(f_55215_, Boolean.valueOf(false)).m_61124_(f_152149_, Boolean.valueOf(false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean m_55219_(Level p_55220_, BlockPos p_55221_, BlockState p_55222_, boolean p_55223_, int p_55224_) {
|
@@ -28,7 +_,7 @@
|
||||||
@@ -99,13 +_,13 @@
|
int j = p_55221_.m_123342_();
|
||||||
|
int k = p_55221_.m_123343_();
|
||||||
|
boolean flag = true;
|
||||||
|
- RailShape railshape = p_55222_.m_61143_(f_55214_);
|
||||||
|
+ RailShape railshape = p_55222_.m_61143_(m_7978_());
|
||||||
|
switch (railshape) {
|
||||||
|
case NORTH_SOUTH:
|
||||||
|
if (p_55223_) {
|
||||||
|
@@ -99,14 +_,14 @@
|
||||||
|
|
||||||
protected boolean m_55225_(Level p_55226_, BlockPos p_55227_, boolean p_55228_, int p_55229_, RailShape p_55230_) {
|
protected boolean m_55225_(Level p_55226_, BlockPos p_55227_, boolean p_55228_, int p_55229_, RailShape p_55230_) {
|
||||||
BlockState blockstate = p_55226_.m_8055_(p_55227_);
|
BlockState blockstate = p_55226_.m_8055_(p_55227_);
|
||||||
- if (!blockstate.m_60713_(this)) {
|
- if (!blockstate.m_60713_(this)) {
|
||||||
+ if (!(blockstate.m_60734_() instanceof PoweredRailBlock)) {
|
+ if (!(blockstate.m_60734_() instanceof PoweredRailBlock other)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
- RailShape railshape = blockstate.m_61143_(f_55214_);
|
- RailShape railshape = blockstate.m_61143_(f_55214_);
|
||||||
+ RailShape railshape = getRailDirection(blockstate, p_55226_, p_55227_, null);
|
+ RailShape railshape = other.getRailDirection(blockstate, p_55226_, p_55227_, null);
|
||||||
if (p_55230_ != RailShape.EAST_WEST || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) {
|
if (p_55230_ != RailShape.EAST_WEST || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) {
|
||||||
if (p_55230_ != RailShape.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) {
|
if (p_55230_ != RailShape.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) {
|
||||||
- if (blockstate.m_61143_(f_55215_)) {
|
- if (blockstate.m_61143_(f_55215_)) {
|
||||||
+ if (isActivator == (((PoweredRailBlock) blockstate.m_60734_()).isActivator)) {
|
- return p_55226_.m_46753_(p_55227_) ? true : this.m_55219_(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1);
|
||||||
return p_55226_.m_46753_(p_55227_) ? true : this.m_55219_(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1);
|
+ if (isActivatorRail() == other.isActivatorRail()) {
|
||||||
|
+ return p_55226_.m_46753_(p_55227_) ? true : other.m_55219_(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
@@ -125,7 +_,7 @@
|
||||||
|
if (flag1 != flag) {
|
||||||
|
p_55233_.m_7731_(p_55234_, p_55232_.m_61124_(f_55215_, Boolean.valueOf(flag1)), 3);
|
||||||
|
p_55233_.m_46672_(p_55234_.m_7495_(), this);
|
||||||
|
- if (p_55232_.m_61143_(f_55214_).m_61745_()) {
|
||||||
|
+ if (p_55232_.m_61143_(m_7978_()).m_61745_()) {
|
||||||
|
p_55233_.m_46672_(p_55234_.m_7494_(), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -156,6 +_,9 @@
|
@@ -156,6 +_,9 @@
|
||||||
return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_EAST);
|
return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_EAST);
|
||||||
case NORTH_EAST:
|
case NORTH_EAST:
|
||||||
return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_WEST);
|
return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_WEST);
|
||||||
+ case NORTH_SOUTH: //Forge fix: MC-196102
|
+ case NORTH_SOUTH: //Forge fix: MC-196102
|
||||||
+ case EAST_WEST:
|
+ case EAST_WEST:
|
||||||
+ return p_55240_;
|
+ return p_55240_;
|
||||||
}
|
}
|
||||||
case COUNTERCLOCKWISE_90:
|
case COUNTERCLOCKWISE_90:
|
||||||
switch ((RailShape)p_55240_.m_61143_(f_55214_)) {
|
switch ((RailShape)p_55240_.m_61143_(f_55214_)) {
|
||||||
@@ -254,5 +_,9 @@
|
@@ -253,6 +_,10 @@
|
||||||
|
}
|
||||||
|
|
||||||
protected void m_7926_(StateDefinition.Builder<Block, BlockState> p_55243_) {
|
protected void m_7926_(StateDefinition.Builder<Block, BlockState> p_55243_) {
|
||||||
p_55243_.m_61104_(f_55214_, f_55215_, f_152149_);
|
- p_55243_.m_61104_(f_55214_, f_55215_, f_152149_);
|
||||||
|
+ p_55243_.m_61104_(m_7978_(), f_55215_, f_152149_);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public boolean isActivatorRail() {
|
+ public boolean isActivatorRail() {
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
--- a/net/minecraft/world/level/block/SaplingBlock.java
|
--- a/net/minecraft/world/level/block/SaplingBlock.java
|
||||||
+++ b/net/minecraft/world/level/block/SaplingBlock.java
|
+++ b/net/minecraft/world/level/block/SaplingBlock.java
|
||||||
@@ -32,6 +_,7 @@
|
@@ -31,6 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
public void m_213898_(BlockState p_222011_, ServerLevel p_222012_, BlockPos p_222013_, RandomSource p_222014_) {
|
public void m_213898_(BlockState p_222011_, ServerLevel p_222012_, BlockPos p_222013_, RandomSource p_222014_) {
|
||||||
if (p_222012_.m_46803_(p_222013_.m_7494_()) >= 9 && p_222014_.m_188503_(7) == 0) {
|
|
||||||
+ if (!p_222012_.isAreaLoaded(p_222013_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
|
+ if (!p_222012_.isAreaLoaded(p_222013_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
|
||||||
|
if (p_222012_.m_46803_(p_222013_.m_7494_()) >= 9 && p_222014_.m_188503_(7) == 0) {
|
||||||
this.m_222000_(p_222012_, p_222013_, p_222011_, p_222014_);
|
this.m_222000_(p_222012_, p_222013_, p_222011_, p_222014_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +_,7 @@
|
|
||||||
if (p_222003_.m_61143_(f_55973_) == 0) {
|
|
||||||
p_222001_.m_7731_(p_222002_, p_222003_.m_61122_(f_55973_), 4);
|
|
||||||
} else {
|
|
||||||
+ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_222001_, p_222004_, p_222002_)) return;
|
|
||||||
this.f_55975_.m_213817_(p_222001_, p_222001_.m_7726_().m_8481_(), p_222002_, p_222003_, p_222004_);
|
|
||||||
}
|
|
||||||
|
|
||||||
+1
-1
@@ -164,7 +164,7 @@
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
|
||||||
+ if (!this.f_58859_ && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
+ if (!this.f_58859_ && facing != null && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
|
||||||
+ if (facing == Direction.UP)
|
+ if (facing == Direction.UP)
|
||||||
+ return handlers[0].cast();
|
+ return handlers[0].cast();
|
||||||
+ else if (facing == Direction.DOWN)
|
+ else if (facing == Direction.DOWN)
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, @org.jetbrains.annotations.Nullable net.minecraft.core.Direction side) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, @org.jetbrains.annotations.Nullable net.minecraft.core.Direction side) {
|
||||||
+ if (!this.f_58859_ && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
|
+ if (!this.f_58859_ && cap == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER)
|
||||||
+ return itemHandler.cast();
|
+ return itemHandler.cast();
|
||||||
+ return super.getCapability(cap, side);
|
+ return super.getCapability(cap, side);
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
|
||||||
+ if (!this.f_58859_ && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
+ if (!this.f_58859_ && facing != null && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
|
||||||
+ if (facing == Direction.UP)
|
+ if (facing == Direction.UP)
|
||||||
+ return handlers[0].cast();
|
+ return handlers[0].cast();
|
||||||
+ else if (facing == Direction.DOWN)
|
+ else if (facing == Direction.DOWN)
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, Direction side) {
|
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, Direction side) {
|
||||||
+ if (!this.f_58859_ && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
+ if (!this.f_58859_ && cap == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
|
||||||
+ if (this.chestHandler == null)
|
+ if (this.chestHandler == null)
|
||||||
+ this.chestHandler = net.minecraftforge.common.util.LazyOptional.of(this::createHandler);
|
+ this.chestHandler = net.minecraftforge.common.util.LazyOptional.of(this::createHandler);
|
||||||
+ return this.chestHandler.cast();
|
+ return this.chestHandler.cast();
|
||||||
|
|||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
--- a/net/minecraft/world/level/block/grower/AbstractMegaTreeGrower.java
|
||||||
|
+++ b/net/minecraft/world/level/block/grower/AbstractMegaTreeGrower.java
|
||||||
|
@@ -25,15 +_,24 @@
|
||||||
|
return super.m_213817_(p_222891_, p_222892_, p_222893_, p_222894_, p_222895_);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Forge: context-sensitive version to be able to use data pack provided features
|
||||||
|
+ @Nullable
|
||||||
|
+ protected Holder<? extends ConfiguredFeature<?, ?>> getConfiguredMegaFeature(ServerLevel level, ChunkGenerator chunkGenerator, BlockPos pos, BlockState state, RandomSource random) {
|
||||||
|
+ return m_213566_(random);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /** @deprecated Forge: Use {@link #getConfiguredMegaFeature(ServerLevel, ChunkGenerator, BlockPos, BlockState, RandomSource)} instead */
|
||||||
|
+ @Deprecated
|
||||||
|
@Nullable
|
||||||
|
protected abstract Holder<? extends ConfiguredFeature<?, ?>> m_213566_(RandomSource p_222904_);
|
||||||
|
|
||||||
|
public boolean m_222896_(ServerLevel p_222897_, ChunkGenerator p_222898_, BlockPos p_222899_, BlockState p_222900_, RandomSource p_222901_, int p_222902_, int p_222903_) {
|
||||||
|
- Holder<? extends ConfiguredFeature<?, ?>> holder = this.m_213566_(p_222901_);
|
||||||
|
- if (holder == null) {
|
||||||
|
+ Holder<? extends ConfiguredFeature<?, ?>> holder = this.getConfiguredMegaFeature(p_222897_, p_222898_, p_222899_, p_222900_, p_222901_);
|
||||||
|
+ net.minecraftforge.event.level.SaplingGrowTreeEvent event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_222897_, p_222901_, p_222899_, holder);
|
||||||
|
+ if (event.getResult().equals(net.minecraftforge.eventbus.api.Event.Result.DENY) || event.getFeature() == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
- ConfiguredFeature<?, ?> configuredfeature = holder.m_203334_();
|
||||||
|
+ ConfiguredFeature<?, ?> configuredfeature = event.getFeature().m_203334_();
|
||||||
|
BlockState blockstate = Blocks.f_50016_.m_49966_();
|
||||||
|
p_222897_.m_7731_(p_222899_.m_7918_(p_222902_, 0, p_222903_), blockstate, 4);
|
||||||
|
p_222897_.m_7731_(p_222899_.m_7918_(p_222902_ + 1, 0, p_222903_), blockstate, 4);
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
--- a/net/minecraft/world/level/block/grower/AbstractTreeGrower.java
|
||||||
|
+++ b/net/minecraft/world/level/block/grower/AbstractTreeGrower.java
|
||||||
|
@@ -12,15 +_,24 @@
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
|
|
||||||
|
public abstract class AbstractTreeGrower {
|
||||||
|
+ // Forge: context-sensitive version to be able to use data pack provided features
|
||||||
|
+ @Nullable
|
||||||
|
+ protected Holder<? extends ConfiguredFeature<?, ?>> getConfiguredFeature(ServerLevel level, ChunkGenerator chunkGenerator, BlockPos pos, BlockState state, RandomSource random, boolean hasFlowers) {
|
||||||
|
+ return m_213888_(random, hasFlowers);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /** @deprecated Forge: Use {@link #getConfiguredFeature(ServerLevel, ChunkGenerator, BlockPos, BlockState, RandomSource, boolean)} instead */
|
||||||
|
+ @Deprecated
|
||||||
|
@Nullable
|
||||||
|
protected abstract Holder<? extends ConfiguredFeature<?, ?>> m_213888_(RandomSource p_222910_, boolean p_222911_);
|
||||||
|
|
||||||
|
public boolean m_213817_(ServerLevel p_222905_, ChunkGenerator p_222906_, BlockPos p_222907_, BlockState p_222908_, RandomSource p_222909_) {
|
||||||
|
- Holder<? extends ConfiguredFeature<?, ?>> holder = this.m_213888_(p_222909_, this.m_60011_(p_222905_, p_222907_));
|
||||||
|
- if (holder == null) {
|
||||||
|
+ Holder<? extends ConfiguredFeature<?, ?>> holder = this.getConfiguredFeature(p_222905_, p_222906_, p_222907_, p_222908_, p_222909_, this.m_60011_(p_222905_, p_222907_));
|
||||||
|
+ net.minecraftforge.event.level.SaplingGrowTreeEvent event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_222905_, p_222909_, p_222907_, holder);
|
||||||
|
+ if (event.getResult().equals(net.minecraftforge.eventbus.api.Event.Result.DENY) || event.getFeature() == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
- ConfiguredFeature<?, ?> configuredfeature = holder.m_203334_();
|
||||||
|
+ ConfiguredFeature<?, ?> configuredfeature = event.getFeature().m_203334_();
|
||||||
|
BlockState blockstate = p_222905_.m_6425_(p_222907_).m_76188_();
|
||||||
|
p_222905_.m_7731_(p_222907_, blockstate, 4);
|
||||||
|
if (configuredfeature.m_224953_(p_222905_, p_222906_, p_222909_, p_222907_)) {
|
||||||
Loaded 100 of 263 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user