mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc2d0d1b25 | ||
|
|
e2c1da98be | ||
|
|
0f6d11b1ee | ||
|
|
340d332e19 | ||
|
|
56f19dd53d | ||
|
|
1fe420e4ab | ||
|
|
945209c283 | ||
|
|
3e5c3cabd5 | ||
|
|
b0f5a13f52 | ||
|
|
15fe8441f0 | ||
|
|
babef71616 | ||
|
|
1dd18ca27c | ||
|
|
65c7390874 | ||
|
|
fe3ad3b8f2 | ||
|
|
d05e76f7c4 | ||
|
|
bfa97bf097 | ||
|
|
469e9a6c1a | ||
|
|
58456c85af | ||
|
|
7fe5b02ef3 | ||
|
|
184392e02e | ||
|
|
d25a5466db | ||
|
|
b5073c10ef | ||
|
|
16bc7cf783 | ||
|
|
2d714f034f | ||
|
|
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 |
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.projectFeatures.githubIssues
|
||||
import jetbrains.buildServer.configs.kotlin.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||
|
||||
/*
|
||||
The settings script is an entry point for defining a TeamCity
|
||||
@@ -30,11 +32,13 @@ project {
|
||||
buildType(Build)
|
||||
buildType(BuildSecondaryBranches)
|
||||
buildType(PullRequests)
|
||||
buildType(PullRequestChecks)
|
||||
buildType(PullRequestCompatibility)
|
||||
|
||||
params {
|
||||
text("docker_jdk_version", "17", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("docker_gradle_version", "7.4", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_main_branch", "1.18.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_main_branch", "1.19.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_branch_spec", """
|
||||
+:refs/heads/(main*)
|
||||
+:refs/heads/(master*)
|
||||
@@ -134,3 +138,71 @@ object PullRequests : BuildType({
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
|
||||
object PullRequestChecks : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
|
||||
id("MinecraftForge_MinecraftForge__PullRequestChecks")
|
||||
name = "Pull Requests (Checks)"
|
||||
description = "Checks pull requests for the project"
|
||||
|
||||
steps {
|
||||
gradle {
|
||||
name = "Check"
|
||||
id = "RUNNER_10_Check"
|
||||
|
||||
tasks = "checkAll"
|
||||
gradleParams = "--continue %gradle_custom_args%"
|
||||
enableStacktrace = true
|
||||
dockerImage = "%docker_gradle_image%"
|
||||
dockerRunParameters = """
|
||||
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
|
||||
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
|
||||
--network=host
|
||||
-u 1000:1000
|
||||
%docker_additional_args%
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
vcs {
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:1.*
|
||||
-:<default>
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
|
||||
object PullRequestCompatibility : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
|
||||
id("MinecraftForge_MinecraftForge__PullRequestCompatibility")
|
||||
name = "Pull Requests (Compatibility)"
|
||||
description = "Validates binary compatibility for pull requests made to the project"
|
||||
|
||||
steps {
|
||||
gradle {
|
||||
name = "Validate"
|
||||
id = "RUNNER_10_Compatibility"
|
||||
|
||||
tasks = "checkJarCompatibility"
|
||||
gradleParams = "--continue %gradle_custom_args%"
|
||||
enableStacktrace = true
|
||||
dockerImage = "%docker_gradle_image%"
|
||||
dockerRunParameters = """
|
||||
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
|
||||
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
|
||||
--network=host
|
||||
-u 1000:1000
|
||||
%docker_additional_args%
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
vcs {
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:1.*
|
||||
-:<default>
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
+39
-39
@@ -19,7 +19,7 @@ plugins {
|
||||
id 'com.github.ben-manes.versions' version '0.36.0'
|
||||
id 'net.minecraftforge.gradleutils' version '2.+'
|
||||
id 'eclipse'
|
||||
id 'de.undercouch.download' version '4.1.2'
|
||||
id 'de.undercouch.download' version '5.1.3'
|
||||
id 'net.minecraftforge.gradle.patcher' version '[5.1.50,5.2.0)' apply false
|
||||
id 'net.minecraftforge.gradle.mcp' version '[5.1.50,5.2.0)' apply false
|
||||
}
|
||||
@@ -47,7 +47,7 @@ ext {
|
||||
MODLAUNCHER_VERSION = '10.0.8'
|
||||
SECUREJARHANDLER_VERSION = '2.1.4'
|
||||
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
|
||||
ASM_VERSION = '9.3'
|
||||
ASM_VERSION = '9.5'
|
||||
INSTALLER_VERSION = '2.1.+'
|
||||
MIXIN_VERSION = '0.8.5'
|
||||
TERMINALCONSOLEAPPENDER_VERSION = '1.2.0'
|
||||
@@ -77,7 +77,7 @@ ext {
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
|
||||
MIN_TAG_FOR_CHANGELOG = "41.0"
|
||||
MIN_TAG_FOR_CHANGELOG = '41.0'
|
||||
}
|
||||
|
||||
println('Version: ' + VERSION +
|
||||
@@ -1184,8 +1184,6 @@ project(':forge') {
|
||||
excs.from patcher.excs
|
||||
}
|
||||
|
||||
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks]){}
|
||||
|
||||
task checkPatchesAndFix(type: CheckPatches, dependsOn: genPatches) {
|
||||
patchDir = file("$rootDir/patches")
|
||||
autoFix = true
|
||||
@@ -1202,57 +1200,59 @@ project(':forge') {
|
||||
lineEnding = '\n'
|
||||
}
|
||||
|
||||
def baseForgeVersion = System.getProperty("forge.compatibility_check_version")
|
||||
if (baseForgeVersion == null)
|
||||
baseForgeVersion = "${MC_VERSION}-${GIT_INFO.tag}.0"
|
||||
if (baseForgeVersion == "null")
|
||||
baseForgeVersion = null // Allow disabling from system property if not wanted
|
||||
def baseForgeUniversal = null
|
||||
if (baseForgeVersion != null)
|
||||
baseForgeUniversal = project.dependencies.create("net.minecraftforge:forge:${baseForgeVersion}:universal")
|
||||
def baseForgeVersionProperty = project.objects.property(String)
|
||||
baseForgeVersionProperty.set(project.provider { getLatestForgeVersion(MC_VERSION) }.map { MC_VERSION + '-' + it })
|
||||
baseForgeVersionProperty.finalizeValueOnRead()
|
||||
def jarCompatibilityTaskSetup = { task ->
|
||||
task.group = 'jar compatibility'
|
||||
task.onlyIf {
|
||||
baseForgeVersion != null
|
||||
baseForgeVersionProperty.getOrNull() != null
|
||||
}
|
||||
task.inputs.property 'baseForgeVersion', baseForgeVersion
|
||||
}
|
||||
|
||||
task downloadBaseCompatibilityBinPatches(type: DownloadBaseCompatibilityBinPatches) {
|
||||
inputVersion = baseForgeVersion
|
||||
tasks.register('setupCheckJarCompatibility', SetupCheckJarCompatibility) {
|
||||
inputVersion = baseForgeVersionProperty
|
||||
}
|
||||
|
||||
task applyBaseCompatibilityJarBinPatches(type: ApplyBinPatches) {
|
||||
tasks.register('applyBaseCompatibilityJarBinPatches', ApplyBinPatches) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
|
||||
clean = createJoinedSRG.output
|
||||
patch = downloadBaseCompatibilityBinPatches.output
|
||||
clean = project.tasks.createJoinedSRG.output
|
||||
patch = project.tasks.named('setupCheckJarCompatibility').flatMap { it.baseBinPatchesOutput }
|
||||
output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') }
|
||||
}
|
||||
|
||||
task checkJarCompatibility(type: CheckJarCompatibility) {
|
||||
tasks.register('mergeBaseForgeJar', MergeJars) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
|
||||
if (baseForgeVersion != null) {
|
||||
def fmlLibs = project.configurations.detachedConfiguration(PACKED_DEPS.collect {
|
||||
def artifactId = it.split(':')[1]
|
||||
return project.dependencies.create("net.minecraftforge:${artifactId}:${baseForgeVersion}")
|
||||
}.toArray(Dependency[]::new))
|
||||
|
||||
baseJar = project.tasks.applyBaseCompatibilityJarBinPatches.output
|
||||
baseLibraries.from(project.configurations.detachedConfiguration(baseForgeUniversal))
|
||||
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)
|
||||
}
|
||||
inputJars.from(project.tasks.named('applyBaseCompatibilityJarBinPatches').flatMap { it.output })
|
||||
inputJars.from(baseForgeVersionProperty.map { inputVersion ->
|
||||
def output = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-universal.jar") }.get().asFile
|
||||
project.rootProject.extensions.download.run {
|
||||
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-universal.jar"
|
||||
dest output
|
||||
}
|
||||
return output
|
||||
})
|
||||
}
|
||||
|
||||
tasks.register('checkJarCompatibility', CheckJarCompatibility) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
dependsOn 'setupCheckJarCompatibility'
|
||||
|
||||
baseJar = project.tasks.named('mergeBaseForgeJar').flatMap { it.output }
|
||||
baseLibraries.from(project.tasks.named('createJoinedSRG').flatMap { it.output })
|
||||
|
||||
inputJar = project.tasks.named('reobfJar').flatMap { it.output }
|
||||
concreteLibraries.from(project.PACKED_DEPS.collect { project.rootProject.tasks.getByPath(it).archiveFile })
|
||||
|
||||
commonLibraries.from(project.configurations.minecraftImplementation)
|
||||
commonLibraries.from(project.configurations.installer)
|
||||
commonLibraries.from(project.configurations.moduleonly)
|
||||
}
|
||||
|
||||
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks, checkPatches, checkLicenses]){}
|
||||
|
||||
task launcherJson(type: LauncherJson) {
|
||||
packedDependencies = [':fmlloader:jar']
|
||||
doFirst {
|
||||
|
||||
@@ -4,7 +4,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.ow2.asm:asm:9.3'
|
||||
implementation 'org.ow2.asm:asm-tree:9.3'
|
||||
implementation 'net.minecraftforge:srgutils:0.4.+'
|
||||
implementation 'org.ow2.asm:asm:9.5'
|
||||
implementation 'org.ow2.asm:asm-tree:9.5'
|
||||
implementation 'net.minecraftforge:srgutils:0.5.+'
|
||||
implementation 'commons-io:commons-io:2.8.0'
|
||||
}
|
||||
-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()
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
abstract class SetupCheckJarCompatibility extends DefaultTask {
|
||||
SetupCheckJarCompatibility() {
|
||||
group = 'jar compatibility'
|
||||
onlyIf {
|
||||
inputVersion.getOrNull() != null
|
||||
}
|
||||
outputs.upToDateWhen { false } // Never up to date, because this setup task should always run
|
||||
|
||||
baseBinPatchesOutput.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
def inputVersion = inputVersion.get()
|
||||
def fmlLibs = project.configurations.detachedConfiguration(project.PACKED_DEPS.collect {
|
||||
def artifactId = it.split(':')[1]
|
||||
return project.dependencies.create("net.minecraftforge:${artifactId}:${inputVersion}")
|
||||
}.toArray(Dependency[]::new))
|
||||
|
||||
project.tasks.named('checkJarCompatibility') {
|
||||
baseLibraries.from(project.provider {
|
||||
fmlLibs.resolvedConfiguration.lenientConfiguration.files
|
||||
})
|
||||
}
|
||||
|
||||
def baseForgeUserdev = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-userdev.jar") }.get().asFile
|
||||
project.rootProject.extensions.download.run {
|
||||
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-userdev.jar"
|
||||
dest baseForgeUserdev
|
||||
}
|
||||
|
||||
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
|
||||
|
||||
Files.copy(joinedLzma.toPath(), baseBinPatchesOutput.get().asFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
|
||||
}
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
abstract Property<String> getInputVersion()
|
||||
|
||||
@OutputFile
|
||||
abstract RegularFileProperty getBaseBinPatchesOutput()
|
||||
}
|
||||
@@ -18,17 +18,17 @@ public class Util {
|
||||
return md.digest().collect {String.format "%02x", it}.join()
|
||||
}
|
||||
File.metaClass.getSha1 = { !delegate.exists() ? null : delegate.sha1() }
|
||||
|
||||
|
||||
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
|
||||
File.metaClass.getJson = { return delegate.exists() ? new JsonSlurper().parse(delegate) : [:] }
|
||||
File.metaClass.setJson = { json -> delegate.text = new JsonBuilder(json).toPrettyString() }
|
||||
|
||||
|
||||
Date.metaClass.iso8601 = { ->
|
||||
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
def result = format.format(delegate)
|
||||
return result[0..21] + ':' + result[22..-1]
|
||||
}
|
||||
|
||||
|
||||
String.metaClass.rsplit = { String del, int limit = -1 ->
|
||||
def lst = new ArrayList()
|
||||
def x = 0, idx
|
||||
@@ -41,7 +41,7 @@ public class Util {
|
||||
return lst
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String[] getClasspath(project, libs, artifact) {
|
||||
def ret = []
|
||||
artifactTree(project, artifact).each { key, lib ->
|
||||
@@ -51,7 +51,7 @@ public class Util {
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
public static def getArtifacts(project, config, classifiers) {
|
||||
def ret = [:]
|
||||
config.resolvedConfiguration.resolvedArtifacts.each {
|
||||
@@ -75,7 +75,7 @@ public class Util {
|
||||
url = "https://maven.minecraftforge.net/${path}"
|
||||
}
|
||||
//TODO remove when Mojang launcher is updated
|
||||
if (!classifiers && art.classifier != null) {
|
||||
if (!classifiers && art.classifier != null) {
|
||||
//Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
|
||||
// However, keep the path normal so that our mirror system works.
|
||||
art.version = "${art.version}-${art.classifier}"
|
||||
@@ -96,14 +96,14 @@ public class Util {
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
public static def getMavenPath(task) {
|
||||
|
||||
public static def getMavenPath(task) {
|
||||
def classifier = task.archiveClassifier.get()
|
||||
def dep = "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
|
||||
return "${task.project.group.replace('.', '/')}/${task.project.name}/${task.project.version}/${task.project.name}-${task.project.version}".toString() + (classifier == '' ? '' : '-' + classifier) + '.jar'
|
||||
}
|
||||
|
||||
public static def getMavenDep(task) {
|
||||
|
||||
public static def getMavenDep(task) {
|
||||
def classifier = task.archiveClassifier.get()
|
||||
return "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class Util {
|
||||
def files = cfg.resolve()
|
||||
return getArtifacts(project, cfg, true)
|
||||
}
|
||||
|
||||
|
||||
private static boolean checkExists(url) {
|
||||
try {
|
||||
def code = new URL(url).openConnection().with {
|
||||
@@ -142,4 +142,9 @@ public class Util {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLatestForgeVersion(mcVersion) {
|
||||
def json = new JsonSlurper().parseText(new URL("https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json").getText("UTF-8"))
|
||||
return json.promos["$mcVersion-latest"]
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -10,8 +10,9 @@ Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
| Version | Support |
|
||||
|---------| ------------- |
|
||||
| 1.19.x | Active |
|
||||
| 1.18.x | LTS |
|
||||
| 1.20.x | Active |
|
||||
| 1.19.4 | Legacy |
|
||||
| 1.19.2 | Legacy |
|
||||
|
||||
* [Download]
|
||||
* [Forum]
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
|
||||
package net.minecraftforge.fml;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraftforge.fml.config.IConfigSpec;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModLoadingContext
|
||||
{
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
|
||||
private Object languageExtension;
|
||||
private ModLoadingStage stage;
|
||||
@@ -46,10 +51,24 @@ public class ModLoadingContext
|
||||
}
|
||||
|
||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
|
||||
if (spec.isEmpty())
|
||||
{
|
||||
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getActiveContainer().getModId());
|
||||
return;
|
||||
}
|
||||
|
||||
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer()));
|
||||
}
|
||||
|
||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
|
||||
if (spec.isEmpty())
|
||||
{
|
||||
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getActiveContainer().getModId(), fileName);
|
||||
return;
|
||||
}
|
||||
|
||||
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer(), fileName));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ package net.minecraftforge.fml.loading;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.Files;
|
||||
@@ -53,4 +54,16 @@ public class FileUtils
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean matchFileName(String path, String... matches) {
|
||||
// Extract file name from path
|
||||
String name = path.substring(Math.min(path.lastIndexOf(File.separatorChar) + 1, path.length()));
|
||||
// Check if it contains any of the desired keywords
|
||||
for (String match : matches) {
|
||||
if (name.contains(match)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+14
-11
@@ -6,21 +6,27 @@
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import cpw.mods.modlauncher.api.NamedPath;
|
||||
import cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.module.ModuleDescriptor;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.Set;
|
||||
|
||||
public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final Set<String> SERVICES = Set.of(
|
||||
"cpw.mods.modlauncher.api.ITransformationService",
|
||||
"net.minecraftforge.forgespi.locating.IModLocator",
|
||||
"net.minecraftforge.forgespi.locating.IDependencyLocator"
|
||||
);
|
||||
|
||||
@Override
|
||||
public List<NamedPath> candidates(final Path gameDirectory) {
|
||||
@@ -51,14 +57,11 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
|
||||
if (!Files.isRegularFile(path)) return;
|
||||
if (!path.toString().endsWith(".jar")) return;
|
||||
if (LamdbaExceptionUtils.uncheck(() -> Files.size(path)) == 0) return;
|
||||
try (ZipFile zf = new ZipFile(new File(path.toUri()))) {
|
||||
if (zf.getEntry("META-INF/services/cpw.mods.modlauncher.api.ITransformationService") != null) {
|
||||
found.add(new NamedPath(zf.getName(), path));
|
||||
} else if (zf.getEntry("META-INF/services/net.minecraftforge.forgespi.locating.IModLocator") != null) {
|
||||
found.add(new NamedPath(zf.getName(), path));
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.error("Zip Error when loading jar file {}", path, ioe);
|
||||
}
|
||||
|
||||
SecureJar jar = SecureJar.from(path);
|
||||
jar.moduleDataProvider().descriptor().provides().stream()
|
||||
.map(ModuleDescriptor.Provides::service)
|
||||
.filter(SERVICES::contains)
|
||||
.forEach(s -> found.add(new NamedPath(s, path)));
|
||||
}
|
||||
}
|
||||
@@ -210,10 +210,24 @@ public class ModSorter
|
||||
|
||||
if (!missingVersions.isEmpty()) {
|
||||
if (mandatoryMissing > 0) {
|
||||
LOGGER.error(LOADING, "Missing mandatory dependencies: {}", missingVersions.stream().filter(IModInfo.ModVersion::isMandatory).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
|
||||
LOGGER.error(
|
||||
LOADING,
|
||||
"Missing or unsupported mandatory dependencies:\n{}",
|
||||
missingVersions.stream()
|
||||
.filter(IModInfo.ModVersion::isMandatory)
|
||||
.map(ver -> formatDependencyError(ver, modVersions))
|
||||
.collect(Collectors.joining("\n"))
|
||||
);
|
||||
}
|
||||
if (missingVersions.size() - mandatoryMissing > 0) {
|
||||
LOGGER.error(LOADING, "Unsupported installed optional dependencies: {}", missingVersions.stream().filter(ver -> !ver.isMandatory()).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
|
||||
LOGGER.error(
|
||||
LOADING,
|
||||
"Unsupported installed optional dependencies:\n{}",
|
||||
missingVersions.stream()
|
||||
.filter(ver -> !ver.isMandatory())
|
||||
.map(ver -> formatDependencyError(ver, modVersions))
|
||||
.collect(Collectors.joining("\n"))
|
||||
);
|
||||
}
|
||||
|
||||
return missingVersions.stream()
|
||||
@@ -225,6 +239,18 @@ public class ModSorter
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private static String formatDependencyError(IModInfo.ModVersion dependency, Map<String, ArtifactVersion> modVersions)
|
||||
{
|
||||
ArtifactVersion installed = modVersions.get(dependency.getModId());
|
||||
return String.format(
|
||||
"\tMod ID: '%s', Requested by: '%s', Expected range: '%s', Actual version: '%s'",
|
||||
dependency.getModId(),
|
||||
dependency.getOwner().getModId(),
|
||||
dependency.getVersionRange(),
|
||||
installed != null ? installed.toString() : "[MISSING]"
|
||||
);
|
||||
}
|
||||
|
||||
private boolean modVersionNotContained(final IModInfo.ModVersion mv, final Map<String, ArtifactVersion> modVersions)
|
||||
{
|
||||
return !(VersionSupportMatrix.testVersionSupportMatrix(mv.getVersionRange(), mv.getModId(), "mod", (modId, range) -> modVersions.containsKey(modId) &&
|
||||
|
||||
@@ -11,11 +11,17 @@ import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.*;
|
||||
import static java.util.stream.Collectors.groupingBy;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
||||
|
||||
public class UniqueModListBuilder
|
||||
{
|
||||
@@ -66,28 +72,34 @@ public class UniqueModListBuilder
|
||||
|
||||
// Its theoretically possible that some mod has somehow moved an id to a secondary place, thus causing a dupe.
|
||||
// We can't handle this
|
||||
final List<IModInfo> dupedMods = modIds.values().stream()
|
||||
final List<String> dupedModErrors = modIds.values().stream()
|
||||
.filter(modInfos -> modInfos.size() > 1)
|
||||
.map(modInfos -> modInfos.get(0))
|
||||
.toList();
|
||||
.map(mods -> String.format("\tMod ID: '%s' from mod files: %s",
|
||||
mods.get(0).getModId(),
|
||||
mods.stream()
|
||||
.map(modInfo -> modInfo.getOwningFile().getFile().getFileName()).collect(joining(", "))
|
||||
)).toList();
|
||||
|
||||
if (!dupedMods.isEmpty()) {
|
||||
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods.stream()
|
||||
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm, Objects.toString(dm)))
|
||||
.toList();
|
||||
throw new EarlyLoadingException("Duplicate mods found", null, duplicateModErrors);
|
||||
if (!dupedModErrors.isEmpty()) {
|
||||
LOGGER.error(LOADING, "Found duplicate mods:\n{}", dupedModErrors.stream().collect(joining("\n")));
|
||||
throw new EarlyLoadingException("Duplicate mods found", null, dupedModErrors.stream()
|
||||
.map(s -> new EarlyLoadingException.ExceptionData(s))
|
||||
.toList());
|
||||
}
|
||||
|
||||
final List<ModFile> dupedLibs = versionedLibIds.values().stream()
|
||||
final List<String> dupedLibErrors = versionedLibIds.values().stream()
|
||||
.filter(modFiles -> modFiles.size() > 1)
|
||||
.map(modFiles -> modFiles.get(0))
|
||||
.toList();
|
||||
.map(mods -> String.format("\tLibrary: '%s' from files: %s",
|
||||
getModId(mods.get(0)),
|
||||
mods.stream()
|
||||
.map(modFile -> modFile.getFileName()).collect(joining(", "))
|
||||
)).toList();
|
||||
|
||||
if (!dupedLibs.isEmpty()) {
|
||||
final List<EarlyLoadingException.ExceptionData> duplicateLibErrors = dupedLibs.stream()
|
||||
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedlib.versioned", dm, Objects.toString(dm)))
|
||||
.toList();
|
||||
throw new EarlyLoadingException("Duplicate plugins or libraries found", null, duplicateLibErrors);
|
||||
if (!dupedLibErrors.isEmpty()) {
|
||||
LOGGER.error(LOADING, "Found duplicate plugins or libraries:\n{}", dupedLibErrors.stream().collect(joining("\n")));
|
||||
throw new EarlyLoadingException("Duplicate plugins or libraries found", null, dupedLibErrors.stream()
|
||||
.map(s -> new EarlyLoadingException.ExceptionData(s))
|
||||
.toList());
|
||||
}
|
||||
|
||||
// Collect unique mod files by module name. This will be used for deduping purposes
|
||||
|
||||
+10
-2
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import net.minecraftforge.fml.loading.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
@@ -29,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
|
||||
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);
|
||||
|
||||
// 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) {
|
||||
// We also want the FML things, fmlcore, javafmllanguage, mclanguage, I don't like hard coding these, but hey whatever works for now.
|
||||
return Arrays.stream(classpath)
|
||||
.filter(e -> e.contains("fmlcore") || e.contains("javafmllanguage") || e.contains("lowcodelanguage") || e.contains("mclanguage"))
|
||||
.filter(e -> FileUtils.matchFileName(e, "fmlcore", "javafmllanguage", "lowcodelanguage", "mclanguage"))
|
||||
.map(Paths::get)
|
||||
.toList();
|
||||
}
|
||||
|
||||
protected static Path findJarOnClasspath(String[] classpath, String match) {
|
||||
return Paths.get(Arrays.stream(classpath)
|
||||
.filter(e -> FileUtils.matchFileName(e, match))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("Could not find " + match + " in classpath")));
|
||||
}
|
||||
|
||||
protected BiPredicate<String, String> getMcFilter(Path extra, List<Path> minecraft, Stream.Builder<List<Path>> mods) {
|
||||
final var packages = getPackages();
|
||||
final var extraPath = extra.toString().replace('\\', '/');
|
||||
|
||||
-6
@@ -10,8 +10,6 @@ import net.minecraftforge.fml.loading.VersionInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -41,8 +39,4 @@ public abstract class CommonUserdevLaunchHandler extends CommonDevLaunchHandler
|
||||
}
|
||||
|
||||
protected abstract void processStreams(String[] classpath, VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods);
|
||||
|
||||
protected static Path findJarOnClasspath(String[] classpath, String match) {
|
||||
return Paths.get(Arrays.stream(classpath).filter(e -> e.contains(match)).findFirst().orElseThrow(() -> new IllegalStateException("Could not find " + match + " in classpath")));
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
<MarkerFilter marker="REGISTRIES" onMatch="${sys:forge.logging.marker.registries:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="REGISTRYDUMP" onMatch="${sys:forge.logging.marker.registrydump:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="SPLASH" onMatch="${sys:forge.logging.marker.splash:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="RESOURCE-CACHE" onMatch="${sys:forge.logging.marker.resource.cache:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="FORGEMOD" onMatch="${sys:forge.logging.marker.forgemod:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="LOADING" onMatch="${sys:forge.logging.marker.loading:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="CORE" onMatch="${sys:forge.logging.marker.core:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class LowCodeModLanguageProvider implements IModLanguageProvider
|
||||
throw new ModLoadingException(info, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmodclass", e);
|
||||
}
|
||||
} catch (NoSuchMethodException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
LOGGER.fatal(LOADING, "Unable to load FMLModContainer, wut?", e);
|
||||
LOGGER.fatal(LOADING, "Unable to load LowCodeModContainer, wut?", e);
|
||||
final Class<RuntimeException> mle = (Class<RuntimeException>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingException", true, Thread.currentThread().getContextClassLoader()));
|
||||
final Class<ModLoadingStage> mls = (Class<ModLoadingStage>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingStage", true, Thread.currentThread().getContextClassLoader()));
|
||||
throw LamdbaExceptionUtils.uncheck(() -> LamdbaExceptionUtils.uncheck(() -> mle.getConstructor(IModInfo.class, mls, String.class, Throwable.class)).newInstance(info, Enum.valueOf(mls, "CONSTRUCT"), "fml.modloading.failedtoloadmodclass", e));
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
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
|
||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public static class ClientModEvents
|
||||
{
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -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_) {
|
||||
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
|
||||
+++ 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 @@
|
||||
} else if (recipetype == RecipeType.f_44113_) {
|
||||
return RecipeBookCategories.SMITHING;
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
|
||||
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) break; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
|
||||
InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand);
|
||||
if (!interactionresult.m_19077_()) {
|
||||
interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand);
|
||||
@@ -342,6 +342,22 @@
|
||||
this.f_91026_.m_6180_("gui");
|
||||
this.f_240378_.m_240688_();
|
||||
this.f_91065_.m_193832_(this.f_91012_);
|
||||
@@ -1749,6 +_,7 @@
|
||||
|
||||
this.f_91005_.m_120596_();
|
||||
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.f_91073_, () -> true);
|
||||
try {
|
||||
this.f_91073_.m_104726_(() -> {
|
||||
return true;
|
||||
@@ -1764,6 +_,7 @@
|
||||
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.f_91073_, () -> true);
|
||||
}
|
||||
|
||||
this.f_91026_.m_6182_("animateTick");
|
||||
@@ -1783,6 +_,8 @@
|
||||
this.f_91026_.m_6182_("keyboard");
|
||||
this.f_91068_.m_90931_();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
|
||||
@@ -73,6 +_,8 @@
|
||||
}
|
||||
|
||||
if (!optional.isPresent()) {
|
||||
+ ConnectScreen.f_95683_.error("Couldn't connect to server: Unknown host \"{}\"", p_169266_.m_171863_());
|
||||
+ net.minecraftforge.network.DualStackUtils.logInitialPreferences();
|
||||
p_169265_.execute(() -> {
|
||||
p_169265_.m_91152_(new DisconnectedScreen(ConnectScreen.this.f_95686_, CommonComponents.f_130661_, ConnectScreen.f_169260_));
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
@@ -77,9 +_,10 @@
|
||||
this.f_96541_.m_91152_(new SocialInteractionsScreen());
|
||||
}));
|
||||
}
|
||||
+ this.m_142416_(new Button(this.f_96543_ / 2 - 102, this.f_96544_ / 4 + 120 - 16, 204, 20, Component.m_237115_("fml.menu.mods"), modButton -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this))));
|
||||
|
||||
Component component = this.f_96541_.m_91090_() ? Component.m_237115_("menu.returnToMenu") : Component.m_237115_("menu.disconnect");
|
||||
- this.m_142416_(new Button(this.f_96543_ / 2 - 102, this.f_96544_ / 4 + 120 + -16, 204, 20, component, (p_96315_) -> {
|
||||
+ this.m_142416_(new Button(this.f_96543_ / 2 - 102, this.f_96544_ / 4 + 144 + -16, 204, 20, component, (p_96315_) -> {
|
||||
boolean flag = this.f_96541_.m_91090_();
|
||||
boolean flag1 = this.f_96541_.m_91294_();
|
||||
p_96315_.f_93623_ = false;
|
||||
@@ -27,7 +27,7 @@
|
||||
EMPTY(false),
|
||||
ITEM(false),
|
||||
BLOCK(false),
|
||||
@@ -411,10 +_,30 @@
|
||||
@@ -411,10 +_,29 @@
|
||||
|
||||
private ArmPose(boolean p_102896_) {
|
||||
this.f_102890_ = p_102896_;
|
||||
@@ -52,8 +52,7 @@
|
||||
+ }
|
||||
+
|
||||
+ public <T extends LivingEntity> void applyTransform(HumanoidModel<T> model, T entity, net.minecraft.world.entity.HumanoidArm arm) {
|
||||
+ com.google.common.base.Preconditions.checkNotNull(this.forgeArmPose, "applyTransform() must not be called on a vanilla ArmPose!");
|
||||
+ this.forgeArmPose.applyTransform(model, entity, arm);
|
||||
+ if (this.forgeArmPose != null) this.forgeArmPose.applyTransform(model, entity, arm);
|
||||
+ }
|
||||
+ // FORGE END
|
||||
}
|
||||
|
||||
@@ -19,3 +19,23 @@
|
||||
this.m_241119_(p_242290_, component);
|
||||
}
|
||||
}
|
||||
@@ -194,7 +_,9 @@
|
||||
}
|
||||
|
||||
boolean m_241171_(ChatType.Bound p_241518_, PlayerChatMessage p_241542_, Component p_241510_) {
|
||||
- this.f_240348_.f_91065_.m_93076_().m_93785_(p_241510_);
|
||||
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_241518_, p_241510_, p_241542_, p_241542_.m_241067_());
|
||||
+ if (forgeComponent == null) return false;
|
||||
+ this.f_240348_.f_91065_.m_93076_().m_93785_(forgeComponent);
|
||||
this.m_241119_(p_241518_, p_241542_.m_237220_());
|
||||
this.m_240498_(p_241510_, p_241542_.m_241109_());
|
||||
this.f_240659_ = Util.m_137550_();
|
||||
@@ -263,6 +_,8 @@
|
||||
|
||||
public void m_240494_(Component p_240522_, boolean p_240642_) {
|
||||
if (!this.f_240348_.f_91066_.m_231833_().m_231551_() || !this.f_240348_.m_91246_(this.m_240473_(p_240522_))) {
|
||||
+ p_240522_ = net.minecraftforge.client.ForgeHooksClient.onClientSystemChat(p_240522_, p_240642_);
|
||||
+ if (p_240522_ == null) return;
|
||||
if (p_240642_) {
|
||||
this.f_240348_.f_91065_.m_93063_(p_240522_, false);
|
||||
} else {
|
||||
@@ -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_();
|
||||
@@ -109,7 +109,7 @@
|
||||
+ 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().");
|
||||
+ checkClientLoading();
|
||||
+ FLUID_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid), type);
|
||||
|
||||
@@ -30,3 +30,28 @@
|
||||
InputStream inputstream = resource.m_215507_();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -45,19 +_,27 @@
|
||||
@@ -45,19 +_,30 @@
|
||||
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);
|
||||
+ }
|
||||
+ 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 {
|
||||
RenderShape rendershape = p_234356_.m_60799_();
|
||||
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_.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) {
|
||||
|
||||
+13
-2
@@ -1,6 +1,6 @@
|
||||
--- a/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_;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
+ }
|
||||
+ 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);
|
||||
+ Vec3 vec3 = p_111050_.m_60824_(p_111048_, p_111051_);
|
||||
+ 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 {
|
||||
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 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||
@@ -19,12 +_,18 @@
|
||||
@@ -19,12 +_,24 @@
|
||||
public final int f_111355_;
|
||||
public final String f_111356_;
|
||||
public final BlockFaceUV f_111357_;
|
||||
+ public final int emissivity;
|
||||
+ public final boolean hasAmbientOcclusion;
|
||||
|
||||
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) {
|
||||
+ 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_111355_ = p_111360_;
|
||||
this.f_111356_ = p_111361_;
|
||||
this.f_111357_ = p_111362_;
|
||||
+ this.emissivity = emissivity;
|
||||
+ this.hasAmbientOcclusion = hasAmbientOcclusion;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -37,7 +_,10 @@
|
||||
@@ -37,7 +_,11 @@
|
||||
int i = this.m_111368_(jsonobject);
|
||||
String s = this.m_111370_(jsonobject);
|
||||
BlockFaceUV blockfaceuv = p_111367_.deserialize(jsonobject, BlockFaceUV.class);
|
||||
@@ -27,7 +33,8 @@
|
||||
+ int emissivity = GsonHelper.m_13824_(jsonobject, "emissivity", 0);
|
||||
+ 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);
|
||||
+ 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_) {
|
||||
@@ -49,7 +49,7 @@
|
||||
for(BlockElement blockelement : this.m_111436_()) {
|
||||
for(BlockElementFace blockelementface : blockelement.f_111310_.values()) {
|
||||
Material material = this.m_111480_(blockelementface.f_111356_);
|
||||
@@ -181,11 +_,17 @@
|
||||
@@ -181,11 +_,18 @@
|
||||
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_);
|
||||
+ }
|
||||
+
|
||||
+ @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) {
|
||||
+ 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"));
|
||||
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_());
|
||||
@@ -204,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- return simplebakedmodel$builder.m_119533_();
|
||||
+ return simplebakedmodel$builder.build(renderTypes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +_,18 @@
|
||||
ItemTransform itemtransform5 = this.m_111444_(ItemTransforms.TransformType.GUI);
|
||||
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_);
|
||||
+ 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);
|
||||
+ return quad;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/ItemModelGenerator.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/ItemModelGenerator.java
|
||||
@@ -39,6 +_,7 @@
|
||||
@@ -39,6 +_,8 @@
|
||||
map.put("particle", p_111672_.m_111477_("particle") ? Either.left(p_111672_.m_111480_("particle")) : map.get("layer0"));
|
||||
BlockModel blockmodel = new BlockModel((ResourceLocation)null, list, map, false, p_111672_.m_111479_(), p_111672_.m_111491_(), p_111672_.m_111484_());
|
||||
blockmodel.f_111416_ = p_111672_.f_111416_;
|
||||
+ blockmodel.customData.copyFrom(p_111672_.customData);
|
||||
+ blockmodel.customData.setGui3d(false);
|
||||
return blockmodel;
|
||||
}
|
||||
|
||||
+2
-2
@@ -88,7 +88,7 @@
|
||||
if (blockstate.m_60799_() != RenderShape.INVISIBLE) {
|
||||
- RenderType rendertype2 = ItemBlockRenderTypes.m_109282_(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));
|
||||
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, modelData)) {
|
||||
BufferBuilder bufferbuilder2 = p_234471_.m_108839_(rendertype2);
|
||||
@@ -99,7 +99,7 @@
|
||||
posestack.m_85836_();
|
||||
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.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_();
|
||||
+ }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/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_() {
|
||||
return this.f_112908_.m_141928_();
|
||||
}
|
||||
@@ -8,5 +8,10 @@
|
||||
+ @Override
|
||||
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) {
|
||||
+ return this.f_112908_.getShade(normalX, normalY, normalZ, shade);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.model.data.ModelDataManager getModelDataManager() {
|
||||
+ return f_112908_.getModelDataManager();
|
||||
+ }
|
||||
}
|
||||
@@ -8,4 +8,4 @@
|
||||
+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_81287_ = new SimpleCommandExceptionType(Component.m_237115_("permissions.requires.entity"));
|
||||
private final CommandSource f_81288_;
|
||||
public final CommandSource f_81288_;
|
||||
@@ -1,5 +1,14 @@
|
||||
--- a/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -343,7 +_,7 @@
|
||||
DispensibleContainerItem dispensiblecontaineritem = (DispensibleContainerItem)p_123562_.m_41720_();
|
||||
BlockPos blockpos = p_123561_.m_7961_().m_121945_(p_123561_.m_6414_().m_61143_(DispenserBlock.f_52659_));
|
||||
Level level = p_123561_.m_7727_();
|
||||
- if (dispensiblecontaineritem.m_142073_((Player)null, level, blockpos, (BlockHitResult)null)) {
|
||||
+ if (dispensiblecontaineritem.emptyContents((Player)null, level, blockpos, (BlockHitResult)null, p_123562_)) {
|
||||
dispensiblecontaineritem.m_142131_((Player)null, level, p_123562_, blockpos);
|
||||
return new ItemStack(Items.f_42446_);
|
||||
} else {
|
||||
@@ -402,9 +_,10 @@
|
||||
level.m_46597_(blockpos, BaseFireBlock.m_49245_(level, blockpos));
|
||||
level.m_142346_((Entity)null, GameEvent.f_157797_, blockpos);
|
||||
|
||||
+1
-1
@@ -51,5 +51,5 @@
|
||||
+
|
||||
+ @Override public int getIndex() { return Integer.MAX_VALUE; }
|
||||
+ @Override public ResourceLocation getName() { return m_132042_(); }
|
||||
+ @org.jetbrains.annotations.Nullable @Override public FriendlyByteBuf getInternalData() { return this.f_132030_; }
|
||||
+ @Override public FriendlyByteBuf getInternalData() { return m_132045_(); }
|
||||
}
|
||||
@@ -1,5 +1,14 @@
|
||||
--- 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;
|
||||
|
||||
@@ -20,11 +20,26 @@
|
||||
boolean flag = false;
|
||||
AdvancementProgress advancementprogress = this.m_135996_(p_135989_);
|
||||
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_)) {
|
||||
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.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_()) {
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/server/commands/SummonCommand.java
|
||||
+++ b/net/minecraft/server/commands/SummonCommand.java
|
||||
@@ -55,6 +_,7 @@
|
||||
throw f_138810_.create();
|
||||
} else {
|
||||
if (p_138825_ && entity instanceof Mob) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((Mob)entity, p_138821_.m_81372_(), (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), null, MobSpawnType.COMMAND))
|
||||
((Mob)entity).m_6518_(p_138821_.m_81372_(), p_138821_.m_81372_().m_6436_(entity.m_20183_()), MobSpawnType.COMMAND, (SpawnGroupData)null, (CompoundTag)null);
|
||||
}
|
||||
|
||||
+10
-5
@@ -76,7 +76,7 @@
|
||||
return !component.equals(p_238202_) ? p_238202_ : null;
|
||||
});
|
||||
completablefuture.thenAcceptAsync((p_242747_) -> {
|
||||
@@ -1532,11 +_,13 @@
|
||||
@@ -1532,9 +_,10 @@
|
||||
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
|
||||
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_);
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(f_9743_, entity, entity.m_20182_(), p_143679_) != null) return;
|
||||
if (interactionresult.m_19077_()) {
|
||||
CriteriaTriggers.f_10565_.m_61494_(ServerGamePacketListenerImpl.this.f_9743_, itemstack, entity);
|
||||
if (interactionresult.m_19080_()) {
|
||||
@@ -1558,6 +_,8 @@
|
||||
@@ -1552,12 +_,16 @@
|
||||
|
||||
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_() {
|
||||
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
|
||||
+ public void initForNamespace(final String nameSpace) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
public PackRepository(Pack.PackConstructor p_10502_, RepositorySource... p_10503_) {
|
||||
this.f_10500_ = p_10502_;
|
||||
- this.f_10497_ = ImmutableSet.copyOf(p_10503_);
|
||||
+ this.f_10497_ = new java.util.HashSet<>(java.util.Arrays.asList(p_10503_));
|
||||
+ this.f_10497_ = new java.util.LinkedHashSet<>(List.of(p_10503_)); //Forge: This needs to be a mutable set, so that we can add to it later on.
|
||||
}
|
||||
|
||||
public PackRepository(PackType p_143890_, RepositorySource... p_143891_) {
|
||||
|
||||
-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,12 @@
|
||||
--- a/net/minecraft/util/SpawnUtil.java
|
||||
+++ b/net/minecraft/util/SpawnUtil.java
|
||||
@@ -24,7 +_,8 @@
|
||||
if (p_216406_.m_6857_().m_61937_(blockpos$mutableblockpos) && m_216398_(p_216406_, p_216410_, blockpos$mutableblockpos, p_216411_)) {
|
||||
T t = p_216404_.m_20655_(p_216406_, (CompoundTag)null, (Component)null, (Player)null, blockpos$mutableblockpos, p_216405_, false, false);
|
||||
if (t != null) {
|
||||
- if (t.m_5545_(p_216406_, p_216405_) && t.m_6914_(p_216406_)) {
|
||||
+ int res = net.minecraftforge.common.ForgeHooks.canEntitySpawn(t, p_216406_, t.m_20185_(), t.m_20186_(), t.m_20189_(), null, p_216405_);
|
||||
+ if (res == 1 || (res == 0 && t.m_5545_(p_216406_, p_216405_) && t.m_6914_(p_216406_))) {
|
||||
p_216406_.m_47205_(t);
|
||||
return Optional.of(t);
|
||||
}
|
||||
@@ -33,14 +33,14 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -326,6 +_,7 @@
|
||||
public T m_20600_(ServerLevel p_20601_, @Nullable CompoundTag p_20602_, @Nullable Component p_20603_, @Nullable Player p_20604_, BlockPos p_20605_, MobSpawnType p_20606_, boolean p_20607_, boolean p_20608_) {
|
||||
T t = this.m_20655_(p_20601_, p_20602_, p_20603_, p_20604_, p_20605_, p_20606_, p_20607_, p_20608_);
|
||||
if (t != null) {
|
||||
+ if (t instanceof net.minecraft.world.entity.Mob && net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((net.minecraft.world.entity.Mob) t, p_20601_, p_20605_.m_123341_(), p_20605_.m_123342_(), p_20605_.m_123343_(), null, p_20606_)) return null;
|
||||
p_20601_.m_47205_(t);
|
||||
}
|
||||
|
||||
@@ -351,6 +_,7 @@
|
||||
Mob mob = (Mob)t;
|
||||
mob.f_20885_ = mob.m_146908_();
|
||||
mob.f_20883_ = mob.m_146908_();
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, p_20656_, (float) mob.m_20185_(), (float) mob.m_20186_(), (float) mob.m_20189_(), null, p_20661_))
|
||||
mob.m_6518_(p_20656_, p_20656_.m_6436_(mob.m_20183_()), p_20661_, (SpawnGroupData)null, p_20657_);
|
||||
mob.m_8032_();
|
||||
}
|
||||
@@ -543,14 +_,23 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
if (itemstack != null) {
|
||||
if (this instanceof ServerPlayer) {
|
||||
@@ -699,7 +708,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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();
|
||||
+ else if (facing.m_122434_().m_122478_()) return handlers[0].cast();
|
||||
+ else if (facing.m_122434_().m_122479_()) return handlers[1].cast();
|
||||
|
||||
@@ -1,13 +1,52 @@
|
||||
--- a/net/minecraft/world/entity/Mob.java
|
||||
+++ b/net/minecraft/world/entity/Mob.java
|
||||
@@ -211,6 +_,7 @@
|
||||
@@ -116,6 +_,8 @@
|
||||
private CompoundTag f_21359_;
|
||||
private BlockPos f_21360_ = BlockPos.f_121853_;
|
||||
private float f_21341_ = -1.0F;
|
||||
+ @Nullable
|
||||
+ private MobSpawnType spawnType;
|
||||
|
||||
protected Mob(EntityType<? extends Mob> p_21368_, Level p_21369_) {
|
||||
super(p_21368_, p_21369_);
|
||||
@@ -210,7 +_,11 @@
|
||||
}
|
||||
|
||||
public void m_6710_(@Nullable LivingEntity p_21544_) {
|
||||
this.f_21362_ = p_21544_;
|
||||
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_21544_);
|
||||
- this.f_21362_ = 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_) {
|
||||
@@ -408,6 +_,9 @@
|
||||
p_21484_.m_128379_("NoAI", this.m_21525_());
|
||||
}
|
||||
|
||||
+ if (this.spawnType != null) {
|
||||
+ p_21484_.m_128359_("forge:spawn_type", this.spawnType.name());
|
||||
+ }
|
||||
}
|
||||
|
||||
public void m_7378_(CompoundTag p_21450_) {
|
||||
@@ -460,6 +_,14 @@
|
||||
}
|
||||
|
||||
this.m_21557_(p_21450_.m_128471_("NoAI"));
|
||||
+
|
||||
+ if (p_21450_.m_128441_("forge:spawn_type")) {
|
||||
+ try {
|
||||
+ this.spawnType = MobSpawnType.valueOf(p_21450_.m_128461_("forge:spawn_type"));
|
||||
+ } catch (Exception ex) {
|
||||
+ p_21450_.m_128473_("forge:spawn_type");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
protected void m_7625_(DamageSource p_21389_, boolean p_21390_) {
|
||||
@@ -499,9 +_,9 @@
|
||||
public void m_8107_() {
|
||||
super.m_8107_();
|
||||
@@ -34,7 +73,26 @@
|
||||
if (entity != null) {
|
||||
double d0 = entity.m_20280_(this);
|
||||
int i = this.m_6095_().m_20674_().m_21611_();
|
||||
@@ -1374,13 +_,23 @@
|
||||
@@ -990,6 +_,10 @@
|
||||
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * <p>Calls to this method should be accompanied by firing the {@link net.minecraftforge.event.entity.living.LivingSpawnEvent.SpecialSpawn SpecialSpawn} event via {@link net.minecraftforge.event.ForgeEventFactory#doSpecialSpawn}.</p>
|
||||
+ * Additionally, if you override this method, you should ensure you either call super, or manually set {@link #spawnType} from your override.
|
||||
+ */
|
||||
@Nullable
|
||||
public SpawnGroupData m_6518_(ServerLevelAccessor p_21434_, DifficultyInstance p_21435_, MobSpawnType p_21436_, @Nullable SpawnGroupData p_21437_, @Nullable CompoundTag p_21438_) {
|
||||
RandomSource randomsource = p_21434_.m_213780_();
|
||||
@@ -1000,6 +_,7 @@
|
||||
this.m_21559_(false);
|
||||
}
|
||||
|
||||
+ this.spawnType = p_21436_;
|
||||
return p_21437_;
|
||||
}
|
||||
|
||||
@@ -1374,15 +_,25 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,11 +109,30 @@
|
||||
this.m_20256_(this.m_20184_().m_82520_(0.0D, 0.3D, 0.0D));
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public void jumpInFluid(net.minecraftforge.fluids.FluidType type) {
|
||||
+ this.jumpInLiquidInternal(() -> super.jumpInFluid(type));
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
public void m_147272_() {
|
||||
this.f_21345_.m_148096_();
|
||||
this.m_6274_().m_147343_();
|
||||
@@ -1404,5 +_,16 @@
|
||||
|
||||
public Iterable<BlockPos> m_238383_() {
|
||||
return ImmutableSet.of(new BlockPos(this.m_20191_().f_82288_, (double)this.m_146904_(), this.m_20191_().f_82290_), new BlockPos(this.m_20191_().f_82288_, (double)this.m_146904_(), this.m_20191_().f_82293_), new BlockPos(this.m_20191_().f_82291_, (double)this.m_146904_(), this.m_20191_().f_82290_), new BlockPos(this.m_20191_().f_82291_, (double)this.m_146904_(), this.m_20191_().f_82293_));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@return the type of spawn that created this mob, if applicable}
|
||||
+ * If it could not be determined, this will return null.
|
||||
+ * <p>
|
||||
+ * This is set via {@link Mob#finalizeSpawn}, so you should not call this from within that method, and instead use the parameter.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public final MobSpawnType getSpawnType() {
|
||||
+ return this.spawnType;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,14 @@
|
||||
--- a/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_);
|
||||
}
|
||||
|
||||
@@ -26,5 +34,14 @@
|
||||
+ if (predicate == null) return net.minecraft.world.level.NaturalSpawner.canSpawnAtBody(this, 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
|
||||
+++ 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.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_5634_((float)item.m_41473_().m_38744_());
|
||||
+ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_());
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
--- a/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);
|
||||
}
|
||||
|
||||
- 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);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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 super.getCapability(capability, facing);
|
||||
+ }
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/entity/monster/Strider.java
|
||||
+++ b/net/minecraft/world/entity/monster/Strider.java
|
||||
@@ -418,6 +_,7 @@
|
||||
|
||||
private SpawnGroupData m_33881_(ServerLevelAccessor p_33882_, DifficultyInstance p_33883_, Mob p_33884_, @Nullable SpawnGroupData p_33885_) {
|
||||
p_33884_.m_7678_(this.m_20185_(), this.m_20186_(), this.m_20189_(), this.m_146908_(), 0.0F);
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(p_33884_, p_33882_, (float)p_33884_.m_20185_(), (float)p_33884_.m_20186_(), (float)p_33884_.m_20189_(), null, MobSpawnType.JOCKEY))
|
||||
p_33884_.m_6518_(p_33882_, p_33883_, MobSpawnType.JOCKEY, p_33885_, (CompoundTag)null);
|
||||
p_33884_.m_7998_(this, true);
|
||||
return new AgeableMob.AgeableMobGroupData(0.0F);
|
||||
@@ -1,11 +1,13 @@
|
||||
--- a/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
+++ b/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
@@ -86,8 +_,9 @@
|
||||
@@ -86,8 +_,11 @@
|
||||
if (cat == null) {
|
||||
return 0;
|
||||
} else {
|
||||
+ cat.m_20035_(p_35334_, 0.0F, 0.0F); // Fix MC-147659: Some witch huts spawn the incorrect cat
|
||||
+ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(cat, p_35335_, p_35334_.m_123341_(), p_35334_.m_123342_(), p_35334_.m_123343_(), null, MobSpawnType.NATURAL) == -1) return 0;
|
||||
+ // Note: This call to canEntitySpawn is erroneous, it is only provided for backwards compatibility.
|
||||
+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(cat, p_35335_, p_35334_.m_123341_(), p_35334_.m_123342_(), p_35334_.m_123343_(), null, MobSpawnType.NATURAL) == -1) return 0;
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(cat, p_35335_, p_35334_.m_123341_(), p_35334_.m_123342_(), p_35334_.m_123343_(), null, MobSpawnType.NATURAL))
|
||||
cat.m_6518_(p_35335_, p_35335_.m_6436_(p_35334_), MobSpawnType.NATURAL, (SpawnGroupData)null, (CompoundTag)null);
|
||||
- cat.m_20035_(p_35334_, 0.0F, 0.0F);
|
||||
p_35335_.m_47205_(cat);
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
--- a/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 @@
|
||||
int i = p_36049_.m_41613_();
|
||||
ItemStack itemstack = this.m_8020_(p_36048_);
|
||||
|
||||
@@ -215,7 +215,11 @@
|
||||
if (p_36347_.m_6097_()) {
|
||||
if (!p_36347_.m_7313_(this)) {
|
||||
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) {
|
||||
boolean flag = f2 > 0.9F;
|
||||
boolean flag1 = false;
|
||||
@@ -276,6 +280,14 @@
|
||||
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 @@
|
||||
}
|
||||
|
||||
@@ -431,7 +443,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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();
|
||||
+ else if (facing.m_122434_().m_122478_()) return playerMainHandler.cast();
|
||||
+ else if (facing.m_122434_().m_122479_()) return playerEquipmentHandler.cast();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
if (!this.f_19853_.f_46443_) {
|
||||
Entity entity = this.m_37282_();
|
||||
- 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_());
|
||||
if (this.f_19853_.m_46859_(blockpos)) {
|
||||
this.f_19853_.m_46597_(blockpos, BaseFireBlock.m_49245_(this.f_19853_, blockpos));
|
||||
@@ -4,7 +4,7 @@
|
||||
if (entity instanceof ServerPlayer) {
|
||||
ServerPlayer serverplayer = (ServerPlayer)entity;
|
||||
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 (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_);
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -390,7 +_,8 @@
|
||||
@@ -390,18 +_,19 @@
|
||||
d1 = (double)p_38156_.m_123342_();
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
@@ -120,7 +120,11 @@
|
||||
flag = p_38157_.m_61143_(PoweredRailBlock.f_55215_);
|
||||
flag1 = !flag;
|
||||
}
|
||||
@@ -401,22 +_,22 @@
|
||||
|
||||
- double d3 = 0.0078125D;
|
||||
+ double d3 = getSlopeAdjustment();
|
||||
if (this.m_20069_()) {
|
||||
d3 *= 0.2D;
|
||||
}
|
||||
|
||||
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);
|
||||
switch (railshape) {
|
||||
case ASCENDING_EAST:
|
||||
- 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;
|
||||
}
|
||||
|
||||
this.m_20256_(vec31.m_82520_(-d3, 0.0D, 0.0D));
|
||||
@@ -447,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
@@ -236,8 +221,8 @@
|
||||
+ private float currentSpeedCapOnRail = getMaxCartSpeedOnRail();
|
||||
+ @Override public float getCurrentCartSpeedCapOnRail() { return currentSpeedCapOnRail; }
|
||||
+ @Override public void setCurrentCartSpeedCapOnRail(float value) { currentSpeedCapOnRail = Math.min(value, getMaxCartSpeedOnRail()); }
|
||||
+ private float maxSpeedAirLateral = DEFAULT_MAX_SPEED_AIR_LATERAL;
|
||||
+ @Override public float getMaxSpeedAirLateral() { return maxSpeedAirLateral; }
|
||||
+ @org.jetbrains.annotations.Nullable private Float maxSpeedAirLateral = null;
|
||||
+ @Override public float getMaxSpeedAirLateral() { return maxSpeedAirLateral == null ? (float) this.m_7097_() : maxSpeedAirLateral; }
|
||||
+ @Override public void setMaxSpeedAirLateral(float value) { maxSpeedAirLateral = value; }
|
||||
+ private float maxSpeedAirVertical = DEFAULT_MAX_SPEED_AIR_VERTICAL;
|
||||
+ @Override public float getMaxSpeedAirVertical() { return maxSpeedAirVertical; }
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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 super.getCapability(capability, facing);
|
||||
+ }
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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 super.getCapability(capability, facing);
|
||||
+ }
|
||||
|
||||
@@ -12,6 +12,14 @@
|
||||
for(ContainerListener containerlistener : this.f_38848_) {
|
||||
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 @@
|
||||
ItemStack itemstack = slot.m_7993_();
|
||||
if (!itemstack.m_41619_() && ItemStack.m_150942_(p_38904_, itemstack)) {
|
||||
|
||||
@@ -1,5 +1,53 @@
|
||||
--- a/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 @@
|
||||
}
|
||||
|
||||
@@ -19,6 +67,17 @@
|
||||
if (!ItemStack.m_41728_(itemstack, itemstack1)) {
|
||||
this.f_39559_.m_6836_(0, ItemStack.f_41583_);
|
||||
this.m_38946_();
|
||||
@@ -163,6 +_,10 @@
|
||||
itemstack2 = flag3 ? itemstack : itemstack1;
|
||||
}
|
||||
|
||||
+ // Forge: Skip the repair if the result would give an item stack with a count not normally obtainable
|
||||
+ if (j > itemstack2.m_41741_())
|
||||
+ this.f_39559_.m_6836_(0, ItemStack.f_41583_);
|
||||
+ else
|
||||
this.f_39559_.m_6836_(0, this.m_39579_(itemstack2, i, j));
|
||||
}
|
||||
|
||||
@@ -175,7 +_,7 @@
|
||||
|
||||
for(Map.Entry<Enchantment, Integer> entry : map.entrySet()) {
|
||||
|
||||
@@ -38,15 +38,44 @@
|
||||
p_40704_.m_5496_(p_150709_, 1.0F, 1.0F);
|
||||
});
|
||||
p_40703_.m_142346_(p_40704_, GameEvent.f_157816_, blockpos);
|
||||
@@ -72,7 +_,7 @@
|
||||
@@ -72,8 +_,8 @@
|
||||
return InteractionResultHolder.m_19100_(itemstack);
|
||||
} else {
|
||||
BlockState blockstate = p_40703_.m_8055_(blockpos);
|
||||
- BlockPos blockpos2 = blockstate.m_60734_() instanceof LiquidBlockContainer && this.f_40687_ == Fluids.f_76193_ ? blockpos : blockpos1;
|
||||
- if (this.m_142073_(p_40704_, p_40703_, blockpos2, blockhitresult)) {
|
||||
+ BlockPos blockpos2 = canBlockContainFluid(p_40703_, blockpos, blockstate) ? blockpos : blockpos1;
|
||||
if (this.m_142073_(p_40704_, p_40703_, blockpos2, blockhitresult)) {
|
||||
+ if (this.emptyContents(p_40704_, p_40703_, blockpos2, blockhitresult, itemstack)) {
|
||||
this.m_142131_(p_40704_, p_40703_, itemstack, blockpos2);
|
||||
if (p_40704_ instanceof ServerPlayer) {
|
||||
CriteriaTriggers.f_10591_.m_59469_((ServerPlayer)p_40704_, blockpos2, itemstack);
|
||||
@@ -98,7 +_,12 @@
|
||||
public void m_142131_(@Nullable Player p_150711_, Level p_150712_, ItemStack p_150713_, BlockPos p_150714_) {
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: use the ItemStack sensitive version
|
||||
public boolean m_142073_(@Nullable Player p_150716_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_) {
|
||||
+ return this.emptyContents(p_150716_, p_150717_, p_150718_, p_150719_, null);
|
||||
+ }
|
||||
+
|
||||
+ public boolean emptyContents(@Nullable Player p_150716_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_, @Nullable ItemStack container) {
|
||||
if (!(this.f_40687_ instanceof FlowingFluid)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -107,8 +_,12 @@
|
||||
Material material = blockstate.m_60767_();
|
||||
boolean flag = blockstate.m_60722_(this.f_40687_);
|
||||
boolean flag1 = blockstate.m_60795_() || flag || block instanceof LiquidBlockContainer && ((LiquidBlockContainer)block).m_6044_(p_150717_, p_150718_, blockstate, this.f_40687_);
|
||||
+ java.util.Optional<net.minecraftforge.fluids.FluidStack> containedFluidStack = java.util.Optional.ofNullable(container).flatMap(net.minecraftforge.fluids.FluidUtil::getFluidContained);
|
||||
if (!flag1) {
|
||||
- return p_150719_ != null && this.m_142073_(p_150716_, p_150717_, p_150719_.m_82425_().m_121945_(p_150719_.m_82434_()), (BlockHitResult)null);
|
||||
+ return p_150719_ != null && this.emptyContents(p_150716_, p_150717_, p_150719_.m_82425_().m_121945_(p_150719_.m_82434_()), (BlockHitResult)null, container);
|
||||
+ } else if (containedFluidStack.isPresent() && this.f_40687_.getFluidType().isVaporizedOnPlacement(p_150717_, p_150718_, containedFluidStack.get())) {
|
||||
+ this.f_40687_.getFluidType().onVaporize(p_150716_, p_150717_, p_150718_, containedFluidStack.get());
|
||||
+ return true;
|
||||
} else if (p_150717_.m_6042_().f_63857_() && this.f_40687_.m_205067_(FluidTags.f_13131_)) {
|
||||
int i = p_150718_.m_123341_();
|
||||
int j = p_150718_.m_123342_();
|
||||
@@ -120,7 +_,7 @@
|
||||
}
|
||||
|
||||
@@ -78,7 +107,7 @@
|
||||
+ private final java.util.function.Supplier<? extends Fluid> fluidSupplier;
|
||||
+ public Fluid getFluid() { return fluidSupplier.get(); }
|
||||
+
|
||||
+ private boolean canBlockContainFluid(Level worldIn, BlockPos posIn, BlockState blockstate)
|
||||
+ protected boolean canBlockContainFluid(Level worldIn, BlockPos posIn, BlockState blockstate)
|
||||
+ {
|
||||
+ return blockstate.m_60734_() instanceof LiquidBlockContainer && ((LiquidBlockContainer)blockstate.m_60734_()).m_6044_(worldIn, posIn, blockstate, this.f_40687_);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--- a/net/minecraft/world/item/BundleItem.java
|
||||
+++ b/net/minecraft/world/item/BundleItem.java
|
||||
@@ -40,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean m_142207_(ItemStack p_150733_, Slot p_150734_, ClickAction p_150735_, Player p_150736_) {
|
||||
- if (p_150735_ != ClickAction.SECONDARY) {
|
||||
+ if (p_150733_.m_41613_() != 1 || p_150735_ != ClickAction.SECONDARY) {
|
||||
return false;
|
||||
} else {
|
||||
ItemStack itemstack = p_150734_.m_7993_();
|
||||
@@ -62,6 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean m_142305_(ItemStack p_150742_, ItemStack p_150743_, Slot p_150744_, ClickAction p_150745_, Player p_150746_, SlotAccess p_150747_) {
|
||||
+ if (p_150742_.m_41613_() != 1) return false;
|
||||
if (p_150745_ == ClickAction.SECONDARY && p_150744_.m_150651_(p_150746_)) {
|
||||
if (p_150743_.m_41619_()) {
|
||||
m_150780_(p_150742_).ifPresent((p_186347_) -> {
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/world/item/DispensibleContainerItem.java
|
||||
+++ b/net/minecraft/world/item/DispensibleContainerItem.java
|
||||
@@ -6,9 +_,10 @@
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
||||
-public interface DispensibleContainerItem {
|
||||
+public interface DispensibleContainerItem extends net.minecraftforge.common.extensions.IForgeDispensibleContainerItem {
|
||||
default void m_142131_(@Nullable Player p_150817_, Level p_150818_, ItemStack p_150819_, BlockPos p_150820_) {
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: use the ItemStack sensitive version
|
||||
boolean m_142073_(@Nullable Player p_150821_, Level p_150822_, BlockPos p_150823_, @Nullable BlockHitResult p_150824_);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -127,11 +_,15 @@
|
||||
@@ -127,10 +_,15 @@
|
||||
entity.m_7678_(entity.m_20185_(), entity.m_20186_(), entity.m_20189_(), randomsource.m_188501_() * 360.0F, 0.0F);
|
||||
if (entity instanceof Mob) {
|
||||
Mob mob = (Mob)entity;
|
||||
@@ -11,11 +11,11 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
+ // Fire this early so mods can react to mobs that vanilla normally ignores.
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, p_151312_, (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), this, MobSpawnType.SPAWNER))
|
||||
if (this.f_45444_.m_186567_().m_128440_() == 1 && this.f_45444_.m_186567_().m_128425_("id", 8)) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, (LevelAccessor)p_151312_, (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), this, MobSpawnType.SPAWNER))
|
||||
((Mob)entity).m_6518_(p_151312_, p_151312_.m_6436_(entity.m_20183_()), MobSpawnType.SPAWNER, (SpawnGroupData)null, (CompoundTag)null);
|
||||
}
|
||||
}
|
||||
@@ -275,4 +_,12 @@
|
||||
public double m_45474_() {
|
||||
return this.f_45446_;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
mob.m_7678_(d0, (double)i, d1, p_47040_.f_46441_.m_188501_() * 360.0F, 0.0F);
|
||||
- if (m_46991_(p_47040_, mob, d2)) {
|
||||
+ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_47040_, d0, i, d1, null, MobSpawnType.NATURAL);
|
||||
+ if (canSpawn != -1 && (canSpawn == 1 || m_46991_(p_47040_, mob, d2))) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, (LevelAccessor) p_47040_, (float)d0, (float)i, (float)d1, null, MobSpawnType.NATURAL))
|
||||
+ if (canSpawn == 1 || (canSpawn == 0 && m_46991_(p_47040_, mob, d2))) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, p_47040_, (float)d0, (float)i, (float)d1, null, MobSpawnType.NATURAL))
|
||||
spawngroupdata = mob.m_6518_(p_47040_, p_47040_.m_6436_(mob.m_20183_()), MobSpawnType.NATURAL, spawngroupdata, (CompoundTag)null);
|
||||
++j;
|
||||
++l1;
|
||||
@@ -75,11 +75,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,6 +_,7 @@
|
||||
@@ -370,7 +_,9 @@
|
||||
entity.m_7678_(d0, (double)blockpos.m_123342_(), d1, p_220454_.m_188501_() * 360.0F, 0.0F);
|
||||
if (entity instanceof Mob) {
|
||||
Mob mob = (Mob)entity;
|
||||
+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_220451_, d0, blockpos.m_123342_(), d1, null, MobSpawnType.CHUNK_GENERATION) == -1) continue;
|
||||
if (mob.m_5545_(p_220451_, MobSpawnType.CHUNK_GENERATION) && mob.m_6914_(p_220451_)) {
|
||||
- if (mob.m_5545_(p_220451_, MobSpawnType.CHUNK_GENERATION) && mob.m_6914_(p_220451_)) {
|
||||
+ int res = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_220451_, d0, blockpos.m_123342_(), d1, null, MobSpawnType.CHUNK_GENERATION);
|
||||
+ if (res == 1 || (res == 0 && mob.m_5545_(p_220451_, MobSpawnType.CHUNK_GENERATION) && mob.m_6914_(p_220451_))) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, p_220451_, (float) d0, blockpos.m_123342_(), (float) d1, null, MobSpawnType.CHUNK_GENERATION))
|
||||
spawngroupdata = mob.m_6518_(p_220451_, p_220451_.m_6436_(mob.m_20183_()), MobSpawnType.CHUNK_GENERATION, spawngroupdata, (CompoundTag)null);
|
||||
p_220451_.m_47205_(mob);
|
||||
flag = true;
|
||||
@@ -8,3 +8,12 @@
|
||||
if (optional.isPresent()) {
|
||||
optional.get().m_77743_();
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
+ @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 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_) {
|
||||
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
|
||||
+++ 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 @@
|
||||
return list.get(0).m_38534_().m_45436_();
|
||||
}
|
||||
@@ -11,3 +22,11 @@
|
||||
if (!list1.isEmpty()) {
|
||||
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,12 @@
|
||||
--- 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_) {
|
||||
- this.f_53597_.get().m_203334_().m_224953_(p_221243_, p_221243_.m_7726_().m_8481_(), p_221244_, p_221245_);
|
||||
+ 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;
|
||||
+ event.getFeature().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
|
||||
+++ b/net/minecraft/world/level/block/MushroomBlock.java
|
||||
@@ -70,7 +_,7 @@
|
||||
@@ -70,13 +_,15 @@
|
||||
if (blockstate.m_204336_(BlockTags.f_13057_)) {
|
||||
return true;
|
||||
} 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
|
||||
+++ b/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||
@@ -14,10 +_,16 @@
|
||||
@@ -14,9 +_,19 @@
|
||||
public class PoweredRailBlock extends BaseRailBlock {
|
||||
public static final EnumProperty<RailShape> f_55214_ = BlockStateProperties.f_61404_;
|
||||
public static final BooleanProperty f_55215_ = BlockStateProperties.f_61448_;
|
||||
+ private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail
|
||||
|
||||
public PoweredRailBlock(BlockBehaviour.Properties p_55218_) {
|
||||
- super(true, p_55218_);
|
||||
+ this(p_55218_, false);
|
||||
+ }
|
||||
+
|
||||
+ protected PoweredRailBlock(BlockBehaviour.Properties builder, boolean isPoweredRail) {
|
||||
+ super(true, builder);
|
||||
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 PoweredRailBlock(BlockBehaviour.Properties p_55218_, boolean isPoweredRail) {
|
||||
super(true, p_55218_);
|
||||
+ 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_) {
|
||||
@@ -99,13 +_,13 @@
|
||||
@@ -28,7 +_,7 @@
|
||||
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_) {
|
||||
BlockState blockstate = p_55226_.m_8055_(p_55227_);
|
||||
- if (!blockstate.m_60713_(this)) {
|
||||
+ if (!(blockstate.m_60734_() instanceof PoweredRailBlock)) {
|
||||
+ if (!(blockstate.m_60734_() instanceof PoweredRailBlock other)) {
|
||||
return false;
|
||||
} else {
|
||||
- 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.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) {
|
||||
- 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 {
|
||||
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 @@
|
||||
return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_EAST);
|
||||
case NORTH_EAST:
|
||||
return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_WEST);
|
||||
+ case NORTH_SOUTH: //Forge fix: MC-196102
|
||||
+ case EAST_WEST:
|
||||
+ return p_55240_;
|
||||
+ case NORTH_SOUTH: //Forge fix: MC-196102
|
||||
+ case EAST_WEST:
|
||||
+ return p_55240_;
|
||||
}
|
||||
case COUNTERCLOCKWISE_90:
|
||||
switch ((RailShape)p_55240_.m_61143_(f_55214_)) {
|
||||
@@ -254,5 +_,9 @@
|
||||
@@ -253,6 +_,10 @@
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
--- a/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_) {
|
||||
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_.m_46803_(p_222013_.m_7494_()) >= 9 && p_222014_.m_188503_(7) == 0) {
|
||||
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,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/StemBlock.java
|
||||
+++ b/net/minecraft/world/level/block/StemBlock.java
|
||||
@@ -43,22 +_,24 @@
|
||||
@@ -43,22 +_,23 @@
|
||||
}
|
||||
|
||||
public void m_213898_(BlockState p_222538_, ServerLevel p_222539_, BlockPos p_222540_, RandomSource p_222541_) {
|
||||
@@ -19,8 +19,7 @@
|
||||
BlockPos blockpos = p_222540_.m_121945_(direction);
|
||||
BlockState blockstate = p_222539_.m_8055_(blockpos.m_7495_());
|
||||
- if (p_222539_.m_8055_(blockpos).m_60795_() && (blockstate.m_60713_(Blocks.f_50093_) || blockstate.m_204336_(BlockTags.f_144274_))) {
|
||||
+ Block block = blockstate.m_60734_();
|
||||
+ if (p_222539_.m_46859_(blockpos) && (blockstate.canSustainPlant(p_222539_, blockpos.m_7495_(), Direction.UP, this) || block == Blocks.f_50093_ || block == Blocks.f_50493_ || block == Blocks.f_50546_ || block == Blocks.f_50599_ || block == Blocks.f_50440_)) {
|
||||
+ if (p_222539_.m_46859_(blockpos) && (blockstate.canSustainPlant(p_222539_, blockpos.m_7495_(), Direction.UP, this.f_57015_) || blockstate.m_60713_(Blocks.f_50093_) || blockstate.m_204336_(BlockTags.f_144274_))) {
|
||||
p_222539_.m_46597_(blockpos, this.f_57015_.m_49966_());
|
||||
p_222539_.m_46597_(p_222540_, this.f_57015_.m_7810_().m_49966_().m_61124_(HorizontalDirectionalBlock.f_54117_, direction));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--- a/net/minecraft/world/level/block/StemGrownBlock.java
|
||||
+++ b/net/minecraft/world/level/block/StemGrownBlock.java
|
||||
@@ -2,7 +_,7 @@
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
|
||||
-public abstract class StemGrownBlock extends Block {
|
||||
+public abstract class StemGrownBlock extends Block implements net.minecraftforge.common.IPlantable {
|
||||
public StemGrownBlock(BlockBehaviour.Properties p_57058_) {
|
||||
super(p_57058_);
|
||||
}
|
||||
@@ -10,4 +_,11 @@
|
||||
public abstract StemBlock m_7161_();
|
||||
|
||||
public abstract AttachedStemBlock m_7810_();
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.world.level.block.state.BlockState getPlant(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos) {
|
||||
+ net.minecraft.world.level.block.state.BlockState state = world.m_8055_(pos);
|
||||
+ if (state.m_60734_() != this) return m_49966_();
|
||||
+ return state;
|
||||
+ }
|
||||
}
|
||||
+1
-1
@@ -164,7 +164,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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)
|
||||
+ return handlers[0].cast();
|
||||
+ 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) {
|
||||
+ 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 super.getCapability(cap, side);
|
||||
+ }
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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)
|
||||
+ return handlers[0].cast();
|
||||
+ else if (facing == Direction.DOWN)
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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)
|
||||
+ this.chestHandler = net.minecraftforge.common.util.LazyOptional.of(this::createHandler);
|
||||
+ 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_)) {
|
||||
@@ -1,10 +1,12 @@
|
||||
--- a/net/minecraft/world/level/levelgen/PatrolSpawner.java
|
||||
+++ b/net/minecraft/world/level/levelgen/PatrolSpawner.java
|
||||
@@ -104,6 +_,7 @@
|
||||
@@ -104,6 +_,9 @@
|
||||
}
|
||||
|
||||
patrollingmonster.m_6034_((double)p_224534_.m_123341_(), (double)p_224534_.m_123342_(), (double)p_224534_.m_123343_());
|
||||
+ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(patrollingmonster, p_224533_, p_224534_.m_123341_(), p_224534_.m_123342_(), p_224534_.m_123343_(), null, MobSpawnType.PATROL) == -1) return false;
|
||||
+ // Note: This call to canEntitySpawn is erroneous, it is only provided for backwards compatibility.
|
||||
+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(patrollingmonster, p_224533_, p_224534_.m_123341_(), p_224534_.m_123342_(), p_224534_.m_123343_(), null, MobSpawnType.PATROL) == -1) return false;
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(patrollingmonster, p_224533_, p_224534_.m_123341_(), p_224534_.m_123342_(), p_224534_.m_123343_(), null, MobSpawnType.PATROL))
|
||||
patrollingmonster.m_6518_(p_224533_, p_224533_.m_6436_(p_224534_), MobSpawnType.PATROL, (SpawnGroupData)null, (CompoundTag)null);
|
||||
p_224533_.m_47205_(patrollingmonster);
|
||||
return true;
|
||||
@@ -1,10 +1,12 @@
|
||||
--- a/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
+++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
@@ -60,6 +_,7 @@
|
||||
@@ -60,6 +_,9 @@
|
||||
for(int i1 = 0; i1 < l; ++i1) {
|
||||
Phantom phantom = EntityType.f_20509_.m_20615_(p_64576_);
|
||||
phantom.m_20035_(blockpos1, 0.0F, 0.0F);
|
||||
+ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(phantom, p_64576_, blockpos1.m_123341_(), blockpos1.m_123342_(), blockpos1.m_123343_(), null, MobSpawnType.NATURAL) == -1) return 0;
|
||||
+ // Note: This call to canEntitySpawn is erroneous, it is only provided for backwards compatibility.
|
||||
+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(phantom, p_64576_, blockpos1.m_123341_(), blockpos1.m_123342_(), blockpos1.m_123343_(), null, MobSpawnType.NATURAL) == -1) { i--; continue; }
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(phantom, p_64576_, blockpos1.m_123341_(), blockpos1.m_123342_(), blockpos1.m_123343_(), null, MobSpawnType.NATURAL))
|
||||
spawngroupdata = phantom.m_6518_(p_64576_, difficultyinstance, MobSpawnType.NATURAL, spawngroupdata, (CompoundTag)null);
|
||||
p_64576_.m_47205_(phantom);
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java
|
||||
@@ -72,7 +_,7 @@
|
||||
for(int i = 2; i >= -3; --i) {
|
||||
BlockPos blockpos = p_225975_.m_6630_(i);
|
||||
if (Feature.m_65788_(p_225974_.m_226058_(), blockpos)) {
|
||||
- p_225974_.m_226061_(blockpos, this.f_69303_.m_213972_(p_225974_.m_226067_(), p_225975_));
|
||||
+ p_225974_.m_226061_(blockpos, net.minecraftforge.event.ForgeEventFactory.alterGround(p_225974_.m_226058_(), p_225974_.m_226067_(), blockpos, this.f_69303_.m_213972_(p_225974_.m_226067_(), p_225975_)));
|
||||
break;
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacer.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacer.java
|
||||
@@ -58,7 +_,7 @@
|
||||
}
|
||||
|
||||
protected static void m_226169_(LevelSimulatedReader p_226170_, BiConsumer<BlockPos, BlockState> p_226171_, RandomSource p_226172_, BlockPos p_226173_, TreeConfiguration p_226174_) {
|
||||
- if (p_226174_.f_161215_ || !m_70295_(p_226170_, p_226173_)) {
|
||||
+ if (!(((net.minecraft.world.level.LevelReader) p_226170_).m_8055_(p_226173_).onTreeGrow((net.minecraft.world.level.LevelReader) p_226170_, p_226171_, p_226172_, p_226173_, p_226174_)) && (p_226174_.f_161215_ || !m_70295_(p_226170_, p_226173_))) {
|
||||
p_226171_.accept(p_226173_, p_226174_.f_161212_.m_213972_(p_226172_, p_226173_));
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java
|
||||
@@ -1442,6 +_,7 @@
|
||||
ElderGuardian elderguardian = EntityType.f_20563_.m_20615_(p_228844_.m_6018_());
|
||||
elderguardian.m_5634_(elderguardian.m_21233_());
|
||||
elderguardian.m_7678_((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_(), (double)blockpos.m_123343_() + 0.5D, 0.0F, 0.0F);
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(elderguardian, p_228844_, (float)elderguardian.m_20185_(), (float)elderguardian.m_20186_(), (float)elderguardian.m_20189_(), null, MobSpawnType.STRUCTURE))
|
||||
elderguardian.m_6518_(p_228844_, p_228844_.m_6436_(elderguardian.m_20183_()), MobSpawnType.STRUCTURE, (SpawnGroupData)null, (CompoundTag)null);
|
||||
p_228844_.m_47205_(elderguardian);
|
||||
return true;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java
|
||||
@@ -1052,6 +_,7 @@
|
||||
for(Mob mob : list) {
|
||||
mob.m_21530_();
|
||||
mob.m_20035_(p_230214_, 0.0F, 0.0F);
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, p_230215_, (float)mob.m_20185_(), (float)mob.m_20186_(), (float)mob.m_20189_(), null, MobSpawnType.STRUCTURE))
|
||||
mob.m_6518_(p_230215_, p_230215_.m_6436_(mob.m_20183_()), MobSpawnType.STRUCTURE, (SpawnGroupData)null, (CompoundTag)null);
|
||||
p_230215_.m_47205_(mob);
|
||||
p_230215_.m_7731_(p_230214_, Blocks.f_50016_.m_49966_(), 2);
|
||||
+2
-1
@@ -86,7 +86,7 @@
|
||||
ListTag listtag = new ListTag();
|
||||
listtag.add(DoubleTag.m_128500_(vec31.f_82479_));
|
||||
listtag.add(DoubleTag.m_128500_(vec31.f_82480_));
|
||||
@@ -391,10 +_,10 @@
|
||||
@@ -391,10 +_,11 @@
|
||||
compoundtag.m_128365_("Pos", listtag);
|
||||
compoundtag.m_128473_("UUID");
|
||||
m_74543_(p_74524_, compoundtag).ifPresent((p_205061_) -> {
|
||||
@@ -97,6 +97,7 @@
|
||||
p_205061_.m_7678_(vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, f, p_205061_.m_146909_());
|
||||
- if (p_74530_ && p_205061_ instanceof Mob) {
|
||||
+ if (placementIn.m_74414_() && p_205061_ instanceof Mob) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((Mob)p_205061_, p_74524_, (float)p_205061_.m_20185_(), (float)p_205061_.m_20186_(), (float)p_205061_.m_20189_(), null, MobSpawnType.STRUCTURE))
|
||||
((Mob)p_205061_).m_6518_(p_74524_, p_74524_.m_6436_(new BlockPos(vec31)), MobSpawnType.STRUCTURE, (SpawnGroupData)null, compoundtag);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
+ LevelStorageSource.this.m_230817_(this.f_230867_, (path, dataFixer) -> {
|
||||
+ try {
|
||||
+ CompoundTag compoundTag = NbtIo.m_128937_(path.toFile());
|
||||
+ net.minecraftforge.common.ForgeHooks.readAdditionalLevelSaveData(compoundTag);
|
||||
+ net.minecraftforge.common.ForgeHooks.readAdditionalLevelSaveData(compoundTag, this.f_230867_);
|
||||
+ } catch (Exception e) {
|
||||
+ f_78191_.error("Exception reading {}", path, e);
|
||||
+ }
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<MarkerFilter marker="REGISTRIES" onMatch="${sys:forge.logging.marker.registries:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="REGISTRYDUMP" onMatch="${sys:forge.logging.marker.registrydump:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="SPLASH" onMatch="${sys:forge.logging.marker.splash:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="RESOURCE-CACHE" onMatch="${sys:forge.logging.marker.resource.cache:-DENY}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="FORGEMOD" onMatch="${sys:forge.logging.marker.forgemod:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="LOADING" onMatch="${sys:forge.logging.marker.loading:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
<MarkerFilter marker="CORE" onMatch="${sys:forge.logging.marker.core:-ACCEPT}" onMismatch="NEUTRAL"/>
|
||||
|
||||
Loaded 100 of 234 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user