mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 09:05:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3426008d3 | ||
|
|
54233da14c | ||
|
|
ed3ac8a122 | ||
|
|
201b0b8695 | ||
|
|
09f1b8d438 | ||
|
|
0403cc8147 | ||
|
|
9a21260575 | ||
|
|
a4ca2c69f0 | ||
|
|
4e47eab41e | ||
|
|
fb5f2ea750 | ||
|
|
18ca2e9b78 | ||
|
|
ad8bc658bb | ||
|
|
3b54aea224 | ||
|
|
e81a984165 | ||
|
|
5fc5f15cc6 | ||
|
|
cae822ced9 | ||
|
|
07aba06d59 | ||
|
|
2b6fbf6697 | ||
|
|
e23e94ccfe | ||
|
|
83faa98df9 | ||
|
|
ed1f83047c | ||
|
|
17522788d7 | ||
|
|
e872587906 | ||
|
|
f998289776 | ||
|
|
5a2c7aa0a2 | ||
|
|
ae7609979e | ||
|
|
53873dd3d0 | ||
|
|
6568649965 | ||
|
|
111d3ec5d5 | ||
|
|
2c36b306a4 | ||
|
|
56f4300117 | ||
|
|
62a4329c7d | ||
|
|
38a7ffbc0d | ||
|
|
4610784443 | ||
|
|
0ecc6c6359 | ||
|
|
9ef34a9f1a | ||
|
|
acf871f934 | ||
|
|
a8b2ade614 | ||
|
|
854f4deb04 | ||
|
|
083624fb67 | ||
|
|
c5725d1c61 | ||
|
|
a2bd95ca39 | ||
|
|
98bae44a3a |
No files matched your search
Vendored
+104
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0"?>
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>MinecraftForge_Forge Config DSL Script</name>
|
||||
<groupId>MinecraftForge_Forge</groupId>
|
||||
<artifactId>MinecraftForge_Forge_dsl</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.jetbrains.teamcity</groupId>
|
||||
<artifactId>configs-dsl-kotlin-parent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jetbrains-all</id>
|
||||
<url>https://download.jetbrains.com/teamcity-repository</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>teamcity-server</id>
|
||||
<url>https://teamcity.minecraftforge.net/app/dsl-plugins-repository</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>JetBrains</id>
|
||||
<url>https://download.jetbrains.com/teamcity-repository</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${basedir}</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<version>${kotlin.version}</version>
|
||||
|
||||
<configuration/>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>process-test-sources</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.teamcity</groupId>
|
||||
<artifactId>teamcity-configs-maven-plugin</artifactId>
|
||||
<version>${teamcity.dsl.version}</version>
|
||||
<configuration>
|
||||
<format>kotlin</format>
|
||||
<dstDir>target/generated-configs</dstDir>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.teamcity</groupId>
|
||||
<artifactId>configs-dsl-kotlin</artifactId>
|
||||
<version>${teamcity.dsl.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.teamcity</groupId>
|
||||
<artifactId>configs-dsl-kotlin-plugins</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-script-runtime</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
Vendored
+185
@@ -0,0 +1,185 @@
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues
|
||||
import jetbrains.buildServer.configs.kotlin.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||
|
||||
/*
|
||||
The settings script is an entry point for defining a TeamCity
|
||||
project hierarchy. The script should contain a single call to the
|
||||
project() function with a Project instance or an init function as
|
||||
an argument.
|
||||
|
||||
VcsRoots, BuildTypes, Templates, and subprojects can be
|
||||
registered inside the project using the vcsRoot(), buildType(),
|
||||
template(), and subProject() methods respectively.
|
||||
|
||||
To debug settings scripts in command-line, run the
|
||||
|
||||
mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
|
||||
|
||||
command and attach your debugger to the port 8000.
|
||||
|
||||
To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
|
||||
-> Tool Windows -> Maven Projects), find the generate task node
|
||||
(Plugins -> teamcity-configs -> teamcity-configs:generate), the
|
||||
'Debug' option is available in the context menu for the task.
|
||||
*/
|
||||
|
||||
version = "2021.2"
|
||||
|
||||
project {
|
||||
|
||||
buildType(Build)
|
||||
buildType(BuildSecondaryBranches)
|
||||
buildType(PullRequests)
|
||||
buildType(PullRequestChecks)
|
||||
buildType(PullRequestCompatibility)
|
||||
|
||||
params {
|
||||
text("docker_jdk_version", "8", 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.3.3", 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.20.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_branch_spec", """
|
||||
+:refs/heads/(main*)
|
||||
+:refs/heads/(master*)
|
||||
+:refs/heads/(develop|release|staging|main|master)
|
||||
+:refs/heads/(1.*)
|
||||
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
|
||||
text("github_repository_name", "MinecraftForge", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `MinecraftForge` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forge", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||
text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||
//These are references and not actually keys
|
||||
password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN)
|
||||
password("env.LEGACY_KEYSTORE_URL", "credentialsJSON:a2d2efc7-4492-47b6-9826-d14b2c1243a0", display = ParameterDisplay.HIDDEN)
|
||||
password("env.LEGACY_KEYSTORE_PASSWORD", "credentialsJSON:9f9a1a9e-f91b-40d5-b888-8ebc79a99ded", display = ParameterDisplay.HIDDEN)
|
||||
text("additional_publishing_gradle_parameters", "-PcrowdinKey=%env.CROWDIN_KEY% -PkeystoreKeyPass=%env.LEGACY_KEYSTORE_PASSWORD% -PkeystoreStorePass=%env.LEGACY_KEYSTORE_PASSWORD% -Pkeystore=%env.LEGACY_KEYSTORE_URL%", label = "Additional gradle parameters for publish", description = "Contains the additional gradle parameters used during publishing.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
|
||||
|
||||
checkbox("should_execute_build", "false", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
|
||||
checked = "true", unchecked = "false")
|
||||
checkbox("should_execute_test", "false", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
|
||||
checked = "true", unchecked = "false")
|
||||
}
|
||||
|
||||
features {
|
||||
githubIssues {
|
||||
id = "MinecraftForge_MinecraftForge__IssueTracker"
|
||||
displayName = "MinecraftForge/MinecraftForge"
|
||||
repositoryURL = "https://github.com/MinecraftForge/MinecraftForge"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Build : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"), AbsoluteId("MinecraftForge_PublishProjectUsingGradle"), AbsoluteId("MinecraftForge_TriggersStaticFilesWebpageGenerator"))
|
||||
id("MinecraftForge_MinecraftForge__Build")
|
||||
name = "Build"
|
||||
description = "Builds and Publishes the main branches of the project."
|
||||
})
|
||||
|
||||
object BuildSecondaryBranches : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_ExcludesBuildingDefaultBranch"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"))
|
||||
id("MinecraftForge_MinecraftForge__BuildSecondaryBranches")
|
||||
name = "Build - Secondary Branches"
|
||||
description = "Builds and Publishes the secondary branches of the project."
|
||||
params {
|
||||
text("git_branch_spec", """
|
||||
+:refs/heads/(*)
|
||||
-:refs/heads/noci*
|
||||
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
|
||||
}
|
||||
vcs {
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:1.*
|
||||
-:<default>
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
|
||||
object PullRequests : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"))
|
||||
id("MinecraftForge_MinecraftForge__PullRequests")
|
||||
name = "Pull Requests"
|
||||
description = "Builds pull requests for the project"
|
||||
|
||||
params {
|
||||
checkbox("should_execute_build", "true", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
|
||||
checked = "true", unchecked = "false")
|
||||
text(
|
||||
"gradle_build_task",
|
||||
"assemble",
|
||||
label = "Gradle build task to execute during build",
|
||||
description = "Determines the build task that is executed to build the project.",
|
||||
display = ParameterDisplay.HIDDEN,
|
||||
allowEmpty = false
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
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()
|
||||
}
|
||||
})
|
||||
+2
-16
@@ -1,16 +1,2 @@
|
||||
Minecraft Forge
|
||||
Copyright (c) 2016-${year}.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation version 2.1
|
||||
of the License.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Copyright (c) Forge Development LLC and contributors
|
||||
SPDX-License-Identifier: LGPL-2.1-only
|
||||
+212
-68
@@ -5,29 +5,39 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:[6.0.36,6.2)'
|
||||
}
|
||||
}
|
||||
|
||||
import groovy.json.JsonBuilder
|
||||
import net.minecraftforge.forge.tasks.checks.CheckATs
|
||||
import net.minecraftforge.forge.tasks.checks.CheckExcs
|
||||
import net.minecraftforge.forge.tasks.checks.CheckPatches
|
||||
import net.minecraftforge.forge.tasks.checks.CheckSAS
|
||||
import net.minecraftforge.forge.tasks.checks.CheckTask
|
||||
import net.minecraftforge.forge.tasks.checks.CheckMode
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.util.Date
|
||||
import java.util.LinkedHashMap
|
||||
import net.minecraftforge.forge.tasks.*
|
||||
import static net.minecraftforge.forge.tasks.Util.*
|
||||
import net.minecraftforge.gradle.common.tasks.ApplyBinPatches
|
||||
import net.minecraftforge.gradle.common.tasks.CheckJarCompatibility
|
||||
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact
|
||||
import net.minecraftforge.gradle.common.tasks.ExtractInheritance
|
||||
import net.minecraftforge.gradle.common.tasks.SignJar
|
||||
import net.minecraftforge.gradle.patcher.tasks.GeneratePatches
|
||||
import net.minecraftforge.gradle.patcher.tasks.ReobfuscateJar
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||
|
||||
plugins {
|
||||
id 'org.cadixdev.licenser' version '0.6.1'
|
||||
id 'com.github.ben-manes.versions' version '0.36.0'
|
||||
id 'net.minecraftforge.gradleutils' version '1.+'
|
||||
id 'com.github.ben-manes.versions' version '0.46.0'
|
||||
id 'net.minecraftforge.gradleutils' version '[2.2,2.3)'
|
||||
id 'eclipse'
|
||||
id 'de.undercouch.download' version '5.4.0'
|
||||
}
|
||||
|
||||
Util.init() //Init all our extension methods
|
||||
@@ -47,9 +57,15 @@ ext {
|
||||
MAPPING_VERSION = '1.16.5'
|
||||
MC_VERSION = '1.16.5'
|
||||
MCP_VERSION = '20210115.111550'
|
||||
ASM_VERSION = '9.6'
|
||||
SPI_VERSION = '3.2.0'
|
||||
MIN_TAG_FOR_CHANGELOG = "36.0"
|
||||
GIT_INFO = gradleutils.gitInfo
|
||||
LAST_RB = GIT_INFO.tag.rsplit('.', 1)[1] as int >= 1 ? GIT_INFO.tag + '.0' : null
|
||||
}
|
||||
|
||||
version = gradleutils.getMCTagOffsetBranchVersion(MC_VERSION)
|
||||
|
||||
project(':mcp') {
|
||||
apply plugin: 'net.minecraftforge.gradle.mcp'
|
||||
repositories {
|
||||
@@ -189,11 +205,10 @@ project(':forge') {
|
||||
// ForgeMC is a unique identifier for every MC version we have supported.
|
||||
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
|
||||
MCP_ARTIFACT = project(':mcp').mcp.config.get()
|
||||
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.10.0'
|
||||
SPECIAL_SOURCE_MCP = 'net.md-5:SpecialSource:1.8.5'
|
||||
VERSION_JSON = project(':mcp').file('build/mcp/downloadJson/version.json')
|
||||
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar'
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.2.6'
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
||||
}
|
||||
|
||||
version = gradleutils.getMCTagOffsetBranchVersion(MC_VERSION)
|
||||
@@ -204,7 +219,7 @@ project(':forge') {
|
||||
parent = project(':clean')
|
||||
patches = file("$rootDir/patches/minecraft")
|
||||
patchedSrc = file('src/main/java')
|
||||
srgPatches = true
|
||||
srgPatches = false
|
||||
accessTransformers.from file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
|
||||
sideAnnotationStrippers.from file("$rootDir/src/main/resources/forge.sas")
|
||||
|
||||
@@ -215,6 +230,12 @@ project(':forge') {
|
||||
main 'net.minecraftforge.userdev.LaunchTesting'
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Support Forge devs running on Java 8 and up, including 16
|
||||
jvmArgs '-XX:+IgnoreUnrecognizedVMOptions'
|
||||
jvmArgs '--add-exports=java.base/sun.security.util=ALL-UNNAMED'
|
||||
jvmArgs '--add-exports=jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
||||
jvmArgs '--add-opens=java.base/java.util.jar=ALL-UNNAMED'
|
||||
|
||||
environment 'target', 'fmldevclient'
|
||||
environment 'assetIndex', '{asset_index}'
|
||||
environment 'assetDirectory', downloadAssets.output
|
||||
@@ -259,6 +280,12 @@ project(':forge') {
|
||||
main 'net.minecraftforge.userdev.LaunchTesting'
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Support Forge devs running on Java 8 and up, including 16
|
||||
jvmArgs '-XX:+IgnoreUnrecognizedVMOptions'
|
||||
jvmArgs '--add-exports=java.base/sun.security.util=ALL-UNNAMED'
|
||||
jvmArgs '--add-exports=jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
||||
jvmArgs '--add-opens=java.base/java.util.jar=ALL-UNNAMED'
|
||||
|
||||
environment 'target', 'fmldevserver'
|
||||
|
||||
environment 'MC_VERSION', MC_VERSION
|
||||
@@ -272,7 +299,10 @@ project(':forge') {
|
||||
ideaModule "${rootProject.name}.${project.name}.userdev"
|
||||
|
||||
mods {
|
||||
forge { source sourceSets.main }
|
||||
forge {
|
||||
source sourceSets.main
|
||||
source sourceSets.userdev
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,6 +326,12 @@ project(':forge') {
|
||||
main 'net.minecraftforge.userdev.LaunchTesting'
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Support Forge devs running on Java 8 and up, including 16
|
||||
jvmArgs '-XX:+IgnoreUnrecognizedVMOptions'
|
||||
jvmArgs '--add-exports=java.base/sun.security.util=ALL-UNNAMED'
|
||||
jvmArgs '--add-exports=jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
||||
jvmArgs '--add-opens=java.base/java.util.jar=ALL-UNNAMED'
|
||||
|
||||
environment 'target', 'fmldevdata'
|
||||
environment 'assetIndex', '{asset_index}'
|
||||
environment 'assetDirectory', downloadAssets.output
|
||||
@@ -310,7 +346,10 @@ project(':forge') {
|
||||
ideaModule "${rootProject.name}.${project.name}.userdev"
|
||||
|
||||
mods {
|
||||
forge { source sourceSets.main }
|
||||
forge {
|
||||
source sourceSets.main
|
||||
source sourceSets.userdev
|
||||
}
|
||||
}
|
||||
|
||||
args '--mod', 'forge', '--all', '--output', rootProject.file('src/generated/resources/'), '--validate',
|
||||
@@ -318,13 +357,40 @@ project(':forge') {
|
||||
}
|
||||
|
||||
forge_test_data {
|
||||
parent runs.forge_data
|
||||
taskName 'forge_test_data'
|
||||
|
||||
environment 'MOD_CLASSES', 'dummy' // Needed to work around FG limitation, FG will replace this!
|
||||
|
||||
main 'net.minecraftforge.userdev.LaunchTesting'
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Support Forge devs running on Java 8 and up, including 16
|
||||
jvmArgs '-XX:+IgnoreUnrecognizedVMOptions'
|
||||
jvmArgs '--add-exports=java.base/sun.security.util=ALL-UNNAMED'
|
||||
jvmArgs '--add-exports=jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
||||
jvmArgs '--add-opens=java.base/java.util.jar=ALL-UNNAMED'
|
||||
|
||||
environment 'target', 'fmldevdata'
|
||||
environment 'assetIndex', '{asset_index}'
|
||||
environment 'assetDirectory', downloadAssets.output
|
||||
|
||||
environment 'MC_VERSION', MC_VERSION
|
||||
environment 'MCP_VERSION', MCP_VERSION
|
||||
environment 'FORGE_GROUP', project.group
|
||||
environment 'FORGE_SPEC', SPEC_VERSION
|
||||
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1)
|
||||
environment 'LAUNCHER_VERSION', SPEC_VERSION
|
||||
|
||||
ideaModule "${rootProject.name}.${project.name}.userdev"
|
||||
ideaModule "${rootProject.name}.${project.name}.userdev_test"
|
||||
|
||||
mods {
|
||||
forge {
|
||||
source sourceSets.main
|
||||
source sourceSets.userdev
|
||||
}
|
||||
}
|
||||
|
||||
mods {
|
||||
tests { sources sourceSets.test }
|
||||
}
|
||||
@@ -342,6 +408,33 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if (!patcher.srgPatches) {
|
||||
srg2mcpClean {
|
||||
dependsOn = []
|
||||
input = project(':mcp').setupMCP.output
|
||||
}
|
||||
userdevJar {
|
||||
onlyIf = { t -> true }
|
||||
}
|
||||
def patches = project.file('build/genPatchesForUserdev/output/')
|
||||
patches.mkdirs()
|
||||
def genPatchesForUserdev = tasks.register('genPatchesForUserdev', GeneratePatches){
|
||||
base = project(':mcp').setupMCP.output
|
||||
modified = applyRangeMapBase.output
|
||||
originalPrefix = genPatches.originalPrefix
|
||||
modifiedPrefix = genPatches.modifiedPrefix
|
||||
output = patches
|
||||
autoHeader true
|
||||
lineEnding = '\n'
|
||||
}
|
||||
bakePatches {
|
||||
dependsOn = []
|
||||
input = genPatchesForUserdev.get().output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
MANIFESTS = [
|
||||
@@ -409,12 +502,12 @@ project(':forge') {
|
||||
fmllauncherImplementation.extendsFrom(installer, implementation)
|
||||
}
|
||||
dependencies {
|
||||
installer 'org.ow2.asm:asm:9.1'
|
||||
installer 'org.ow2.asm:asm-commons:9.1'
|
||||
installer 'org.ow2.asm:asm-tree:9.1'
|
||||
installer 'org.ow2.asm:asm-util:9.1'
|
||||
installer 'org.ow2.asm:asm-analysis:9.1'
|
||||
installer 'cpw.mods:modlauncher:8.0.9'
|
||||
installer 'org.ow2.asm:asm:' + ASM_VERSION
|
||||
installer 'org.ow2.asm:asm-commons:' + ASM_VERSION
|
||||
installer 'org.ow2.asm:asm-tree:' + ASM_VERSION
|
||||
installer 'org.ow2.asm:asm-util:' + ASM_VERSION
|
||||
installer 'org.ow2.asm:asm-analysis:' + ASM_VERSION
|
||||
installer 'cpw.mods:modlauncher:8.1.3'
|
||||
installer 'cpw.mods:grossjava9hacks:1.3.3'
|
||||
installer 'net.minecraftforge:accesstransformers:3.0.1'
|
||||
installer 'org.antlr:antlr4-runtime:4.9.1' //Dep of AccessTransformer
|
||||
@@ -427,11 +520,12 @@ project(':forge') {
|
||||
installer 'org.jline:jline:3.12.+'
|
||||
installer 'org.apache.maven:maven-artifact:3.6.3'
|
||||
installer 'net.jodah:typetools:0.8.3'
|
||||
installer 'org.apache.logging.log4j:log4j-api:2.11.2'
|
||||
installer 'org.apache.logging.log4j:log4j-core:2.11.2'
|
||||
installer 'org.apache.logging.log4j:log4j-api:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
|
||||
installer 'org.apache.logging.log4j:log4j-core:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
|
||||
installer 'org.apache.logging.log4j:log4j-slf4j18-impl:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
|
||||
installer 'net.minecrell:terminalconsoleappender:1.2.0'
|
||||
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
|
||||
installer 'org.spongepowered:mixin:0.8.2'
|
||||
installer 'org.spongepowered:mixin:0.8.4'
|
||||
// This is org.openjdk.nashorn:nashorn-core:15.1.1 repackaged so it doesn't crash on JREs < 15.
|
||||
// See: https://github.com/LexManos/NashornLegacyPackager
|
||||
installer 'net.minecraftforge:nashorn-core-compat:15.1.1.1'
|
||||
@@ -449,13 +543,10 @@ project(':forge') {
|
||||
|
||||
def extraTxts = [
|
||||
rootProject.file('CREDITS.txt'),
|
||||
rootProject.file('LICENSE.txt')
|
||||
rootProject.file('LICENSE.txt'),
|
||||
rootProject.file('build/changelog.txt'),
|
||||
]
|
||||
|
||||
def changelog = rootProject.file('build/changelog.txt')
|
||||
if (changelog.exists())
|
||||
extraTxts += changelog
|
||||
|
||||
|
||||
task crowdin(type: Crowdin) {
|
||||
key = project.hasProperty('crowdinKey') ? project.crowdinKey : null
|
||||
//TODO: Merge our english.json?
|
||||
@@ -489,6 +580,7 @@ project(':forge') {
|
||||
|
||||
task extractInheritance(type: ExtractInheritance, dependsOn: [genJoinedBinPatches, downloadLibraries]) {
|
||||
tool = INSTALLER_TOOLS + ':fatjar'
|
||||
args.add '--annotations'
|
||||
input = genJoinedBinPatches.cleanJar
|
||||
libraries.addAll downloadLibraries.librariesOutput.map { rf -> Files.readAllLines(rf.asFile.toPath()).stream().map(File::new).collect(java.util.stream.Collectors.toList()) }
|
||||
}
|
||||
@@ -529,39 +621,98 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
|
||||
task checkATs(type: CheckATs, dependsOn: [extractInheritance, createSrg2Mcp]) {
|
||||
inheritance = extractInheritance.output
|
||||
tasks.register('checkAll') {
|
||||
dependsOn 'checkLicenses'
|
||||
group = 'checks'
|
||||
}
|
||||
tasks.register('checkAllAndFix') {
|
||||
dependsOn 'findFieldInstanceChecks', 'checkLicenses'
|
||||
group = 'checks'
|
||||
}
|
||||
|
||||
CheckTask.registerTask(tasks, 'ATs', CheckATs) {
|
||||
dependsOn extractInheritance, createSrg2Mcp
|
||||
ats.from patcher.accessTransformers
|
||||
inheritance = extractInheritance.output
|
||||
mappings = createSrg2Mcp.output
|
||||
}
|
||||
|
||||
task checkSAS(type: CheckSAS, dependsOn: extractInheritance) {
|
||||
inheritance = extractInheritance.output
|
||||
CheckTask.registerTask(tasks, 'SAS', CheckSAS) {
|
||||
dependsOn extractInheritance
|
||||
sass.from patcher.sideAnnotationStrippers
|
||||
inheritance = extractInheritance.output
|
||||
}
|
||||
|
||||
task checkExcs(type: CheckExcs, dependsOn: jar) {
|
||||
binary = jar.archiveFile
|
||||
CheckTask.registerTask(tasks, 'Excs', CheckExcs) {
|
||||
dependsOn jar
|
||||
binary = jar.archiveFile.get().asFile
|
||||
excs.from patcher.excs
|
||||
}
|
||||
|
||||
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks]){}
|
||||
|
||||
task checkPatchesAndFix(type: CheckPatches, dependsOn: genPatches) {
|
||||
CheckTask.registerTask(tasks, 'Patches', CheckPatches) {
|
||||
dependsOn genPatches
|
||||
patchDir = file("$rootDir/patches")
|
||||
autoFix = true
|
||||
patchesWithS2SArtifact = [
|
||||
'minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch',
|
||||
'minecraft/net/minecraft/data/BlockModelDefinition.java.patch',
|
||||
]
|
||||
}
|
||||
|
||||
task checkPatches(type: CheckPatches, dependsOn: genPatches) {
|
||||
patchDir = file("$rootDir/patches")
|
||||
autoFix = false
|
||||
}
|
||||
genPatches {
|
||||
finalizedBy checkPatches
|
||||
finalizedBy checkAndFixPatches
|
||||
autoHeader true
|
||||
lineEnding = '\n'
|
||||
}
|
||||
|
||||
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 {
|
||||
baseForgeVersionProperty.getOrNull() != null
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('setupCheckJarCompatibility', SetupCheckJarCompatibility) {
|
||||
inputVersion = baseForgeVersionProperty
|
||||
}
|
||||
|
||||
tasks.register('applyBaseCompatibilityJarBinPatches', ApplyBinPatches) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
|
||||
clean = project.tasks.createJoinedSRG.output
|
||||
patch = project.tasks.named('setupCheckJarCompatibility').flatMap { it.baseBinPatchesOutput }
|
||||
output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') }
|
||||
}
|
||||
|
||||
tasks.register('mergeBaseForgeJar', MergeJars) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
|
||||
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 }
|
||||
|
||||
commonLibraries.from(project.configurations.minecraftImplementation)
|
||||
commonLibraries.from(project.configurations.installer)
|
||||
}
|
||||
|
||||
task launcherJson(dependsOn: ['signUniversalJar', 'signLauncherJar']) {
|
||||
inputs.file universalJar.archiveFile
|
||||
inputs.file { launcherJar.archiveFile }
|
||||
@@ -803,10 +954,14 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
dependsOn project.rootProject.tasks.createChangelog
|
||||
}
|
||||
}
|
||||
|
||||
task launcherJar(type: Jar) {
|
||||
classifier 'launcher'
|
||||
archiveClassifier.set('launcher')
|
||||
from sourceSets.fmllauncher.output
|
||||
doFirst {
|
||||
def classpath = new StringBuilder()
|
||||
@@ -838,7 +993,7 @@ project(':forge') {
|
||||
}
|
||||
|
||||
task downloadInstaller(type: DownloadMavenArtifact) {
|
||||
artifact = 'net.minecraftforge:installer:2.1.+:shrunk'
|
||||
artifact = 'net.minecraftforge:installer:2.2.+:fatjar'
|
||||
changing = true
|
||||
}
|
||||
|
||||
@@ -871,6 +1026,10 @@ project(':forge') {
|
||||
duplicatesStrategy = 'exclude'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
dependsOn project.rootProject.tasks.createChangelog
|
||||
}
|
||||
}
|
||||
|
||||
[universalJar, launcherJar, installerJar].each { t ->
|
||||
@@ -910,7 +1069,7 @@ project(':forge') {
|
||||
exclude it
|
||||
}
|
||||
filter(ReplaceTokens, tokens: [
|
||||
FORGE_VERSION: project.version,
|
||||
FORGE_VERSION: project.version.substring(MC_VERSION.length() + 1),
|
||||
FORGE_GROUP: project.group,
|
||||
FORGE_NAME: project.name,
|
||||
MC_VERSION: MC_VERSION,
|
||||
@@ -922,6 +1081,10 @@ project(':forge') {
|
||||
rename 'gitignore\\.txt', '.gitignore'
|
||||
rename 'gitattributes\\.txt', '.gitattributes'
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
dependsOn project.rootProject.tasks.createChangelog
|
||||
}
|
||||
}
|
||||
|
||||
userdevConfig {
|
||||
@@ -994,7 +1157,7 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
license {
|
||||
header = file("$rootDir/LICENSE-header.txt")
|
||||
|
||||
@@ -1024,11 +1187,7 @@ project(':forge') {
|
||||
task userdevExtras(type:Jar) {
|
||||
dependsOn classes
|
||||
from sourceSets.userdev.output
|
||||
classifier 'userdev-temp'
|
||||
}
|
||||
|
||||
reobfJar {
|
||||
tool = SPECIAL_SOURCE + ':shaded'
|
||||
archiveClassifier.set('userdev-temp')
|
||||
}
|
||||
|
||||
task userdevExtrasReobf(type: ReobfuscateJar) {
|
||||
@@ -1036,7 +1195,6 @@ project(':forge') {
|
||||
input = tasks.userdevExtras.archiveFile
|
||||
classpath.from project.configurations.userdevCompileClasspath
|
||||
srg = tasks.createMcp2Srg.output
|
||||
tool = SPECIAL_SOURCE + ':shaded'
|
||||
}
|
||||
|
||||
userdevJar {
|
||||
@@ -1074,11 +1232,6 @@ project(':forge') {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact universalJar
|
||||
if (changelog.exists()) {
|
||||
artifact(changelog) {
|
||||
classifier = 'changelog'
|
||||
}
|
||||
}
|
||||
artifact installerJar
|
||||
//TODO: installer-win
|
||||
artifact makeMdk
|
||||
@@ -1113,20 +1266,7 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
if (System.env.MAVEN_USER) {
|
||||
url "https://maven.minecraftforge.net/releases/"
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
credentials {
|
||||
username = System.env.MAVEN_USER ?: 'not'
|
||||
password = System.env.MAVEN_PASSWORD ?: 'set'
|
||||
}
|
||||
} else {
|
||||
url 'file://' + rootProject.file('repo').getAbsolutePath()
|
||||
}
|
||||
}
|
||||
maven gradleutils.getPublishingForgeMaven()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1136,3 +1276,7 @@ task setup() {
|
||||
dependsOn ':clean:extractMapped'
|
||||
dependsOn ':forge:extractMapped' //These must be strings so that we can do lazy resolution. Else we need evaluationDependsOnChildren above
|
||||
}
|
||||
|
||||
changelog {
|
||||
fromTag MIN_TAG_FOR_CHANGELOG
|
||||
}
|
||||
@@ -3,7 +3,9 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
implementation 'org.ow2.asm:asm:9.1'
|
||||
implementation 'org.ow2.asm:asm-tree:9.1'
|
||||
implementation 'org.ow2.asm:asm:9.6'
|
||||
implementation 'org.ow2.asm:asm-tree:9.6'
|
||||
implementation 'net.minecraftforge:srgutils:0.4.+'
|
||||
implementation 'commons-io:commons-io:2.12.0'
|
||||
implementation 'com.google.code.gson:gson:2.10'
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import groovy.json.JsonBuilder
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.Opcodes
|
||||
@@ -17,7 +17,9 @@ import java.util.zip.ZipInputStream
|
||||
|
||||
abstract class BytecodeFinder extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getJar()
|
||||
@OutputFile abstract RegularFileProperty getOutput()
|
||||
// It should be fine to mark the output as internal as we want to control when we run it anyways.
|
||||
// This also shuts Gradle 8 up about implicit task dependencies.
|
||||
@Internal abstract RegularFileProperty getOutput()
|
||||
|
||||
BytecodeFinder() {
|
||||
output.convention(project.layout.buildDirectory.dir(name).map { it.file("output.json") })
|
||||
|
||||
@@ -1,266 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import net.minecraftforge.srgutils.IMappingFile
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
abstract class CheckATs extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getAts()
|
||||
@InputFile @Optional abstract RegularFileProperty getMappings()
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
def mappings = mappings.map { IMappingFile.load(it.asFile) }.getOrNull()
|
||||
Util.init()
|
||||
def parse = { line ->
|
||||
def idx = line.indexOf('#')
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
def (modifier, cls, desc) = (line.trim() + ' ').split(' ', -1)
|
||||
def key = cls + (desc.isEmpty() ? '' : ' ' + desc)
|
||||
return [modifier, cls, desc, comment, key]
|
||||
}
|
||||
def accessLevel = { access ->
|
||||
if ((access & Opcodes.ACC_PUBLIC) != 0) return 3
|
||||
if ((access & Opcodes.ACC_PROTECTED) != 0) return 2
|
||||
if ((access & Opcodes.ACC_PRIVATE) != 0) return 0
|
||||
return 1
|
||||
}
|
||||
def accessStr = { access ->
|
||||
if (access.endsWith('-f') || access.endsWith('+f'))
|
||||
return 4
|
||||
switch (access.toLowerCase()) {
|
||||
case 'public': return 3
|
||||
case 'protected': return 2
|
||||
case 'default': return 1
|
||||
case 'private': return 0
|
||||
default: return -1
|
||||
}
|
||||
}
|
||||
def json = inheritance.get().asFile.json()
|
||||
|
||||
ats.each { f ->
|
||||
TreeMap lines = [:]
|
||||
def group = null
|
||||
for (def line : f.readLines()) {
|
||||
if (line.isEmpty()) continue
|
||||
if (line.startsWith('#group ')) {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line.substring(7))
|
||||
|
||||
if (desc != '*' && desc != '*()' && desc != '<init>')
|
||||
throw new IllegalStateException('Invalid group: ' + line)
|
||||
|
||||
group = [modifier: modifier, cls: cls, desc: desc, comment: comment,
|
||||
existing: [] as Set,
|
||||
children: [] as TreeSet,
|
||||
group: true
|
||||
]
|
||||
if (lines.containsKey(key))
|
||||
throw new IllegalStateException('Duplicate group: ' + line)
|
||||
|
||||
lines[key] = group
|
||||
} else if (group != null) {
|
||||
if (line.startsWith('#endgroup')) {
|
||||
group = null
|
||||
} else {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line)
|
||||
group['existing'].add(key)
|
||||
}
|
||||
} else if (line.startsWith('#endgroup')) {
|
||||
throw new IllegalStateException('Invalid group ending: ' + line)
|
||||
} else if (line.startsWith('#')) {
|
||||
//Nom
|
||||
} else {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line)
|
||||
if (lines.containsKey(key)) {
|
||||
println('Duplicate: ' + line)
|
||||
continue
|
||||
}
|
||||
lines[key] = [modifier: modifier, cls: cls, desc: desc, comment: comment, group: false]
|
||||
}
|
||||
}
|
||||
|
||||
// Process Groups, this will remove any entries outside the group that is covered by the group
|
||||
for (def key : new ArrayList<>(lines.keySet())) {
|
||||
def entry = lines.get(key)
|
||||
if (entry != null && entry['group']) {
|
||||
def cls = entry['cls']
|
||||
def jcls = json.get(cls.replaceAll('\\.', '/'))
|
||||
if (jcls == null) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group: ' + key)
|
||||
} else if ('*' == entry['desc']) {
|
||||
if (!jcls.containsKey('fields')) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group, Class has no fields: ' + key)
|
||||
} else {
|
||||
jcls['fields'].each { field, value ->
|
||||
def fkey = cls + ' ' + field
|
||||
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
|
||||
if (lines.containsKey(fkey)) {
|
||||
lines.remove(fkey)
|
||||
} else if (!entry['existing'].contains(fkey)) {
|
||||
println('Added: ' + fkey)
|
||||
}
|
||||
entry['children'].add(fkey)
|
||||
} else if (lines.containsKey(fkey)) {
|
||||
lines.remove(fkey)
|
||||
println('Removed: ' + fkey)
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('*()' == entry['desc']) {
|
||||
if (!jcls.containsKey('methods')) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group, Class has no methods: ' + key)
|
||||
} else {
|
||||
jcls['methods'].each{ mtd, value ->
|
||||
if (mtd.startsWith('<clinit>') || mtd.startsWith('lambda$'))
|
||||
return
|
||||
key = cls + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
|
||||
if (lines.containsKey(key)) {
|
||||
lines.remove(key)
|
||||
} else if (!entry['existing'].contains(key)) {
|
||||
println('Added: ' + key)
|
||||
}
|
||||
entry['children'].add(key)
|
||||
} else if (lines.containsKey(key)) {
|
||||
lines.remove(key)
|
||||
println('Removed: ' + key)
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('<init>' == entry['desc']) { //Make all public non-abstract subclasses
|
||||
json.each{ tcls,value ->
|
||||
if (!value.containsKey('methods') || ((value['access'] & Opcodes.ACC_ABSTRACT) != 0))
|
||||
return
|
||||
def parents = [] as Set
|
||||
def parent = tcls
|
||||
while (parent != null && json.containsKey(parent)) {
|
||||
parents.add(parent)
|
||||
def p = json[parent]
|
||||
parent = p == null ? null : p['superName']
|
||||
}
|
||||
if (parents.contains(cls.replaceAll('\\.', '/'))) {
|
||||
value['methods'].each{ mtd, v ->
|
||||
if (mtd.startsWith('<init>')) {
|
||||
def child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel.call(v['access']) < 3) {
|
||||
if (lines.containsKey(child)) {
|
||||
lines.remove(child)
|
||||
} else if (!entry['existing'].contains(child)) {
|
||||
println('Added: ' + child)
|
||||
}
|
||||
entry['children'].add(child)
|
||||
} else if (lines.containsKey(child)) {
|
||||
lines.remove(child)
|
||||
println('Removed: ' + child)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process normal lines, remove invalid and remove narrowing
|
||||
for (def key : new ArrayList<>(lines.keySet())) {
|
||||
def entry = lines.get(key)
|
||||
if (entry != null && !entry['group']) {
|
||||
def cls = entry['cls']
|
||||
def jcls = json.get(cls.replaceAll('\\.', '/'))
|
||||
if (jcls == null) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else if (entry['desc'] == '') {
|
||||
if (accessLevel.call(jcls['access']) > accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
}
|
||||
} else if (!entry['desc'].contains('(')) {
|
||||
if (!jcls.containsKey('fields') || !jcls['fields'].containsKey(entry['desc'])) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else {
|
||||
def value = jcls['fields'][entry['desc']]
|
||||
if (accessLevel.call(value['access']) > accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
println(entry.comment)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
def jdesc = entry['desc'].replace('(', ' (')
|
||||
if (!jcls.containsKey('methods') || !jcls['methods'].containsKey(jdesc)) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else {
|
||||
def value = jcls['methods'][jdesc]
|
||||
if (accessLevel.call(value['access']) > accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def data = []
|
||||
def remapComment = { entry ->
|
||||
if (!mappings || !entry || !entry.desc) return null
|
||||
def comment = entry.comment?.substring(1)?.trim()
|
||||
def jsonCls = json.get(entry.cls.replaceAll('\\.', '/'))
|
||||
def mappingsClass = mappings?.getClass(jsonCls.name)
|
||||
if (!mappingsClass) return entry.comment
|
||||
def idx = entry.desc.indexOf('(')
|
||||
def mappedName = idx == -1
|
||||
? mappingsClass.remapField(entry.desc)
|
||||
: mappingsClass.remapMethod(entry.desc.substring(0, idx), entry.desc.substring(idx))
|
||||
if (!mappedName) return entry.comment
|
||||
if (mappedName == '<init>')
|
||||
mappedName = 'constructor'
|
||||
|
||||
if (comment?.startsWith(mappedName))
|
||||
return '# ' + comment
|
||||
if (comment && comment.indexOf(' ') != -1) {
|
||||
def split = comment.split(" - ").toList()
|
||||
if (split[0].indexOf(' ') != -1)
|
||||
// The first string is more than one word, so append before it
|
||||
return "# ${mappedName} - ${comment}"
|
||||
split.remove(0)
|
||||
return "# ${mappedName} - ${String.join(' - ', split)}"
|
||||
}
|
||||
return '# ' + mappedName
|
||||
}
|
||||
lines.each { key,value ->
|
||||
if (!value.group) {
|
||||
def comment = remapComment.call(value)
|
||||
data.add(value.modifier + ' ' + key + (comment ? ' ' + comment : ''))
|
||||
} else {
|
||||
data.add('#group ' + value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
|
||||
value.children.each {
|
||||
def line = value.modifier + ' ' + it
|
||||
def (modifier, cls, desc, comment) = parse.call(line)
|
||||
comment = remapComment.call([modifier: modifier, cls: cls, desc: desc, comment: comment])
|
||||
data.add(line + (comment ? ' ' + comment : ''))
|
||||
}
|
||||
data.add('#endgroup')
|
||||
}
|
||||
}
|
||||
f.text = data.join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.*
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
abstract class CheckExcs extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getBinary()
|
||||
@InputFiles abstract ConfigurableFileCollection getExcs()
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def known = []
|
||||
binary.get().asFile.withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
def visitor = new ClassVisitor(Opcodes.ASM9) {
|
||||
private String cls
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||
this.cls = name
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
known.add(this.cls + '.' + name + descriptor)
|
||||
super.visitMethod(access, name, descriptor, signature, exceptions)
|
||||
}
|
||||
}
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) != null) {
|
||||
if (zein.name.endsWith('.class')) {
|
||||
ClassReader reader = new ClassReader(zin)
|
||||
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
excs.each { f ->
|
||||
def lines = []
|
||||
f.eachLine { line ->
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
|
||||
if (!line.contains('=')) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
def (key, value) = line.split('=', 2)
|
||||
if (!known.contains(key)) {
|
||||
println('Unknown: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
def (cls, desc) = key.split('\\.', 2)
|
||||
if (!desc.contains('(')) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
def name = desc.split('\\(', 2)[0]
|
||||
desc = '(' + desc.split('\\(', 2)[1]
|
||||
|
||||
def (exceptions, args) = value.contains('|') ? value.split('|', 2) : [value, '']
|
||||
|
||||
if (args.split(',').length != Type.getArgumentTypes(desc).length) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
lines.add(line)
|
||||
}
|
||||
f.text = lines.sort().join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.regex.Pattern
|
||||
|
||||
abstract class CheckPatches extends DefaultTask {
|
||||
@InputDirectory abstract DirectoryProperty getPatchDir()
|
||||
@Input boolean autoFix = false
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
def hasS2SArtifact = [
|
||||
Paths.get("patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch"),
|
||||
Paths.get("patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch")
|
||||
]
|
||||
|
||||
def verified = true;
|
||||
patchDir.get().asFileTree.each { patch ->
|
||||
def patchPath = project.rootDir.toPath().relativize(patch.toPath())
|
||||
verified &= verifyPatch(patch, autoFix, patchPath.toString(), hasS2SArtifact.contains(patchPath))
|
||||
}
|
||||
|
||||
if (!verified)
|
||||
throw new RuntimeException('One or more patches failed verification. Check the log for errors.')
|
||||
}
|
||||
|
||||
def verifyPatch(patch, fix, patchPath, hasS2SArtifact) {
|
||||
def hunk_start_pattern = Pattern.compile('^@@ -[0-9,]* \\+[0-9,_]* @@$')
|
||||
def white_space_pattern = Pattern.compile('^[+\\-]\\s*$')
|
||||
def import_pattern = Pattern.compile('^[+\\-]\\s*import.*')
|
||||
def field_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$')
|
||||
def method_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$')
|
||||
def class_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$')
|
||||
|
||||
def accessMap = [("private"):0, (null):1, ("protected"):2, ("public"):3]
|
||||
|
||||
def hasProblem = false;
|
||||
def lines = patch.readLines()
|
||||
|
||||
def hunksStart = 0
|
||||
def onlyWhiteSpace = false
|
||||
|
||||
def didFix = false
|
||||
def newLines = []
|
||||
def whiteSpaceErrors = []
|
||||
|
||||
// First two lines are file name ++/-- and we do not care
|
||||
newLines.add(lines[0] + '\n')
|
||||
newLines.add(lines[1] + '\n')
|
||||
|
||||
int i = 2
|
||||
for (; i < lines.size(); ++i) {
|
||||
def line = lines[i]
|
||||
newLines.add(line + '\n')
|
||||
|
||||
if (hunk_start_pattern.matcher(line).find()) {
|
||||
if (onlyWhiteSpace) {
|
||||
if (fix || hasS2SArtifact) {
|
||||
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
didFix = true
|
||||
}
|
||||
else {
|
||||
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!whiteSpaceErrors.empty)
|
||||
hasProblem = true
|
||||
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
|
||||
whiteSpaceErrors.clear()
|
||||
}
|
||||
hunksStart = i
|
||||
onlyWhiteSpace = true
|
||||
continue
|
||||
}
|
||||
|
||||
if (line.startsWithAny('+','-')) {
|
||||
def prefixChange = false
|
||||
def prevLine = lines[i - 1]
|
||||
|
||||
if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') {
|
||||
def prevTrim = prevLine.substring(1).replaceAll("\\s", "")
|
||||
def currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (prevTrim.equals(currTrim)) {
|
||||
prefixChange = true
|
||||
}
|
||||
|
||||
def pMatcher = field_pattern.matcher(prevLine)
|
||||
def cMatcher = field_pattern.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // = ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // field name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
|
||||
pMatcher = method_pattern.matcher(prevLine)
|
||||
cMatcher = method_pattern.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // params
|
||||
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
|
||||
pMatcher = class_pattern.matcher(prevLine)
|
||||
cMatcher = class_pattern.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // class | interface
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
|
||||
if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) {
|
||||
def nextLine = lines[i + 1]
|
||||
if (nextLine.charAt(0) == (char)'+') {
|
||||
def nextTrim = nextLine.substring(1).replaceAll("\\s", "")
|
||||
def currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (nextTrim.equals(currTrim)) {
|
||||
prefixChange = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def isWhiteSpaceChange = white_space_pattern.matcher(line).find()
|
||||
|
||||
if (!prefixChange && !isWhiteSpaceChange) {
|
||||
onlyWhiteSpace = hasS2SArtifact && import_pattern.matcher(line).find()
|
||||
}
|
||||
else if (isWhiteSpaceChange) {
|
||||
def prevLineChange = prevLine.startsWithAny('+','-')
|
||||
def nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
|
||||
|
||||
if (!prevLineChange && !nextLineChange) {
|
||||
whiteSpaceErrors.add(String.format("Patch contains white space change in valid hunk at line %d (cannot auto fix), file: %s", i + 1, patchPath))
|
||||
}
|
||||
}
|
||||
|
||||
if (line.contains("\t")) {
|
||||
if (!fix) {
|
||||
logger.lifecycle("Patch contains tabs on line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
else {
|
||||
logger.lifecycle("Fixing tabs on line {}, file: {}", i + 1, patchPath)
|
||||
line = line.replaceAll('\t', ' ')
|
||||
newLines.remove(newLines.size() - 1)
|
||||
newLines.add(line + '\n')
|
||||
didFix = true
|
||||
}
|
||||
}
|
||||
|
||||
if (import_pattern.matcher(line).find() && !hasS2SArtifact) {
|
||||
logger.lifecycle("Patch contains import change on line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (onlyWhiteSpace) {
|
||||
if (fix || hasS2SArtifact) {
|
||||
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
didFix = true
|
||||
}
|
||||
else {
|
||||
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!whiteSpaceErrors.empty)
|
||||
hasProblem = true
|
||||
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
|
||||
}
|
||||
|
||||
if (didFix) {
|
||||
if (newLines.size() <= 2) {
|
||||
logger.lifecycle("Patch is now empty removing, file: {}", patchPath)
|
||||
Files.delete(patch.toPath())
|
||||
}
|
||||
else {
|
||||
if (!hasS2SArtifact)
|
||||
logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***")
|
||||
patch.withWriter('UTF-8') { writer ->
|
||||
newLines.each { l -> writer.write(l) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !hasProblem
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
abstract class CheckSAS extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getSass()
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def json = inheritance.get().asFile.json()
|
||||
|
||||
sass.each { f ->
|
||||
def lines = []
|
||||
f.eachLine { line ->
|
||||
if (line[0] == '\t') return //Skip any tabbed lines, those are ones we add
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
lines.add(line)
|
||||
return
|
||||
}
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
def (cls, desc) = (line.trim() + ' ').split(' ', -1)
|
||||
cls = cls.replaceAll('\\.', '/')
|
||||
desc = desc.replace('(', ' (')
|
||||
|
||||
if (json[cls] == null || (!desc.isEmpty() && (json[cls]['methods'] == null || json[cls]['methods'][desc] == null))) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
//Class SAS
|
||||
if (desc.isEmpty()) {
|
||||
lines.add(cls + (comment == null ? '' : ' ' + comment))
|
||||
if (json[cls]['methods'] != null)
|
||||
(json[cls]['methods'] as TreeMap).each {
|
||||
findChildMethods(json, cls, it.key).each { lines.add('\t' + it) }
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//Method SAS
|
||||
lines.add(cls + ' ' + desc.replace(' ', '') + (comment == null ? '' : ' ' + comment))
|
||||
findChildMethods(json, cls, desc).each { lines.add('\t' + it) }
|
||||
}
|
||||
f.text = lines.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
protected static findChildMethods(json, cls, desc)
|
||||
{
|
||||
return json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls}
|
||||
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TupleConstructor
|
||||
|
||||
@CompileStatic
|
||||
@TupleConstructor
|
||||
final class InheritanceData implements Annotatable {
|
||||
String name
|
||||
int access
|
||||
String superName
|
||||
List<String> interfaces = []
|
||||
Map<String, Method> methods = [:]
|
||||
Map<String, Field> fields = [:]
|
||||
List<Annotation> annotations = []
|
||||
|
||||
@TupleConstructor
|
||||
static final class Method implements Annotatable {
|
||||
int access
|
||||
String override
|
||||
List<Annotation> annotations = []
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Field implements Annotatable {
|
||||
int access
|
||||
String desc
|
||||
List<Annotation> annotations = []
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Annotation {
|
||||
String desc
|
||||
}
|
||||
|
||||
private static final Gson GSON = new Gson()
|
||||
static Map<String, InheritanceData> parse(File file) {
|
||||
try (final reader = file.newReader()) {
|
||||
return GSON.fromJson(reader, new TypeToken<Map<String, InheritanceData>>() {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
interface Annotatable {
|
||||
List<InheritanceData.Annotation> getAnnotations()
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.apache.commons.io.IOUtils
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
abstract class MergeJars extends DefaultTask {
|
||||
MergeJars() {
|
||||
output.convention(project.layout.buildDirectory.dir(name).map { it.file('output.jar') })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
def jars = inputJars.files
|
||||
|
||||
try (ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(output.get().asFile))) {
|
||||
for (def jar : jars) {
|
||||
try (ZipInputStream zin = new ZipInputStream(new FileInputStream(jar))) {
|
||||
def entry
|
||||
while ((entry = zin.getNextEntry()) != null) {
|
||||
ZipEntry _new = new ZipEntry(entry.getName())
|
||||
_new.setTime(0) //SHOULD be the same time as the main entry, but NOOOO _new.setTime(entry.getTime()) throws DateTimeException, so you get 0, screw you!
|
||||
zout.putNextEntry(_new)
|
||||
IOUtils.copy(zin, zout)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@InputFiles
|
||||
abstract ConfigurableFileCollection getInputJars()
|
||||
|
||||
@OutputFile
|
||||
abstract RegularFileProperty getOutput()
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
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 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()
|
||||
}
|
||||
@@ -125,4 +125,9 @@ public class Util {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLatestForgeVersion(mcVersion) {
|
||||
def json = new JsonSlurper().parseText(new URL("https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json").getText("UTF-8"))
|
||||
return json.promos["$mcVersion-latest"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TupleConstructor
|
||||
import net.minecraftforge.forge.tasks.InheritanceData
|
||||
import net.minecraftforge.srgutils.IMappingFile
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFile
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckATs extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getAts()
|
||||
@InputFile @Optional abstract RegularFileProperty getMappings()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final IMappingFile mappings = mappings.map { RegularFile it -> IMappingFile.load(it.asFile) }.getOrNull()
|
||||
final inheritance = InheritanceData.parse(this.inheritance.get().asFile)
|
||||
|
||||
ats.each {
|
||||
final lines = process(it, reporter, inheritance)
|
||||
if (fix) {
|
||||
it.text = joinBack(lines, inheritance, mappings).join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static TreeMap<String, ATParser.Entry> process(File file, Reporter reporter, Map<String, InheritanceData> inheritance) {
|
||||
final TreeMap<String, ATParser.Entry> lines = ATParser.parse(file.readLines(), reporter)
|
||||
final Map<String, ATParser.Entry> constructorGroups = [:]
|
||||
|
||||
final itr = lines.entrySet().iterator()
|
||||
final toRemove = []
|
||||
while (itr.hasNext()) {
|
||||
final next = itr.next()
|
||||
String key = next.key
|
||||
final entry = next.value
|
||||
if (entry === null) continue
|
||||
|
||||
final binaryName = entry.cls.replaceAll('\\.', '/')
|
||||
|
||||
// Process Groups, this will remove any entries outside the group that is covered by the group
|
||||
if (entry.group) {
|
||||
final jcls = inheritance[binaryName]
|
||||
if (jcls === null) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group: $key")
|
||||
} else if ('*' == entry.desc) {
|
||||
if (!jcls.fields) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group, class has no fields: $key")
|
||||
} else {
|
||||
jcls.fields.each { field, value ->
|
||||
final fkey = entry.cls + ' ' + field
|
||||
if (accessLevel(value.access) < accessStr(entry.modifier)) {
|
||||
if (lines.containsKey(fkey)) {
|
||||
toRemove.add(fkey)
|
||||
} else if (!entry.existing.contains(fkey)) {
|
||||
reporter.report("Missing group entry: $fkey")
|
||||
}
|
||||
entry.children.add(fkey)
|
||||
} else if (lines.containsKey(fkey)) {
|
||||
toRemove.add(fkey)
|
||||
reporter.report("Found invalid group entry: $fkey")
|
||||
}
|
||||
}
|
||||
entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('*()' == entry.desc) {
|
||||
if (!jcls.methods) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group, class has no methods: $key")
|
||||
} else {
|
||||
jcls.methods.each { mtd, value ->
|
||||
if (mtd.startsWith('<clinit>') || mtd.startsWith('lambda$')) return
|
||||
key = entry.cls + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel(value.access) < accessStr(entry.modifier)) {
|
||||
if (lines.containsKey(key)) {
|
||||
toRemove.add(key)
|
||||
} else if (!entry.existing.contains(key)) {
|
||||
reporter.report("Missing group entry: $key")
|
||||
}
|
||||
entry.children.add(key)
|
||||
} else if (lines.containsKey(key)) {
|
||||
toRemove.add(key)
|
||||
reporter.report("Found invalid group entry: $key")
|
||||
}
|
||||
}
|
||||
entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('<init>' == entry.desc) { //Make all public non-abstract subclasses
|
||||
constructorGroups.put(binaryName, entry)
|
||||
}
|
||||
}
|
||||
|
||||
// Process normal lines, remove invalid and remove narrowing
|
||||
else {
|
||||
def jcls = inheritance.get(binaryName)
|
||||
if (jcls === null) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else if (entry.desc == '') {
|
||||
if (accessLevel(jcls.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key")
|
||||
}
|
||||
} else if (!entry.desc.contains('(')) {
|
||||
if (!jcls.fields || !jcls.fields.containsKey(entry.desc)) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else {
|
||||
final value = jcls.fields[entry.desc]
|
||||
if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key - ${entry.comment}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final jdesc = entry.desc.replace('(', ' (')
|
||||
if (!jcls.methods || !jcls.methods.containsKey(jdesc)) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else {
|
||||
final value = jcls.methods[jdesc]
|
||||
if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inheritance.each { tcls, value ->
|
||||
if (!value.methods || ((value.access & Opcodes.ACC_ABSTRACT) !== 0)) return
|
||||
String parent = tcls
|
||||
while (parent !== null) {
|
||||
constructorGroups[parent]?.tap { entry ->
|
||||
value.methods.each { mtd, v ->
|
||||
if (mtd.startsWith('<init>')) {
|
||||
final child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel(v.access) < 3) {
|
||||
if (lines.containsKey(child)) {
|
||||
toRemove.add(child)
|
||||
} else if (child !in entry.existing) {
|
||||
reporter.report("Missing group entry: $child")
|
||||
}
|
||||
entry.children.add(child)
|
||||
} else if (lines.containsKey(child)) {
|
||||
toRemove.add(child)
|
||||
reporter.report("Found invalid group entry: $child")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parent = inheritance[parent]?.superName
|
||||
}
|
||||
}
|
||||
constructorGroups.values().each { entry -> entry.existing.findAll { it !in entry.children }.each{ reporter.report("Found invalid group entry: $it") } }
|
||||
|
||||
toRemove.each(lines.&remove)
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
private static List<String> joinBack(TreeMap<String, ATParser.Entry> lines, Map<String, InheritanceData> inheritance, IMappingFile mappings) {
|
||||
final List<String> data = []
|
||||
final remapComment = { ATParser.Entry entry ->
|
||||
if (!mappings || !entry || !entry.desc) return null
|
||||
final comment = entry.comment?.substring(1)?.trim()
|
||||
final jsonCls = inheritance.get(entry.cls.replaceAll('\\.', '/'))
|
||||
final mappingsClass = mappings?.getClass(jsonCls.name)
|
||||
if (mappingsClass === null) return entry.comment
|
||||
final idx = entry.desc.indexOf('(')
|
||||
|
||||
String mappedName = idx == -1
|
||||
? mappingsClass.remapField(entry.desc)
|
||||
: mappingsClass.remapMethod(entry.desc.substring(0, idx), entry.desc.substring(idx))
|
||||
if (!mappedName) return entry.comment
|
||||
if (mappedName == '<init>')
|
||||
mappedName = 'constructor'
|
||||
|
||||
if (comment?.startsWith(mappedName))
|
||||
return '# ' + comment
|
||||
if (comment && comment.indexOf(' ') !== -1) {
|
||||
def split = comment.split(' - ').toList()
|
||||
if (split[0].indexOf(' ') !== -1)
|
||||
// The first string is more than one word, so append before it
|
||||
return "# ${mappedName} - ${comment}"
|
||||
split.remove(0)
|
||||
return "# ${mappedName} - ${String.join(' - ', split)}"
|
||||
}
|
||||
return '# ' + mappedName
|
||||
}
|
||||
lines.each { key, value ->
|
||||
if (!value.group) {
|
||||
def comment = remapComment.call(value)
|
||||
data.add(value.modifier + ' ' + key + (comment ? ' ' + comment : ''))
|
||||
} else {
|
||||
data.add(('#group ' + value.modifier + ' ' + key + ' ' + (value.comment ?: '')).trim())
|
||||
value.children.each {
|
||||
final line = value.modifier + ' ' + it
|
||||
final entry = ATParser.parseEntry(line)
|
||||
final comment = remapComment(entry)
|
||||
data.add(line + (comment ? ' ' + comment : ''))
|
||||
}
|
||||
data.add('#endgroup')
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
static int accessStr(String access) {
|
||||
if (access.endsWith('-f') || access.endsWith('+f')) return 4
|
||||
switch (access.toLowerCase()) {
|
||||
case 'public': return 3
|
||||
case 'protected': return 2
|
||||
case 'default': return 1
|
||||
case 'private': return 0
|
||||
default: return -1
|
||||
}
|
||||
}
|
||||
|
||||
static int accessLevel(int access) {
|
||||
if ((access & Opcodes.ACC_PUBLIC) !== 0) return 3
|
||||
if ((access & Opcodes.ACC_PROTECTED) !== 0) return 2
|
||||
if ((access & Opcodes.ACC_PRIVATE) !== 0) return 0
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
class ATParser {
|
||||
static TreeMap<String, Entry> parse(List<String> lines, CheckTask.Reporter reporter) {
|
||||
TreeMap<String, Entry> outLines = new TreeMap<>()
|
||||
Entry group = null
|
||||
for (final line : lines) {
|
||||
if (line.isEmpty()) continue
|
||||
if (line.startsWith('#group ')) {
|
||||
final entry = parseEntry(line.substring(7))
|
||||
|
||||
if (entry.desc != '*' && entry.desc != '*()' && entry.desc != '<init>') {
|
||||
reporter.report("Invalid group: $line", false)
|
||||
}
|
||||
|
||||
entry.group = true
|
||||
entry.children = []
|
||||
entry.existing = []
|
||||
|
||||
group = entry
|
||||
|
||||
if (outLines.containsKey(entry.key)) {
|
||||
reporter.report("Duplicate group: $line", false)
|
||||
}
|
||||
|
||||
outLines[entry.key] = group
|
||||
} else if (group !== null) {
|
||||
if (line.startsWith('#endgroup')) {
|
||||
group = null
|
||||
} else {
|
||||
final key = parseEntry(line).key
|
||||
group.existing.add(key)
|
||||
}
|
||||
} else if (line.startsWith('#endgroup')) {
|
||||
reporter.report("Invalid group ending: $line", false)
|
||||
} else if (line.startsWith('#')) {
|
||||
//Nom
|
||||
} else {
|
||||
final entry = parseEntry(line)
|
||||
if (outLines.containsKey(entry.key)) {
|
||||
reporter.report("Found duplicate: $line")
|
||||
continue
|
||||
}
|
||||
outLines[entry.key] = entry
|
||||
}
|
||||
}
|
||||
return outLines
|
||||
}
|
||||
|
||||
static Entry parseEntry(String line) {
|
||||
final idx = line.indexOf('#')
|
||||
final String comment = idx === -1 ? null : line.substring(idx)
|
||||
if (idx !== -1) line = line.substring(0, idx - 1)
|
||||
final data = (line.trim() + ' ').split(' ', -1)
|
||||
new Entry(data[0], data[1], data[2], comment)
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Entry {
|
||||
String modifier, cls, desc, comment
|
||||
|
||||
Set<String> existing
|
||||
TreeSet<String> children
|
||||
boolean group = false
|
||||
|
||||
@Lazy
|
||||
String key = {cls + (desc.isEmpty() ? '' : ' ' + desc)}()
|
||||
|
||||
Object getAt(String key) {
|
||||
return getProperty(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.ClassVisitor
|
||||
import org.objectweb.asm.MethodVisitor
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.Type
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
abstract class CheckExcs extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getBinary()
|
||||
@InputFiles abstract ConfigurableFileCollection getExcs()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final Set<String> known = []
|
||||
collectKnown(known)
|
||||
|
||||
excs.each { f ->
|
||||
final lines = []
|
||||
f.eachLine { line ->
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
|
||||
if (!line.contains('=')) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
|
||||
def (String key, String value) = line.split('=', 2)
|
||||
if (!known.contains(key)) {
|
||||
reporter.report("Unknown: $line")
|
||||
return
|
||||
}
|
||||
|
||||
String desc = key.split('\\.', 2)[1]
|
||||
if (!desc.contains('(')) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
desc = '(' + desc.split('\\(', 2)[1]
|
||||
|
||||
def (exceptions, String args) = value.contains('|') ? value.split('|', 2) : [value, '']
|
||||
|
||||
if (args.split(',').length !== Type.getArgumentTypes(desc).length) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
lines.add(line)
|
||||
}
|
||||
|
||||
if (fix) f.text = lines.sort().join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
private void collectKnown(Collection<String> known) {
|
||||
binary.get().asFile.withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
final visitor = new ClassVisitor(Opcodes.ASM9) {
|
||||
private String cls
|
||||
@Override
|
||||
void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||
this.cls = name
|
||||
}
|
||||
|
||||
@Override
|
||||
MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
known.add(this.cls + '.' + name + descriptor)
|
||||
super.visitMethod(access, name, descriptor, signature, exceptions)
|
||||
}
|
||||
}
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) !== null) {
|
||||
if (zein.name.endsWith('.class')) {
|
||||
ClassReader reader = new ClassReader(zin)
|
||||
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
enum CheckMode {
|
||||
CHECK,
|
||||
FIX
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.Optional
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckPatches extends CheckTask {
|
||||
|
||||
private static final Pattern HUNK_START_PATTERN = Pattern.compile('^@@ -[0-9,]* \\+[0-9,_]* @@$')
|
||||
private static final Pattern WHITESPACE_PATTERN = Pattern.compile('^[+\\-]\\s*$')
|
||||
private static final Pattern IMPORT_PATTERN = Pattern.compile('^[+\\-]\\s*import.*')
|
||||
private static final Pattern FIELD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$')
|
||||
private static final Pattern METHOD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$')
|
||||
private static final Pattern CLASS_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$')
|
||||
private static final Map<String, Integer> ACCESS_MAP = [private: 0, protected: 2, public: 3].tap { it.put(null, 1) }
|
||||
|
||||
@InputDirectory abstract DirectoryProperty getPatchDir()
|
||||
@Input @Optional abstract ListProperty<String> getPatchesWithS2SArtifact()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final patchDir = getPatchDir().get().asFile.toPath()
|
||||
Files.walk(patchDir).withCloseable {
|
||||
it.filter(Files.&isRegularFile).forEach { path ->
|
||||
final String relativeName = patchDir.relativize(path).toString()
|
||||
verifyPatch(path, reporter, fix, relativeName, patchesWithS2SArtifact.get().contains(relativeName.replace('\\', '/')))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void verifyPatch(Path patch, Reporter reporter, boolean fix, String patchPath, boolean hasS2SArtifact) {
|
||||
final oldFixedErrors = reporter.fixed.size()
|
||||
|
||||
final lines = Files.readAllLines(patch)
|
||||
|
||||
int hunksStart = 0
|
||||
boolean onlyWhiteSpace = false
|
||||
|
||||
final List<String> newLines = []
|
||||
|
||||
// First two lines are file name ++/-- and we do not care
|
||||
newLines.add(lines[0] + '\n')
|
||||
newLines.add(lines[1] + '\n')
|
||||
|
||||
int i
|
||||
for (i = 2; i < lines.size(); ++i) {
|
||||
def line = lines[i]
|
||||
newLines.add(line + '\n')
|
||||
|
||||
if (HUNK_START_PATTERN.matcher(line).find()) {
|
||||
if (onlyWhiteSpace) {
|
||||
if (!hasS2SArtifact)
|
||||
reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath")
|
||||
int toRemove = i - hunksStart
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
}
|
||||
hunksStart = i
|
||||
onlyWhiteSpace = true
|
||||
continue
|
||||
}
|
||||
|
||||
if (line.startsWithAny('+','-')) {
|
||||
def prefixChange = false
|
||||
def prevLine = lines[i - 1]
|
||||
|
||||
if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') {
|
||||
def prevTrim = prevLine.substring(1).replaceAll("\\s", "")
|
||||
def currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (prevTrim == currTrim) {
|
||||
prefixChange = true
|
||||
}
|
||||
|
||||
def pMatcher = FIELD_PATTERN.matcher(prevLine)
|
||||
def cMatcher = FIELD_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // = ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // field name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
|
||||
pMatcher = METHOD_PATTERN.matcher(prevLine)
|
||||
cMatcher = METHOD_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // params
|
||||
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
|
||||
pMatcher = CLASS_PATTERN.matcher(prevLine)
|
||||
cMatcher = CLASS_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // class | interface
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
|
||||
if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) {
|
||||
final nextLine = lines[i + 1]
|
||||
if (nextLine.charAt(0) == (char)'+') {
|
||||
final nextTrim = nextLine.substring(1).replaceAll("\\s", "")
|
||||
final currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (nextTrim == currTrim) {
|
||||
prefixChange = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final isWhiteSpaceChange = WHITESPACE_PATTERN.matcher(line).find()
|
||||
|
||||
if (!prefixChange && !isWhiteSpaceChange) {
|
||||
onlyWhiteSpace = hasS2SArtifact && IMPORT_PATTERN.matcher(line).find()
|
||||
} else if (isWhiteSpaceChange) {
|
||||
final prevLineChange = prevLine.startsWithAny('+','-')
|
||||
final nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
|
||||
|
||||
if (!prevLineChange && !nextLineChange) {
|
||||
reporter.report("Patch contains white space change in valid hunk at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
|
||||
if (line.contains('\t')) {
|
||||
reporter.report("Patch contains tabs on line ${i + 1}, file: $patchPath")
|
||||
line = line.replaceAll('\t', ' ')
|
||||
newLines.remove(newLines.size() - 1)
|
||||
newLines.add(line + '\n')
|
||||
}
|
||||
|
||||
if (IMPORT_PATTERN.matcher(line).find() && !hasS2SArtifact) {
|
||||
reporter.report("Patch contains import change on line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (onlyWhiteSpace) {
|
||||
if (!hasS2SArtifact)
|
||||
reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath")
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
}
|
||||
|
||||
if ((reporter.fixed.size() > oldFixedErrors && fix) || hasS2SArtifact) {
|
||||
if (newLines.size() <= 2) {
|
||||
logger.lifecycle("Patch is now empty removing, file: {}", patchPath)
|
||||
Files.delete(patch)
|
||||
}
|
||||
else {
|
||||
if (!hasS2SArtifact)
|
||||
logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***")
|
||||
Files.newBufferedWriter(patch).withCloseable {
|
||||
newLines.each { l -> it.write(l) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import net.minecraftforge.forge.tasks.Annotatable
|
||||
import net.minecraftforge.forge.tasks.InheritanceData
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckSAS extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getSass()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final inheritance = InheritanceData.parse(this.inheritance.get().asFile)
|
||||
|
||||
sass.each { f ->
|
||||
final lines = []
|
||||
f.eachLine { line ->
|
||||
if (line[0] == '\t') return // Skip any tabbed lines, those are ones we add
|
||||
final idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
lines.add(line)
|
||||
return
|
||||
}
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
final spl = (line.trim().replace('(', ' (') + ' ').split(' ', -1)
|
||||
def (String cls, String name, String desc) = [spl[0], spl[1], spl[2]]
|
||||
cls = cls.replaceAll('\\.', '/')
|
||||
|
||||
if (inheritance[cls] === null) {
|
||||
reporter.report("Invalid: $line")
|
||||
} else if (name.isEmpty()) { //Class SAS
|
||||
final toAdd = []
|
||||
final clsSided = isSided(inheritance[cls])
|
||||
boolean sided = clsSided
|
||||
|
||||
/* TODO: MergeTool doesn't do fields
|
||||
if (json[cls]['fields'] != null) {
|
||||
for (entry in json[cls]['fields']) {
|
||||
if (isSided(entry.value)) {
|
||||
sided = true
|
||||
toAdd.add('\t' + cls + ' ' + entry.key)
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
final clsInh = inheritance[cls]
|
||||
if (clsInh.methods) {
|
||||
for (entry in clsInh.methods) {
|
||||
if (isSided(entry.value)) {
|
||||
sided = true
|
||||
toAdd.add('\t' + cls + ' ' + entry.key.replaceAll(' ', ''))
|
||||
findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) }
|
||||
findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) }
|
||||
} else if (clsSided) {
|
||||
findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) }
|
||||
findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sided) {
|
||||
lines.add(cls + (comment == null ? '' : ' ' + comment))
|
||||
lines.addAll(toAdd.sort())
|
||||
} else {
|
||||
reporter.report("Invalid: $line")
|
||||
}
|
||||
|
||||
} else if (desc.isEmpty()) { // Fields
|
||||
/* TODO: MergeTool doesn't do fields
|
||||
if (json[cls]['fields'] != null && isSided(json[cls]['fields'][name]))
|
||||
lines.add(cls + ' ' + name + (comment == null ? '' : ' ' + comment))
|
||||
else */
|
||||
reporter.report("Invalid: $line")
|
||||
} else { // Methods
|
||||
final clsInh = inheritance[cls]
|
||||
if (clsInh.methods === null || !isSided(clsInh.methods[name + ' ' + desc]))
|
||||
reporter.report("Invalid: $line")
|
||||
else {
|
||||
lines.add(cls + ' ' + name + desc + (comment == null ? '' : ' ' + comment))
|
||||
findChildMethods(inheritance, cls, name + ' ' + desc).each { println(line + ' -- ' + it) }
|
||||
findChildMethods(inheritance, cls, name + ' ' + desc).each { lines.add('\t' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fix) f.text = lines.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
protected static isSided(Annotatable annotatable) {
|
||||
if (annotatable === null) return false
|
||||
for (ann in annotatable.annotations) {
|
||||
if ('Lnet/minecraftforge/api/distmarker/OnlyIn;' == ann.desc)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
protected static findChildMethods(Map<String, InheritanceData> json, String cls, String desc) {
|
||||
return json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls && isSided(it.methods[desc]) }
|
||||
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import net.minecraftforge.forge.tasks.Util
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.TaskContainer
|
||||
import org.gradle.api.tasks.VerificationTask
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckTask extends DefaultTask implements VerificationTask {
|
||||
@Input
|
||||
abstract Property<CheckMode> getMode()
|
||||
|
||||
private boolean ignoreFailures = false
|
||||
|
||||
@Input
|
||||
@Override
|
||||
boolean getIgnoreFailures() {
|
||||
return ignoreFailures
|
||||
}
|
||||
|
||||
@Override
|
||||
void setIgnoreFailures(boolean ignoreFailures) {
|
||||
this.ignoreFailures = ignoreFailures
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
Util.init()
|
||||
|
||||
final doFix = getMode().get() === CheckMode.FIX
|
||||
final Reporter reporter = new Reporter(doFix)
|
||||
check(reporter, doFix)
|
||||
|
||||
if (reporter.messages) {
|
||||
if (getMode().get() === CheckMode.CHECK) {
|
||||
logger.error("Check task '{}' found errors:\n{}", name, reporter.messages.join('\n'))
|
||||
if (!ignoreFailures) {
|
||||
throw new IllegalArgumentException("${reporter.messages.size()} errors were found!")
|
||||
}
|
||||
} else {
|
||||
if (logger.isEnabled(LogLevel.DEBUG)) {
|
||||
logger.warn("Check task '{}' found {} errors and fixed {}:\n{}", name, reporter.messages.size(), reporter.fixed.size(), reporter.fixed.join('\n'))
|
||||
} else {
|
||||
logger.warn("Check task '{}' found {} errors and fixed {}.", name, reporter.messages.size(), reporter.fixed.size())
|
||||
}
|
||||
|
||||
if (reporter.notFixed) {
|
||||
logger.error('{} errors could not be fixed:\n{}', reporter.notFixed.size(), reporter.notFixed.join('\n'))
|
||||
if (!ignoreFailures) {
|
||||
throw new IllegalArgumentException("${reporter.notFixed.size()} errors which cannot be fixed were found!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract void check(Reporter reporter, boolean fix)
|
||||
|
||||
@CompileStatic
|
||||
static final class Reporter {
|
||||
final boolean trackFixed
|
||||
Reporter(boolean trackFixed) {
|
||||
this.trackFixed = trackFixed
|
||||
}
|
||||
|
||||
public final List<String> messages = []
|
||||
|
||||
public final List<String> fixed = []
|
||||
public final List<String> notFixed = []
|
||||
|
||||
void report(String message, boolean canBeFixed = true) {
|
||||
messages.add(message)
|
||||
|
||||
if (trackFixed) {
|
||||
if (canBeFixed) {
|
||||
fixed.add(message)
|
||||
} else {
|
||||
notFixed.add(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static <T extends CheckTask> void registerTask(TaskContainer tasks, String taskName, @DelegatesTo.Target('type') Class<T> clazz,
|
||||
@DelegatesTo(genericTypeIndex = 0, target = 'type') Closure configuration) {
|
||||
taskName = taskName.capitalize()
|
||||
tasks.register("check$taskName", clazz) { CheckTask task ->
|
||||
configuration.setDelegate((T) task)
|
||||
configuration.call(task)
|
||||
task.mode.set(CheckMode.CHECK)
|
||||
task.group = 'checks'
|
||||
}
|
||||
tasks.named('checkAll').configure { it.dependsOn("check$taskName") }
|
||||
|
||||
tasks.register("checkAndFix$taskName", clazz) { CheckTask task ->
|
||||
configuration.setDelegate((T) task)
|
||||
configuration.call(task)
|
||||
task.mode.set(CheckMode.FIX)
|
||||
task.group = 'checks'
|
||||
}
|
||||
tasks.named('checkAllAndFix').configure { it.dependsOn("checkAndFix$taskName") }
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+6
-6
@@ -16,14 +16,14 @@ Step 1: Open your command-line and browse to the folder where you extracted the
|
||||
|
||||
Step 2: You're left with a choice.
|
||||
If you prefer to use Eclipse:
|
||||
1. Run the following command: `gradlew genEclipseRuns` (`./gradlew genEclipseRuns` if you are on Mac/Linux)
|
||||
1. Run the following command: `./gradlew genEclipseRuns`
|
||||
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
|
||||
or run `gradlew eclipse` to generate the project.
|
||||
|
||||
If you prefer to use IntelliJ:
|
||||
1. Open IDEA, and import project.
|
||||
2. Select your build.gradle file and have it import.
|
||||
3. Run the following command: `gradlew genIntellijRuns` (`./gradlew genIntellijRuns` if you are on Mac/Linux)
|
||||
3. Run the following command: `./gradlew genIntellijRuns`
|
||||
4. Refresh the Gradle Project in IDEA if required.
|
||||
|
||||
If at any point you are missing libraries in your IDE, or you've run into problems you can
|
||||
@@ -40,7 +40,7 @@ https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
|
||||
Additional Resources:
|
||||
=========================
|
||||
Community Documentation: http://mcforge.readthedocs.io/en/latest/gettingstarted/
|
||||
LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0
|
||||
Forge Forum: https://forums.minecraftforge.net/
|
||||
Forge Discord: https://discord.gg/UvedJ9m
|
||||
Community Documentation: https://docs.minecraftforge.net/en/1.16.x/gettingstarted/
|
||||
LexManos' Install Video: https://youtu.be/8VEdtQLuLO0
|
||||
Forge Forums: https://forums.minecraftforge.net/
|
||||
Forge Discord: https://discord.minecraftforge.net/
|
||||
+128
-107
@@ -1,49 +1,69 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://maven.minecraftforge.net' }
|
||||
mavenCentral()
|
||||
plugins {
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
||||
|
||||
version = mod_version
|
||||
group = mod_group_id
|
||||
|
||||
base {
|
||||
archivesName = mod_id
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.0'
|
||||
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'modid'
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
|
||||
|
||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
||||
minecraft {
|
||||
// The mappings can be changed at any time, and must be in the following format.
|
||||
// The mappings can be changed at any time and must be in the following format.
|
||||
// Channel: Version:
|
||||
// snapshot YYYYMMDD Snapshot are built nightly.
|
||||
// stable # Stables are built at the discretion of the MCP team.
|
||||
// official MCVersion Official field/method names from Mojang mapping files
|
||||
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
|
||||
//
|
||||
// You must be aware of the Mojang license when using the 'official' mappings.
|
||||
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
//
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
||||
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
|
||||
//
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@'
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
mappings channel: mapping_channel, version: mapping_version
|
||||
|
||||
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
||||
// In most cases, it is not necessary to enable.
|
||||
// enableEclipsePrepareRuns = true
|
||||
// enableIdeaPrepareRuns = true
|
||||
|
||||
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
|
||||
// It is REQUIRED to be set to true for this template to function.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
copyIdeResources = true
|
||||
|
||||
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
|
||||
// The folder name can be set on a run configuration using the "folderName" property.
|
||||
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
|
||||
// generateRunFolders = true
|
||||
|
||||
// This property enables access transformers for use in development.
|
||||
// They will be applied to the Minecraft artifact.
|
||||
// The access transformer file can be anywhere in the project.
|
||||
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
|
||||
// This default location is a best practice to automatically put the file in the right place in the final jar.
|
||||
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
client {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be changed as needed.
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
@@ -55,57 +75,26 @@ minecraft {
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
"${mod_id}" {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
client {
|
||||
// this block needs to be here for runClient to exist
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be changed as needed.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
args '--nogui'
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be changed as needed.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
// example of overriding the workingDirectory set in configureEach above
|
||||
workingDirectory project.file('run-data')
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,62 +102,94 @@ minecraft {
|
||||
// Include resources generated by data generators.
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
dependencies {
|
||||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
|
||||
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
// compile "some.group:artifact:version"
|
||||
|
||||
// Real examples
|
||||
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
||||
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
||||
|
||||
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
|
||||
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// These dependencies get remapped to your current MCP mappings
|
||||
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// For more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
repositories {
|
||||
// Put repositories for dependencies here
|
||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
|
||||
// flatDir {
|
||||
// dir 'libs'
|
||||
// }
|
||||
}
|
||||
|
||||
// Example for how to get properties into the manifest for reading by the runtime..
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title": "examplemod",
|
||||
"Specification-Vendor": "examplemodsareus",
|
||||
"Specification-Version": "1", // We are version 1 of ourselves
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Version": "${version}",
|
||||
"Implementation-Vendor" :"examplemodsareus",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
dependencies {
|
||||
// Specify the version of Minecraft to use.
|
||||
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
|
||||
// The "userdev" classifier will be requested and setup by ForgeGradle.
|
||||
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
|
||||
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
|
||||
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
|
||||
|
||||
// Example mod dependency using a mod jar from ./libs with a flat dir repository
|
||||
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
|
||||
// The group id is ignored when searching -- in this case, it is "blank"
|
||||
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
|
||||
|
||||
// For more info:
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
}
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||
loader_version_range: loader_version_range,
|
||||
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors: mod_authors, mod_description: mod_description,
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||
expand replaceProperties + [project: project]
|
||||
}
|
||||
}
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish task
|
||||
// Example for how to get properties into the manifest for reading at runtime.
|
||||
tasks.named('jar', Jar).configure {
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
'Specification-Vendor' : mod_authors,
|
||||
'Specification-Version' : '1', // We are version 1 of ourselves
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version' : project.jar.archiveVersion,
|
||||
'Implementation-Vendor' : mod_authors,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
|
||||
// This is the preferred method to reobfuscate your jar file
|
||||
jar.finalizedBy('reobfJar')
|
||||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
|
||||
//publish.dependsOn('reobfJar')
|
||||
finalizedBy 'reobfJar'
|
||||
}
|
||||
|
||||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
|
||||
// tasks.named('publish').configure {
|
||||
// dependsOn 'reobfJar'
|
||||
// }
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
register('mavenJava', MavenPublication) {
|
||||
artifact jar
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file:///${project.projectDir}/mcmodsrepo"
|
||||
url "file://${project.projectDir}/mcmodsrepo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
+56
-1
@@ -1,4 +1,59 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
org.gradle.daemon=false
|
||||
|
||||
|
||||
## Environment Properties
|
||||
|
||||
# The Minecraft version must agree with the Forge version to get a valid artifact
|
||||
minecraft_version=@MC_VERSION@
|
||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[@MC_VERSION@,@MC_NEXT_VERSION@)
|
||||
# The Forge version must agree with the Minecraft version to get a valid artifact
|
||||
forge_version=@FORGE_VERSION@
|
||||
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
||||
forge_version_range=[@FORGE_SPEC_VERSION@,)
|
||||
# The loader version range can only use the major version of Forge/FML as bounds
|
||||
loader_version_range=[@FORGE_SPEC_VERSION@,)
|
||||
# The mapping channel to use for mappings.
|
||||
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
||||
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
||||
#
|
||||
# | Channel | Version | |
|
||||
# |-----------|----------------------|--------------------------------------------------------------------------------|
|
||||
# | official | MCVersion | Official field/method names from Mojang mapping files |
|
||||
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
|
||||
#
|
||||
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
#
|
||||
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
|
||||
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
|
||||
mapping_channel=@MAPPING_CHANNEL@
|
||||
# The mapping version to query from the mapping channel.
|
||||
# This must match the format required by the mapping channel.
|
||||
mapping_version=@MAPPING_VERSION@
|
||||
|
||||
|
||||
## Mod Properties
|
||||
|
||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||
mod_id=examplemod
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=Example Mod
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.0.0
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
mod_group_id=com.example.examplemod
|
||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||
mod_authors=YourNameHere, OtherNameHere
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
|
||||
@@ -0,0 +1,14 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven { url = 'https://maven.minecraftforge.net/' }
|
||||
maven {
|
||||
name = 'MinecraftForge'
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||
}
|
||||
@@ -6,57 +6,52 @@
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="[@FORGE_SPEC_VERSION@,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license="All rights reserved"
|
||||
license="${mod_license}"
|
||||
# A URL to refer people to when problems occur with this mod
|
||||
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||
[[mods]] #mandatory
|
||||
# The modid of the mod
|
||||
modId="examplemod" #mandatory
|
||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
||||
# see the associated build.gradle script for how to populate this completely automatically during a build
|
||||
version="${file.jarVersion}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="Example Mod" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||
modId="${mod_id}" #mandatory
|
||||
# The version number of the mod
|
||||
version="${mod_version}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="${mod_name}" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
|
||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||
# A file name (in the root of the mod JAR) containing a logo for display
|
||||
logoFile="examplemod.png" #optional
|
||||
#logoFile="examplemod.png" #optional
|
||||
# A text field displayed in the mod UI
|
||||
credits="Thanks for this example mod goes to Java" #optional
|
||||
#credits="" #optional
|
||||
# A text field displayed in the mod UI
|
||||
authors="Love, Cheese and small house plants" #optional
|
||||
authors="${mod_authors}" #optional
|
||||
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
description='''
|
||||
This is a long form description of the mod. You can write whatever you want here
|
||||
|
||||
Have some lorem ipsum.
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
'''
|
||||
description='''${mod_description}'''
|
||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||
[[dependencies.examplemod]] #optional
|
||||
# the modid of the dependency
|
||||
modId="forge" #mandatory
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="[@FORGE_SPEC_VERSION@,)" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||
ordering="NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||
side="BOTH"
|
||||
[[dependencies.${mod_id}]] #optional
|
||||
# the modid of the dependency
|
||||
modId="forge" #mandatory
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="${forge_version_range}" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
|
||||
# BEFORE - This mod is loaded BEFORE the dependency
|
||||
# AFTER - This mod is loaded AFTER the dependency
|
||||
ordering="NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
|
||||
side="BOTH"
|
||||
# Here's another dependency
|
||||
[[dependencies.examplemod]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
versionRange="${minecraft_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "examplemod resources",
|
||||
"description": "${mod_id} resources",
|
||||
"pack_format": 6,
|
||||
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+ public static float lastBrightnessX = 0.0f;
|
||||
+ public static float lastBrightnessY = 0.0f;
|
||||
@Deprecated
|
||||
public static void func_227640_a_(int p_227640_0_, float p_227640_1_, float p_227640_2_) {
|
||||
public static void _glMultiTexCoord2f(int p_227640_0_, float p_227640_1_, float p_227640_2_) {
|
||||
RenderSystem.assertThread(RenderSystem::isOnRenderThread);
|
||||
GL13.glMultiTexCoord2f(p_227640_0_, p_227640_1_, p_227640_2_);
|
||||
+ if (p_227640_0_ == GL13.GL_TEXTURE1) {
|
||||
@@ -17,4 +17,4 @@
|
||||
+ }
|
||||
}
|
||||
|
||||
public static void func_227706_d_(int p_227706_0_, int p_227706_1_, int p_227706_2_, int p_227706_3_) {
|
||||
public static void glBlendFuncSeparate(int p_227706_0_, int p_227706_1_, int p_227706_2_, int p_227706_3_) {
|
||||
@@ -6,9 +6,9 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public interface IVertexBuilder {
|
||||
+public interface IVertexBuilder extends net.minecraftforge.client.extensions.IForgeVertexBuilder {
|
||||
Logger field_227884_f_ = LogManager.getLogger();
|
||||
Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
IVertexBuilder func_225582_a_(double p_225582_1_, double p_225582_3_, double p_225582_5_);
|
||||
IVertexBuilder vertex(double p_225582_1_, double p_225582_3_, double p_225582_5_);
|
||||
@@ -96,11 +_,12 @@
|
||||
f5 = p_227890_3_[k] * p_227890_6_;
|
||||
}
|
||||
@@ -18,8 +18,8 @@
|
||||
float f9 = bytebuffer.getFloat(16);
|
||||
float f10 = bytebuffer.getFloat(20);
|
||||
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
|
||||
vector4f.func_229372_a_(matrix4f);
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_227890_1_.func_227872_b_());
|
||||
this.func_225588_a_(vector4f.func_195910_a(), vector4f.func_195913_b(), vector4f.func_195914_c(), f3, f4, f5, 1.0F, f9, f10, p_227890_8_, l, vector3f.func_195899_a(), vector3f.func_195900_b(), vector3f.func_195902_c());
|
||||
vector4f.transform(matrix4f);
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_227890_1_.normal());
|
||||
this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_227890_8_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -5,14 +5,14 @@
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public boolean func_231046_a_(int key, int scanCode, int modifiers) {
|
||||
+ public boolean keyPressed(int key, int scanCode, int modifiers) {
|
||||
+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
|
||||
+ field_230706_i_.func_147108_a(this.field_224228_a);
|
||||
+ minecraft.setScreen(this.nextScreen);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return super.func_231046_a_(key, scanCode, modifiers);
|
||||
+ return super.keyPressed(key, scanCode, modifiers);
|
||||
+ }
|
||||
+
|
||||
public void func_230430_a_(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
|
||||
this.func_230446_a_(p_230430_1_);
|
||||
func_238472_a_(p_230430_1_, this.field_230712_o_, this.field_224229_b, this.field_230708_k_ / 2, 80, 16777215);
|
||||
public void render(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
|
||||
this.renderBackground(p_230430_1_);
|
||||
drawCenteredString(p_230430_1_, this.font, this.line1, this.width / 2, 80, 16777215);
|
||||
@@ -1,10 +1,19 @@
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -130,7 +_,7 @@
|
||||
return this.chatComponent;
|
||||
}
|
||||
|
||||
- public static class Builder {
|
||||
+ public static class Builder implements net.minecraftforge.common.extensions.IForgeAdvancementBuilder {
|
||||
private ResourceLocation parentId;
|
||||
private Advancement parent;
|
||||
private DisplayInfo display;
|
||||
@@ -309,6 +_,7 @@
|
||||
}
|
||||
|
||||
public static Advancement.Builder func_241043_a_(JsonObject p_241043_0_, ConditionArrayParser p_241043_1_) {
|
||||
public static Advancement.Builder fromJson(JsonObject p_241043_0_, ConditionArrayParser p_241043_1_) {
|
||||
+ if ((p_241043_0_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_241043_0_)) == null) return null;
|
||||
ResourceLocation resourcelocation = p_241043_0_.has("parent") ? new ResourceLocation(JSONUtils.func_151200_h(p_241043_0_, "parent")) : null;
|
||||
DisplayInfo displayinfo = p_241043_0_.has("display") ? DisplayInfo.func_192294_a(JSONUtils.func_152754_s(p_241043_0_, "display")) : null;
|
||||
AdvancementRewards advancementrewards = p_241043_0_.has("rewards") ? AdvancementRewards.func_241096_a_(JSONUtils.func_152754_s(p_241043_0_, "rewards")) : AdvancementRewards.field_192114_a;
|
||||
ResourceLocation resourcelocation = p_241043_0_.has("parent") ? new ResourceLocation(JSONUtils.getAsString(p_241043_0_, "parent")) : null;
|
||||
DisplayInfo displayinfo = p_241043_0_.has("display") ? DisplayInfo.fromJson(JSONUtils.getAsJsonObject(p_241043_0_, "display")) : null;
|
||||
AdvancementRewards advancementrewards = p_241043_0_.has("rewards") ? AdvancementRewards.deserialize(JSONUtils.getAsJsonObject(p_241043_0_, "rewards")) : AdvancementRewards.EMPTY;
|
||||
@@ -4,7 +4,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.field_192093_c);
|
||||
field_192091_a.info("Loaded {} advancements", (int)this.field_192092_b.size());
|
||||
+ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.roots);
|
||||
LOGGER.info("Loaded {} advancements", (int)this.advancements.size());
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
+++ b/net/minecraft/advancements/AdvancementManager.java
|
||||
@@ -36,6 +_,10 @@
|
||||
try {
|
||||
JsonObject jsonobject = JSONUtils.func_151210_l(p_240923_3_, "advancement");
|
||||
Advancement.Builder advancement$builder = Advancement.Builder.func_241043_a_(jsonobject, new ConditionArrayParser(p_240923_2_, this.field_240922_d_));
|
||||
JsonObject jsonobject = JSONUtils.convertToJsonObject(p_240923_3_, "advancement");
|
||||
Advancement.Builder advancement$builder = Advancement.Builder.fromJson(jsonobject, new ConditionArrayParser(p_240923_2_, this.predicateManager));
|
||||
+ if (advancement$builder == null) {
|
||||
+ field_192782_a.debug("Skipping loading advancement {} as it's conditions were not met", p_240923_2_);
|
||||
+ LOGGER.debug("Skipping loading advancement {} as it's conditions were not met", p_240923_2_);
|
||||
+ return;
|
||||
+ }
|
||||
map.put(p_240923_2_, advancement$builder);
|
||||
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
|
||||
field_192782_a.error("Parsing error loading custom advancement {}: {}", p_240923_2_, jsonparseexception.getMessage());
|
||||
LOGGER.error("Parsing error loading custom advancement {}: {}", p_240923_2_, jsonparseexception.getMessage());
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
||||
@@ -39,7 +_,7 @@
|
||||
|
||||
public void func_192113_a(ServerPlayerEntity p_192113_1_) {
|
||||
p_192113_1_.func_195068_e(this.field_192115_b);
|
||||
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_237457_g_, p_192113_1_.func_213303_ch()).func_216023_a(p_192113_1_.func_70681_au()).func_216022_a(LootParameterSets.field_216265_f);
|
||||
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_237457_g_, p_192113_1_.func_213303_ch()).func_216023_a(p_192113_1_.func_70681_au()).func_186469_a(p_192113_1_.func_184817_da()).func_216022_a(LootParameterSets.field_216265_f); // FORGE: luck to LootContext
|
||||
public void grant(ServerPlayerEntity p_192113_1_) {
|
||||
p_192113_1_.giveExperiencePoints(this.experience);
|
||||
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.getLevel())).withParameter(LootParameters.THIS_ENTITY, p_192113_1_).withParameter(LootParameters.ORIGIN, p_192113_1_.position()).withRandom(p_192113_1_.getRandom()).create(LootParameterSets.ADVANCEMENT_REWARD);
|
||||
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.getLevel())).withParameter(LootParameters.THIS_ENTITY, p_192113_1_).withParameter(LootParameters.ORIGIN, p_192113_1_.position()).withRandom(p_192113_1_.getRandom()).withLuck(p_192113_1_.getLuck()).create(LootParameterSets.ADVANCEMENT_REWARD); // FORGE: luck to LootContext
|
||||
boolean flag = false;
|
||||
|
||||
for(ResourceLocation resourcelocation : this.field_192116_c) {
|
||||
for(ResourceLocation resourcelocation : this.loot) {
|
||||
@@ -3,28 +3,28 @@
|
||||
@@ -159,6 +_,10 @@
|
||||
}
|
||||
|
||||
this.func_240920_c_(p_240921_1_);
|
||||
this.checkForAutomaticTriggers(p_240921_1_);
|
||||
+
|
||||
+ if (net.minecraftforge.common.ForgeConfig.SERVER.fixAdvancementLoading.get())
|
||||
+ net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.field_192759_g, this.field_192760_h, this.field_192758_f, this.field_192761_i, this::func_192738_c);
|
||||
+ net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.visible, this.visibilityChanged, this.advancements, this.progressChanged, this::shouldBeVisible);
|
||||
+ else
|
||||
this.func_192752_d();
|
||||
this.func_240919_b_(p_240921_1_);
|
||||
this.ensureAllVisible();
|
||||
this.registerListeners(p_240921_1_);
|
||||
}
|
||||
@@ -192,6 +_,8 @@
|
||||
}
|
||||
|
||||
public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) {
|
||||
public boolean award(Advancement p_192750_1_, String p_192750_2_) {
|
||||
+ // Forge: don't grant advancements for fake players
|
||||
+ if (this.field_192762_j instanceof net.minecraftforge.common.util.FakePlayer) return false;
|
||||
+ if (this.player instanceof net.minecraftforge.common.util.FakePlayer) return false;
|
||||
boolean flag = false;
|
||||
AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_);
|
||||
boolean flag1 = advancementprogress.func_192105_a();
|
||||
AdvancementProgress advancementprogress = this.getOrStartProgress(p_192750_1_);
|
||||
boolean flag1 = advancementprogress.isDone();
|
||||
@@ -204,6 +_,7 @@
|
||||
if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223620_w)) {
|
||||
this.field_240917_e_.func_232641_a_(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j()), ChatType.SYSTEM, Util.field_240973_b_);
|
||||
if (p_192750_1_.getDisplay() != null && p_192750_1_.getDisplay().shouldAnnounceChat() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.playerList.broadcastMessage(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.getDisplay().getFrame().getName(), this.player.getDisplayName(), p_192750_1_.getChatComponent()), ChatType.SYSTEM, Util.NIL_UUID);
|
||||
}
|
||||
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_);
|
||||
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.player, p_192750_1_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
public class ItemPredicate {
|
||||
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> custom_predicates = new java.util.HashMap<>();
|
||||
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates);
|
||||
public static final ItemPredicate field_192495_a = new ItemPredicate();
|
||||
public static final ItemPredicate ANY = new ItemPredicate();
|
||||
@Nullable
|
||||
private final ITag<Item> field_200018_b;
|
||||
private final ITag<Item> tag;
|
||||
@@ -105,6 +_,11 @@
|
||||
public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) {
|
||||
public static ItemPredicate fromJson(@Nullable JsonElement p_192492_0_) {
|
||||
if (p_192492_0_ != null && !p_192492_0_.isJsonNull()) {
|
||||
JsonObject jsonobject = JSONUtils.func_151210_l(p_192492_0_, "item");
|
||||
JsonObject jsonobject = JSONUtils.convertToJsonObject(p_192492_0_, "item");
|
||||
+ if (jsonobject.has("type")) {
|
||||
+ final ResourceLocation rl = new ResourceLocation(JSONUtils.func_151200_h(jsonobject, "type"));
|
||||
+ final ResourceLocation rl = new ResourceLocation(JSONUtils.getAsString(jsonobject, "type"));
|
||||
+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject);
|
||||
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
|
||||
+ }
|
||||
MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("count"));
|
||||
MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("durability"));
|
||||
MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.fromJson(jsonobject.get("count"));
|
||||
MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.fromJson(jsonobject.get("durability"));
|
||||
if (jsonobject.has("data")) {
|
||||
@@ -202,6 +_,14 @@
|
||||
} else {
|
||||
|
||||
@@ -7,33 +7,33 @@
|
||||
-public abstract class AbstractBlock {
|
||||
+//TODO, Delegates are weird here now, because Block extends this.
|
||||
+public abstract class AbstractBlock extends net.minecraftforge.registries.ForgeRegistryEntry<Block> {
|
||||
protected static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
|
||||
protected final Material field_149764_J;
|
||||
protected final boolean field_235688_at_;
|
||||
protected static final Direction[] UPDATE_SHAPE_ORDER = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
|
||||
protected final Material material;
|
||||
protected final boolean hasCollision;
|
||||
@@ -87,6 +_,8 @@
|
||||
this.field_226887_g_ = p_i241196_1_.field_226894_k_;
|
||||
this.field_208621_p = p_i241196_1_.field_208772_j;
|
||||
this.field_235684_aB_ = p_i241196_1_;
|
||||
+ final ResourceLocation lootTableCache = p_i241196_1_.field_222381_j;
|
||||
+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().func_110624_b(), "blocks/" + this.getRegistryName().func_110623_a());
|
||||
this.jumpFactor = p_i241196_1_.jumpFactor;
|
||||
this.dynamicShape = p_i241196_1_.dynamicShape;
|
||||
this.properties = p_i241196_1_;
|
||||
+ final ResourceLocation lootTableCache = p_i241196_1_.drops;
|
||||
+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().getNamespace(), "blocks/" + this.getRegistryName().getPath());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -129,7 +_,7 @@
|
||||
|
||||
@Deprecated
|
||||
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
|
||||
- if (this.func_235695_q_() && !p_196243_1_.func_203425_a(p_196243_4_.func_177230_c())) {
|
||||
+ if (p_196243_1_.hasTileEntity() && (!p_196243_1_.func_203425_a(p_196243_4_.func_177230_c()) || !p_196243_4_.hasTileEntity())) {
|
||||
p_196243_2_.func_175713_t(p_196243_3_);
|
||||
public void onRemove(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
|
||||
- if (this.isEntityBlock() && !p_196243_1_.is(p_196243_4_.getBlock())) {
|
||||
+ if (p_196243_1_.hasTileEntity() && (!p_196243_1_.is(p_196243_4_.getBlock()) || !p_196243_4_.hasTileEntity())) {
|
||||
p_196243_2_.removeBlockEntity(p_196243_3_);
|
||||
}
|
||||
|
||||
@@ -191,7 +_,7 @@
|
||||
|
||||
@Deprecated
|
||||
public boolean func_196253_a(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) {
|
||||
- return this.field_149764_J.func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j());
|
||||
+ return p_196253_1_.func_185904_a().func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j());
|
||||
public boolean canBeReplaced(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) {
|
||||
- return this.material.isReplaceable() && (p_196253_2_.getItemInHand().isEmpty() || p_196253_2_.getItemInHand().getItem() != this.asItem());
|
||||
+ return p_196253_1_.getMaterial().isReplaceable() && (p_196253_2_.getItemInHand().isEmpty() || p_196253_2_.getItemInHand().getItem() != this.asItem());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -41,8 +41,8 @@
|
||||
if (f == -1.0F) {
|
||||
return 0.0F;
|
||||
} else {
|
||||
- int i = p_180647_2_.func_234569_d_(p_180647_1_) ? 30 : 100;
|
||||
- return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i;
|
||||
- int i = p_180647_2_.hasCorrectToolForDrops(p_180647_1_) ? 30 : 100;
|
||||
- return p_180647_2_.getDestroySpeed(p_180647_1_) / f / (float)i;
|
||||
+ int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_) ? 30 : 100;
|
||||
+ return p_180647_2_.getDigSpeed(p_180647_1_, p_180647_4_) / f / (float)i;
|
||||
}
|
||||
@@ -53,24 +53,24 @@
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use state.hasTileEntity()
|
||||
public final boolean func_235695_q_() {
|
||||
public final boolean isEntityBlock() {
|
||||
return this instanceof ITileEntityProvider;
|
||||
}
|
||||
|
||||
public final ResourceLocation func_220068_i() {
|
||||
if (this.field_220085_g == null) {
|
||||
- ResourceLocation resourcelocation = Registry.field_212618_g.func_177774_c(this.func_230328_p_());
|
||||
- this.field_220085_g = new ResourceLocation(resourcelocation.func_110624_b(), "blocks/" + resourcelocation.func_110623_a());
|
||||
+ this.field_220085_g = this.lootTableSupplier.get();
|
||||
public final ResourceLocation getLootTable() {
|
||||
if (this.drops == null) {
|
||||
- ResourceLocation resourcelocation = Registry.BLOCK.getKey(this.asBlock());
|
||||
- this.drops = new ResourceLocation(resourcelocation.getNamespace(), "blocks/" + resourcelocation.getPath());
|
||||
+ this.drops = this.lootTableSupplier.get();
|
||||
}
|
||||
|
||||
return this.field_220085_g;
|
||||
return this.drops;
|
||||
@@ -346,6 +_,14 @@
|
||||
return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P());
|
||||
return this.properties.materialColor.apply(this.asBlock().defaultBlockState());
|
||||
}
|
||||
|
||||
+ protected boolean isAir(BlockState state) {
|
||||
+ return ((AbstractBlockState)state).field_235702_f_;
|
||||
+ return ((AbstractBlockState)state).isAir;
|
||||
+ }
|
||||
+
|
||||
+ /* ======================================== FORGE START ===================================== */
|
||||
@@ -78,53 +78,53 @@
|
||||
+ /* ========================================= FORGE END ====================================== */
|
||||
+
|
||||
public abstract static class AbstractBlockState extends StateHolder<Block, BlockState> {
|
||||
private final int field_215708_d;
|
||||
private final boolean field_215709_e;
|
||||
private final int lightEmission;
|
||||
private final boolean useShapeForLightOcclusion;
|
||||
@@ -424,18 +_,24 @@
|
||||
return this.field_215709_e;
|
||||
return this.useShapeForLightOcclusion;
|
||||
}
|
||||
|
||||
+ /** @deprecated use {@link BlockState#getLightValue(IBlockReader, BlockPos)} */
|
||||
+ @Deprecated
|
||||
public int func_185906_d() {
|
||||
return this.field_215708_d;
|
||||
public int getLightEmission() {
|
||||
return this.lightEmission;
|
||||
}
|
||||
|
||||
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos)} until 1.17, at which point this method will be undreprecated. See https://github.com/MinecraftForge/MinecraftForge/issues/7409 for more details */
|
||||
+ @Deprecated
|
||||
public boolean func_196958_f() {
|
||||
- return this.field_235702_f_;
|
||||
+ return this.func_177230_c().isAir((BlockState)this);
|
||||
public boolean isAir() {
|
||||
- return this.isAir;
|
||||
+ return this.getBlock().isAir((BlockState)this);
|
||||
}
|
||||
|
||||
public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
|
||||
return this.field_235704_h_;
|
||||
public MaterialColor getMapColor(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
|
||||
return this.materialColor;
|
||||
}
|
||||
|
||||
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation)} */
|
||||
+ @Deprecated
|
||||
public BlockState func_185907_a(Rotation p_185907_1_) {
|
||||
return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_);
|
||||
public BlockState rotate(Rotation p_185907_1_) {
|
||||
return this.getBlock().rotate(this.asState(), p_185907_1_);
|
||||
}
|
||||
@@ -802,8 +_,11 @@
|
||||
private ResourceLocation field_222381_j;
|
||||
private boolean field_226895_m_ = true;
|
||||
private boolean field_235813_o_;
|
||||
private ResourceLocation drops;
|
||||
private boolean canOcclude = true;
|
||||
private boolean isAir;
|
||||
+ private int harvestLevel = -1;
|
||||
+ private net.minecraftforge.common.ToolType harvestTool;
|
||||
+ private java.util.function.Supplier<ResourceLocation> lootTableSupplier;
|
||||
private AbstractBlock.IExtendedPositionPredicate<EntityType<?>> field_235814_p_ = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> {
|
||||
- return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.func_185906_d() < 14;
|
||||
+ return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightValue(p_235832_1_, p_235832_2_) < 14;
|
||||
private AbstractBlock.IExtendedPositionPredicate<EntityType<?>> isValidSpawn = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> {
|
||||
- return p_235832_0_.isFaceSturdy(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightEmission() < 14;
|
||||
+ return p_235832_0_.isFaceSturdy(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightValue(p_235832_1_, p_235832_2_) < 14;
|
||||
};
|
||||
private AbstractBlock.IPositionPredicate field_235815_q_ = (p_235853_0_, p_235853_1_, p_235853_2_) -> {
|
||||
return p_235853_0_.func_185904_a().func_76218_k() && p_235853_0_.func_235785_r_(p_235853_1_, p_235853_2_);
|
||||
private AbstractBlock.IPositionPredicate isRedstoneConductor = (p_235853_0_, p_235853_1_, p_235853_2_) -> {
|
||||
return p_235853_0_.getMaterial().isSolidBlocking() && p_235853_0_.isCollisionShapeFullBlock(p_235853_1_, p_235853_2_);
|
||||
@@ -863,6 +_,8 @@
|
||||
abstractblock$properties.field_226895_m_ = p_200950_0_.field_235684_aB_.field_226895_m_;
|
||||
abstractblock$properties.field_235813_o_ = p_200950_0_.field_235684_aB_.field_235813_o_;
|
||||
abstractblock$properties.field_235806_h_ = p_200950_0_.field_235684_aB_.field_235806_h_;
|
||||
+ abstractblock$properties.harvestLevel = p_200950_0_.field_235684_aB_.harvestLevel;
|
||||
+ abstractblock$properties.harvestTool = p_200950_0_.field_235684_aB_.harvestTool;
|
||||
abstractblock$properties.canOcclude = p_200950_0_.properties.canOcclude;
|
||||
abstractblock$properties.isAir = p_200950_0_.properties.isAir;
|
||||
abstractblock$properties.requiresCorrectToolForDrops = p_200950_0_.properties.requiresCorrectToolForDrops;
|
||||
+ abstractblock$properties.harvestLevel = p_200950_0_.properties.harvestLevel;
|
||||
+ abstractblock$properties.harvestTool = p_200950_0_.properties.harvestTool;
|
||||
return abstractblock$properties;
|
||||
}
|
||||
|
||||
@@ -150,23 +150,23 @@
|
||||
+ return this.harvestTool;
|
||||
+ }
|
||||
+
|
||||
public AbstractBlock.Properties func_200941_a(float p_200941_1_) {
|
||||
this.field_200961_i = p_200941_1_;
|
||||
public AbstractBlock.Properties friction(float p_200941_1_) {
|
||||
this.friction = p_200941_1_;
|
||||
return this;
|
||||
@@ -932,9 +_,15 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
+ @Deprecated // FORGE: Use the variant that takes a Supplier below
|
||||
public AbstractBlock.Properties func_222379_b(Block p_222379_1_) {
|
||||
- this.field_222381_j = p_222379_1_.func_220068_i();
|
||||
+ this.lootTableSupplier = () -> p_222379_1_.delegate.get().func_220068_i();
|
||||
public AbstractBlock.Properties dropsLike(Block p_222379_1_) {
|
||||
- this.drops = p_222379_1_.getLootTable();
|
||||
+ this.lootTableSupplier = () -> p_222379_1_.delegate.get().getLootTable();
|
||||
return this;
|
||||
+ }
|
||||
+
|
||||
+ public AbstractBlock.Properties lootFrom(java.util.function.Supplier<? extends Block> blockIn) {
|
||||
+ this.lootTableSupplier = () -> blockIn.get().func_220068_i();
|
||||
+ this.lootTableSupplier = () -> blockIn.get().getLootTable();
|
||||
+ return this;
|
||||
}
|
||||
|
||||
public AbstractBlock.Properties func_235859_g_() {
|
||||
public AbstractBlock.Properties air() {
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/block/AbstractFireBlock.java
|
||||
+++ b/net/minecraft/block/AbstractFireBlock.java
|
||||
@@ -124,6 +_,7 @@
|
||||
if (!p_220082_4_.func_203425_a(p_220082_1_.func_177230_c())) {
|
||||
if (func_242649_a(p_220082_2_)) {
|
||||
Optional<PortalSize> optional = PortalSize.func_242964_a(p_220082_2_, p_220082_3_, Direction.Axis.X);
|
||||
if (!p_220082_4_.is(p_220082_1_.getBlock())) {
|
||||
if (inPortalDimension(p_220082_2_)) {
|
||||
Optional<PortalSize> optional = PortalSize.findEmptyPortalShape(p_220082_2_, p_220082_3_, Direction.Axis.X);
|
||||
+ optional = net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_220082_2_, p_220082_3_, optional);
|
||||
if (optional.isPresent()) {
|
||||
optional.get().func_150859_c();
|
||||
optional.get().createPortalBlocks();
|
||||
return;
|
||||
@@ -6,53 +6,53 @@
|
||||
|
||||
-public abstract class AbstractRailBlock extends Block {
|
||||
+public abstract class AbstractRailBlock extends Block implements net.minecraftforge.common.extensions.IAbstractRailBlock {
|
||||
protected static final VoxelShape field_185590_a = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
|
||||
protected static final VoxelShape field_190959_b = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
private final boolean field_196277_c;
|
||||
protected static final VoxelShape FLAT_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
|
||||
protected static final VoxelShape HALF_BLOCK_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
private final boolean isStraight;
|
||||
@@ -37,6 +_,7 @@
|
||||
|
||||
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
|
||||
RailShape railshape = p_220053_1_.func_203425_a(this) ? p_220053_1_.func_177229_b(this.func_176560_l()) : null;
|
||||
+ RailShape railShape2 = p_220053_1_.func_203425_a(this) ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null;
|
||||
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
|
||||
public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
|
||||
RailShape railshape = p_220053_1_.is(this) ? p_220053_1_.getValue(this.getShapeProperty()) : null;
|
||||
+ RailShape railShape2 = p_220053_1_.is(this) ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null;
|
||||
return railshape != null && railshape.isAscending() ? HALF_BLOCK_AABB : FLAT_AABB;
|
||||
}
|
||||
|
||||
@@ -61,7 +_,7 @@
|
||||
|
||||
public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
|
||||
if (!p_220069_2_.field_72995_K && p_220069_2_.func_180495_p(p_220069_3_).func_203425_a(this)) {
|
||||
- RailShape railshape = p_220069_1_.func_177229_b(this.func_176560_l());
|
||||
public void neighborChanged(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
|
||||
if (!p_220069_2_.isClientSide && p_220069_2_.getBlockState(p_220069_3_).is(this)) {
|
||||
- RailShape railshape = p_220069_1_.getValue(this.getShapeProperty());
|
||||
+ RailShape railshape = getRailDirection(p_220069_1_, p_220069_2_, p_220069_3_, null);
|
||||
if (func_235328_a_(p_220069_3_, p_220069_2_, railshape)) {
|
||||
func_220075_c(p_220069_1_, p_220069_2_, p_220069_3_);
|
||||
p_220069_2_.func_217377_a(p_220069_3_, p_220069_6_);
|
||||
if (shouldBeRemoved(p_220069_3_, p_220069_2_, railshape)) {
|
||||
dropResources(p_220069_1_, p_220069_2_, p_220069_3_);
|
||||
p_220069_2_.removeBlock(p_220069_3_, p_220069_6_);
|
||||
@@ -110,7 +_,7 @@
|
||||
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
|
||||
public void onRemove(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
|
||||
if (!p_196243_5_) {
|
||||
super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
|
||||
- if (p_196243_1_.func_177229_b(this.func_176560_l()).func_208092_c()) {
|
||||
+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) {
|
||||
p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this);
|
||||
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
|
||||
- if (p_196243_1_.getValue(this.getShapeProperty()).isAscending()) {
|
||||
+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).isAscending()) {
|
||||
p_196243_2_.updateNeighborsAt(p_196243_3_.above(), this);
|
||||
}
|
||||
|
||||
@@ -129,5 +_,20 @@
|
||||
return blockstate.func_206870_a(this.func_176560_l(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
|
||||
return blockstate.setValue(this.getShapeProperty(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
|
||||
public abstract Property<RailShape> func_176560_l();
|
||||
public abstract Property<RailShape> getShapeProperty();
|
||||
+
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos)
|
||||
+ {
|
||||
+ return !this.field_196277_c;
|
||||
+ return !this.isStraight;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) {
|
||||
+ return state.func_177229_b(func_176560_l());
|
||||
+ return state.getValue(getShapeProperty());
|
||||
+ }
|
||||
+ /* ========================================= FORGE END ======================================*/
|
||||
}
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -32,10 +_,11 @@
|
||||
}
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
- if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && p_225542_4_.nextDouble() < this.field_235503_e_) {
|
||||
+ if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_.func_177972_a(this.field_235498_a_), p_225542_2_.func_180495_p(p_225542_3_.func_177972_a(this.field_235498_a_)),p_225542_4_.nextDouble() < this.field_235503_e_)) {
|
||||
BlockPos blockpos = p_225542_3_.func_177972_a(this.field_235498_a_);
|
||||
if (this.func_230334_h_(p_225542_2_.func_180495_p(blockpos))) {
|
||||
p_225542_2_.func_175656_a(blockpos, p_225542_1_.func_235896_a_(field_235502_d_));
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, blockpos, p_225542_2_.func_180495_p(blockpos));
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
- if (p_225542_1_.getValue(AGE) < 25 && p_225542_4_.nextDouble() < this.growPerTickProbability) {
|
||||
+ if (p_225542_1_.getValue(AGE) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_.relative(this.growthDirection), p_225542_2_.getBlockState(p_225542_3_.relative(this.growthDirection)),p_225542_4_.nextDouble() < this.growPerTickProbability)) {
|
||||
BlockPos blockpos = p_225542_3_.relative(this.growthDirection);
|
||||
if (this.canGrowInto(p_225542_2_.getBlockState(blockpos))) {
|
||||
p_225542_2_.setBlockAndUpdate(blockpos, p_225542_1_.cycle(AGE));
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, blockpos, p_225542_2_.getBlockState(blockpos));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
+++ b/net/minecraft/block/BambooBlock.java
|
||||
@@ -100,10 +_,11 @@
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
if (p_225542_1_.func_177229_b(field_220266_f) == 0) {
|
||||
- if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
|
||||
+ if (p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
|
||||
int i = this.func_220260_b(p_225542_2_, p_225542_3_) + 1;
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
if (p_225542_1_.getValue(STAGE) == 0) {
|
||||
- if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.isEmptyBlock(p_225542_3_.above()) && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) {
|
||||
+ if (p_225542_2_.isEmptyBlock(p_225542_3_.above()) && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) {
|
||||
int i = this.getHeightBelowUpToMax(p_225542_2_, p_225542_3_) + 1;
|
||||
- if (i < 16) {
|
||||
+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(3) == 0)) {
|
||||
this.func_220258_a(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i);
|
||||
this.growBamboo(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i);
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/block/BeehiveBlock.java
|
||||
+++ b/net/minecraft/block/BeehiveBlock.java
|
||||
@@ -65,6 +_,9 @@
|
||||
public int func_180641_l(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) {
|
||||
return p_180641_1_.func_177229_b(field_226873_c_);
|
||||
public int getAnalogOutputSignal(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) {
|
||||
return p_180641_1_.getValue(HONEY_LEVEL);
|
||||
}
|
||||
+ // Forge: Fixed MC-227255 Beehives and bee nests do not rotate/mirror correctly in structure blocks
|
||||
+ @Override public BlockState func_185499_a(BlockState blockState, net.minecraft.util.Rotation rotation) { return (BlockState)blockState.func_206870_a(field_226872_b_, rotation.func_185831_a(blockState.func_177229_b(field_226872_b_))); }
|
||||
+ @Override public BlockState func_185471_a(BlockState blockState, net.minecraft.util.Mirror mirror) { return blockState.func_185907_a(mirror.func_185800_a(blockState.func_177229_b(field_226872_b_))); }
|
||||
+ @Override public BlockState rotate(BlockState blockState, net.minecraft.util.Rotation rotation) { return (BlockState)blockState.setValue(FACING, rotation.rotate(blockState.getValue(FACING))); }
|
||||
+ @Override public BlockState mirror(BlockState blockState, net.minecraft.util.Mirror mirror) { return blockState.rotate(mirror.getRotation(blockState.getValue(FACING))); }
|
||||
|
||||
public void func_180657_a(World p_180657_1_, PlayerEntity p_180657_2_, BlockPos p_180657_3_, BlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
|
||||
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
|
||||
public void playerDestroy(World p_180657_1_, PlayerEntity p_180657_2_, BlockPos p_180657_3_, BlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
|
||||
super.playerDestroy(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
|
||||
@@ -85,6 +_,7 @@
|
||||
List<BeeEntity> list = p_226881_1_.func_217357_a(BeeEntity.class, (new AxisAlignedBB(p_226881_2_)).func_72314_b(8.0D, 6.0D, 8.0D));
|
||||
List<BeeEntity> list = p_226881_1_.getEntitiesOfClass(BeeEntity.class, (new AxisAlignedBB(p_226881_2_)).inflate(8.0D, 6.0D, 8.0D));
|
||||
if (!list.isEmpty()) {
|
||||
List<PlayerEntity> list1 = p_226881_1_.func_217357_a(PlayerEntity.class, (new AxisAlignedBB(p_226881_2_)).func_72314_b(8.0D, 6.0D, 8.0D));
|
||||
List<PlayerEntity> list1 = p_226881_1_.getEntitiesOfClass(PlayerEntity.class, (new AxisAlignedBB(p_226881_2_)).inflate(8.0D, 6.0D, 8.0D));
|
||||
+ if (list1.isEmpty()) return; //Forge: Prevent Error when no players are around.
|
||||
int i = list1.size();
|
||||
|
||||
|
||||
@@ -6,92 +6,92 @@
|
||||
|
||||
-public class Block extends AbstractBlock implements IItemProvider {
|
||||
+public class Block extends AbstractBlock implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock {
|
||||
protected static final Logger field_196273_d = LogManager.getLogger();
|
||||
- public static final ObjectIntIdentityMap<BlockState> field_176229_d = new ObjectIntIdentityMap<>();
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
- public static final ObjectIntIdentityMap<BlockState> BLOCK_STATE_REGISTRY = new ObjectIntIdentityMap<>();
|
||||
+ @Deprecated //Forge: Do not use, use GameRegistry
|
||||
+ public static final ObjectIntIdentityMap<BlockState> field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap();
|
||||
private static final LoadingCache<VoxelShape, Boolean> field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() {
|
||||
+ public static final ObjectIntIdentityMap<BlockState> BLOCK_STATE_REGISTRY = net.minecraftforge.registries.GameData.getBlockStateIDMap();
|
||||
private static final LoadingCache<VoxelShape, Boolean> SHAPE_FULL_BLOCK_CACHE = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() {
|
||||
public Boolean load(VoxelShape p_load_1_) {
|
||||
return !VoxelShapes.func_197879_c(VoxelShapes.func_197868_b(), p_load_1_, IBooleanFunction.field_223236_g_);
|
||||
return !VoxelShapes.joinIsNotEmpty(VoxelShapes.block(), p_load_1_, IBooleanFunction.NOT_SAME);
|
||||
@@ -151,6 +_,8 @@
|
||||
super(p_i48440_1_);
|
||||
StateContainer.Builder<Block, BlockState> builder = new StateContainer.Builder<>(this);
|
||||
this.func_206840_a(builder);
|
||||
this.createBlockStateDefinition(builder);
|
||||
+ this.harvestLevel = p_i48440_1_.getHarvestLevel();
|
||||
+ this.harvestTool = p_i48440_1_.getHarvestTool();
|
||||
this.field_176227_L = builder.func_235882_a_(Block::func_176223_P, BlockState::new);
|
||||
this.func_180632_j(this.field_176227_L.func_177621_b());
|
||||
this.stateDefinition = builder.create(Block::defaultBlockState, BlockState::new);
|
||||
this.registerDefaultState(this.stateDefinition.any());
|
||||
}
|
||||
@@ -261,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) {
|
||||
- if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f)) {
|
||||
+ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180635_0_.restoringBlockSnapshots) {
|
||||
public static void popResource(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) {
|
||||
- if (!p_180635_0_.isClientSide && !p_180635_2_.isEmpty() && p_180635_0_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
|
||||
+ if (!p_180635_0_.isClientSide && !p_180635_2_.isEmpty() && p_180635_0_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && !p_180635_0_.restoringBlockSnapshots) {
|
||||
float f = 0.5F;
|
||||
double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
|
||||
double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
|
||||
double d0 = (double)(p_180635_0_.random.nextFloat() * 0.5F) + 0.25D;
|
||||
double d1 = (double)(p_180635_0_.random.nextFloat() * 0.5F) + 0.25D;
|
||||
@@ -273,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void func_180637_b(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) {
|
||||
- if (p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f)) {
|
||||
+ if (p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180637_1_.restoringBlockSnapshots) {
|
||||
public void popExperience(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) {
|
||||
- if (p_180637_1_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
|
||||
+ if (p_180637_1_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && !p_180637_1_.restoringBlockSnapshots) {
|
||||
while(p_180637_3_ > 0) {
|
||||
int i = ExperienceOrbEntity.func_70527_a(p_180637_3_);
|
||||
int i = ExperienceOrbEntity.getExperienceValue(p_180637_3_);
|
||||
p_180637_3_ -= i;
|
||||
@@ -283,6 +_,7 @@
|
||||
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use more sensitive version
|
||||
public float func_149638_a() {
|
||||
return this.field_235689_au_;
|
||||
public float getExplosionResistance() {
|
||||
return this.explosionResistance;
|
||||
}
|
||||
@@ -332,6 +_,7 @@
|
||||
p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D));
|
||||
p_176216_2_.setDeltaMovement(p_176216_2_.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D));
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use more sensitive version
|
||||
public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) {
|
||||
public ItemStack getCloneItemStack(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) {
|
||||
return new ItemStack(this);
|
||||
}
|
||||
@@ -363,6 +_,7 @@
|
||||
public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) {
|
||||
public void handleRain(World p_176224_1_, BlockPos p_176224_2_) {
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use more sensitive version
|
||||
public boolean func_149659_a(Explosion p_149659_1_) {
|
||||
public boolean dropFromExplosion(Explosion p_149659_1_) {
|
||||
return true;
|
||||
}
|
||||
@@ -382,6 +_,7 @@
|
||||
return this.field_196275_y;
|
||||
return this.defaultBlockState;
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) }
|
||||
public SoundType func_220072_p(BlockState p_220072_1_) {
|
||||
return this.field_149762_H;
|
||||
public SoundType getSoundType(BlockState p_220072_1_) {
|
||||
return this.soundType;
|
||||
}
|
||||
@@ -391,7 +_,7 @@
|
||||
this.field_220086_i = Item.func_150898_a(this);
|
||||
this.item = Item.byBlock(this);
|
||||
}
|
||||
|
||||
- return this.field_220086_i;
|
||||
+ return this.field_220086_i.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements.
|
||||
- return this.item;
|
||||
+ return this.item.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements.
|
||||
}
|
||||
|
||||
public boolean func_208619_r() {
|
||||
public boolean hasDynamicShape() {
|
||||
@@ -399,7 +_,7 @@
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
- return "Block{" + Registry.field_212618_g.func_177774_c(this) + "}";
|
||||
- return "Block{" + Registry.BLOCK.getKey(this) + "}";
|
||||
+ return "Block{" + getRegistryName() + "}";
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -409,6 +_,78 @@
|
||||
protected Block func_230328_p_() {
|
||||
protected Block asBlock() {
|
||||
return this;
|
||||
}
|
||||
+
|
||||
@@ -99,7 +99,7 @@
|
||||
+ protected Random RANDOM = new Random();
|
||||
+ private net.minecraftforge.common.ToolType harvestTool;
|
||||
+ private int harvestLevel;
|
||||
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Block> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::func_199896_a);
|
||||
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Block> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::getAllTags);
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
@@ -114,38 +114,38 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, net.minecraftforge.common.IPlantable plantable) {
|
||||
+ BlockState plant = plantable.getPlant(world, pos.func_177972_a(facing));
|
||||
+ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.func_177972_a(facing));
|
||||
+ BlockState plant = plantable.getPlant(world, pos.relative(facing));
|
||||
+ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.relative(facing));
|
||||
+
|
||||
+ if (plant.func_177230_c() == Blocks.field_150434_aF)
|
||||
+ return state.func_203425_a(Blocks.field_150434_aF) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
|
||||
+ if (plant.getBlock() == Blocks.CACTUS)
|
||||
+ return state.is(Blocks.CACTUS) || state.is(Blocks.SAND) || state.is(Blocks.RED_SAND);
|
||||
+
|
||||
+ if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF)
|
||||
+ if (plant.getBlock() == Blocks.SUGAR_CANE && this == Blocks.SUGAR_CANE)
|
||||
+ return true;
|
||||
+
|
||||
+ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos))
|
||||
+ if (plantable instanceof BushBlock && ((BushBlock)plantable).mayPlaceOn(state, world, pos))
|
||||
+ return true;
|
||||
+
|
||||
+ if (net.minecraftforge.common.PlantType.DESERT.equals(type)) {
|
||||
+ return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock;
|
||||
+ return this.getBlock() == Blocks.SAND || this.getBlock() == Blocks.TERRACOTTA || this.getBlock() instanceof GlazedTerracottaBlock;
|
||||
+ } else if (net.minecraftforge.common.PlantType.NETHER.equals(type)) {
|
||||
+ return this.getBlock() == Blocks.field_150425_aM;
|
||||
+ return this.getBlock() == Blocks.SOUL_SAND;
|
||||
+ } else if (net.minecraftforge.common.PlantType.CROP.equals(type)) {
|
||||
+ return state.func_203425_a(Blocks.field_150458_ak);
|
||||
+ return state.is(Blocks.FARMLAND);
|
||||
+ } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) {
|
||||
+ return state.func_224755_d(world, pos, Direction.UP);
|
||||
+ return state.isFaceSturdy(world, pos, Direction.UP);
|
||||
+ } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) {
|
||||
+ return this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150458_ak;
|
||||
+ return this.getBlock() == Blocks.GRASS_BLOCK || net.minecraftforge.common.Tags.Blocks.DIRT.contains(this) || this.getBlock() == Blocks.FARMLAND;
|
||||
+ } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) {
|
||||
+ return state.func_185904_a() == net.minecraft.block.material.Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper)
|
||||
+ return state.getMaterial() == net.minecraft.block.material.Material.WATER; //&& state.getValue(BlockLiquidWrapper)
|
||||
+ } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) {
|
||||
+ boolean isBeach = state.func_203425_a(Blocks.field_196658_i) || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
|
||||
+ boolean isBeach = state.is(Blocks.GRASS_BLOCK) || net.minecraftforge.common.Tags.Blocks.DIRT.contains(this) || state.is(Blocks.SAND) || state.is(Blocks.RED_SAND);
|
||||
+ boolean hasWater = false;
|
||||
+ for (Direction face : Direction.Plane.HORIZONTAL) {
|
||||
+ BlockState blockState = world.func_180495_p(pos.func_177972_a(face));
|
||||
+ net.minecraft.fluid.FluidState fluidState = world.func_204610_c(pos.func_177972_a(face));
|
||||
+ hasWater |= blockState.func_203425_a(Blocks.field_185778_de);
|
||||
+ hasWater |= fluidState.func_206884_a(net.minecraft.tags.FluidTags.field_206959_a);
|
||||
+ BlockState blockState = world.getBlockState(pos.relative(face));
|
||||
+ net.minecraft.fluid.FluidState fluidState = world.getFluidState(pos.relative(face));
|
||||
+ hasWater |= blockState.is(Blocks.FROSTED_ICE);
|
||||
+ hasWater |= fluidState.is(net.minecraft.tags.FluidTags.WATER);
|
||||
+ if (hasWater)
|
||||
+ break; //No point continuing.
|
||||
+ }
|
||||
@@ -168,4 +168,4 @@
|
||||
+ /* ========================================= FORGE END ======================================*/
|
||||
|
||||
public static final class RenderSideCacheKey {
|
||||
private final BlockState field_212164_a;
|
||||
private final BlockState first;
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
-public class BlockState extends AbstractBlock.AbstractBlockState {
|
||||
+public class BlockState extends AbstractBlock.AbstractBlockState implements net.minecraftforge.common.extensions.IForgeBlockState {
|
||||
public static final Codec<BlockState> field_235877_b_ = func_235897_a_(Registry.field_212618_g, Block::func_176223_P).stable();
|
||||
public static final Codec<BlockState> CODEC = codec(Registry.BLOCK, Block::defaultBlockState).stable();
|
||||
|
||||
public BlockState(Block p_i231876_1_, ImmutableMap<Property<?>, Comparable<?>> p_i231876_2_, MapCodec<BlockState> p_i231876_3_) {
|
||||
@@ -6,30 +6,30 @@
|
||||
|
||||
[email protected]("minecraft")
|
||||
public class Blocks {
|
||||
public static final Block field_150350_a = func_222382_a("air", new AirBlock(AbstractBlock.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e().func_235859_g_()));
|
||||
public static final Block field_150348_b = func_222382_a("stone", new Block(AbstractBlock.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_235861_h_().func_200948_a(1.5F, 6.0F)));
|
||||
public static final Block AIR = register("air", new AirBlock(AbstractBlock.Properties.of(Material.AIR).noCollission().noDrops().air()));
|
||||
public static final Block STONE = register("stone", new Block(AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).requiresCorrectToolForDrops().strength(1.5F, 6.0F)));
|
||||
@@ -119,7 +_,7 @@
|
||||
public static final Block field_196601_az = func_222382_a("green_bed", func_235422_a_(DyeColor.GREEN));
|
||||
public static final Block field_196550_aA = func_222382_a("red_bed", func_235422_a_(DyeColor.RED));
|
||||
public static final Block field_196551_aB = func_222382_a("black_bed", func_235422_a_(DyeColor.BLACK));
|
||||
- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
|
||||
+ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true));
|
||||
public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
|
||||
public static final Block field_150320_F = func_222382_a("sticky_piston", func_235432_a_(true));
|
||||
public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(AbstractBlock.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_235861_h_().func_200943_b(4.0F)));
|
||||
public static final Block GREEN_BED = register("green_bed", bed(DyeColor.GREEN));
|
||||
public static final Block RED_BED = register("red_bed", bed(DyeColor.RED));
|
||||
public static final Block BLACK_BED = register("black_bed", bed(DyeColor.BLACK));
|
||||
- public static final Block POWERED_RAIL = register("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL)));
|
||||
+ public static final Block POWERED_RAIL = register("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL), true));
|
||||
public static final Block DETECTOR_RAIL = register("detector_rail", new DetectorRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL)));
|
||||
public static final Block STICKY_PISTON = register("sticky_piston", pistonBase(true));
|
||||
public static final Block COBWEB = register("cobweb", new WebBlock(AbstractBlock.Properties.of(Material.WEB).noCollission().requiresCorrectToolForDrops().strength(4.0F)));
|
||||
@@ -936,16 +_,5 @@
|
||||
|
||||
public static void func_235419_a_() {
|
||||
Block.field_176229_d.forEach(AbstractBlock.AbstractBlockState::func_215692_c);
|
||||
public static void rebuildCache() {
|
||||
Block.BLOCK_STATE_REGISTRY.forEach(AbstractBlock.AbstractBlockState::initCache);
|
||||
- }
|
||||
-
|
||||
- static {
|
||||
- for(Block block : Registry.field_212618_g) {
|
||||
- for(BlockState blockstate : block.func_176194_O().func_177619_a()) {
|
||||
- Block.field_176229_d.func_195867_b(blockstate);
|
||||
- for(Block block : Registry.BLOCK) {
|
||||
- for(BlockState blockstate : block.getStateDefinition().getPossibleStates()) {
|
||||
- Block.BLOCK_STATE_REGISTRY.add(blockstate);
|
||||
- }
|
||||
-
|
||||
- block.func_220068_i();
|
||||
- block.getLootTable();
|
||||
- }
|
||||
-
|
||||
}
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
}
|
||||
@@ -22,6 +_,8 @@
|
||||
|
||||
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
|
||||
BlockPos blockpos = p_196260_3_.func_177977_b();
|
||||
+ if (p_196260_1_.func_177230_c() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
|
||||
+ return p_196260_2_.func_180495_p(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this);
|
||||
return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos);
|
||||
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
|
||||
BlockPos blockpos = p_196260_3_.below();
|
||||
+ if (p_196260_1_.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
|
||||
+ return p_196260_2_.getBlockState(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this);
|
||||
return this.mayPlaceOn(p_196260_2_.getBlockState(blockpos), p_196260_2_, blockpos);
|
||||
}
|
||||
|
||||
@@ -31,5 +_,12 @@
|
||||
|
||||
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
return p_196266_4_ == PathType.AIR && !this.field_235688_at_ ? true : super.func_196266_a(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_);
|
||||
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
return p_196266_4_ == PathType.AIR && !this.hasCollision ? true : super.isPathfindable(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
|
||||
+ BlockState state = world.func_180495_p(pos);
|
||||
+ if (state.func_177230_c() != this) return func_176223_P();
|
||||
+ BlockState state = world.getBlockState(pos);
|
||||
+ if (state.getBlock() != this) return defaultBlockState();
|
||||
+ return state;
|
||||
}
|
||||
}
|
||||
@@ -6,28 +6,28 @@
|
||||
|
||||
-public class CactusBlock extends Block {
|
||||
+public class CactusBlock extends Block implements net.minecraftforge.common.IPlantable {
|
||||
public static final IntegerProperty field_176587_a = BlockStateProperties.field_208171_X;
|
||||
protected static final VoxelShape field_196400_b = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D);
|
||||
protected static final VoxelShape field_196401_c = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
public static final IntegerProperty AGE = BlockStateProperties.AGE_15;
|
||||
protected static final VoxelShape COLLISION_SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D);
|
||||
protected static final VoxelShape OUTLINE_SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
@@ -30,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
|
||||
public void tick(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
|
||||
+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update
|
||||
if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) {
|
||||
p_225534_2_.func_175655_b(p_225534_3_, true);
|
||||
if (!p_225534_1_.canSurvive(p_225534_2_, p_225534_3_)) {
|
||||
p_225534_2_.destroyBlock(p_225534_3_, true);
|
||||
}
|
||||
@@ -45,6 +_,7 @@
|
||||
|
||||
if (i < 3) {
|
||||
int j = p_225542_1_.func_177229_b(field_176587_a);
|
||||
int j = p_225542_1_.getValue(AGE);
|
||||
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
|
||||
if (j == 15) {
|
||||
p_225542_2_.func_175656_a(blockpos, this.func_176223_P());
|
||||
BlockState blockstate = p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(0));
|
||||
p_225542_2_.setBlockAndUpdate(blockpos, this.defaultBlockState());
|
||||
BlockState blockstate = p_225542_1_.setValue(AGE, Integer.valueOf(0));
|
||||
@@ -53,7 +_,8 @@
|
||||
} else {
|
||||
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4);
|
||||
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(j + 1)), 4);
|
||||
}
|
||||
-
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
@@ -38,15 +38,15 @@
|
||||
@@ -84,7 +_,7 @@
|
||||
}
|
||||
|
||||
BlockState blockstate1 = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
|
||||
- return (blockstate1.func_203425_a(Blocks.field_150434_aF) || blockstate1.func_203425_a(Blocks.field_150354_m) || blockstate1.func_203425_a(Blocks.field_196611_F)) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
|
||||
+ return blockstate1.canSustainPlant(p_196260_2_, p_196260_3_, Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
|
||||
BlockState blockstate1 = p_196260_2_.getBlockState(p_196260_3_.below());
|
||||
- return (blockstate1.is(Blocks.CACTUS) || blockstate1.is(Blocks.SAND) || blockstate1.is(Blocks.RED_SAND)) && !p_196260_2_.getBlockState(p_196260_3_.above()).getMaterial().isLiquid();
|
||||
+ return blockstate1.canSustainPlant(p_196260_2_, p_196260_3_, Direction.UP, this) && !p_196260_2_.getBlockState(p_196260_3_.above()).getMaterial().isLiquid();
|
||||
}
|
||||
|
||||
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
|
||||
public void entityInside(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
|
||||
@@ -97,5 +_,15 @@
|
||||
|
||||
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
return false;
|
||||
+ }
|
||||
+
|
||||
@@ -57,6 +57,6 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
|
||||
+ return func_176223_P();
|
||||
+ return defaultBlockState();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/block/CampfireBlock.java
|
||||
+++ b/net/minecraft/block/CampfireBlock.java
|
||||
@@ -181,7 +_,7 @@
|
||||
public void func_220066_a(World p_220066_1_, BlockState p_220066_2_, BlockRayTraceResult p_220066_3_, ProjectileEntity p_220066_4_) {
|
||||
if (!p_220066_1_.field_72995_K && p_220066_4_.func_70027_ad()) {
|
||||
Entity entity = p_220066_4_.func_234616_v_();
|
||||
- boolean flag = entity == null || entity instanceof PlayerEntity || p_220066_1_.func_82736_K().func_223586_b(GameRules.field_223599_b);
|
||||
public void onProjectileHit(World p_220066_1_, BlockState p_220066_2_, BlockRayTraceResult p_220066_3_, ProjectileEntity p_220066_4_) {
|
||||
if (!p_220066_1_.isClientSide && p_220066_4_.isOnFire()) {
|
||||
Entity entity = p_220066_4_.getOwner();
|
||||
- boolean flag = entity == null || entity instanceof PlayerEntity || p_220066_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ boolean flag = entity == null || entity instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_220066_1_, entity);
|
||||
if (flag && !p_220066_2_.func_177229_b(field_220101_b) && !p_220066_2_.func_177229_b(field_220103_d)) {
|
||||
BlockPos blockpos = p_220066_3_.func_216350_a();
|
||||
p_220066_1_.func_180501_a(blockpos, p_220066_2_.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true)), 11);
|
||||
if (flag && !p_220066_2_.getValue(LIT) && !p_220066_2_.getValue(WATERLOGGED)) {
|
||||
BlockPos blockpos = p_220066_3_.getBlockPos();
|
||||
p_220066_1_.setBlock(blockpos, p_220066_2_.setValue(BlockStateProperties.LIT, Boolean.valueOf(true)), 11);
|
||||
@@ -208,7 +_,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
- boolean flag = VoxelShapes.func_197879_c(field_226912_f_, blockstate.func_215685_b(p_235474_0_, p_235474_1_, ISelectionContext.func_216377_a()), IBooleanFunction.field_223238_i_);
|
||||
+ boolean flag = VoxelShapes.func_197879_c(field_226912_f_, blockstate.func_215685_b(p_235474_0_, blockpos, ISelectionContext.func_216377_a()), IBooleanFunction.field_223238_i_);//Forge fix: MC-201374
|
||||
- boolean flag = VoxelShapes.joinIsNotEmpty(VIRTUAL_FENCE_POST, blockstate.getCollisionShape(p_235474_0_, p_235474_1_, ISelectionContext.empty()), IBooleanFunction.AND);
|
||||
+ boolean flag = VoxelShapes.joinIsNotEmpty(VIRTUAL_FENCE_POST, blockstate.getCollisionShape(p_235474_0_, blockpos, ISelectionContext.empty()), IBooleanFunction.AND);//Forge fix: MC-201374
|
||||
if (flag) {
|
||||
BlockState blockstate1 = p_235474_0_.func_180495_p(blockpos.func_177977_b());
|
||||
return func_226915_i_(blockstate1);
|
||||
BlockState blockstate1 = p_235474_0_.getBlockState(blockpos.below());
|
||||
return isLitCampfire(blockstate1);
|
||||
@@ -3,10 +3,10 @@
|
||||
@@ -325,7 +_,8 @@
|
||||
}
|
||||
|
||||
public BlockState func_185471_a(BlockState p_185471_1_, Mirror p_185471_2_) {
|
||||
- return p_185471_1_.func_185907_a(p_185471_2_.func_185800_a(p_185471_1_.func_177229_b(field_176459_a)));
|
||||
+ BlockState rotated = p_185471_1_.func_185907_a(p_185471_2_.func_185800_a(p_185471_1_.func_177229_b(field_176459_a)));
|
||||
+ return p_185471_2_ == Mirror.NONE ? rotated : rotated.func_206870_a(field_196314_b, rotated.func_177229_b(field_196314_b).func_208081_a()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests
|
||||
public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) {
|
||||
- return p_185471_1_.rotate(p_185471_2_.getRotation(p_185471_1_.getValue(FACING)));
|
||||
+ BlockState rotated = p_185471_1_.rotate(p_185471_2_.getRotation(p_185471_1_.getValue(FACING)));
|
||||
+ return p_185471_2_ == Mirror.NONE ? rotated : rotated.setValue(TYPE, rotated.getValue(TYPE).getOpposite()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests
|
||||
}
|
||||
|
||||
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
@@ -1,26 +1,26 @@
|
||||
--- a/net/minecraft/block/ChorusFlowerBlock.java
|
||||
+++ b/net/minecraft/block/ChorusFlowerBlock.java
|
||||
@@ -40,7 +_,7 @@
|
||||
BlockPos blockpos = p_225542_3_.func_177984_a();
|
||||
if (p_225542_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) {
|
||||
int i = p_225542_1_.func_177229_b(field_185607_a);
|
||||
BlockPos blockpos = p_225542_3_.above();
|
||||
if (p_225542_2_.isEmptyBlock(blockpos) && blockpos.getY() < 256) {
|
||||
int i = p_225542_1_.getValue(AGE);
|
||||
- if (i < 5) {
|
||||
+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
BlockState blockstate = p_225542_2_.func_180495_p(p_225542_3_.func_177977_b());
|
||||
BlockState blockstate = p_225542_2_.getBlockState(p_225542_3_.below());
|
||||
@@ -65,7 +_,7 @@
|
||||
if (j < 2 || j <= p_225542_4_.nextInt(flag1 ? 5 : 4)) {
|
||||
flag = true;
|
||||
}
|
||||
- } else if (blockstate.func_196958_f()) {
|
||||
+ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.func_177977_b())) {
|
||||
- } else if (blockstate.isAir()) {
|
||||
+ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.below())) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -97,7 +_,7 @@
|
||||
} else {
|
||||
this.func_185605_c(p_225542_2_, p_225542_3_);
|
||||
this.placeDeadFlower(p_225542_2_, p_225542_3_);
|
||||
}
|
||||
-
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
@@ -28,11 +28,11 @@
|
||||
}
|
||||
}
|
||||
@@ -133,7 +_,7 @@
|
||||
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
|
||||
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
|
||||
if (blockstate.func_177230_c() != this.field_196405_b && !blockstate.func_203425_a(Blocks.field_150377_bs)) {
|
||||
- if (!blockstate.func_196958_f()) {
|
||||
+ if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) {
|
||||
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
|
||||
BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below());
|
||||
if (blockstate.getBlock() != this.plant && !blockstate.is(Blocks.END_STONE)) {
|
||||
- if (!blockstate.isAir()) {
|
||||
+ if (!blockstate.isAir(p_196260_2_, p_196260_3_.below())) {
|
||||
return false;
|
||||
} else {
|
||||
boolean flag = false;
|
||||
@@ -40,8 +40,8 @@
|
||||
}
|
||||
|
||||
flag = true;
|
||||
- } else if (!blockstate1.func_196958_f()) {
|
||||
+ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.func_177972_a(direction))) {
|
||||
- } else if (!blockstate1.isAir()) {
|
||||
+ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.relative(direction))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -35,10 +_,11 @@
|
||||
}
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
- if (p_225542_2_.field_73012_v.nextInt(5) == 0) {
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
- if (p_225542_2_.random.nextInt(5) == 0) {
|
||||
+ if (true) {
|
||||
int i = p_225542_1_.func_177229_b(field_176501_a);
|
||||
int i = p_225542_1_.getValue(AGE);
|
||||
- if (i < 2) {
|
||||
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_2_.field_73012_v.nextInt(5) == 0)) {
|
||||
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2);
|
||||
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_2_.random.nextInt(5) == 0)) {
|
||||
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2);
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/block/ComparatorBlock.java
|
||||
+++ b/net/minecraft/block/ComparatorBlock.java
|
||||
@@ -154,4 +_,16 @@
|
||||
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c);
|
||||
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.add(FACING, MODE, POWERED);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean getWeakChanges(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) {
|
||||
+ return state.func_203425_a(Blocks.field_196762_fd);
|
||||
+ return state.is(Blocks.COMPARATOR);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onNeighborChange(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) {
|
||||
+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) {
|
||||
+ state.func_215697_a((World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor, false);
|
||||
+ if (pos.getY() == neighbor.getY() && world instanceof World && !((World)world).isClientSide()) {
|
||||
+ state.neighborChanged((World)world, pos, world.getBlockState(neighbor).getBlock(), neighbor, false);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
@@ -3,15 +3,15 @@
|
||||
@@ -61,12 +_,14 @@
|
||||
}
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
|
||||
if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) {
|
||||
int i = this.func_185527_x(p_225542_1_);
|
||||
if (i < this.func_185526_g()) {
|
||||
float f = func_180672_a(this, p_225542_2_, p_225542_3_);
|
||||
if (p_225542_2_.getRawBrightness(p_225542_3_, 0) >= 9) {
|
||||
int i = this.getAge(p_225542_1_);
|
||||
if (i < this.getMaxAge()) {
|
||||
float f = getGrowthSpeed(this, p_225542_2_, p_225542_3_);
|
||||
- if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) {
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
|
||||
p_225542_2_.func_180501_a(p_225542_3_, this.func_185528_e(i + 1), 2);
|
||||
p_225542_2_.setBlock(p_225542_3_, this.getStateForAge(i + 1), 2);
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
}
|
||||
}
|
||||
@@ -19,21 +19,21 @@
|
||||
@@ -95,9 +_,9 @@
|
||||
for(int j = -1; j <= 1; ++j) {
|
||||
float f1 = 0.0F;
|
||||
BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j));
|
||||
- if (blockstate.func_203425_a(Blocks.field_150458_ak)) {
|
||||
+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable) p_180672_0_)) {
|
||||
BlockState blockstate = p_180672_1_.getBlockState(blockpos.offset(i, 0, j));
|
||||
- if (blockstate.is(Blocks.FARMLAND)) {
|
||||
+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.offset(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable) p_180672_0_)) {
|
||||
f1 = 1.0F;
|
||||
- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) {
|
||||
+ if (blockstate.isFertile(p_180672_1_, p_180672_2_.func_177982_a(i, 0, j))) {
|
||||
- if (blockstate.getValue(FarmlandBlock.MOISTURE) > 0) {
|
||||
+ if (blockstate.isFertile(p_180672_1_, p_180672_2_.offset(i, 0, j))) {
|
||||
f1 = 3.0F;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
|
||||
- if (p_196262_4_ instanceof RavagerEntity && p_196262_2_.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
|
||||
public void entityInside(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
|
||||
- if (p_196262_4_ instanceof RavagerEntity && p_196262_2_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (p_196262_4_ instanceof RavagerEntity && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_196262_2_, p_196262_4_)) {
|
||||
p_196262_2_.func_225521_a_(p_196262_3_, true, p_196262_4_);
|
||||
p_196262_2_.destroyBlock(p_196262_3_, true, p_196262_4_);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
-public class DeadBushBlock extends BushBlock {
|
||||
+public class DeadBushBlock extends BushBlock implements net.minecraftforge.common.IForgeShearable {
|
||||
protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
|
||||
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
|
||||
|
||||
public DeadBushBlock(AbstractBlock.Properties p_i48418_1_) {
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -131,6 +_,8 @@
|
||||
}
|
||||
|
||||
List<AbstractMinecartEntity> list1 = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.field_96566_b);
|
||||
+ List<AbstractMinecartEntity> carts = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null);
|
||||
List<AbstractMinecartEntity> list1 = this.getInteractingMinecartOfType(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.CONTAINER_ENTITY_SELECTOR);
|
||||
+ List<AbstractMinecartEntity> carts = this.getInteractingMinecartOfType(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null);
|
||||
+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
|
||||
if (!list1.isEmpty()) {
|
||||
return Container.func_94526_b((IInventory)list1.get(0));
|
||||
return Container.getRedstoneSignalFromContainer((IInventory)list1.get(0));
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/block/DoublePlantBlock.java
|
||||
+++ b/net/minecraft/block/DoublePlantBlock.java
|
||||
@@ -51,6 +_,7 @@
|
||||
return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_);
|
||||
return super.canSurvive(p_196260_1_, p_196260_2_, p_196260_3_);
|
||||
} else {
|
||||
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
|
||||
+ if (p_196260_1_.func_177230_c() != this) return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
|
||||
return blockstate.func_203425_a(this) && blockstate.func_177229_b(field_176492_b) == DoubleBlockHalf.LOWER;
|
||||
BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below());
|
||||
+ if (p_196260_1_.getBlock() != this) return super.canSurvive(p_196260_1_, p_196260_2_, p_196260_3_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
|
||||
return blockstate.is(this) && blockstate.getValue(HALF) == DoubleBlockHalf.LOWER;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/DropperBlock.java
|
||||
+++ b/net/minecraft/block/DropperBlock.java
|
||||
@@ -37,7 +_,7 @@
|
||||
p_176439_1_.func_217379_c(1001, p_176439_2_, 0);
|
||||
p_176439_1_.levelEvent(1001, p_176439_2_, 0);
|
||||
} else {
|
||||
ItemStack itemstack = dispensertileentity.func_70301_a(i);
|
||||
- if (!itemstack.func_190926_b()) {
|
||||
+ if (!itemstack.func_190926_b() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, dispensertileentity, i, itemstack)) {
|
||||
Direction direction = p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a);
|
||||
IInventory iinventory = HopperTileEntity.func_195484_a(p_176439_1_, p_176439_2_.func_177972_a(direction));
|
||||
ItemStack itemstack = dispensertileentity.getItem(i);
|
||||
- if (!itemstack.isEmpty()) {
|
||||
+ if (!itemstack.isEmpty() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, dispensertileentity, i, itemstack)) {
|
||||
Direction direction = p_176439_1_.getBlockState(p_176439_2_).getValue(FACING);
|
||||
IInventory iinventory = HopperTileEntity.getContainerAt(p_176439_1_, p_176439_2_.relative(direction));
|
||||
ItemStack itemstack1;
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -54,7 +_,7 @@
|
||||
if (p_180655_4_.nextInt(16) == 0) {
|
||||
for(int k = 0; k <= 1; ++k) {
|
||||
BlockPos blockpos = p_180655_3_.func_177982_a(i, k, j);
|
||||
- if (p_180655_2_.func_180495_p(blockpos).func_203425_a(Blocks.field_150342_X)) {
|
||||
+ if (p_180655_2_.func_180495_p(blockpos).getEnchantPowerBonus(p_180655_2_, blockpos) > 0) {
|
||||
if (!p_180655_2_.func_175623_d(p_180655_3_.func_177982_a(i / 2, 0, j / 2))) {
|
||||
BlockPos blockpos = p_180655_3_.offset(i, k, j);
|
||||
- if (p_180655_2_.getBlockState(blockpos).is(Blocks.BOOKSHELF)) {
|
||||
+ if (p_180655_2_.getBlockState(blockpos).getEnchantPowerBonus(p_180655_2_, blockpos) > 0) {
|
||||
if (!p_180655_2_.isEmptyBlock(p_180655_3_.offset(i / 2, 0, j / 2))) {
|
||||
break;
|
||||
}
|
||||
@@ -3,18 +3,18 @@
|
||||
@@ -30,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
|
||||
- if (func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) {
|
||||
+ if (p_225534_2_.func_175623_d(p_225534_3_.func_177977_b()) || func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) {
|
||||
FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_225534_2_, (double)p_225534_3_.func_177958_n() + 0.5D, (double)p_225534_3_.func_177956_o(), (double)p_225534_3_.func_177952_p() + 0.5D, p_225534_2_.func_180495_p(p_225534_3_));
|
||||
this.func_149829_a(fallingblockentity);
|
||||
p_225534_2_.func_217376_c(fallingblockentity);
|
||||
public void tick(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
|
||||
- if (isFree(p_225534_2_.getBlockState(p_225534_3_.below())) && p_225534_3_.getY() >= 0) {
|
||||
+ if (p_225534_2_.isEmptyBlock(p_225534_3_.below()) || isFree(p_225534_2_.getBlockState(p_225534_3_.below())) && p_225534_3_.getY() >= 0) {
|
||||
FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_225534_2_, (double)p_225534_3_.getX() + 0.5D, (double)p_225534_3_.getY(), (double)p_225534_3_.getZ() + 0.5D, p_225534_2_.getBlockState(p_225534_3_));
|
||||
this.falling(fallingblockentity);
|
||||
p_225534_2_.addFreshEntity(fallingblockentity);
|
||||
@@ -59,7 +_,7 @@
|
||||
public void func_180655_c(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) {
|
||||
public void animateTick(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) {
|
||||
if (p_180655_4_.nextInt(16) == 0) {
|
||||
BlockPos blockpos = p_180655_3_.func_177977_b();
|
||||
- if (func_185759_i(p_180655_2_.func_180495_p(blockpos))) {
|
||||
+ if (p_180655_2_.func_175623_d(blockpos) || func_185759_i(p_180655_2_.func_180495_p(blockpos))) {
|
||||
double d0 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
|
||||
double d1 = (double)p_180655_3_.func_177956_o() - 0.05D;
|
||||
double d2 = (double)p_180655_3_.func_177952_p() + p_180655_4_.nextDouble();
|
||||
BlockPos blockpos = p_180655_3_.below();
|
||||
- if (isFree(p_180655_2_.getBlockState(blockpos))) {
|
||||
+ if (p_180655_2_.isEmptyBlock(blockpos) || isFree(p_180655_2_.getBlockState(blockpos))) {
|
||||
double d0 = (double)p_180655_3_.getX() + p_180655_4_.nextDouble();
|
||||
double d1 = (double)p_180655_3_.getY() - 0.05D;
|
||||
double d2 = (double)p_180655_3_.getZ() + p_180655_4_.nextDouble();
|
||||
@@ -3,26 +3,26 @@
|
||||
@@ -77,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void func_180658_a(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
|
||||
- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.func_82736_K().func_223586_b(GameRules.field_223599_b)) && p_180658_3_.func_213311_cf() * p_180658_3_.func_213311_cf() * p_180658_3_.func_213302_cg() > 0.512F) {
|
||||
+ if (!p_180658_1_.field_72995_K && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.field_150346_d.func_176223_P(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample
|
||||
func_199610_d(p_180658_1_.func_180495_p(p_180658_2_), p_180658_1_, p_180658_2_);
|
||||
public void fallOn(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
|
||||
- if (!p_180658_1_.isClientSide && p_180658_1_.random.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && p_180658_3_.getBbWidth() * p_180658_3_.getBbWidth() * p_180658_3_.getBbHeight() > 0.512F) {
|
||||
+ if (!p_180658_1_.isClientSide && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.DIRT.defaultBlockState(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample
|
||||
turnToDirt(p_180658_1_.getBlockState(p_180658_2_), p_180658_1_, p_180658_2_);
|
||||
}
|
||||
|
||||
@@ -88,9 +_,10 @@
|
||||
p_199610_1_.func_175656_a(p_199610_2_, func_199601_a(p_199610_0_, Blocks.field_150346_d.func_176223_P(), p_199610_1_, p_199610_2_));
|
||||
p_199610_1_.setBlockAndUpdate(p_199610_2_, pushEntitiesUp(p_199610_0_, Blocks.DIRT.defaultBlockState(), p_199610_1_, p_199610_2_));
|
||||
}
|
||||
|
||||
- private static boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
|
||||
- Block block = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()).func_177230_c();
|
||||
- private static boolean isUnderCrops(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
|
||||
- Block block = p_176529_0_.getBlockState(p_176529_1_.above()).getBlock();
|
||||
- return block instanceof CropsBlock || block instanceof StemBlock || block instanceof AttachedStemBlock;
|
||||
+ private boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
|
||||
+ BlockState plant = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a());
|
||||
+ BlockState state = p_176529_0_.func_180495_p(p_176529_1_);
|
||||
+ return plant.func_177230_c() instanceof net.minecraftforge.common.IPlantable && state.canSustainPlant(p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)plant.func_177230_c());
|
||||
+ private boolean isUnderCrops(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
|
||||
+ BlockState plant = p_176529_0_.getBlockState(p_176529_1_.above());
|
||||
+ BlockState state = p_176529_0_.getBlockState(p_176529_1_);
|
||||
+ return plant.getBlock() instanceof net.minecraftforge.common.IPlantable && state.canSustainPlant(p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)plant.getBlock());
|
||||
}
|
||||
|
||||
private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) {
|
||||
private static boolean isNearWater(IWorldReader p_176530_0_, BlockPos p_176530_1_) {
|
||||
@@ -100,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
@@ -31,4 +31,4 @@
|
||||
+ return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_176530_0_, p_176530_1_);
|
||||
}
|
||||
|
||||
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
@@ -1,87 +1,87 @@
|
||||
--- a/net/minecraft/block/FireBlock.java
|
||||
+++ b/net/minecraft/block/FireBlock.java
|
||||
@@ -92,13 +_,13 @@
|
||||
protected BlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) {
|
||||
BlockPos blockpos = p_196448_2_.func_177977_b();
|
||||
BlockState blockstate = p_196448_1_.func_180495_p(blockpos);
|
||||
- if (!this.func_196446_i(blockstate) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) {
|
||||
+ if (!this.canCatchFire(p_196448_1_, p_196448_2_, Direction.UP) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) {
|
||||
BlockState blockstate1 = this.func_176223_P();
|
||||
protected BlockState getStateForPlacement(IBlockReader p_196448_1_, BlockPos p_196448_2_) {
|
||||
BlockPos blockpos = p_196448_2_.below();
|
||||
BlockState blockstate = p_196448_1_.getBlockState(blockpos);
|
||||
- if (!this.canBurn(blockstate) && !blockstate.isFaceSturdy(p_196448_1_, blockpos, Direction.UP)) {
|
||||
+ if (!this.canCatchFire(p_196448_1_, p_196448_2_, Direction.UP) && !blockstate.isFaceSturdy(p_196448_1_, blockpos, Direction.UP)) {
|
||||
BlockState blockstate1 = this.defaultBlockState();
|
||||
|
||||
for(Direction direction : Direction.values()) {
|
||||
BooleanProperty booleanproperty = field_196449_B.get(direction);
|
||||
BooleanProperty booleanproperty = PROPERTY_BY_DIRECTION.get(direction);
|
||||
if (booleanproperty != null) {
|
||||
- blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.func_196446_i(p_196448_1_.func_180495_p(p_196448_2_.func_177972_a(direction)))));
|
||||
+ blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.func_177972_a(direction), direction.func_176734_d())));
|
||||
- blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canBurn(p_196448_1_.getBlockState(p_196448_2_.relative(direction)))));
|
||||
+ blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.relative(direction), direction.getOpposite())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +_,7 @@
|
||||
}
|
||||
|
||||
BlockState blockstate = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b());
|
||||
- boolean flag = blockstate.func_235714_a_(p_225534_2_.func_230315_m_().func_241515_q_());
|
||||
BlockState blockstate = p_225534_2_.getBlockState(p_225534_3_.below());
|
||||
- boolean flag = blockstate.is(p_225534_2_.dimensionType().infiniburn());
|
||||
+ boolean flag = blockstate.isFireSource(p_225534_2_, p_225534_3_, Direction.UP);
|
||||
int i = p_225534_1_.func_177229_b(field_176543_a);
|
||||
if (!flag && p_225534_2_.func_72896_J() && this.func_176537_d(p_225534_2_, p_225534_3_) && p_225534_4_.nextFloat() < 0.2F + (float)i * 0.03F) {
|
||||
p_225534_2_.func_217377_a(p_225534_3_, false);
|
||||
int i = p_225534_1_.getValue(AGE);
|
||||
if (!flag && p_225534_2_.isRaining() && this.isNearRain(p_225534_2_, p_225534_3_) && p_225534_4_.nextFloat() < 0.2F + (float)i * 0.03F) {
|
||||
p_225534_2_.removeBlock(p_225534_3_, false);
|
||||
@@ -142,7 +_,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.func_196446_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()))) {
|
||||
+ if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), Direction.UP)) {
|
||||
p_225534_2_.func_217377_a(p_225534_3_, false);
|
||||
- if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canBurn(p_225534_2_.getBlockState(p_225534_3_.below()))) {
|
||||
+ if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canCatchFire(p_225534_2_, p_225534_3_.below(), Direction.UP)) {
|
||||
p_225534_2_.removeBlock(p_225534_3_, false);
|
||||
return;
|
||||
}
|
||||
@@ -150,12 +_,12 @@
|
||||
|
||||
boolean flag1 = p_225534_2_.func_180502_D(p_225534_3_);
|
||||
boolean flag1 = p_225534_2_.isHumidAt(p_225534_3_);
|
||||
int k = flag1 ? -50 : 0;
|
||||
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i);
|
||||
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i);
|
||||
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i);
|
||||
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i);
|
||||
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i);
|
||||
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i, Direction.WEST);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i, Direction.EAST);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i, Direction.UP);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i, Direction.DOWN);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i, Direction.SOUTH);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i, Direction.NORTH);
|
||||
- this.checkBurnOut(p_225534_2_, p_225534_3_.east(), 300 + k, p_225534_4_, i);
|
||||
- this.checkBurnOut(p_225534_2_, p_225534_3_.west(), 300 + k, p_225534_4_, i);
|
||||
- this.checkBurnOut(p_225534_2_, p_225534_3_.below(), 250 + k, p_225534_4_, i);
|
||||
- this.checkBurnOut(p_225534_2_, p_225534_3_.above(), 250 + k, p_225534_4_, i);
|
||||
- this.checkBurnOut(p_225534_2_, p_225534_3_.north(), 300 + k, p_225534_4_, i);
|
||||
- this.checkBurnOut(p_225534_2_, p_225534_3_.south(), 300 + k, p_225534_4_, i);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.east(), 300 + k, p_225534_4_, i, Direction.WEST);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.west(), 300 + k, p_225534_4_, i, Direction.EAST);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.below(), 250 + k, p_225534_4_, i, Direction.UP);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.above(), 250 + k, p_225534_4_, i, Direction.DOWN);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.north(), 300 + k, p_225534_4_, i, Direction.SOUTH);
|
||||
+ this.tryCatchFire(p_225534_2_, p_225534_3_.south(), 300 + k, p_225534_4_, i, Direction.NORTH);
|
||||
BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable();
|
||||
|
||||
for(int l = -1; l <= 1; ++l) {
|
||||
@@ -193,16 +_,18 @@
|
||||
return p_176537_1_.func_175727_C(p_176537_2_) || p_176537_1_.func_175727_C(p_176537_2_.func_177976_e()) || p_176537_1_.func_175727_C(p_176537_2_.func_177974_f()) || p_176537_1_.func_175727_C(p_176537_2_.func_177978_c()) || p_176537_1_.func_175727_C(p_176537_2_.func_177968_d());
|
||||
return p_176537_1_.isRainingAt(p_176537_2_) || p_176537_1_.isRainingAt(p_176537_2_.west()) || p_176537_1_.isRainingAt(p_176537_2_.east()) || p_176537_1_.isRainingAt(p_176537_2_.north()) || p_176537_1_.isRainingAt(p_176537_2_.south());
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only.
|
||||
public int func_220274_q(BlockState p_220274_1_) {
|
||||
return p_220274_1_.func_235901_b_(BlockStateProperties.field_208198_y) && p_220274_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149848_b.getInt(p_220274_1_.func_177230_c());
|
||||
public int getBurnOdd(BlockState p_220274_1_) {
|
||||
return p_220274_1_.hasProperty(BlockStateProperties.WATERLOGGED) && p_220274_1_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.burnOdds.getInt(p_220274_1_.getBlock());
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed
|
||||
public int func_220275_r(BlockState p_220275_1_) {
|
||||
return p_220275_1_.func_235901_b_(BlockStateProperties.field_208198_y) && p_220275_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149849_a.getInt(p_220275_1_.func_177230_c());
|
||||
public int getFlameOdds(BlockState p_220275_1_) {
|
||||
return p_220275_1_.hasProperty(BlockStateProperties.WATERLOGGED) && p_220275_1_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.flameOdds.getInt(p_220275_1_.getBlock());
|
||||
}
|
||||
|
||||
- private void func_176536_a(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) {
|
||||
- int i = this.func_220274_q(p_176536_1_.func_180495_p(p_176536_2_));
|
||||
- private void checkBurnOut(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) {
|
||||
- int i = this.getBurnOdd(p_176536_1_.getBlockState(p_176536_2_));
|
||||
+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, Direction face) {
|
||||
+ int i = p_176536_1_.func_180495_p(p_176536_2_).getFlammability(p_176536_1_, p_176536_2_, face);
|
||||
+ int i = p_176536_1_.getBlockState(p_176536_2_).getFlammability(p_176536_1_, p_176536_2_, face);
|
||||
if (p_176536_4_.nextInt(p_176536_3_) < i) {
|
||||
BlockState blockstate = p_176536_1_.func_180495_p(p_176536_2_);
|
||||
if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.func_175727_C(p_176536_2_)) {
|
||||
BlockState blockstate = p_176536_1_.getBlockState(p_176536_2_);
|
||||
if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.isRainingAt(p_176536_2_)) {
|
||||
@@ -212,11 +_,7 @@
|
||||
p_176536_1_.func_217377_a(p_176536_2_, false);
|
||||
p_176536_1_.removeBlock(p_176536_2_, false);
|
||||
}
|
||||
|
||||
- Block block = blockstate.func_177230_c();
|
||||
- Block block = blockstate.getBlock();
|
||||
- if (block instanceof TNTBlock) {
|
||||
- TNTBlock tntblock = (TNTBlock)block;
|
||||
- TNTBlock.func_196534_a(p_176536_1_, p_176536_2_);
|
||||
- TNTBlock.explode(p_176536_1_, p_176536_2_);
|
||||
- }
|
||||
+ blockstate.catchFire(p_176536_1_, p_176536_2_, face, null);
|
||||
}
|
||||
@@ -89,19 +89,19 @@
|
||||
}
|
||||
@@ -228,7 +_,7 @@
|
||||
|
||||
private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) {
|
||||
private boolean isValidFireLocation(IBlockReader p_196447_1_, BlockPos p_196447_2_) {
|
||||
for(Direction direction : Direction.values()) {
|
||||
- if (this.func_196446_i(p_196447_1_.func_180495_p(p_196447_2_.func_177972_a(direction)))) {
|
||||
+ if (this.canCatchFire(p_196447_1_, p_196447_2_.func_177972_a(direction), direction.func_176734_d())) {
|
||||
- if (this.canBurn(p_196447_1_.getBlockState(p_196447_2_.relative(direction)))) {
|
||||
+ if (this.canCatchFire(p_196447_1_, p_196447_2_.relative(direction), direction.getOpposite())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -244,13 +_,14 @@
|
||||
|
||||
for(Direction direction : Direction.values()) {
|
||||
BlockState blockstate = p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(direction));
|
||||
- i = Math.max(this.func_220275_r(blockstate), i);
|
||||
+ i = Math.max(blockstate.getFireSpreadSpeed(p_176538_1_, p_176538_2_.func_177972_a(direction), direction.func_176734_d()), i);
|
||||
BlockState blockstate = p_176538_1_.getBlockState(p_176538_2_.relative(direction));
|
||||
- i = Math.max(this.getFlameOdds(blockstate), i);
|
||||
+ i = Math.max(blockstate.getFireSpreadSpeed(p_176538_1_, p_176538_2_.relative(direction), direction.getOpposite()), i);
|
||||
}
|
||||
|
||||
return i;
|
||||
@@ -109,16 +109,16 @@
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use canCatchFire with more context
|
||||
protected boolean func_196446_i(BlockState p_196446_1_) {
|
||||
return this.func_220275_r(p_196446_1_) > 0;
|
||||
protected boolean canBurn(BlockState p_196446_1_) {
|
||||
return this.getFlameOdds(p_196446_1_) > 0;
|
||||
}
|
||||
@@ -269,8 +_,21 @@
|
||||
}
|
||||
|
||||
private void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) {
|
||||
+ if (p_180686_1_ == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
|
||||
this.field_149849_a.put(p_180686_1_, p_180686_2_);
|
||||
this.field_149848_b.put(p_180686_1_, p_180686_3_);
|
||||
private void setFlammable(Block p_180686_1_, int p_180686_2_, int p_180686_3_) {
|
||||
+ if (p_180686_1_ == Blocks.AIR) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
|
||||
this.flameOdds.put(p_180686_1_, p_180686_2_);
|
||||
this.burnOdds.put(p_180686_1_, p_180686_3_);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -130,7 +130,7 @@
|
||||
+ * @return True if the face can catch fire.
|
||||
+ */
|
||||
+ public boolean canCatchFire(IBlockReader world, BlockPos pos, Direction face) {
|
||||
+ return world.func_180495_p(pos).isFlammable(world, pos, face);
|
||||
+ return world.getBlockState(pos).isFlammable(world, pos, face);
|
||||
}
|
||||
|
||||
public static void func_149843_e() {
|
||||
public static void bootStrap() {
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/block/FlowerPotBlock.java
|
||||
+++ b/net/minecraft/block/FlowerPotBlock.java
|
||||
@@ -24,10 +_,33 @@
|
||||
protected static final VoxelShape field_196450_a = Block.func_208617_a(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
|
||||
private final Block field_196452_c;
|
||||
protected static final VoxelShape SHAPE = Block.box(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
|
||||
private final Block content;
|
||||
|
||||
+ @Deprecated // Mods should use the constructor below
|
||||
public FlowerPotBlock(Block p_i48395_1_, AbstractBlock.Properties p_i48395_2_) {
|
||||
- super(p_i48395_2_);
|
||||
- this.field_196452_c = p_i48395_1_;
|
||||
- field_196451_b.put(p_i48395_1_, this);
|
||||
+ this(Blocks.field_150457_bL == null ? null : () -> (FlowerPotBlock) Blocks.field_150457_bL.delegate.get(), () -> p_i48395_1_.delegate.get(), p_i48395_2_);
|
||||
+ if (Blocks.field_150457_bL != null) {
|
||||
+ ((FlowerPotBlock)Blocks.field_150457_bL).addPlant(p_i48395_1_.getRegistryName(), () -> this);
|
||||
- this.content = p_i48395_1_;
|
||||
- POTTED_BY_CONTENT.put(p_i48395_1_, this);
|
||||
+ this(Blocks.FLOWER_POT == null ? null : () -> (FlowerPotBlock) Blocks.FLOWER_POT.delegate.get(), () -> p_i48395_1_.delegate.get(), p_i48395_2_);
|
||||
+ if (Blocks.FLOWER_POT != null) {
|
||||
+ ((FlowerPotBlock)Blocks.FLOWER_POT).addPlant(p_i48395_1_.getRegistryName(), () -> this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -25,7 +25,7 @@
|
||||
+ */
|
||||
+ public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier<FlowerPotBlock> emptyPot, java.util.function.Supplier<? extends Block> p_i48395_1_, AbstractBlock.Properties properties) {
|
||||
+ super(properties);
|
||||
+ this.field_196452_c = null; // Unused, redirected by coremod
|
||||
+ this.content = null; // Unused, redirected by coremod
|
||||
+ this.flowerDelegate = p_i48395_1_;
|
||||
+ if (emptyPot == null) {
|
||||
+ this.fullPots = Maps.newHashMap();
|
||||
@@ -36,34 +36,34 @@
|
||||
+ }
|
||||
}
|
||||
|
||||
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
|
||||
public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
|
||||
@@ -41,7 +_,7 @@
|
||||
public ActionResultType func_225533_a_(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) {
|
||||
ItemStack itemstack = p_225533_4_.func_184586_b(p_225533_5_);
|
||||
Item item = itemstack.func_77973_b();
|
||||
- Block block = item instanceof BlockItem ? field_196451_b.getOrDefault(((BlockItem)item).func_179223_d(), Blocks.field_150350_a) : Blocks.field_150350_a;
|
||||
+ Block block = item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(((BlockItem)item).func_179223_d().getRegistryName(), Blocks.field_150350_a.delegate).get() : Blocks.field_150350_a;
|
||||
boolean flag = block == Blocks.field_150350_a;
|
||||
boolean flag1 = this.field_196452_c == Blocks.field_150350_a;
|
||||
public ActionResultType use(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) {
|
||||
ItemStack itemstack = p_225533_4_.getItemInHand(p_225533_5_);
|
||||
Item item = itemstack.getItem();
|
||||
- Block block = item instanceof BlockItem ? POTTED_BY_CONTENT.getOrDefault(((BlockItem)item).getBlock(), Blocks.AIR) : Blocks.AIR;
|
||||
+ Block block = item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(((BlockItem)item).getBlock().getRegistryName(), Blocks.AIR.delegate).get() : Blocks.AIR;
|
||||
boolean flag = block == Blocks.AIR;
|
||||
boolean flag1 = this.content == Blocks.AIR;
|
||||
if (flag != flag1) {
|
||||
@@ -59,7 +_,7 @@
|
||||
p_225533_4_.func_71019_a(itemstack1, false);
|
||||
p_225533_4_.drop(itemstack1, false);
|
||||
}
|
||||
|
||||
- p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150457_bL.func_176223_P(), 3);
|
||||
+ p_225533_2_.func_180501_a(p_225533_3_, getEmptyPot().func_176223_P(), 3);
|
||||
- p_225533_2_.setBlock(p_225533_3_, Blocks.FLOWER_POT.defaultBlockState(), 3);
|
||||
+ p_225533_2_.setBlock(p_225533_3_, getEmptyPot().defaultBlockState(), 3);
|
||||
}
|
||||
|
||||
return ActionResultType.func_233537_a_(p_225533_2_.field_72995_K);
|
||||
@@ -77,10 +_,27 @@
|
||||
return ActionResultType.sidedSuccess(p_225533_2_.isClientSide);
|
||||
@@ -77,10 +_,31 @@
|
||||
}
|
||||
|
||||
public Block func_220276_d() {
|
||||
- return this.field_196452_c;
|
||||
public Block getContent() {
|
||||
- return this.content;
|
||||
+ return flowerDelegate.get();
|
||||
}
|
||||
|
||||
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
@@ -82,5 +82,9 @@
|
||||
+ }
|
||||
+ fullPots.put(flower, fullPot);
|
||||
+ }
|
||||
+
|
||||
+ public Map<net.minecraft.util.ResourceLocation, java.util.function.Supplier<? extends Block>> getFullPotsView() {
|
||||
+ return java.util.Collections.unmodifiableMap(fullPots);
|
||||
+ }
|
||||
+ //Forge End
|
||||
}
|
||||
@@ -3,20 +3,20 @@
|
||||
@@ -29,10 +_,11 @@
|
||||
|
||||
public class FlowingFluidBlock extends Block implements IBucketPickupHandler {
|
||||
public static final IntegerProperty field_176367_b = BlockStateProperties.field_208132_ag;
|
||||
- protected final FlowingFluid field_204517_c;
|
||||
+ private final FlowingFluid field_204517_c;
|
||||
private final List<FluidState> field_212565_c;
|
||||
public static final VoxelShape field_235510_c_ = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL;
|
||||
- protected final FlowingFluid fluid;
|
||||
+ private final FlowingFluid fluid;
|
||||
private final List<FluidState> stateCache;
|
||||
public static final VoxelShape STABLE_SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
|
||||
+ @Deprecated // Forge: Use the constructor that takes a supplier
|
||||
public FlowingFluidBlock(FlowingFluid p_i49014_1_, AbstractBlock.Properties p_i49014_2_) {
|
||||
super(p_i49014_2_);
|
||||
this.field_204517_c = p_i49014_1_;
|
||||
this.fluid = p_i49014_1_;
|
||||
@@ -45,6 +_,19 @@
|
||||
|
||||
this.field_212565_c.add(p_i49014_1_.func_207207_a(8, true));
|
||||
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0)));
|
||||
this.stateCache.add(p_i49014_1_.getFlowing(8, true));
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
|
||||
+ fluidStateCacheInitialized = true;
|
||||
+ supplier = p_i49014_1_.delegate;
|
||||
+ }
|
||||
@@ -26,41 +26,41 @@
|
||||
+ */
|
||||
+ public FlowingFluidBlock(java.util.function.Supplier<? extends FlowingFluid> supplier, AbstractBlock.Properties p_i48368_1_) {
|
||||
+ super(p_i48368_1_);
|
||||
+ this.field_204517_c = null;
|
||||
+ this.field_212565_c = Lists.newArrayList();
|
||||
+ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0)));
|
||||
+ this.fluid = null;
|
||||
+ this.stateCache = Lists.newArrayList();
|
||||
+ this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
|
||||
+ this.supplier = supplier;
|
||||
}
|
||||
|
||||
public VoxelShape func_220071_b(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, ISelectionContext p_220071_4_) {
|
||||
public VoxelShape getCollisionShape(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, ISelectionContext p_220071_4_) {
|
||||
@@ -69,6 +_,7 @@
|
||||
|
||||
public FluidState func_204507_t(BlockState p_204507_1_) {
|
||||
int i = p_204507_1_.func_177229_b(field_176367_b);
|
||||
public FluidState getFluidState(BlockState p_204507_1_) {
|
||||
int i = p_204507_1_.getValue(LEVEL);
|
||||
+ if (!fluidStateCacheInitialized) initFluidStateCache();
|
||||
return this.field_212565_c.get(Math.min(i, 8));
|
||||
return this.stateCache.get(Math.min(i, 8));
|
||||
}
|
||||
|
||||
@@ -120,13 +_,13 @@
|
||||
BlockPos blockpos = p_204515_2_.func_177972_a(direction);
|
||||
if (p_204515_1_.func_204610_c(blockpos).func_206884_a(FluidTags.field_206959_a)) {
|
||||
Block block = p_204515_1_.func_204610_c(p_204515_2_).func_206889_d() ? Blocks.field_150343_Z : Blocks.field_150347_e;
|
||||
- p_204515_1_.func_175656_a(p_204515_2_, block.func_176223_P());
|
||||
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, block.func_176223_P()));
|
||||
this.func_180688_d(p_204515_1_, p_204515_2_);
|
||||
BlockPos blockpos = p_204515_2_.relative(direction);
|
||||
if (p_204515_1_.getFluidState(blockpos).is(FluidTags.WATER)) {
|
||||
Block block = p_204515_1_.getFluidState(p_204515_2_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
|
||||
- p_204515_1_.setBlockAndUpdate(p_204515_2_, block.defaultBlockState());
|
||||
+ p_204515_1_.setBlockAndUpdate(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, block.defaultBlockState()));
|
||||
this.fizz(p_204515_1_, p_204515_2_);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flag && p_204515_1_.func_180495_p(blockpos).func_203425_a(Blocks.field_205164_gk)) {
|
||||
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_235337_cO_.func_176223_P());
|
||||
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_235337_cO_.func_176223_P()));
|
||||
this.func_180688_d(p_204515_1_, p_204515_2_);
|
||||
if (flag && p_204515_1_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) {
|
||||
- p_204515_1_.setBlockAndUpdate(p_204515_2_, Blocks.BASALT.defaultBlockState());
|
||||
+ p_204515_1_.setBlockAndUpdate(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.BASALT.defaultBlockState()));
|
||||
this.fizz(p_204515_1_, p_204515_2_);
|
||||
return false;
|
||||
}
|
||||
@@ -151,6 +_,25 @@
|
||||
return this.field_204517_c;
|
||||
return this.fluid;
|
||||
} else {
|
||||
return Fluids.field_204541_a;
|
||||
return Fluids.EMPTY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -73,12 +73,12 @@
|
||||
+ private boolean fluidStateCacheInitialized = false;
|
||||
+ protected synchronized void initFluidStateCache() {
|
||||
+ if (fluidStateCacheInitialized == false) {
|
||||
+ this.field_212565_c.add(getFluid().func_207204_a(false));
|
||||
+ this.stateCache.add(getFluid().getSource(false));
|
||||
+
|
||||
+ for (int i = 1; i < 8; ++i)
|
||||
+ this.field_212565_c.add(getFluid().func_207207_a(8 - i, false));
|
||||
+ this.stateCache.add(getFluid().getFlowing(8 - i, false));
|
||||
+
|
||||
+ this.field_212565_c.add(getFluid().func_207207_a(8, true));
|
||||
+ this.stateCache.add(getFluid().getFlowing(8, true));
|
||||
+ fluidStateCacheInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
+@Deprecated //Forge: Do not use, use BlockState.hasTileEntity/Block.createTileEntity
|
||||
public interface ITileEntityProvider {
|
||||
@Nullable
|
||||
TileEntity func_196283_a_(IBlockReader p_196283_1_);
|
||||
TileEntity newBlockEntity(IBlockReader p_196283_1_);
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
-public class LeavesBlock extends Block {
|
||||
+public class LeavesBlock extends Block implements net.minecraftforge.common.IForgeShearable {
|
||||
public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa;
|
||||
public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s;
|
||||
public static final IntegerProperty DISTANCE = BlockStateProperties.DISTANCE;
|
||||
public static final BooleanProperty PERSISTENT = BlockStateProperties.PERSISTENT;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/MushroomBlock.java
|
||||
+++ b/net/minecraft/block/MushroomBlock.java
|
||||
@@ -64,7 +_,7 @@
|
||||
if (blockstate.func_235714_a_(BlockTags.field_242171_aD)) {
|
||||
if (blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK)) {
|
||||
return true;
|
||||
} else {
|
||||
- return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos);
|
||||
+ return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this);
|
||||
- return p_196260_2_.getRawBrightness(p_196260_3_, 0) < 13 && this.mayPlaceOn(blockstate, p_196260_2_, blockpos);
|
||||
+ return p_196260_2_.getRawBrightness(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
+++ b/net/minecraft/block/NetherWartBlock.java
|
||||
@@ -35,9 +_,10 @@
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
int i = p_225542_1_.func_177229_b(field_176486_a);
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
int i = p_225542_1_.getValue(AGE);
|
||||
- if (i < 3 && p_225542_4_.nextInt(10) == 0) {
|
||||
+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(10) == 0)) {
|
||||
p_225542_1_ = p_225542_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1));
|
||||
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_, 2);
|
||||
p_225542_1_ = p_225542_1_.setValue(AGE, Integer.valueOf(i + 1));
|
||||
p_225542_2_.setBlock(p_225542_3_, p_225542_1_, 2);
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,30 +3,30 @@
|
||||
@@ -50,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void func_196482_a(World p_196482_1_, BlockPos p_196482_2_) {
|
||||
- if (p_196482_1_.func_180495_p(p_196482_2_.func_177984_a()).func_196958_f()) {
|
||||
+ if (p_196482_1_.func_175623_d(p_196482_2_.func_177984_a())) {
|
||||
p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0);
|
||||
private void playNote(World p_196482_1_, BlockPos p_196482_2_) {
|
||||
- if (p_196482_1_.getBlockState(p_196482_2_.above()).isAir()) {
|
||||
+ if (p_196482_1_.isEmptyBlock(p_196482_2_.above())) {
|
||||
p_196482_1_.blockEvent(p_196482_2_, this, 0, 0);
|
||||
}
|
||||
|
||||
@@ -60,7 +_,9 @@
|
||||
if (p_225533_2_.field_72995_K) {
|
||||
if (p_225533_2_.isClientSide) {
|
||||
return ActionResultType.SUCCESS;
|
||||
} else {
|
||||
- p_225533_1_ = p_225533_1_.func_235896_a_(field_196485_c);
|
||||
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.func_177229_b(field_196485_c), p_225533_1_.func_235896_a_(field_196485_c).func_177229_b(field_196485_c));
|
||||
- p_225533_1_ = p_225533_1_.cycle(NOTE);
|
||||
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.getValue(NOTE), p_225533_1_.cycle(NOTE).getValue(NOTE));
|
||||
+ if (_new == -1) return ActionResultType.FAIL;
|
||||
+ p_225533_1_ = p_225533_1_.func_206870_a(field_196485_c, _new);
|
||||
p_225533_2_.func_180501_a(p_225533_3_, p_225533_1_, 3);
|
||||
this.func_196482_a(p_225533_2_, p_225533_3_);
|
||||
p_225533_4_.func_195066_a(Stats.field_188087_U);
|
||||
+ p_225533_1_ = p_225533_1_.setValue(NOTE, _new);
|
||||
p_225533_2_.setBlock(p_225533_3_, p_225533_1_, 3);
|
||||
this.playNote(p_225533_2_, p_225533_3_);
|
||||
p_225533_4_.awardStat(Stats.TUNE_NOTEBLOCK);
|
||||
@@ -76,6 +_,9 @@
|
||||
}
|
||||
|
||||
public boolean func_189539_a(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) {
|
||||
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.func_177229_b(field_196485_c), p_189539_1_.func_177229_b(field_196483_a));
|
||||
public boolean triggerEvent(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) {
|
||||
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.getValue(NOTE), p_189539_1_.getValue(INSTRUMENT));
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
|
||||
+ p_189539_1_ = p_189539_1_.func_206870_a(field_196485_c, e.getVanillaNoteId()).func_206870_a(field_196483_a, e.getInstrument());
|
||||
int i = p_189539_1_.func_177229_b(field_196485_c);
|
||||
+ p_189539_1_ = p_189539_1_.setValue(NOTE, e.getVanillaNoteId()).setValue(INSTRUMENT, e.getInstrument());
|
||||
int i = p_189539_1_.getValue(NOTE);
|
||||
float f = (float)Math.pow(2.0D, (double)(i - 12) / 12.0D);
|
||||
p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, p_189539_1_.func_177229_b(field_196483_a).func_208088_a(), SoundCategory.RECORDS, 3.0F, f);
|
||||
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, p_189539_1_.getValue(INSTRUMENT).getSoundEvent(), SoundCategory.RECORDS, 3.0F, f);
|
||||
@@ -2,18 +2,18 @@
|
||||
+++ b/net/minecraft/block/OreBlock.java
|
||||
@@ -31,12 +_,10 @@
|
||||
|
||||
public void func_220062_a(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
|
||||
super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
|
||||
- if (EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_220062_4_) == 0) {
|
||||
- int i = this.func_220281_a(p_220062_2_.field_73012_v);
|
||||
public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
|
||||
super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
|
||||
- if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, p_220062_4_) == 0) {
|
||||
- int i = this.xpOnDrop(p_220062_2_.random);
|
||||
- if (i > 0) {
|
||||
- this.func_180637_b(p_220062_2_, p_220062_3_, i);
|
||||
- this.popExperience(p_220062_2_, p_220062_3_, i);
|
||||
- }
|
||||
- }
|
||||
+ }
|
||||
|
||||
+ @Override
|
||||
+ public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune, int silktouch) {
|
||||
+ return silktouch == 0 ? this.func_220281_a(RANDOM) : 0;
|
||||
+ return silktouch == 0 ? this.xpOnDrop(RANDOM) : 0;
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,19 @@
|
||||
|
||||
if (p_189539_4_ == 0) {
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, true)) return false;
|
||||
if (!this.func_176319_a(p_189539_2_, p_189539_3_, direction, true)) {
|
||||
if (!this.moveBlocks(p_189539_2_, p_189539_3_, direction, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -165,6 +_,7 @@
|
||||
p_189539_2_.func_180501_a(p_189539_3_, p_189539_1_.func_206870_a(field_176320_b, Boolean.valueOf(true)), 67);
|
||||
p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, SoundEvents.field_187715_dR, SoundCategory.BLOCKS, 0.5F, p_189539_2_.field_73012_v.nextFloat() * 0.25F + 0.6F);
|
||||
p_189539_2_.setBlock(p_189539_3_, p_189539_1_.setValue(EXTENDED, Boolean.valueOf(true)), 67);
|
||||
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, SoundEvents.PISTON_EXTEND, SoundCategory.BLOCKS, 0.5F, p_189539_2_.random.nextFloat() * 0.25F + 0.6F);
|
||||
} else if (p_189539_4_ == 1 || p_189539_4_ == 2) {
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, false)) return false;
|
||||
TileEntity tileentity1 = p_189539_2_.func_175625_s(p_189539_3_.func_177972_a(direction));
|
||||
TileEntity tileentity1 = p_189539_2_.getBlockEntity(p_189539_3_.relative(direction));
|
||||
if (tileentity1 instanceof PistonTileEntity) {
|
||||
((PistonTileEntity)tileentity1).func_145866_f();
|
||||
((PistonTileEntity)tileentity1).finalTick();
|
||||
@@ -204,6 +_,7 @@
|
||||
p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, SoundEvents.field_187712_dQ, SoundCategory.BLOCKS, 0.5F, p_189539_2_.field_73012_v.nextFloat() * 0.15F + 0.6F);
|
||||
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, SoundEvents.PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, p_189539_2_.random.nextFloat() * 0.15F + 0.6F);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(p_189539_2_, p_189539_3_, direction, (p_189539_4_ == 0));
|
||||
@@ -28,7 +28,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- return !p_185646_0_.func_177230_c().func_235695_q_();
|
||||
- return !p_185646_0_.getBlock().isEntityBlock();
|
||||
+ return !p_185646_0_.hasTileEntity();
|
||||
}
|
||||
} else {
|
||||
@@ -36,20 +36,20 @@
|
||||
@@ -273,7 +_,7 @@
|
||||
for(int k = list2.size() - 1; k >= 0; --k) {
|
||||
BlockPos blockpos2 = list2.get(k);
|
||||
BlockState blockstate1 = p_176319_1_.func_180495_p(blockpos2);
|
||||
- TileEntity tileentity = blockstate1.func_177230_c().func_235695_q_() ? p_176319_1_.func_175625_s(blockpos2) : null;
|
||||
+ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.func_175625_s(blockpos2) : null;
|
||||
func_220059_a(blockstate1, p_176319_1_, blockpos2, tileentity);
|
||||
p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18);
|
||||
BlockState blockstate1 = p_176319_1_.getBlockState(blockpos2);
|
||||
- TileEntity tileentity = blockstate1.getBlock().isEntityBlock() ? p_176319_1_.getBlockEntity(blockpos2) : null;
|
||||
+ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.getBlockEntity(blockpos2) : null;
|
||||
dropResources(blockstate1, p_176319_1_, blockpos2, tileentity);
|
||||
p_176319_1_.setBlock(blockpos2, Blocks.AIR.defaultBlockState(), 18);
|
||||
ablockstate[j++] = blockstate1;
|
||||
@@ -335,6 +_,10 @@
|
||||
|
||||
public BlockState func_185499_a(BlockState p_185499_1_, Rotation p_185499_2_) {
|
||||
return p_185499_1_.func_206870_a(field_176387_N, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176387_N)));
|
||||
public BlockState rotate(BlockState p_185499_1_, Rotation p_185499_2_) {
|
||||
return p_185499_1_.setValue(FACING, p_185499_2_.rotate(p_185499_1_.getValue(FACING)));
|
||||
+ }
|
||||
+
|
||||
+ public BlockState rotate(BlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) {
|
||||
+ return state.func_177229_b(field_176320_b) ? state : super.rotate(state, world, pos, direction);
|
||||
+ return state.getValue(EXTENDED) ? state : super.rotate(state, world, pos, direction);
|
||||
}
|
||||
|
||||
public BlockState func_185471_a(BlockState p_185471_1_, Mirror p_185471_2_) {
|
||||
public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) {
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/block/PistonBlockStructureHelper.java
|
||||
@@ -48,7 +_,7 @@
|
||||
} else {
|
||||
for(int i = 0; i < this.field_177258_e.size(); ++i) {
|
||||
BlockPos blockpos = this.field_177258_e.get(i);
|
||||
- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos).func_177230_c()) && !this.func_177250_b(blockpos)) {
|
||||
+ if (this.field_177261_a.func_180495_p(blockpos).isStickyBlock() && !this.func_177250_b(blockpos)) {
|
||||
for(int i = 0; i < this.toPush.size(); ++i) {
|
||||
BlockPos blockpos = this.toPush.get(i);
|
||||
- if (isSticky(this.level.getBlockState(blockpos).getBlock()) && !this.addBranchingBlocks(blockpos)) {
|
||||
+ if (this.level.getBlockState(blockpos).isStickyBlock() && !this.addBranchingBlocks(blockpos)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -13,69 +13,69 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private static boolean func_227029_a_(Block p_227029_0_) {
|
||||
- return p_227029_0_ == Blocks.field_180399_cE || p_227029_0_ == Blocks.field_226907_mc_;
|
||||
- private static boolean isSticky(Block p_227029_0_) {
|
||||
- return p_227029_0_ == Blocks.SLIME_BLOCK || p_227029_0_ == Blocks.HONEY_BLOCK;
|
||||
- }
|
||||
-
|
||||
- private static boolean func_227030_a_(Block p_227030_0_, Block p_227030_1_) {
|
||||
- if (p_227030_0_ == Blocks.field_226907_mc_ && p_227030_1_ == Blocks.field_180399_cE) {
|
||||
- private static boolean canStickToEachOther(Block p_227030_0_, Block p_227030_1_) {
|
||||
- if (p_227030_0_ == Blocks.HONEY_BLOCK && p_227030_1_ == Blocks.SLIME_BLOCK) {
|
||||
- return false;
|
||||
- } else if (p_227030_0_ == Blocks.field_180399_cE && p_227030_1_ == Blocks.field_226907_mc_) {
|
||||
- } else if (p_227030_0_ == Blocks.SLIME_BLOCK && p_227030_1_ == Blocks.HONEY_BLOCK) {
|
||||
- return false;
|
||||
- } else {
|
||||
- return func_227029_a_(p_227030_0_) || func_227029_a_(p_227030_1_);
|
||||
- return isSticky(p_227030_0_) || isSticky(p_227030_1_);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
private boolean func_177251_a(BlockPos p_177251_1_, Direction p_177251_2_) {
|
||||
BlockState blockstate = this.field_177261_a.func_180495_p(p_177251_1_);
|
||||
- Block block = blockstate.func_177230_c();
|
||||
- if (blockstate.func_196958_f()) {
|
||||
+ if (field_177261_a.func_175623_d(p_177251_1_)) {
|
||||
private boolean addBlockLine(BlockPos p_177251_1_, Direction p_177251_2_) {
|
||||
BlockState blockstate = this.level.getBlockState(p_177251_1_);
|
||||
- Block block = blockstate.getBlock();
|
||||
- if (blockstate.isAir()) {
|
||||
+ if (level.isEmptyBlock(p_177251_1_)) {
|
||||
return true;
|
||||
} else if (!PistonBlock.func_185646_a(blockstate, this.field_177261_a, p_177251_1_, this.field_177257_d, false, p_177251_2_)) {
|
||||
} else if (!PistonBlock.isPushable(blockstate, this.level, p_177251_1_, this.pushDirection, false, p_177251_2_)) {
|
||||
return true;
|
||||
@@ -87,12 +_,12 @@
|
||||
if (i + this.field_177258_e.size() > 12) {
|
||||
if (i + this.toPush.size() > 12) {
|
||||
return false;
|
||||
} else {
|
||||
- while(func_227029_a_(block)) {
|
||||
- while(isSticky(block)) {
|
||||
+ BlockState oldState;
|
||||
+ while(blockstate.isStickyBlock()) {
|
||||
BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i);
|
||||
BlockPos blockpos = p_177251_1_.relative(this.pushDirection.getOpposite(), i);
|
||||
- Block block1 = block;
|
||||
+ oldState = blockstate;
|
||||
blockstate = this.field_177261_a.func_180495_p(blockpos);
|
||||
- block = blockstate.func_177230_c();
|
||||
- if (blockstate.func_196958_f() || !func_227030_a_(block1, block) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) {
|
||||
+ if (blockstate.isAir(this.field_177261_a, blockpos) || !oldState.canStickTo(blockstate) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) {
|
||||
blockstate = this.level.getBlockState(blockpos);
|
||||
- block = blockstate.getBlock();
|
||||
- if (blockstate.isAir() || !canStickToEachOther(block1, block) || !PistonBlock.isPushable(blockstate, this.level, blockpos, this.pushDirection, false, this.pushDirection.getOpposite()) || blockpos.equals(this.pistonPos)) {
|
||||
+ if (blockstate.isAir(this.level, blockpos) || !oldState.canStickTo(blockstate) || !PistonBlock.isPushable(blockstate, this.level, blockpos, this.pushDirection, false, this.pushDirection.getOpposite()) || blockpos.equals(this.pistonPos)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -119,7 +_,7 @@
|
||||
|
||||
for(int k = 0; k <= j + l; ++k) {
|
||||
BlockPos blockpos2 = this.field_177258_e.get(k);
|
||||
- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos2).func_177230_c()) && !this.func_177250_b(blockpos2)) {
|
||||
+ if (this.field_177261_a.func_180495_p(blockpos2).isStickyBlock() && !this.func_177250_b(blockpos2)) {
|
||||
BlockPos blockpos2 = this.toPush.get(k);
|
||||
- if (isSticky(this.level.getBlockState(blockpos2).getBlock()) && !this.addBranchingBlocks(blockpos2)) {
|
||||
+ if (this.level.getBlockState(blockpos2).isStickyBlock() && !this.addBranchingBlocks(blockpos2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +_,7 @@
|
||||
}
|
||||
|
||||
blockstate = this.field_177261_a.func_180495_p(blockpos1);
|
||||
- if (blockstate.func_196958_f()) {
|
||||
+ if (blockstate.isAir(field_177261_a, blockpos1)) {
|
||||
blockstate = this.level.getBlockState(blockpos1);
|
||||
- if (blockstate.isAir()) {
|
||||
+ if (blockstate.isAir(level, blockpos1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -173,7 +_,7 @@
|
||||
if (direction.func_176740_k() != this.field_177257_d.func_176740_k()) {
|
||||
BlockPos blockpos = p_177250_1_.func_177972_a(direction);
|
||||
BlockState blockstate1 = this.field_177261_a.func_180495_p(blockpos);
|
||||
- if (func_227030_a_(blockstate1.func_177230_c(), blockstate.func_177230_c()) && !this.func_177251_a(blockpos, direction)) {
|
||||
+ if (blockstate1.canStickTo(blockstate) && !this.func_177251_a(blockpos, direction)) {
|
||||
if (direction.getAxis() != this.pushDirection.getAxis()) {
|
||||
BlockPos blockpos = p_177250_1_.relative(direction);
|
||||
BlockState blockstate1 = this.level.getBlockState(blockpos);
|
||||
- if (canStickToEachOther(blockstate1.getBlock(), blockstate.getBlock()) && !this.addBlockLine(blockpos, direction)) {
|
||||
+ if (blockstate1.canStickTo(blockstate) && !this.addBlockLine(blockpos, direction)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -16,7 +_,7 @@
|
||||
|
||||
public class PortalSize {
|
||||
private static final AbstractBlock.IPositionPredicate field_242962_a = (p_242966_0_, p_242966_1_, p_242966_2_) -> {
|
||||
- return p_242966_0_.func_203425_a(Blocks.field_150343_Z);
|
||||
private static final AbstractBlock.IPositionPredicate FRAME = (p_242966_0_, p_242966_1_, p_242966_2_) -> {
|
||||
- return p_242966_0_.is(Blocks.OBSIDIAN);
|
||||
+ return p_242966_0_.isPortalFrame(p_242966_1_, p_242966_2_);
|
||||
};
|
||||
private final IWorld field_150867_a;
|
||||
private final Direction.Axis field_150865_b;
|
||||
private final IWorld level;
|
||||
private final Direction.Axis axis;
|
||||
@@ -2,8 +2,8 @@
|
||||
+++ b/net/minecraft/block/PoweredRailBlock.java
|
||||
@@ -14,10 +_,16 @@
|
||||
public class PoweredRailBlock extends AbstractRailBlock {
|
||||
public static final EnumProperty<RailShape> field_176568_b = BlockStateProperties.field_208166_S;
|
||||
public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u;
|
||||
public static final EnumProperty<RailShape> SHAPE = BlockStateProperties.RAIL_SHAPE_STRAIGHT;
|
||||
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
|
||||
+ private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail
|
||||
|
||||
public PoweredRailBlock(AbstractBlock.Properties p_i48349_1_) {
|
||||
@@ -13,42 +13,42 @@
|
||||
+
|
||||
+ protected PoweredRailBlock(AbstractBlock.Properties builder, boolean isPoweredRail) {
|
||||
+ super(true, builder);
|
||||
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176568_b, RailShape.NORTH_SOUTH).func_206870_a(field_176569_M, Boolean.valueOf(false)));
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(SHAPE, RailShape.NORTH_SOUTH).setValue(POWERED, Boolean.valueOf(false)));
|
||||
+ this.isActivator = !isPoweredRail;
|
||||
}
|
||||
|
||||
protected boolean func_176566_a(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) {
|
||||
protected boolean findPoweredRailSignal(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) {
|
||||
@@ -99,13 +_,13 @@
|
||||
|
||||
protected boolean func_208071_a(World p_208071_1_, BlockPos p_208071_2_, boolean p_208071_3_, int p_208071_4_, RailShape p_208071_5_) {
|
||||
BlockState blockstate = p_208071_1_.func_180495_p(p_208071_2_);
|
||||
- if (!blockstate.func_203425_a(this)) {
|
||||
+ if (!(blockstate.func_177230_c() instanceof PoweredRailBlock)) {
|
||||
protected boolean isSameRailWithPower(World p_208071_1_, BlockPos p_208071_2_, boolean p_208071_3_, int p_208071_4_, RailShape p_208071_5_) {
|
||||
BlockState blockstate = p_208071_1_.getBlockState(p_208071_2_);
|
||||
- if (!blockstate.is(this)) {
|
||||
+ if (!(blockstate.getBlock() instanceof PoweredRailBlock)) {
|
||||
return false;
|
||||
} else {
|
||||
- RailShape railshape = blockstate.func_177229_b(field_176568_b);
|
||||
- RailShape railshape = blockstate.getValue(SHAPE);
|
||||
+ RailShape railshape = getRailDirection(blockstate, p_208071_1_, p_208071_2_, null);
|
||||
if (p_208071_5_ != RailShape.EAST_WEST || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) {
|
||||
if (p_208071_5_ != RailShape.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) {
|
||||
- if (blockstate.func_177229_b(field_176569_M)) {
|
||||
+ if (isActivator == (((PoweredRailBlock) blockstate.func_177230_c()).isActivator)) {
|
||||
return p_208071_1_.func_175640_z(p_208071_2_) ? true : this.func_176566_a(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1);
|
||||
- if (blockstate.getValue(POWERED)) {
|
||||
+ if (isActivator == (((PoweredRailBlock) blockstate.getBlock()).isActivator)) {
|
||||
return p_208071_1_.hasNeighborSignal(p_208071_2_) ? true : this.findPoweredRailSignal(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1);
|
||||
} else {
|
||||
return false;
|
||||
@@ -156,6 +_,9 @@
|
||||
return p_185499_1_.func_206870_a(field_176568_b, RailShape.SOUTH_EAST);
|
||||
return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_EAST);
|
||||
case NORTH_EAST:
|
||||
return p_185499_1_.func_206870_a(field_176568_b, RailShape.SOUTH_WEST);
|
||||
return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_WEST);
|
||||
+ case NORTH_SOUTH: //Forge fix: MC-196102
|
||||
+ case EAST_WEST:
|
||||
+ return p_185499_1_;
|
||||
}
|
||||
case COUNTERCLOCKWISE_90:
|
||||
switch((RailShape)p_185499_1_.func_177229_b(field_176568_b)) {
|
||||
switch((RailShape)p_185499_1_.getValue(SHAPE)) {
|
||||
@@ -254,5 +_,9 @@
|
||||
|
||||
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.func_206894_a(field_176568_b, field_176569_M);
|
||||
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.add(SHAPE, POWERED);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isActivatorRail() {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/block/RailBlock.java
|
||||
+++ b/net/minecraft/block/RailBlock.java
|
||||
@@ -49,6 +_,9 @@
|
||||
return p_185499_1_.func_206870_a(field_176565_b, RailShape.SOUTH_EAST);
|
||||
return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_EAST);
|
||||
case NORTH_EAST:
|
||||
return p_185499_1_.func_206870_a(field_176565_b, RailShape.SOUTH_WEST);
|
||||
return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_WEST);
|
||||
+ case NORTH_SOUTH: //Forge fix: MC-196102
|
||||
+ case EAST_WEST:
|
||||
+ return p_185499_1_;
|
||||
}
|
||||
case COUNTERCLOCKWISE_90:
|
||||
switch((RailShape)p_185499_1_.func_177229_b(field_176565_b)) {
|
||||
switch((RailShape)p_185499_1_.getValue(SHAPE)) {
|
||||
@@ -1,22 +1,22 @@
|
||||
--- a/net/minecraft/block/RailState.java
|
||||
+++ b/net/minecraft/block/RailState.java
|
||||
@@ -15,14 +_,16 @@
|
||||
private BlockState field_196923_d;
|
||||
private final boolean field_208513_e;
|
||||
private final List<BlockPos> field_196924_e = Lists.newArrayList();
|
||||
private BlockState state;
|
||||
private final boolean isStraight;
|
||||
private final List<BlockPos> connections = Lists.newArrayList();
|
||||
+ private final boolean canMakeSlopes;
|
||||
|
||||
public RailState(World p_i47755_1_, BlockPos p_i47755_2_, BlockState p_i47755_3_) {
|
||||
this.field_196920_a = p_i47755_1_;
|
||||
this.field_196921_b = p_i47755_2_;
|
||||
this.field_196923_d = p_i47755_3_;
|
||||
this.field_196922_c = (AbstractRailBlock)p_i47755_3_.func_177230_c();
|
||||
- RailShape railshape = p_i47755_3_.func_177229_b(this.field_196922_c.func_176560_l());
|
||||
- this.field_208513_e = this.field_196922_c.func_208490_b();
|
||||
+ RailShape railshape = this.field_196922_c.getRailDirection(field_196923_d, p_i47755_1_, p_i47755_2_, null);
|
||||
+ this.field_208513_e = !this.field_196922_c.isFlexibleRail(field_196923_d, p_i47755_1_, p_i47755_2_);
|
||||
+ this.canMakeSlopes = this.field_196922_c.canMakeSlopes(field_196923_d, p_i47755_1_, p_i47755_2_);
|
||||
this.func_208509_a(railshape);
|
||||
this.level = p_i47755_1_;
|
||||
this.pos = p_i47755_2_;
|
||||
this.state = p_i47755_3_;
|
||||
this.block = (AbstractRailBlock)p_i47755_3_.getBlock();
|
||||
- RailShape railshape = p_i47755_3_.getValue(this.block.getShapeProperty());
|
||||
- this.isStraight = this.block.isStraight();
|
||||
+ RailShape railshape = this.block.getRailDirection(state, p_i47755_1_, p_i47755_2_, null);
|
||||
+ this.isStraight = !this.block.isFlexibleRail(state, p_i47755_1_, p_i47755_2_);
|
||||
+ this.canMakeSlopes = this.block.canMakeSlopes(state, p_i47755_1_, p_i47755_2_);
|
||||
this.updateConnections(railshape);
|
||||
}
|
||||
|
||||
@@ -178,7 +_,7 @@
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
- if (railshape == RailShape.NORTH_SOUTH) {
|
||||
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
|
||||
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
|
||||
if (AbstractRailBlock.isRail(this.level, blockpos.above())) {
|
||||
railshape = RailShape.ASCENDING_NORTH;
|
||||
}
|
||||
@@ -188,7 +_,7 @@
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
- if (railshape == RailShape.EAST_WEST) {
|
||||
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
|
||||
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
|
||||
if (AbstractRailBlock.isRail(this.level, blockpos3.above())) {
|
||||
railshape = RailShape.ASCENDING_EAST;
|
||||
}
|
||||
@@ -304,7 +_,7 @@
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
- if (railshape == RailShape.NORTH_SOUTH) {
|
||||
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
|
||||
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
|
||||
if (AbstractRailBlock.isRail(this.level, blockpos.above())) {
|
||||
railshape = RailShape.ASCENDING_NORTH;
|
||||
}
|
||||
@@ -314,7 +_,7 @@
|
||||
@@ -52,6 +52,6 @@
|
||||
|
||||
- if (railshape == RailShape.EAST_WEST) {
|
||||
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
|
||||
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
|
||||
if (AbstractRailBlock.isRail(this.level, blockpos3.above())) {
|
||||
railshape = RailShape.ASCENDING_EAST;
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/block/RedstoneDiodeBlock.java
|
||||
+++ b/net/minecraft/block/RedstoneDiodeBlock.java
|
||||
@@ -65,7 +_,7 @@
|
||||
if (p_220069_1_.func_196955_c(p_220069_2_, p_220069_3_)) {
|
||||
this.func_176398_g(p_220069_2_, p_220069_3_, p_220069_1_);
|
||||
if (p_220069_1_.canSurvive(p_220069_2_, p_220069_3_)) {
|
||||
this.checkTickOnNeighbor(p_220069_2_, p_220069_3_, p_220069_1_);
|
||||
} else {
|
||||
- TileEntity tileentity = this.func_235695_q_() ? p_220069_2_.func_175625_s(p_220069_3_) : null;
|
||||
+ TileEntity tileentity = p_220069_1_.hasTileEntity() ? p_220069_2_.func_175625_s(p_220069_3_) : null;
|
||||
func_220059_a(p_220069_1_, p_220069_2_, p_220069_3_, tileentity);
|
||||
p_220069_2_.func_217377_a(p_220069_3_, false);
|
||||
- TileEntity tileentity = this.isEntityBlock() ? p_220069_2_.getBlockEntity(p_220069_3_) : null;
|
||||
+ TileEntity tileentity = p_220069_1_.hasTileEntity() ? p_220069_2_.getBlockEntity(p_220069_3_) : null;
|
||||
dropResources(p_220069_1_, p_220069_2_, p_220069_3_, tileentity);
|
||||
p_220069_2_.removeBlock(p_220069_3_, false);
|
||||
|
||||
@@ -163,6 +_,8 @@
|
||||
protected void func_176400_h(World p_176400_1_, BlockPos p_176400_2_, BlockState p_176400_3_) {
|
||||
Direction direction = p_176400_3_.func_177229_b(field_185512_D);
|
||||
BlockPos blockpos = p_176400_2_.func_177972_a(direction.func_176734_d());
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(direction.func_176734_d()), false).isCanceled())
|
||||
protected void updateNeighborsInFront(World p_176400_1_, BlockPos p_176400_2_, BlockState p_176400_3_) {
|
||||
Direction direction = p_176400_3_.getValue(FACING);
|
||||
BlockPos blockpos = p_176400_2_.relative(direction.getOpposite());
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.getBlockState(p_176400_2_), java.util.EnumSet.of(direction.getOpposite()), false).isCanceled())
|
||||
+ return;
|
||||
p_176400_1_.func_190524_a(blockpos, this, p_176400_2_);
|
||||
p_176400_1_.func_175695_a(blockpos, this, direction);
|
||||
p_176400_1_.neighborChanged(blockpos, this, p_176400_2_);
|
||||
p_176400_1_.updateNeighborsAtExceptFromFacing(blockpos, this, direction);
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
+++ b/net/minecraft/block/RedstoneOreBlock.java
|
||||
@@ -71,11 +_,11 @@
|
||||
|
||||
public void func_220062_a(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
|
||||
super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
|
||||
- if (EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_220062_4_) == 0) {
|
||||
- int i = 1 + p_220062_2_.field_73012_v.nextInt(5);
|
||||
- this.func_180637_b(p_220062_2_, p_220062_3_, i);
|
||||
public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
|
||||
super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
|
||||
- if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, p_220062_4_) == 0) {
|
||||
- int i = 1 + p_220062_2_.random.nextInt(5);
|
||||
- this.popExperience(p_220062_2_, p_220062_3_, i);
|
||||
- }
|
||||
+ }
|
||||
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
--- a/net/minecraft/block/RedstoneWireBlock.java
|
||||
+++ b/net/minecraft/block/RedstoneWireBlock.java
|
||||
@@ -184,7 +_,7 @@
|
||||
BlockState blockstate = p_235545_1_.func_180495_p(blockpos);
|
||||
BlockState blockstate = p_235545_1_.getBlockState(blockpos);
|
||||
if (p_235545_4_) {
|
||||
boolean flag = this.func_235552_b_(p_235545_1_, blockpos, blockstate);
|
||||
- if (flag && func_176346_d(p_235545_1_.func_180495_p(blockpos.func_177984_a()))) {
|
||||
+ if (flag && canConnectTo(p_235545_1_.func_180495_p(blockpos.func_177984_a()), p_235545_1_, blockpos.func_177984_a(), null) ) {
|
||||
if (blockstate.func_224755_d(p_235545_1_, blockpos, p_235545_3_.func_176734_d())) {
|
||||
boolean flag = this.canSurviveOn(p_235545_1_, blockpos, blockstate);
|
||||
- if (flag && shouldConnectTo(p_235545_1_.getBlockState(blockpos.above()))) {
|
||||
+ if (flag && canConnectTo(p_235545_1_.getBlockState(blockpos.above()), p_235545_1_, blockpos.above(), null) ) {
|
||||
if (blockstate.isFaceSturdy(p_235545_1_, blockpos, p_235545_3_.getOpposite())) {
|
||||
return RedstoneSide.UP;
|
||||
}
|
||||
@@ -193,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- return !func_176343_a(blockstate, p_235545_3_) && (blockstate.func_215686_e(p_235545_1_, blockpos) || !func_176346_d(p_235545_1_.func_180495_p(blockpos.func_177977_b()))) ? RedstoneSide.NONE : RedstoneSide.SIDE;
|
||||
+ return !canConnectTo(blockstate, p_235545_1_, blockpos, p_235545_3_) && (blockstate.func_215686_e(p_235545_1_, blockpos) || !canConnectTo(p_235545_1_.func_180495_p(blockpos.func_177977_b()), p_235545_1_, blockpos.func_177977_b(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE;
|
||||
- return !shouldConnectTo(blockstate, p_235545_3_) && (blockstate.isRedstoneConductor(p_235545_1_, blockpos) || !shouldConnectTo(p_235545_1_.getBlockState(blockpos.below()))) ? RedstoneSide.NONE : RedstoneSide.SIDE;
|
||||
+ return !canConnectTo(blockstate, p_235545_1_, blockpos, p_235545_3_) && (blockstate.isRedstoneConductor(p_235545_1_, blockpos) || !canConnectTo(p_235545_1_.getBlockState(blockpos.below()), p_235545_1_, blockpos.below(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE;
|
||||
}
|
||||
|
||||
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
|
||||
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
|
||||
@@ -335,11 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- protected static boolean func_176346_d(BlockState p_176346_0_) {
|
||||
- return func_176343_a(p_176346_0_, (Direction)null);
|
||||
- protected static boolean shouldConnectTo(BlockState p_176346_0_) {
|
||||
- return shouldConnectTo(p_176346_0_, (Direction)null);
|
||||
- }
|
||||
-
|
||||
- protected static boolean func_176343_a(BlockState p_176343_0_, @Nullable Direction p_176343_1_) {
|
||||
- protected static boolean shouldConnectTo(BlockState p_176343_0_, @Nullable Direction p_176343_1_) {
|
||||
+ protected static boolean canConnectTo(BlockState p_176343_0_, IBlockReader world, BlockPos pos, @Nullable Direction p_176343_1_) {
|
||||
if (p_176343_0_.func_203425_a(Blocks.field_150488_af)) {
|
||||
if (p_176343_0_.is(Blocks.REDSTONE_WIRE)) {
|
||||
return true;
|
||||
} else if (p_176343_0_.func_203425_a(Blocks.field_196633_cV)) {
|
||||
} else if (p_176343_0_.is(Blocks.REPEATER)) {
|
||||
@@ -348,7 +_,7 @@
|
||||
} else if (p_176343_0_.func_203425_a(Blocks.field_190976_dk)) {
|
||||
return p_176343_1_ == p_176343_0_.func_177229_b(ObserverBlock.field_176387_N);
|
||||
} else if (p_176343_0_.is(Blocks.OBSERVER)) {
|
||||
return p_176343_1_ == p_176343_0_.getValue(ObserverBlock.FACING);
|
||||
} else {
|
||||
- return p_176343_0_.func_185897_m() && p_176343_1_ != null;
|
||||
- return p_176343_0_.isSignalSource() && p_176343_1_ != null;
|
||||
+ return p_176343_0_.canConnectRedstone(world, pos, p_176343_1_) && p_176343_1_ != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
+++ b/net/minecraft/block/SaplingBlock.java
|
||||
@@ -29,6 +_,7 @@
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
if (p_225542_2_.func_201696_r(p_225542_3_.func_177984_a()) >= 9 && p_225542_4_.nextInt(7) == 0) {
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
if (p_225542_2_.getMaxLocalRawBrightness(p_225542_3_.above()) >= 9 && p_225542_4_.nextInt(7) == 0) {
|
||||
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
|
||||
this.func_226942_a_(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_);
|
||||
this.advanceTree(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_);
|
||||
}
|
||||
|
||||
@@ -38,6 +_,7 @@
|
||||
if (p_226942_3_.func_177229_b(field_176479_b) == 0) {
|
||||
p_226942_1_.func_180501_a(p_226942_2_, p_226942_3_.func_235896_a_(field_176479_b), 4);
|
||||
if (p_226942_3_.getValue(STAGE) == 0) {
|
||||
p_226942_1_.setBlock(p_226942_2_, p_226942_3_.cycle(STAGE), 4);
|
||||
} else {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_226942_1_, p_226942_4_, p_226942_2_)) return;
|
||||
this.field_196387_c.func_230339_a_(p_226942_1_, p_226942_1_.func_72863_F().func_201711_g(), p_226942_2_, p_226942_3_, p_226942_4_);
|
||||
this.treeGrower.growTree(p_226942_1_, p_226942_1_.getChunkSource().getGenerator(), p_226942_2_, p_226942_3_, p_226942_4_);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
-public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer {
|
||||
+public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer, net.minecraftforge.common.IForgeShearable {
|
||||
protected static final VoxelShape field_207798_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
|
||||
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
|
||||
|
||||
public SeaGrassBlock(AbstractBlock.Properties p_i48780_1_) {
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/block/SoundType.java
|
||||
+++ b/net/minecraft/block/SoundType.java
|
||||
@@ -59,6 +_,7 @@
|
||||
private final SoundEvent field_185865_r;
|
||||
private final SoundEvent field_185866_s;
|
||||
private final SoundEvent hitSound;
|
||||
private final SoundEvent fallSound;
|
||||
|
||||
+ @Deprecated // Forge: Use {@link net.minecraftforge.common.util.ForgeSoundType} instead for suppliers
|
||||
public SoundType(float p_i46679_1_, float p_i46679_2_, SoundEvent p_i46679_3_, SoundEvent p_i46679_4_, SoundEvent p_i46679_5_, SoundEvent p_i46679_6_, SoundEvent p_i46679_7_) {
|
||||
this.field_185860_m = p_i46679_1_;
|
||||
this.field_185861_n = p_i46679_2_;
|
||||
this.volume = p_i46679_1_;
|
||||
this.pitch = p_i46679_2_;
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/block/SpawnerBlock.java
|
||||
@@ -18,8 +_,11 @@
|
||||
|
||||
public void func_220062_a(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
|
||||
super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
|
||||
- int i = 15 + p_220062_2_.field_73012_v.nextInt(15) + p_220062_2_.field_73012_v.nextInt(15);
|
||||
- this.func_180637_b(p_220062_2_, p_220062_3_, i);
|
||||
public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
|
||||
super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
|
||||
- int i = 15 + p_220062_2_.random.nextInt(15) + p_220062_2_.random.nextInt(15);
|
||||
- this.popExperience(p_220062_2_, p_220062_3_, i);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -13,4 +13,4 @@
|
||||
+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
|
||||
}
|
||||
|
||||
public BlockRenderType func_149645_b(BlockState p_149645_1_) {
|
||||
public BlockRenderType getRenderShape(BlockState p_149645_1_) {
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -64,7 +_,7 @@
|
||||
queue.add(new Tuple<>(blockpos1, j + 1));
|
||||
}
|
||||
} else if (material == Material.field_203243_f || material == Material.field_204868_h) {
|
||||
- TileEntity tileentity = blockstate.func_177230_c().func_235695_q_() ? p_176312_1_.func_175625_s(blockpos1) : null;
|
||||
+ TileEntity tileentity = blockstate.hasTileEntity() ? p_176312_1_.func_175625_s(blockpos1) : null;
|
||||
func_220059_a(blockstate, p_176312_1_, blockpos1, tileentity);
|
||||
p_176312_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3);
|
||||
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
||||
- TileEntity tileentity = blockstate.getBlock().isEntityBlock() ? p_176312_1_.getBlockEntity(blockpos1) : null;
|
||||
+ TileEntity tileentity = blockstate.hasTileEntity() ? p_176312_1_.getBlockEntity(blockpos1) : null;
|
||||
dropResources(blockstate, p_176312_1_, blockpos1, tileentity);
|
||||
p_176312_1_.setBlock(blockpos1, Blocks.AIR.defaultBlockState(), 3);
|
||||
++i;
|
||||
@@ -2,9 +2,9 @@
|
||||
+++ b/net/minecraft/block/SpreadableSnowyDirtBlock.java
|
||||
@@ -33,6 +_,7 @@
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
if (!func_220257_b(p_225542_1_, p_225542_2_, p_225542_3_)) {
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
if (!canBeGrass(p_225542_1_, p_225542_2_, p_225542_3_)) {
|
||||
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
|
||||
p_225542_2_.func_175656_a(p_225542_3_, Blocks.field_150346_d.func_176223_P());
|
||||
p_225542_2_.setBlockAndUpdate(p_225542_3_, Blocks.DIRT.defaultBlockState());
|
||||
} else {
|
||||
if (p_225542_2_.func_201696_r(p_225542_3_.func_177984_a()) >= 9) {
|
||||
if (p_225542_2_.getMaxLocalRawBrightness(p_225542_3_.above()) >= 9) {
|
||||
@@ -7,30 +7,30 @@
|
||||
+ @Deprecated // Forge: Use the other constructor that takes a Supplier
|
||||
public StairsBlock(BlockState p_i48321_1_, AbstractBlock.Properties p_i48321_2_) {
|
||||
super(p_i48321_2_);
|
||||
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false)));
|
||||
this.field_150149_b = p_i48321_1_.func_177230_c();
|
||||
this.field_150151_M = p_i48321_1_;
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(HALF, Half.BOTTOM).setValue(SHAPE, StairsShape.STRAIGHT).setValue(WATERLOGGED, Boolean.valueOf(false)));
|
||||
this.base = p_i48321_1_.getBlock();
|
||||
this.baseState = p_i48321_1_;
|
||||
+ this.stateSupplier = () -> p_i48321_1_;
|
||||
+ }
|
||||
+
|
||||
+ public StairsBlock(java.util.function.Supplier<BlockState> state, AbstractBlock.Properties properties) {
|
||||
+ super(properties);
|
||||
+ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false)));
|
||||
+ this.field_150149_b = Blocks.field_150350_a; // These are unused, fields are redirected
|
||||
+ this.field_150151_M = Blocks.field_150350_a.func_176223_P();
|
||||
+ this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(HALF, Half.BOTTOM).setValue(SHAPE, StairsShape.STRAIGHT).setValue(WATERLOGGED, Boolean.valueOf(false)));
|
||||
+ this.base = Blocks.AIR; // These are unused, fields are redirected
|
||||
+ this.baseState = Blocks.AIR.defaultBlockState();
|
||||
+ this.stateSupplier = state;
|
||||
}
|
||||
|
||||
public boolean func_220074_n(BlockState p_220074_1_) {
|
||||
public boolean useShapeForLightOcclusion(BlockState p_220074_1_) {
|
||||
@@ -265,4 +_,14 @@
|
||||
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // Forge Start
|
||||
+ private final java.util.function.Supplier<BlockState> stateSupplier;
|
||||
+ private Block getModelBlock() {
|
||||
+ return getModelState().func_177230_c();
|
||||
+ return getModelState().getBlock();
|
||||
+ }
|
||||
+ private BlockState getModelState() {
|
||||
+ return stateSupplier.get();
|
||||
|
||||
@@ -3,26 +3,26 @@
|
||||
@@ -37,22 +_,24 @@
|
||||
}
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
|
||||
if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) {
|
||||
float f = CropsBlock.func_180672_a(this, p_225542_2_, p_225542_3_);
|
||||
if (p_225542_2_.getRawBrightness(p_225542_3_, 0) >= 9) {
|
||||
float f = CropsBlock.getGrowthSpeed(this, p_225542_2_, p_225542_3_);
|
||||
- if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) {
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
|
||||
int i = p_225542_1_.func_177229_b(field_176484_a);
|
||||
int i = p_225542_1_.getValue(AGE);
|
||||
if (i < 7) {
|
||||
- p_225542_1_ = p_225542_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1));
|
||||
- p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_, 2);
|
||||
+ p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)), 2);
|
||||
- p_225542_1_ = p_225542_1_.setValue(AGE, Integer.valueOf(i + 1));
|
||||
- p_225542_2_.setBlock(p_225542_3_, p_225542_1_, 2);
|
||||
+ p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2);
|
||||
} else {
|
||||
Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_225542_4_);
|
||||
BlockPos blockpos = p_225542_3_.func_177972_a(direction);
|
||||
BlockState blockstate = p_225542_2_.func_180495_p(blockpos.func_177977_b());
|
||||
- if (p_225542_2_.func_180495_p(blockpos).func_196958_f() && (blockstate.func_203425_a(Blocks.field_150458_ak) || blockstate.func_203425_a(Blocks.field_150346_d) || blockstate.func_203425_a(Blocks.field_196660_k) || blockstate.func_203425_a(Blocks.field_196661_l) || blockstate.func_203425_a(Blocks.field_196658_i))) {
|
||||
+ Block block = blockstate.func_177230_c();
|
||||
+ if (p_225542_2_.func_175623_d(blockpos) && (blockstate.canSustainPlant(p_225542_2_, blockpos.func_177977_b(), Direction.UP, this) || block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) {
|
||||
p_225542_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P());
|
||||
p_225542_2_.func_175656_a(p_225542_3_, this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(HorizontalBlock.field_185512_D, direction));
|
||||
Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(p_225542_4_);
|
||||
BlockPos blockpos = p_225542_3_.relative(direction);
|
||||
BlockState blockstate = p_225542_2_.getBlockState(blockpos.below());
|
||||
- if (p_225542_2_.getBlockState(blockpos).isAir() && (blockstate.is(Blocks.FARMLAND) || blockstate.is(Blocks.DIRT) || blockstate.is(Blocks.COARSE_DIRT) || blockstate.is(Blocks.PODZOL) || blockstate.is(Blocks.GRASS_BLOCK))) {
|
||||
+ Block block = blockstate.getBlock();
|
||||
+ if (p_225542_2_.isEmptyBlock(blockpos) && (blockstate.canSustainPlant(p_225542_2_, blockpos.below(), Direction.UP, this) || block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) {
|
||||
p_225542_2_.setBlockAndUpdate(blockpos, this.fruit.defaultBlockState());
|
||||
p_225542_2_.setBlockAndUpdate(p_225542_3_, this.fruit.getAttachedStem().defaultBlockState().setValue(HorizontalBlock.FACING, direction));
|
||||
}
|
||||
}
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
@@ -31,8 +31,8 @@
|
||||
}
|
||||
@@ -96,5 +_,11 @@
|
||||
|
||||
public StemGrownBlock func_208486_d() {
|
||||
return this.field_149877_a;
|
||||
public StemGrownBlock getFruit() {
|
||||
return this.fruit;
|
||||
+ }
|
||||
+
|
||||
+ //FORGE START
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
|
||||
-public class SugarCaneBlock extends Block {
|
||||
+public class SugarCaneBlock extends Block implements net.minecraftforge.common.IPlantable {
|
||||
public static final IntegerProperty field_176355_a = BlockStateProperties.field_208171_X;
|
||||
protected static final VoxelShape field_196503_b = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D);
|
||||
public static final IntegerProperty AGE = BlockStateProperties.AGE_15;
|
||||
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D);
|
||||
|
||||
@@ -43,12 +_,14 @@
|
||||
|
||||
if (i < 3) {
|
||||
int j = p_225542_1_.func_177229_b(field_176355_a);
|
||||
int j = p_225542_1_.getValue(AGE);
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, true)) {
|
||||
if (j == 15) {
|
||||
p_225542_2_.func_175656_a(p_225542_3_.func_177984_a(), this.func_176223_P());
|
||||
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176355_a, Integer.valueOf(0)), 4);
|
||||
p_225542_2_.setBlockAndUpdate(p_225542_3_.above(), this.defaultBlockState());
|
||||
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(0)), 4);
|
||||
} else {
|
||||
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176355_a, Integer.valueOf(j + 1)), 4);
|
||||
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(j + 1)), 4);
|
||||
}
|
||||
+ }
|
||||
}
|
||||
@@ -27,16 +27,16 @@
|
||||
@@ -63,6 +_,8 @@
|
||||
}
|
||||
|
||||
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
|
||||
+ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
|
||||
+ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this)) return true;
|
||||
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
|
||||
if (blockstate.func_177230_c() == this) {
|
||||
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
|
||||
+ BlockState soil = p_196260_2_.getBlockState(p_196260_3_.below());
|
||||
+ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.below(), Direction.UP, this)) return true;
|
||||
BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below());
|
||||
if (blockstate.getBlock() == this) {
|
||||
return true;
|
||||
@@ -85,5 +_,15 @@
|
||||
|
||||
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.func_206894_a(field_176355_a);
|
||||
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.add(AGE);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -46,6 +46,6 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
|
||||
+ return func_176223_P();
|
||||
+ return defaultBlockState();
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
+++ b/net/minecraft/block/SweetBerryBushBlock.java
|
||||
@@ -52,8 +_,9 @@
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
int i = p_225542_1_.func_177229_b(field_220125_a);
|
||||
- if (i < 3 && p_225542_4_.nextInt(5) == 0 && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
|
||||
+ if (i < 3 && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_,p_225542_4_.nextInt(5) == 0)) {
|
||||
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_220125_a, Integer.valueOf(i + 1)), 2);
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
int i = p_225542_1_.getValue(AGE);
|
||||
- if (i < 3 && p_225542_4_.nextInt(5) == 0 && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) {
|
||||
+ if (i < 3 && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_,p_225542_4_.nextInt(5) == 0)) {
|
||||
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2);
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,67 +1,67 @@
|
||||
--- a/net/minecraft/block/TNTBlock.java
|
||||
+++ b/net/minecraft/block/TNTBlock.java
|
||||
@@ -29,10 +_,14 @@
|
||||
this.func_180632_j(this.func_176223_P().func_206870_a(field_212569_a, Boolean.valueOf(false)));
|
||||
this.registerDefaultState(this.defaultBlockState().setValue(UNSTABLE, Boolean.valueOf(false)));
|
||||
}
|
||||
|
||||
+ public void catchFire(BlockState state, World world, BlockPos pos, @Nullable net.minecraft.util.Direction face, @Nullable LivingEntity igniter) {
|
||||
+ func_196535_a(world, pos, igniter);
|
||||
+ explode(world, pos, igniter);
|
||||
+ }
|
||||
+
|
||||
public void func_220082_b(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) {
|
||||
if (!p_220082_4_.func_203425_a(p_220082_1_.func_177230_c())) {
|
||||
if (p_220082_2_.func_175640_z(p_220082_3_)) {
|
||||
- func_196534_a(p_220082_2_, p_220082_3_);
|
||||
public void onPlace(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) {
|
||||
if (!p_220082_4_.is(p_220082_1_.getBlock())) {
|
||||
if (p_220082_2_.hasNeighborSignal(p_220082_3_)) {
|
||||
- explode(p_220082_2_, p_220082_3_);
|
||||
+ catchFire(p_220082_1_, p_220082_2_, p_220082_3_, null, null);
|
||||
p_220082_2_.func_217377_a(p_220082_3_, false);
|
||||
p_220082_2_.removeBlock(p_220082_3_, false);
|
||||
}
|
||||
|
||||
@@ -41,7 +_,7 @@
|
||||
|
||||
public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
|
||||
if (p_220069_2_.func_175640_z(p_220069_3_)) {
|
||||
- func_196534_a(p_220069_2_, p_220069_3_);
|
||||
public void neighborChanged(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
|
||||
if (p_220069_2_.hasNeighborSignal(p_220069_3_)) {
|
||||
- explode(p_220069_2_, p_220069_3_);
|
||||
+ catchFire(p_220069_1_, p_220069_2_, p_220069_3_, null, null);
|
||||
p_220069_2_.func_217377_a(p_220069_3_, false);
|
||||
p_220069_2_.removeBlock(p_220069_3_, false);
|
||||
}
|
||||
|
||||
@@ -49,7 +_,7 @@
|
||||
|
||||
public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) {
|
||||
if (!p_176208_1_.func_201670_d() && !p_176208_4_.func_184812_l_() && p_176208_3_.func_177229_b(field_212569_a)) {
|
||||
- func_196534_a(p_176208_1_, p_176208_2_);
|
||||
public void playerWillDestroy(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) {
|
||||
if (!p_176208_1_.isClientSide() && !p_176208_4_.isCreative() && p_176208_3_.getValue(UNSTABLE)) {
|
||||
- explode(p_176208_1_, p_176208_2_);
|
||||
+ catchFire(p_176208_3_, p_176208_1_, p_176208_2_, null, null);
|
||||
}
|
||||
|
||||
super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
|
||||
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
|
||||
@@ -63,10 +_,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Prefer using IForgeBlock#catchFire
|
||||
public static void func_196534_a(World p_196534_0_, BlockPos p_196534_1_) {
|
||||
func_196535_a(p_196534_0_, p_196534_1_, (LivingEntity)null);
|
||||
public static void explode(World p_196534_0_, BlockPos p_196534_1_) {
|
||||
explode(p_196534_0_, p_196534_1_, (LivingEntity)null);
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Prefer using IForgeBlock#catchFire
|
||||
private static void func_196535_a(World p_196535_0_, BlockPos p_196535_1_, @Nullable LivingEntity p_196535_2_) {
|
||||
if (!p_196535_0_.field_72995_K) {
|
||||
TNTEntity tntentity = new TNTEntity(p_196535_0_, (double)p_196535_1_.func_177958_n() + 0.5D, (double)p_196535_1_.func_177956_o(), (double)p_196535_1_.func_177952_p() + 0.5D, p_196535_2_);
|
||||
private static void explode(World p_196535_0_, BlockPos p_196535_1_, @Nullable LivingEntity p_196535_2_) {
|
||||
if (!p_196535_0_.isClientSide) {
|
||||
TNTEntity tntentity = new TNTEntity(p_196535_0_, (double)p_196535_1_.getX() + 0.5D, (double)p_196535_1_.getY(), (double)p_196535_1_.getZ() + 0.5D, p_196535_2_);
|
||||
@@ -81,7 +_,7 @@
|
||||
if (item != Items.field_151033_d && item != Items.field_151059_bz) {
|
||||
return super.func_225533_a_(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_4_, p_225533_5_, p_225533_6_);
|
||||
if (item != Items.FLINT_AND_STEEL && item != Items.FIRE_CHARGE) {
|
||||
return super.use(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_4_, p_225533_5_, p_225533_6_);
|
||||
} else {
|
||||
- func_196535_a(p_225533_2_, p_225533_3_, p_225533_4_);
|
||||
+ catchFire(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_6_.func_216354_b(), p_225533_4_);
|
||||
p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150350_a.func_176223_P(), 11);
|
||||
if (!p_225533_4_.func_184812_l_()) {
|
||||
if (item == Items.field_151033_d) {
|
||||
- explode(p_225533_2_, p_225533_3_, p_225533_4_);
|
||||
+ catchFire(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_6_.getDirection(), p_225533_4_);
|
||||
p_225533_2_.setBlock(p_225533_3_, Blocks.AIR.defaultBlockState(), 11);
|
||||
if (!p_225533_4_.isCreative()) {
|
||||
if (item == Items.FLINT_AND_STEEL) {
|
||||
@@ -102,7 +_,7 @@
|
||||
Entity entity = p_220066_4_.func_234616_v_();
|
||||
if (p_220066_4_.func_70027_ad()) {
|
||||
BlockPos blockpos = p_220066_3_.func_216350_a();
|
||||
- func_196535_a(p_220066_1_, blockpos, entity instanceof LivingEntity ? (LivingEntity)entity : null);
|
||||
Entity entity = p_220066_4_.getOwner();
|
||||
if (p_220066_4_.isOnFire()) {
|
||||
BlockPos blockpos = p_220066_3_.getBlockPos();
|
||||
- explode(p_220066_1_, blockpos, entity instanceof LivingEntity ? (LivingEntity)entity : null);
|
||||
+ catchFire(p_220066_2_, p_220066_1_, blockpos, null, entity instanceof LivingEntity ? (LivingEntity)entity : null);
|
||||
p_220066_1_.func_217377_a(blockpos, false);
|
||||
p_220066_1_.removeBlock(blockpos, false);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
-public class TallGrassBlock extends BushBlock implements IGrowable {
|
||||
+public class TallGrassBlock extends BushBlock implements IGrowable, net.minecraftforge.common.IForgeShearable {
|
||||
protected static final VoxelShape field_196389_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
|
||||
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
|
||||
|
||||
public TallGrassBlock(AbstractBlock.Properties p_i48310_1_) {
|
||||
@@ -2,16 +2,16 @@
|
||||
+++ b/net/minecraft/block/TrapDoorBlock.java
|
||||
@@ -147,4 +_,17 @@
|
||||
|
||||
return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
|
||||
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
|
||||
}
|
||||
+
|
||||
+ //Forge Start
|
||||
+ @Override
|
||||
+ public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) {
|
||||
+ if (state.func_177229_b(field_176283_b)) {
|
||||
+ BlockPos downPos = pos.func_177977_b();
|
||||
+ BlockState down = world.func_180495_p(downPos);
|
||||
+ return down.func_177230_c().makesOpenTrapdoorAboveClimbable(down, world, downPos, state);
|
||||
+ if (state.getValue(OPEN)) {
|
||||
+ BlockPos downPos = pos.below();
|
||||
+ BlockState down = world.getBlockState(downPos);
|
||||
+ return down.getBlock().makesOpenTrapdoorAboveClimbable(down, world, downPos, state);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/block/TripWireHookBlock.java
|
||||
+++ b/net/minecraft/block/TripWireHookBlock.java
|
||||
@@ -150,8 +_,8 @@
|
||||
BlockPos blockpos2 = p_176260_2_.func_177967_a(direction, k);
|
||||
BlockPos blockpos2 = p_176260_2_.relative(direction, k);
|
||||
BlockState blockstate2 = ablockstate[k];
|
||||
if (blockstate2 != null) {
|
||||
+ if (!p_176260_1_.func_180495_p(blockpos2).func_196958_f()) { // FORGE: fix MC-129055
|
||||
p_176260_1_.func_180501_a(blockpos2, blockstate2.func_206870_a(field_176265_M, Boolean.valueOf(flag2)), 3);
|
||||
- if (!p_176260_1_.func_180495_p(blockpos2).func_196958_f()) {
|
||||
+ if (!p_176260_1_.getBlockState(blockpos2).isAir()) { // FORGE: fix MC-129055
|
||||
p_176260_1_.setBlock(blockpos2, blockstate2.setValue(ATTACHED, Boolean.valueOf(flag2)), 3);
|
||||
- if (!p_176260_1_.getBlockState(blockpos2).isAir()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
if (!(p_212570_2_ instanceof LivingEntity)) {
|
||||
return false;
|
||||
} else {
|
||||
- return p_212570_2_ instanceof PlayerEntity || p_212570_1_.func_82736_K().func_223586_b(GameRules.field_223599_b);
|
||||
- return p_212570_2_ instanceof PlayerEntity || p_212570_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ return p_212570_2_ instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_212570_1_, p_212570_2_);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -6,35 +6,35 @@
|
||||
|
||||
-public class VineBlock extends Block {
|
||||
+public class VineBlock extends Block implements net.minecraftforge.common.IForgeShearable {
|
||||
public static final BooleanProperty field_176277_a = SixWayBlock.field_196496_z;
|
||||
public static final BooleanProperty field_176273_b = SixWayBlock.field_196488_a;
|
||||
public static final BooleanProperty field_176278_M = SixWayBlock.field_196490_b;
|
||||
public static final BooleanProperty UP = SixWayBlock.UP;
|
||||
public static final BooleanProperty NORTH = SixWayBlock.NORTH;
|
||||
public static final BooleanProperty EAST = SixWayBlock.EAST;
|
||||
@@ -152,14 +_,14 @@
|
||||
}
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
- if (p_225542_2_.field_73012_v.nextInt(4) == 0) {
|
||||
+ if (p_225542_2_.field_73012_v.nextInt(4) == 0 && p_225542_2_.isAreaLoaded(p_225542_3_, 4)) { // Forge: check area to prevent loading unloaded chunks
|
||||
Direction direction = Direction.func_239631_a_(p_225542_4_);
|
||||
BlockPos blockpos = p_225542_3_.func_177984_a();
|
||||
if (direction.func_176740_k().func_176722_c() && !p_225542_1_.func_177229_b(func_176267_a(direction))) {
|
||||
if (this.func_196539_a(p_225542_2_, p_225542_3_)) {
|
||||
BlockPos blockpos4 = p_225542_3_.func_177972_a(direction);
|
||||
BlockState blockstate4 = p_225542_2_.func_180495_p(blockpos4);
|
||||
- if (blockstate4.func_196958_f()) {
|
||||
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
- if (p_225542_2_.random.nextInt(4) == 0) {
|
||||
+ if (p_225542_2_.random.nextInt(4) == 0 && p_225542_2_.isAreaLoaded(p_225542_3_, 4)) { // Forge: check area to prevent loading unloaded chunks
|
||||
Direction direction = Direction.getRandom(p_225542_4_);
|
||||
BlockPos blockpos = p_225542_3_.above();
|
||||
if (direction.getAxis().isHorizontal() && !p_225542_1_.getValue(getPropertyForFace(direction))) {
|
||||
if (this.canSpread(p_225542_2_, p_225542_3_)) {
|
||||
BlockPos blockpos4 = p_225542_3_.relative(direction);
|
||||
BlockState blockstate4 = p_225542_2_.getBlockState(blockpos4);
|
||||
- if (blockstate4.isAir()) {
|
||||
+ if (blockstate4.isAir(p_225542_2_, blockpos4)) {
|
||||
Direction direction3 = direction.func_176746_e();
|
||||
Direction direction4 = direction.func_176735_f();
|
||||
boolean flag = p_225542_1_.func_177229_b(func_176267_a(direction3));
|
||||
Direction direction3 = direction.getClockWise();
|
||||
Direction direction4 = direction.getCounterClockWise();
|
||||
boolean flag = p_225542_1_.getValue(getPropertyForFace(direction3));
|
||||
@@ -216,8 +_,9 @@
|
||||
if (p_225542_3_.func_177956_o() > 0) {
|
||||
BlockPos blockpos1 = p_225542_3_.func_177977_b();
|
||||
BlockState blockstate = p_225542_2_.func_180495_p(blockpos1);
|
||||
- if (blockstate.func_196958_f() || blockstate.func_203425_a(this)) {
|
||||
- BlockState blockstate1 = blockstate.func_196958_f() ? this.func_176223_P() : blockstate;
|
||||
if (p_225542_3_.getY() > 0) {
|
||||
BlockPos blockpos1 = p_225542_3_.below();
|
||||
BlockState blockstate = p_225542_2_.getBlockState(blockpos1);
|
||||
- if (blockstate.isAir() || blockstate.is(this)) {
|
||||
- BlockState blockstate1 = blockstate.isAir() ? this.defaultBlockState() : blockstate;
|
||||
+ boolean isAir = blockstate.isAir(p_225542_2_, blockpos1);
|
||||
+ if (isAir || blockstate.func_203425_a(this)) {
|
||||
+ BlockState blockstate1 = isAir ? this.func_176223_P() : blockstate;
|
||||
BlockState blockstate2 = this.func_196544_a(p_225542_1_, blockstate1, p_225542_4_);
|
||||
if (blockstate1 != blockstate2 && this.func_196540_x(blockstate2)) {
|
||||
p_225542_2_.func_180501_a(blockpos1, blockstate2, 2);
|
||||
+ if (isAir || blockstate.is(this)) {
|
||||
+ BlockState blockstate1 = isAir ? this.defaultBlockState() : blockstate;
|
||||
BlockState blockstate2 = this.copyRandomFaces(p_225542_1_, blockstate1, p_225542_4_);
|
||||
if (blockstate1 != blockstate2 && this.hasHorizontalConnection(blockstate2)) {
|
||||
p_225542_2_.setBlock(blockpos1, blockstate2, 2);
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/block/WoodType.java
|
||||
+++ b/net/minecraft/block/WoodType.java
|
||||
@@ -32,4 +_,11 @@
|
||||
public String func_227048_b_() {
|
||||
return this.field_227045_h_;
|
||||
public String name() {
|
||||
return this.name;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
--- a/net/minecraft/client/GameSettings.java
|
||||
+++ b/net/minecraft/client/GameSettings.java
|
||||
@@ -170,6 +_,7 @@
|
||||
public boolean field_241568_aS_;
|
||||
public boolean syncWrites;
|
||||
|
||||
public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) {
|
||||
+ setForgeKeybindProperties();
|
||||
this.field_74317_L = p_i46326_1_;
|
||||
this.field_74354_ai = new File(p_i46326_2_, "options.txt");
|
||||
if (p_i46326_1_.func_147111_S() && Runtime.getRuntime().maxMemory() >= 1000000000L) {
|
||||
this.minecraft = p_i46326_1_;
|
||||
this.optionsFile = new File(p_i46326_2_, "options.txt");
|
||||
if (p_i46326_1_.is64Bit() && Runtime.getRuntime().maxMemory() >= 1000000000L) {
|
||||
@@ -529,7 +_,11 @@
|
||||
|
||||
for(KeyBinding keybinding : this.field_74324_K) {
|
||||
if (s.equals("key_" + keybinding.func_151464_g())) {
|
||||
- keybinding.func_197979_b(InputMappings.func_197955_a(s1));
|
||||
for(KeyBinding keybinding : this.keyMappings) {
|
||||
if (s.equals("key_" + keybinding.getName())) {
|
||||
- keybinding.setKey(InputMappings.getKey(s1));
|
||||
+ if (s1.indexOf(':') != -1) {
|
||||
+ String[] pts = s1.split(":");
|
||||
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.func_197955_a(pts[0]));
|
||||
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.getKey(pts[0]));
|
||||
+ } else
|
||||
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.func_197955_a(s1));
|
||||
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.getKey(s1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void func_74303_b() {
|
||||
public void save() {
|
||||
+ if (net.minecraftforge.fml.client.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
||||
try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) {
|
||||
printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion());
|
||||
printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this));
|
||||
try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) {
|
||||
printwriter.println("version:" + SharedConstants.getCurrentVersion().getWorldVersion());
|
||||
printwriter.println("autoJump:" + AbstractOption.AUTO_JUMP.get(this));
|
||||
@@ -661,7 +_,7 @@
|
||||
printwriter.println("syncChunkWrites:" + this.field_241568_aS_);
|
||||
printwriter.println("syncChunkWrites:" + this.syncWrites);
|
||||
|
||||
for(KeyBinding keybinding : this.field_74324_K) {
|
||||
- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m());
|
||||
+ printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m() + (keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keybinding.getKeyModifier() : ""));
|
||||
for(KeyBinding keybinding : this.keyMappings) {
|
||||
- printwriter.println("key_" + keybinding.getName() + ":" + keybinding.saveString());
|
||||
+ printwriter.println("key_" + keybinding.getName() + ":" + keybinding.saveString() + (keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keybinding.getKeyModifier() : ""));
|
||||
}
|
||||
|
||||
for(SoundCategory soundcategory : SoundCategory.values()) {
|
||||
@@ -758,6 +_,23 @@
|
||||
}
|
||||
|
||||
p_198017_1_.func_198985_a(set);
|
||||
p_198017_1_.setSelected(set);
|
||||
+ }
|
||||
+
|
||||
+ private void setForgeKeybindProperties() {
|
||||
+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME;
|
||||
+ field_74351_w.setKeyConflictContext(inGame);
|
||||
+ field_74370_x.setKeyConflictContext(inGame);
|
||||
+ field_74368_y.setKeyConflictContext(inGame);
|
||||
+ field_74366_z.setKeyConflictContext(inGame);
|
||||
+ field_74314_A.setKeyConflictContext(inGame);
|
||||
+ field_228046_af_.setKeyConflictContext(inGame);
|
||||
+ field_151444_V.setKeyConflictContext(inGame);
|
||||
+ field_74312_F.setKeyConflictContext(inGame);
|
||||
+ field_74310_D.setKeyConflictContext(inGame);
|
||||
+ field_74321_H.setKeyConflictContext(inGame);
|
||||
+ field_74323_J.setKeyConflictContext(inGame);
|
||||
+ field_151457_aa.setKeyConflictContext(inGame);
|
||||
+ field_151458_ab.setKeyConflictContext(inGame);
|
||||
+ keyUp.setKeyConflictContext(inGame);
|
||||
+ keyLeft.setKeyConflictContext(inGame);
|
||||
+ keyDown.setKeyConflictContext(inGame);
|
||||
+ keyRight.setKeyConflictContext(inGame);
|
||||
+ keyJump.setKeyConflictContext(inGame);
|
||||
+ keyShift.setKeyConflictContext(inGame);
|
||||
+ keySprint.setKeyConflictContext(inGame);
|
||||
+ keyAttack.setKeyConflictContext(inGame);
|
||||
+ keyChat.setKeyConflictContext(inGame);
|
||||
+ keyPlayerList.setKeyConflictContext(inGame);
|
||||
+ keyCommand.setKeyConflictContext(inGame);
|
||||
+ keyTogglePerspective.setKeyConflictContext(inGame);
|
||||
+ keySmoothCamera.setKeyConflictContext(inGame);
|
||||
}
|
||||
|
||||
public PointOfView func_243230_g() {
|
||||
public PointOfView getCameraType() {
|
||||
@@ -3,37 +3,37 @@
|
||||
@@ -255,7 +_,9 @@
|
||||
}
|
||||
|
||||
INestedGuiEventHandler inestedguieventhandler = this.field_197972_a.field_71462_r;
|
||||
- if (p_197961_5_ == 1 && (!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) {
|
||||
INestedGuiEventHandler inestedguieventhandler = this.minecraft.screen;
|
||||
- if (p_197961_5_ == 1 && (!(this.minecraft.screen instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).lastKeySelection <= Util.getMillis() - 20L)) {
|
||||
+
|
||||
+ if ((!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) {
|
||||
+ if ((!(this.minecraft.screen instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).lastKeySelection <= Util.getMillis() - 20L)) {
|
||||
+ if (p_197961_5_ == 1) {
|
||||
if (this.field_197972_a.field_71474_y.field_152395_am.func_197976_a(p_197961_3_, p_197961_4_)) {
|
||||
this.field_197972_a.func_228018_at_().func_198077_g();
|
||||
this.field_197972_a.field_71474_y.field_74353_u = this.field_197972_a.func_228018_at_().func_198113_j();
|
||||
if (this.minecraft.options.keyFullscreen.matches(p_197961_3_, p_197961_4_)) {
|
||||
this.minecraft.getWindow().toggleFullScreen();
|
||||
this.minecraft.options.fullscreen = this.minecraft.getWindow().isFullscreen();
|
||||
@@ -274,6 +_,8 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
+ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.field_197972_a.field_71462_r instanceof ControlsScreen)
|
||||
+ ((ControlsScreen)this.field_197972_a.field_71462_r).field_146491_f = null; //Forge: Unset pure modifiers.
|
||||
+ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.minecraft.screen instanceof ControlsScreen)
|
||||
+ ((ControlsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers.
|
||||
}
|
||||
|
||||
boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.func_241217_q_() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.func_241217_q_()).func_212955_f();
|
||||
boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.getFocused() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.getFocused()).canConsumeInput();
|
||||
@@ -289,10 +_,14 @@
|
||||
Screen.func_231153_a_(() -> {
|
||||
if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) {
|
||||
Screen.wrapScreenError(() -> {
|
||||
if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.sendRepeatsToGui)) {
|
||||
if (p_197961_5_ == 0) {
|
||||
- aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
- aboolean[0] = inestedguieventhandler.keyReleased(p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.minecraft.screen, p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyReleased(p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.minecraft.screen, p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
}
|
||||
} else {
|
||||
- aboolean[0] = inestedguieventhandler.func_231046_a_(p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_231046_a_(p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
- aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.minecraft.screen, p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.minecraft.screen, p_197961_3_, p_197961_4_, p_197961_6_);
|
||||
}
|
||||
|
||||
}, "keyPressed event handler", inestedguieventhandler.getClass().getCanonicalName());
|
||||
@@ -47,21 +47,21 @@
|
||||
}
|
||||
|
||||
@@ -355,12 +_,16 @@
|
||||
if (iguieventlistener != null && this.field_197972_a.func_213250_au() == null) {
|
||||
if (iguieventlistener != null && this.minecraft.getOverlay() == null) {
|
||||
if (Character.charCount(p_197963_3_) == 1) {
|
||||
Screen.func_231153_a_(() -> {
|
||||
- iguieventlistener.func_231042_a_((char)p_197963_3_, p_197963_4_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_)) return;
|
||||
+ if (iguieventlistener.func_231042_a_((char)p_197963_3_, p_197963_4_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_);
|
||||
Screen.wrapScreenError(() -> {
|
||||
- iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.minecraft.screen, (char)p_197963_3_, p_197963_4_)) return;
|
||||
+ if (iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.minecraft.screen, (char)p_197963_3_, p_197963_4_);
|
||||
}, "charTyped event handler", iguieventlistener.getClass().getCanonicalName());
|
||||
} else {
|
||||
for(char c0 : Character.toChars(p_197963_3_)) {
|
||||
Screen.func_231153_a_(() -> {
|
||||
- iguieventlistener.func_231042_a_(c0, p_197963_4_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, c0, p_197963_4_)) return;
|
||||
+ if (iguieventlistener.func_231042_a_(c0, p_197963_4_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, c0, p_197963_4_);
|
||||
Screen.wrapScreenError(() -> {
|
||||
- iguieventlistener.charTyped(c0, p_197963_4_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.minecraft.screen, c0, p_197963_4_)) return;
|
||||
+ if (iguieventlistener.charTyped(c0, p_197963_4_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.minecraft.screen, c0, p_197963_4_);
|
||||
}, "charTyped event handler", iguieventlistener.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,24 @@
|
||||
GLFW.glfwWindowHint(139266, 2);
|
||||
GLFW.glfwWindowHint(139267, 0);
|
||||
GLFW.glfwWindowHint(139272, 0);
|
||||
- this.field_198119_f = GLFW.glfwCreateWindow(this.field_198129_p, this.field_198130_q, p_i51170_5_, this.field_198125_l && monitor != null ? monitor.func_197995_f() : 0L, 0L);
|
||||
+ this.field_198119_f = net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.handOffWindow(()->this.field_198129_p, ()->this.field_198130_q, ()->p_i51170_5_, ()->this.field_198125_l && monitor != null ? monitor.func_197995_f() : 0L);
|
||||
- this.window = GLFW.glfwCreateWindow(this.width, this.height, p_i51170_5_, this.fullscreen && monitor != null ? monitor.getMonitor() : 0L, 0L);
|
||||
+ this.window = net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.handOffWindow(()->this.width, ()->this.height, ()->p_i51170_5_, ()->this.fullscreen && monitor != null ? monitor.getMonitor() : 0L);
|
||||
if (monitor != null) {
|
||||
VideoMode videomode = monitor.func_197992_a(this.field_198125_l ? this.field_198124_k : Optional.empty());
|
||||
this.field_198120_g = this.field_198127_n = monitor.func_197989_c() + videomode.func_198064_a() / 2 - this.field_198129_p / 2;
|
||||
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
|
||||
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
|
||||
@@ -136,6 +_,7 @@
|
||||
|
||||
public void setIcon(InputStream p_216529_1_, InputStream p_216529_2_) {
|
||||
RenderSystem.assertThread(RenderSystem::isInInitPhase);
|
||||
+ if (net.minecraft.client.Minecraft.ON_OSX) return;
|
||||
|
||||
try (MemoryStack memorystack = MemoryStack.stackPush()) {
|
||||
if (p_216529_1_ == null) {
|
||||
@@ -271,6 +_,7 @@
|
||||
GLFW.glfwGetFramebufferSize(this.field_198119_f, aint, aint1);
|
||||
this.field_198131_r = aint[0];
|
||||
this.field_198132_s = aint1[0];
|
||||
+ if (this.field_198132_s == 0 || this.field_198131_r==0) net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.updateFBSize(w->this.field_198131_r=w, h->this.field_198132_s=h);
|
||||
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
|
||||
this.framebufferWidth = aint[0];
|
||||
this.framebufferHeight = aint1[0];
|
||||
+ if (this.framebufferHeight == 0 || this.framebufferWidth==0) net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.updateFBSize(w->this.framebufferWidth=w, h->this.framebufferHeight=h);
|
||||
}
|
||||
|
||||
private void func_198089_c(long p_198089_1_, int p_198089_3_, int p_198089_4_) {
|
||||
private void onResize(long p_198089_1_, int p_198089_3_, int p_198089_4_) {
|
||||
@@ -1,78 +1,87 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -241,7 +_,7 @@
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class Minecraft extends RecursiveEventLoop<Runnable> implements ISnooperInfo, IWindowEventListener {
|
||||
+public class Minecraft extends RecursiveEventLoop<Runnable> implements ISnooperInfo, IWindowEventListener, net.minecraftforge.client.extensions.IForgeMinecraft {
|
||||
private static Minecraft instance;
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
|
||||
@@ -368,6 +_,7 @@
|
||||
public Minecraft(GameConfiguration p_i45547_1_) {
|
||||
super("Client");
|
||||
field_71432_P = this;
|
||||
instance = this;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.invalidateLog4jThreadCache();
|
||||
this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a;
|
||||
File file1 = p_i45547_1_.field_178744_c.field_178759_c;
|
||||
this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b;
|
||||
this.gameDirectory = p_i45547_1_.location.gameDirectory;
|
||||
File file1 = p_i45547_1_.location.assetDirectory;
|
||||
this.resourcePackDirectory = p_i45547_1_.location.resourcePackDirectory;
|
||||
@@ -382,7 +_,6 @@
|
||||
this.field_244734_au = this.func_244735_a(yggdrasilauthenticationservice, p_i45547_1_);
|
||||
this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a;
|
||||
field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a());
|
||||
- field_147123_G.debug("(Session ID is {})", (Object)this.field_71449_j.func_111286_b());
|
||||
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
|
||||
this.field_238175_ae_ = !p_i45547_1_.field_178741_d.field_239099_d_;
|
||||
this.field_238176_af_ = !p_i45547_1_.field_178741_d.field_239100_e_;
|
||||
this.socialInteractionsService = this.createSocialInteractions(yggdrasilauthenticationservice, p_i45547_1_);
|
||||
this.user = p_i45547_1_.user.user;
|
||||
LOGGER.info("Setting user: {}", (Object)this.user.getName());
|
||||
- LOGGER.debug("(Session ID is {})", (Object)this.user.getSessionId());
|
||||
this.demo = p_i45547_1_.game.demo;
|
||||
this.allowsMultiplayer = !p_i45547_1_.game.disableMultiplayer;
|
||||
this.allowsChat = !p_i45547_1_.game.disableChat;
|
||||
@@ -428,13 +_,13 @@
|
||||
|
||||
this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i);
|
||||
this.field_71417_B = new MouseHelper(this);
|
||||
- this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i());
|
||||
this.field_195559_v = new KeyboardListener(this);
|
||||
this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i());
|
||||
RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false);
|
||||
this.field_147124_at = new Framebuffer(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), true, field_142025_a);
|
||||
this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax);
|
||||
this.field_110448_aq.func_198983_a();
|
||||
this.field_71474_y.func_198017_a(this.field_110448_aq);
|
||||
this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab);
|
||||
this.window.setFramerateLimit(this.options.framerateLimit);
|
||||
this.mouseHandler = new MouseHelper(this);
|
||||
- this.mouseHandler.setup(this.window.getWindow());
|
||||
this.keyboardHandler = new KeyboardListener(this);
|
||||
this.keyboardHandler.setup(this.window.getWindow());
|
||||
RenderSystem.initRenderer(this.options.glDebugVerbosity, false);
|
||||
this.mainRenderTarget = new Framebuffer(this.window.getWidth(), this.window.getHeight(), true, ON_OSX);
|
||||
this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.resourceManager = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager, this.clientPackSource);
|
||||
this.resourcePackRepository.reload();
|
||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||
this.languageManager = new LanguageManager(this.options.languageCode);
|
||||
@@ -476,6 +_,7 @@
|
||||
this.func_193986_ar();
|
||||
this.field_110451_am.func_219534_a(this.field_193995_ae);
|
||||
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
|
||||
this.createSearchTrees();
|
||||
this.resourceManager.registerReloadListener(this.searchRegistry);
|
||||
this.particleEngine = new ParticleManager(this.level, this.textureManager);
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ParticleFactoryRegisterEvent());
|
||||
this.field_110451_am.func_219534_a(this.field_71452_i);
|
||||
this.field_213272_aL = new PaintingSpriteUploader(this.field_71446_o);
|
||||
this.field_110451_am.func_219534_a(this.field_213272_aL);
|
||||
this.resourceManager.registerReloadListener(this.particleEngine);
|
||||
this.paintingTextures = new PaintingSpriteUploader(this.textureManager);
|
||||
this.resourceManager.registerReloadListener(this.paintingTextures);
|
||||
@@ -483,7 +_,8 @@
|
||||
this.field_110451_am.func_219534_a(this.field_213273_aM);
|
||||
this.field_241557_ar_ = new GPUWarning();
|
||||
this.field_110451_am.func_219534_a(this.field_241557_ar_);
|
||||
- this.field_71456_v = new IngameGui(this);
|
||||
+ this.field_71456_v = new net.minecraftforge.client.gui.ForgeIngameGui(this);
|
||||
+ this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler.
|
||||
this.field_184132_p = new DebugRenderer(this);
|
||||
RenderSystem.setErrorCallback(this::func_195545_a);
|
||||
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
|
||||
this.resourceManager.registerReloadListener(this.mobEffectTextures);
|
||||
this.gpuWarnlistManager = new GPUWarning();
|
||||
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||
- this.gui = new IngameGui(this);
|
||||
+ this.gui = new net.minecraftforge.client.gui.ForgeIngameGui(this);
|
||||
+ this.mouseHandler.setup(this.window.getWindow()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler.
|
||||
this.debugRenderer = new DebugRenderer(this);
|
||||
RenderSystem.setErrorCallback(this::onFullscreenError);
|
||||
if (this.options.fullscreen && !this.window.isFullscreen()) {
|
||||
@@ -495,11 +_,6 @@
|
||||
this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E);
|
||||
this.field_195558_d.func_227801_c_();
|
||||
this.func_213226_a();
|
||||
this.window.updateRawMouseInput(this.options.rawMouseInput);
|
||||
this.window.setDefaultErrorCallback();
|
||||
this.resizeDisplay();
|
||||
- if (s != null) {
|
||||
- this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i));
|
||||
- this.setScreen(new ConnectingScreen(new MainMenuScreen(), this, s, i));
|
||||
- } else {
|
||||
- this.func_147108_a(new MainMenuScreen(true));
|
||||
- this.setScreen(new MainMenuScreen(true));
|
||||
- }
|
||||
|
||||
ResourceLoadProgressGui.func_212970_a(this);
|
||||
List<IResourcePack> list = this.field_110448_aq.func_232623_f_();
|
||||
ResourceLoadProgressGui.registerTextures(this);
|
||||
List<IResourcePack> list = this.resourcePackRepository.openAllSelected();
|
||||
@@ -508,7 +_,14 @@
|
||||
if (SharedConstants.field_206244_b) {
|
||||
this.func_213256_aB();
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
this.selfTest();
|
||||
}
|
||||
-
|
||||
+ if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
|
||||
+ // FORGE: Move opening initial screen to after startup and events are enabled.
|
||||
+ // Also Fixes MC-145102
|
||||
+ if (s != null) {
|
||||
+ this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i));
|
||||
+ this.setScreen(new ConnectingScreen(new MainMenuScreen(), this, s, i));
|
||||
+ } else {
|
||||
+ this.func_147108_a(new MainMenuScreen(true));
|
||||
+ this.setScreen(new MainMenuScreen(true));
|
||||
+ }
|
||||
});
|
||||
}, false));
|
||||
@@ -80,114 +89,120 @@
|
||||
@@ -556,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void func_229988_a_(Throwable p_229988_1_) {
|
||||
- if (this.field_110448_aq.func_232621_d_().size() > 1) {
|
||||
+ if (this.field_110448_aq.func_198980_d().stream().anyMatch(e -> !e.func_195797_g())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
|
||||
private void rollbackResourcePacks(Throwable p_229988_1_) {
|
||||
- if (this.resourcePackRepository.getSelectedIds().size() > 1) {
|
||||
+ if (this.resourcePackRepository.getSelectedPacks().stream().anyMatch(e -> !e.isRequired())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
|
||||
ITextComponent itextcomponent;
|
||||
if (p_229988_1_ instanceof SimpleReloadableResourceManager.FailedPackException) {
|
||||
itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).func_241203_a().func_195762_a());
|
||||
itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).getPack().getName());
|
||||
@@ -644,7 +_,7 @@
|
||||
return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b()));
|
||||
return Stream.of(Registry.ITEM.getKey(p_213251_0_.getItem()));
|
||||
});
|
||||
SearchTreeReloadable<ItemStack> searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> {
|
||||
- return ItemTags.func_199903_a().func_199913_a(p_213235_0_.func_77973_b()).stream();
|
||||
+ return p_213235_0_.func_77973_b().getTags().stream();
|
||||
- return ItemTags.getAllTags().getMatchingTags(p_213235_0_.getItem()).stream();
|
||||
+ return p_213235_0_.getItem().getTags().stream();
|
||||
});
|
||||
NonNullList<ItemStack> nonnulllist = NonNullList.func_191196_a();
|
||||
NonNullList<ItemStack> nonnulllist = NonNullList.create();
|
||||
|
||||
@@ -714,13 +_,13 @@
|
||||
Bootstrap.func_179870_a(p_71377_0_.func_71502_e());
|
||||
if (p_71377_0_.func_71497_f() != null) {
|
||||
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f());
|
||||
Bootstrap.realStdoutPrintln(p_71377_0_.getFriendlyReport());
|
||||
if (p_71377_0_.getSaveFile() != null) {
|
||||
Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.getSaveFile());
|
||||
- System.exit(-1);
|
||||
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-1);
|
||||
} else if (p_71377_0_.func_147149_a(file2)) {
|
||||
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
|
||||
} else if (p_71377_0_.saveToFile(file2)) {
|
||||
Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
|
||||
- System.exit(-1);
|
||||
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-1);
|
||||
} else {
|
||||
Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#");
|
||||
Bootstrap.realStdoutPrintln("#@?@# Game crashed! Crash report could not be saved. #@?@#");
|
||||
- System.exit(-2);
|
||||
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -729,6 +_,7 @@
|
||||
return this.field_71474_y.field_211842_aO;
|
||||
return this.options.forceUnicodeFont;
|
||||
}
|
||||
|
||||
+ @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler
|
||||
public CompletableFuture<Void> func_213237_g() {
|
||||
if (this.field_213276_aV != null) {
|
||||
return this.field_213276_aV;
|
||||
public CompletableFuture<Void> reloadResourcePacks() {
|
||||
if (this.pendingReload != null) {
|
||||
return this.pendingReload;
|
||||
@@ -817,10 +_,6 @@
|
||||
}
|
||||
|
||||
public void func_147108_a(@Nullable Screen p_147108_1_) {
|
||||
- if (this.field_71462_r != null) {
|
||||
- this.field_71462_r.func_231164_f_();
|
||||
public void setScreen(@Nullable Screen p_147108_1_) {
|
||||
- if (this.screen != null) {
|
||||
- this.screen.removed();
|
||||
- }
|
||||
-
|
||||
if (p_147108_1_ == null && this.field_71441_e == null) {
|
||||
if (p_147108_1_ == null && this.level == null) {
|
||||
p_147108_1_ = new MainMenuScreen();
|
||||
} else if (p_147108_1_ == null && this.field_71439_g.func_233643_dh_()) {
|
||||
@@ -831,6 +_,14 @@
|
||||
} else if (p_147108_1_ == null && this.player.isDeadOrDying()) {
|
||||
@@ -831,6 +_,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ Screen old = this.field_71462_r;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
||||
+ Screen old = this.screen;
|
||||
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(p_147108_1_);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
||||
+
|
||||
+ p_147108_1_ = event.getGui();
|
||||
+ if (old != null && p_147108_1_ != old)
|
||||
+ old.func_231164_f_();
|
||||
+ old.removed();
|
||||
+
|
||||
if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) {
|
||||
this.field_71474_y.field_74330_P = false;
|
||||
this.field_71456_v.func_146158_b().func_146231_a(true);
|
||||
this.options.renderDebug = false;
|
||||
this.gui.getChat().clearMessages(true);
|
||||
@@ -962,11 +_,13 @@
|
||||
RenderSystem.enableCull();
|
||||
this.field_71424_I.func_76319_b();
|
||||
if (!this.field_71454_w) {
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickStart(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b);
|
||||
this.field_71424_I.func_219895_b("gameRenderer");
|
||||
this.field_71460_t.func_195458_a(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b, i, p_195542_1_);
|
||||
this.field_71424_I.func_219895_b("toasts");
|
||||
this.field_193034_aS.func_238541_a_(new MatrixStack());
|
||||
this.field_71424_I.func_76319_b();
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickEnd(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b);
|
||||
this.profiler.pop();
|
||||
if (!this.noRender) {
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickStart(this.pause ? this.pausePartialTick : this.timer.partialTick);
|
||||
this.profiler.popPush("gameRenderer");
|
||||
this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_195542_1_);
|
||||
this.profiler.popPush("toasts");
|
||||
this.toast.render(new MatrixStack());
|
||||
this.profiler.pop();
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickEnd(this.pause ? this.pausePartialTick : this.timer.partialTick);
|
||||
}
|
||||
|
||||
if (this.field_238174_aV_ != null) {
|
||||
@@ -1065,6 +_,7 @@
|
||||
if (this.fpsPieResults != null) {
|
||||
@@ -1061,10 +_,12 @@
|
||||
this.window.setGuiScale((double)i);
|
||||
if (this.screen != null) {
|
||||
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
}
|
||||
|
||||
Framebuffer framebuffer = this.func_147110_a();
|
||||
framebuffer.func_216491_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), field_142025_a);
|
||||
+ if (this.field_71460_t != null)
|
||||
this.field_71460_t.func_147704_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l());
|
||||
this.field_71417_B.func_198021_g();
|
||||
Framebuffer framebuffer = this.getMainRenderTarget();
|
||||
framebuffer.resize(this.window.getWidth(), this.window.getHeight(), ON_OSX);
|
||||
+ if (this.gameRenderer != null)
|
||||
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
||||
this.mouseHandler.setIgnoreFirstMove();
|
||||
}
|
||||
@@ -1253,11 +_,21 @@
|
||||
if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) {
|
||||
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
|
||||
BlockPos blockpos = blockraytraceresult.func_216350_a();
|
||||
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) {
|
||||
+ if (!this.field_71441_e.func_175623_d(blockpos)) {
|
||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND);
|
||||
if (p_147115_1_ && this.hitResult != null && this.hitResult.getType() == RayTraceResult.Type.BLOCK) {
|
||||
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.hitResult;
|
||||
BlockPos blockpos = blockraytraceresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, Hand.MAIN_HAND);
|
||||
+ if (inputEvent.isCanceled()) {
|
||||
+ if (inputEvent.shouldSwingHand()) {
|
||||
+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult);
|
||||
+ this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
|
||||
+ this.particleEngine.addBlockHitEffects(blockpos, blockraytraceresult);
|
||||
+ this.player.swing(Hand.MAIN_HAND);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
Direction direction = blockraytraceresult.func_216354_b();
|
||||
if (this.field_71442_b.func_180512_c(blockpos, direction)) {
|
||||
- this.field_71452_i.func_180532_a(blockpos, direction);
|
||||
Direction direction = blockraytraceresult.getDirection();
|
||||
if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
|
||||
- this.particleEngine.crack(blockpos, direction);
|
||||
+ if (inputEvent.shouldSwingHand()) {
|
||||
+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult);
|
||||
this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
|
||||
+ this.particleEngine.addBlockHitEffects(blockpos, blockraytraceresult);
|
||||
this.player.swing(Hand.MAIN_HAND);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
@@ -195,168 +210,168 @@
|
||||
@@ -1276,6 +_,8 @@
|
||||
}
|
||||
|
||||
} else if (!this.field_71439_g.func_184838_M()) {
|
||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND);
|
||||
} else if (!this.player.isHandsBusy()) {
|
||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, Hand.MAIN_HAND);
|
||||
+ if (!inputEvent.isCanceled())
|
||||
switch(this.field_71476_x.func_216346_c()) {
|
||||
switch(this.hitResult.getType()) {
|
||||
case ENTITY:
|
||||
this.field_71442_b.func_78764_a(this.field_71439_g, ((EntityRayTraceResult)this.field_71476_x).func_216348_a());
|
||||
this.gameMode.attack(this.player, ((EntityRayTraceResult)this.hitResult).getEntity());
|
||||
@@ -1283,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
|
||||
BlockPos blockpos = blockraytraceresult.func_216350_a();
|
||||
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) {
|
||||
+ if (!this.field_71441_e.func_175623_d(blockpos)) {
|
||||
this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b());
|
||||
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.hitResult;
|
||||
BlockPos blockpos = blockraytraceresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
this.gameMode.startDestroyBlock(blockpos, blockraytraceresult.getDirection());
|
||||
break;
|
||||
}
|
||||
@@ -1293,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.field_71439_g.func_184821_cY();
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.field_71439_g);
|
||||
this.player.resetAttackStrengthTicker();
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.player);
|
||||
}
|
||||
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
|
||||
this.player.swing(Hand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1309,6 +_,11 @@
|
||||
}
|
||||
|
||||
for(Hand hand : Hand.values()) {
|
||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.field_71474_y.field_74313_G, hand);
|
||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.options.keyUse, hand);
|
||||
+ if (inputEvent.isCanceled()) {
|
||||
+ if (inputEvent.shouldSwingHand()) this.field_71439_g.func_184609_a(hand);
|
||||
+ if (inputEvent.shouldSwingHand()) this.player.swing(hand);
|
||||
+ return;
|
||||
+ }
|
||||
ItemStack itemstack = this.field_71439_g.func_184586_b(hand);
|
||||
if (this.field_71476_x != null) {
|
||||
switch(this.field_71476_x.func_216346_c()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(hand);
|
||||
if (this.hitResult != null) {
|
||||
switch(this.hitResult.getType()) {
|
||||
@@ -1322,6 +_,7 @@
|
||||
|
||||
if (actionresulttype.func_226246_a_()) {
|
||||
if (actionresulttype.func_226247_b_()) {
|
||||
if (actionresulttype.consumesAction()) {
|
||||
if (actionresulttype.shouldSwing()) {
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.field_71439_g.func_184609_a(hand);
|
||||
this.player.swing(hand);
|
||||
}
|
||||
|
||||
@@ -1334,6 +_,7 @@
|
||||
ActionResultType actionresulttype1 = this.field_71442_b.func_217292_a(this.field_71439_g, this.field_71441_e, hand, blockraytraceresult);
|
||||
if (actionresulttype1.func_226246_a_()) {
|
||||
if (actionresulttype1.func_226247_b_()) {
|
||||
ActionResultType actionresulttype1 = this.gameMode.useItemOn(this.player, this.level, hand, blockraytraceresult);
|
||||
if (actionresulttype1.consumesAction()) {
|
||||
if (actionresulttype1.shouldSwing()) {
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.field_71439_g.func_184609_a(hand);
|
||||
if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.field_71442_b.func_78758_h())) {
|
||||
this.field_71460_t.field_78516_c.func_187460_a(hand);
|
||||
this.player.swing(hand);
|
||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(hand);
|
||||
@@ -1349,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (itemstack.func_190926_b() && (this.field_71476_x == null || this.field_71476_x.func_216346_c() == RayTraceResult.Type.MISS))
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, hand);
|
||||
+ if (itemstack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == RayTraceResult.Type.MISS))
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.player, hand);
|
||||
+
|
||||
if (!itemstack.func_190926_b()) {
|
||||
ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand);
|
||||
if (actionresulttype2.func_226246_a_()) {
|
||||
if (!itemstack.isEmpty()) {
|
||||
ActionResultType actionresulttype2 = this.gameMode.useItem(this.player, this.level, hand);
|
||||
if (actionresulttype2.consumesAction()) {
|
||||
@@ -1375,6 +_,8 @@
|
||||
--this.field_71467_ac;
|
||||
--this.rightClickDelay;
|
||||
}
|
||||
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick();
|
||||
+
|
||||
this.field_71424_I.func_76320_a("gui");
|
||||
if (!this.field_71445_n) {
|
||||
this.field_71456_v.func_73831_a();
|
||||
this.profiler.push("gui");
|
||||
if (!this.pause) {
|
||||
this.gui.tick();
|
||||
@@ -1500,6 +_,8 @@
|
||||
this.field_71424_I.func_219895_b("keyboard");
|
||||
this.field_195559_v.func_204870_b();
|
||||
this.field_71424_I.func_76319_b();
|
||||
this.profiler.popPush("keyboard");
|
||||
this.keyboardHandler.tick();
|
||||
this.profiler.pop();
|
||||
+
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.onPostClientTick();
|
||||
}
|
||||
|
||||
private boolean func_244600_aM() {
|
||||
private boolean isMultiplayerServer() {
|
||||
@@ -1638,11 +_,11 @@
|
||||
}
|
||||
|
||||
public void func_238191_a_(String p_238191_1_) {
|
||||
- this.func_238195_a_(p_238191_1_, DynamicRegistries.func_239770_b_(), Minecraft::func_238180_a_, Minecraft::func_238181_a_, false, Minecraft.WorldSelectionType.BACKUP);
|
||||
+ this.loadWorld(p_238191_1_, DynamicRegistries.func_239770_b_(), Minecraft::func_238180_a_, Minecraft::func_238181_a_, false, Minecraft.WorldSelectionType.BACKUP, false);
|
||||
public void loadLevel(String p_238191_1_) {
|
||||
- this.doLoadLevel(p_238191_1_, DynamicRegistries.builtin(), Minecraft::loadDataPacks, Minecraft::loadWorldData, false, Minecraft.WorldSelectionType.BACKUP);
|
||||
+ this.loadWorld(p_238191_1_, DynamicRegistries.builtin(), Minecraft::loadDataPacks, Minecraft::loadWorldData, false, Minecraft.WorldSelectionType.BACKUP, false);
|
||||
}
|
||||
|
||||
public void func_238192_a_(String p_238192_1_, WorldSettings p_238192_2_, DynamicRegistries.Impl p_238192_3_, DimensionGeneratorSettings p_238192_4_) {
|
||||
- this.func_238195_a_(p_238192_1_, p_238192_3_, (p_238179_1_) -> {
|
||||
public void createLevel(String p_238192_1_, WorldSettings p_238192_2_, DynamicRegistries.Impl p_238192_3_, DimensionGeneratorSettings p_238192_4_) {
|
||||
- this.doLoadLevel(p_238192_1_, p_238192_3_, (p_238179_1_) -> {
|
||||
+ this.loadWorld(p_238192_1_, p_238192_3_, (p_238179_1_) -> {
|
||||
return p_238192_2_.func_234958_g_();
|
||||
return p_238192_2_.getDataPackConfig();
|
||||
}, (p_238187_3_, p_238187_4_, p_238187_5_, p_238187_6_) -> {
|
||||
WorldGenSettingsExport<JsonElement> worldgensettingsexport = WorldGenSettingsExport.func_240896_a_(JsonOps.INSTANCE, p_238192_3_);
|
||||
WorldGenSettingsExport<JsonElement> worldgensettingsexport = WorldGenSettingsExport.create(JsonOps.INSTANCE, p_238192_3_);
|
||||
@@ -1652,10 +_,10 @@
|
||||
});
|
||||
DimensionGeneratorSettings dimensiongeneratorsettings = dataresult.resultOrPartial(Util.func_240982_a_("Error reading worldgen settings after loading data packs: ", field_147123_G::error)).orElse(p_238192_4_);
|
||||
DimensionGeneratorSettings dimensiongeneratorsettings = dataresult.resultOrPartial(Util.prefix("Error reading worldgen settings after loading data packs: ", LOGGER::error)).orElse(p_238192_4_);
|
||||
return new ServerWorldInfo(p_238192_2_, dimensiongeneratorsettings, dataresult.lifecycle());
|
||||
- }, false, Minecraft.WorldSelectionType.CREATE);
|
||||
+ }, false, Minecraft.WorldSelectionType.CREATE, true);
|
||||
}
|
||||
|
||||
- private void func_238195_a_(String p_238195_1_, DynamicRegistries.Impl p_238195_2_, Function<SaveFormat.LevelSave, DatapackCodec> p_238195_3_, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> p_238195_4_, boolean p_238195_5_, Minecraft.WorldSelectionType p_238195_6_) {
|
||||
- private void doLoadLevel(String p_238195_1_, DynamicRegistries.Impl p_238195_2_, Function<SaveFormat.LevelSave, DatapackCodec> p_238195_3_, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> p_238195_4_, boolean p_238195_5_, Minecraft.WorldSelectionType p_238195_6_) {
|
||||
+ private void loadWorld(String p_238195_1_, DynamicRegistries.Impl p_238195_2_, Function<SaveFormat.LevelSave, DatapackCodec> p_238195_3_, Function4<SaveFormat.LevelSave, DynamicRegistries.Impl, IResourceManager, DatapackCodec, IServerConfiguration> p_238195_4_, boolean p_238195_5_, Minecraft.WorldSelectionType p_238195_6_, boolean creating) {
|
||||
SaveFormat.LevelSave saveformat$levelsave;
|
||||
try {
|
||||
saveformat$levelsave = this.field_71469_aa.func_237274_c_(p_238195_1_);
|
||||
saveformat$levelsave = this.levelSource.createAccess(p_238195_1_);
|
||||
@@ -1667,12 +_,17 @@
|
||||
}
|
||||
|
||||
Minecraft.PackManager minecraft$packmanager;
|
||||
+ final DynamicRegistries.Impl dyn_f;
|
||||
try {
|
||||
- minecraft$packmanager = this.func_238189_a_(p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave);
|
||||
+ Minecraft.PackManager mgr = this.func_238189_a_(p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave);
|
||||
- minecraft$packmanager = this.makeServerStem(p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave);
|
||||
+ Minecraft.PackManager mgr = this.makeServerStem(p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave);
|
||||
+ // We need to rebuild this if we're loading world, so that it gets all the information from AFTER we inject our mappings from the save.
|
||||
+ dyn_f = creating ? p_238195_2_ : DynamicRegistries.func_239770_b_();
|
||||
+ minecraft$packmanager = creating ? mgr : this.func_238189_a_(dyn_f, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave); //Note this runs the injection again... which isn't good.. but hey.. we need a better spot to hook in.
|
||||
+ dyn_f = creating ? p_238195_2_ : DynamicRegistries.builtin();
|
||||
+ minecraft$packmanager = creating ? mgr : this.makeServerStem(dyn_f, p_238195_3_, p_238195_4_, p_238195_5_, saveformat$levelsave); //Note this runs the injection again... which isn't good.. but hey.. we need a better spot to hook in.
|
||||
+
|
||||
} catch (Exception exception) {
|
||||
field_147123_G.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception);
|
||||
this.func_147108_a(new DatapackFailureScreen(() -> {
|
||||
- this.func_238195_a_(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, true, p_238195_6_);
|
||||
LOGGER.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception);
|
||||
this.setScreen(new DatapackFailureScreen(() -> {
|
||||
- this.doLoadLevel(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, true, p_238195_6_);
|
||||
+ this.loadWorld(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, true, p_238195_6_, creating);
|
||||
}));
|
||||
|
||||
try {
|
||||
@@ -1692,7 +_,7 @@
|
||||
this.field_213277_ad.set((TrackingChunkStatusListener)null);
|
||||
this.progressListener.set((TrackingChunkStatusListener)null);
|
||||
|
||||
try {
|
||||
- saveformat$levelsave.func_237287_a_(p_238195_2_, iserverconfiguration);
|
||||
+ saveformat$levelsave.func_237287_a_(dyn_f, iserverconfiguration);
|
||||
minecraft$packmanager.func_238225_b_().func_240971_i_();
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.field_110453_aa);
|
||||
- saveformat$levelsave.saveDataTag(p_238195_2_, iserverconfiguration);
|
||||
+ saveformat$levelsave.saveDataTag(dyn_f, iserverconfiguration);
|
||||
minecraft$packmanager.serverResources().updateGlobals();
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.proxy);
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
@@ -1702,7 +_,7 @@
|
||||
SkullTileEntity.func_184294_a(minecraftsessionservice);
|
||||
PlayerProfileCache.func_187320_a(false);
|
||||
this.field_71437_Z = MinecraftServer.func_240784_a_((p_238188_8_) -> {
|
||||
- return new IntegratedServer(p_238188_8_, this, p_238195_2_, saveformat$levelsave, minecraft$packmanager.func_238224_a_(), minecraft$packmanager.func_238225_b_(), iserverconfiguration, minecraftsessionservice, gameprofilerepository, playerprofilecache, (p_238211_1_) -> {
|
||||
+ return new IntegratedServer(p_238188_8_, this, dyn_f, saveformat$levelsave, minecraft$packmanager.func_238224_a_(), minecraft$packmanager.func_238225_b_(), iserverconfiguration, minecraftsessionservice, gameprofilerepository, playerprofilecache, (p_238211_1_) -> {
|
||||
SkullTileEntity.setSessionService(minecraftsessionservice);
|
||||
PlayerProfileCache.setUsesAuthentication(false);
|
||||
this.singleplayerServer = MinecraftServer.spin((p_238188_8_) -> {
|
||||
- return new IntegratedServer(p_238188_8_, this, p_238195_2_, saveformat$levelsave, minecraft$packmanager.packRepository(), minecraft$packmanager.serverResources(), iserverconfiguration, minecraftsessionservice, gameprofilerepository, playerprofilecache, (p_238211_1_) -> {
|
||||
+ return new IntegratedServer(p_238188_8_, this, dyn_f, saveformat$levelsave, minecraft$packmanager.packRepository(), minecraft$packmanager.serverResources(), iserverconfiguration, minecraftsessionservice, gameprofilerepository, playerprofilecache, (p_238211_1_) -> {
|
||||
TrackingChunkStatusListener trackingchunkstatuslistener = new TrackingChunkStatusListener(p_238211_1_ + 0);
|
||||
trackingchunkstatuslistener.func_219521_a();
|
||||
this.field_213277_ad.set(trackingchunkstatuslistener);
|
||||
trackingchunkstatuslistener.start();
|
||||
this.progressListener.set(trackingchunkstatuslistener);
|
||||
@@ -1747,11 +_,16 @@
|
||||
networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> {
|
||||
networkmanager.setListener(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> {
|
||||
}));
|
||||
networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN));
|
||||
- networkmanager.func_179290_a(new CLoginStartPacket(this.func_110432_I().func_148256_e()));
|
||||
+ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e();
|
||||
+ if (!this.func_110432_I().hasCachedProperties()) {
|
||||
+ gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
|
||||
+ this.func_110432_I().setProperties(gameProfile.getProperties());
|
||||
networkmanager.send(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN));
|
||||
- networkmanager.send(new CLoginStartPacket(this.getUser().getGameProfile()));
|
||||
+ com.mojang.authlib.GameProfile gameProfile = this.getUser().getGameProfile();
|
||||
+ if (!this.getUser().hasCachedProperties()) {
|
||||
+ gameProfile = minecraftSessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
|
||||
+ this.getUser().setProperties(gameProfile.getProperties());
|
||||
+ }
|
||||
+ networkmanager.func_179290_a(new CLoginStartPacket(gameProfile));
|
||||
this.field_71453_ak = networkmanager;
|
||||
+ networkmanager.send(new CLoginStartPacket(gameProfile));
|
||||
this.pendingConnection = networkmanager;
|
||||
} else {
|
||||
this.func_241559_a_(p_238195_6_, p_238195_1_, flag, () -> {
|
||||
- this.func_238195_a_(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, Minecraft.WorldSelectionType.NONE);
|
||||
this.displayExperimentalConfirmationDialog(p_238195_6_, p_238195_1_, flag, () -> {
|
||||
- this.doLoadLevel(p_238195_1_, p_238195_2_, p_238195_3_, p_238195_4_, p_238195_5_, Minecraft.WorldSelectionType.NONE);
|
||||
+ this.loadWorld(p_238195_1_, dyn_f, p_238195_3_, p_238195_4_, p_238195_5_, Minecraft.WorldSelectionType.NONE, creating);
|
||||
});
|
||||
minecraft$packmanager.close();
|
||||
@@ -364,114 +379,114 @@
|
||||
@@ -1821,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void func_71403_a(ClientWorld p_71403_1_) {
|
||||
+ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e));
|
||||
public void setLevel(ClientWorld p_71403_1_) {
|
||||
+ if (level != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(level));
|
||||
WorkingScreen workingscreen = new WorkingScreen();
|
||||
workingscreen.func_200210_a(new TranslationTextComponent("connect.joining"));
|
||||
this.func_213241_c(workingscreen);
|
||||
workingscreen.progressStartNoAbort(new TranslationTextComponent("connect.joining"));
|
||||
this.updateScreenAndTick(workingscreen);
|
||||
@@ -1852,10 +_,12 @@
|
||||
IntegratedServer integratedserver = this.field_71437_Z;
|
||||
this.field_71437_Z = null;
|
||||
this.field_71460_t.func_190564_k();
|
||||
+ net.minecraftforge.fml.client.ClientHooks.firePlayerLogout(this.field_71442_b, this.field_71439_g);
|
||||
this.field_71442_b = null;
|
||||
NarratorChatListener.field_193643_a.func_193642_b();
|
||||
this.func_213241_c(p_213231_1_);
|
||||
if (this.field_71441_e != null) {
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e));
|
||||
IntegratedServer integratedserver = this.singleplayerServer;
|
||||
this.singleplayerServer = null;
|
||||
this.gameRenderer.resetData();
|
||||
+ net.minecraftforge.fml.client.ClientHooks.firePlayerLogout(this.gameMode, this.player);
|
||||
this.gameMode = null;
|
||||
NarratorChatListener.INSTANCE.clear();
|
||||
this.updateScreenAndTick(p_213231_1_);
|
||||
if (this.level != null) {
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(level));
|
||||
if (integratedserver != null) {
|
||||
this.field_71424_I.func_76320_a("waitForServer");
|
||||
this.profiler.push("waitForServer");
|
||||
|
||||
@@ -1870,6 +_,7 @@
|
||||
this.field_71456_v.func_181029_i();
|
||||
this.field_71422_O = null;
|
||||
this.field_71455_al = false;
|
||||
+ net.minecraftforge.fml.client.ClientHooks.handleClientWorldClosing(field_71441_e);
|
||||
this.field_213274_aO.func_216815_b();
|
||||
this.gui.onDisconnected();
|
||||
this.currentServer = null;
|
||||
this.isLocalServer = false;
|
||||
+ net.minecraftforge.fml.client.ClientHooks.handleClientWorldClosing(level);
|
||||
this.game.onLeaveGameSession();
|
||||
}
|
||||
|
||||
@@ -1900,6 +_,7 @@
|
||||
this.field_71452_i.func_78870_a(p_213257_1_);
|
||||
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_);
|
||||
this.func_230150_b_();
|
||||
this.particleEngine.setLevel(p_213257_1_);
|
||||
TileEntityRendererDispatcher.instance.setLevel(p_213257_1_);
|
||||
this.updateTitle();
|
||||
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
|
||||
}
|
||||
|
||||
public boolean func_238216_r_() {
|
||||
public boolean allowsMultiplayer() {
|
||||
@@ -1945,112 +_,9 @@
|
||||
|
||||
private void func_147112_ai() {
|
||||
if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) {
|
||||
- boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d;
|
||||
private void pickBlock() {
|
||||
if (this.hitResult != null && this.hitResult.getType() != RayTraceResult.Type.MISS) {
|
||||
- boolean flag = this.player.abilities.instabuild;
|
||||
- TileEntity tileentity = null;
|
||||
- RayTraceResult.Type raytraceresult$type = this.field_71476_x.func_216346_c();
|
||||
- RayTraceResult.Type raytraceresult$type = this.hitResult.getType();
|
||||
- ItemStack itemstack;
|
||||
- if (raytraceresult$type == RayTraceResult.Type.BLOCK) {
|
||||
- BlockPos blockpos = ((BlockRayTraceResult)this.field_71476_x).func_216350_a();
|
||||
- BlockState blockstate = this.field_71441_e.func_180495_p(blockpos);
|
||||
- Block block = blockstate.func_177230_c();
|
||||
- if (blockstate.func_196958_f()) {
|
||||
- BlockPos blockpos = ((BlockRayTraceResult)this.hitResult).getBlockPos();
|
||||
- BlockState blockstate = this.level.getBlockState(blockpos);
|
||||
- Block block = blockstate.getBlock();
|
||||
- if (blockstate.isAir()) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- itemstack = block.func_185473_a(this.field_71441_e, blockpos, blockstate);
|
||||
- if (itemstack.func_190926_b()) {
|
||||
- itemstack = block.getCloneItemStack(this.level, blockpos, blockstate);
|
||||
- if (itemstack.isEmpty()) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (flag && Screen.func_231172_r_() && block.func_235695_q_()) {
|
||||
- tileentity = this.field_71441_e.func_175625_s(blockpos);
|
||||
- if (flag && Screen.hasControlDown() && block.isEntityBlock()) {
|
||||
- tileentity = this.level.getBlockEntity(blockpos);
|
||||
- }
|
||||
- } else {
|
||||
- if (raytraceresult$type != RayTraceResult.Type.ENTITY || !flag) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- Entity entity = ((EntityRayTraceResult)this.field_71476_x).func_216348_a();
|
||||
- Entity entity = ((EntityRayTraceResult)this.hitResult).getEntity();
|
||||
- if (entity instanceof PaintingEntity) {
|
||||
- itemstack = new ItemStack(Items.field_151159_an);
|
||||
- itemstack = new ItemStack(Items.PAINTING);
|
||||
- } else if (entity instanceof LeashKnotEntity) {
|
||||
- itemstack = new ItemStack(Items.field_151058_ca);
|
||||
- itemstack = new ItemStack(Items.LEAD);
|
||||
- } else if (entity instanceof ItemFrameEntity) {
|
||||
- ItemFrameEntity itemframeentity = (ItemFrameEntity)entity;
|
||||
- ItemStack itemstack1 = itemframeentity.func_82335_i();
|
||||
- if (itemstack1.func_190926_b()) {
|
||||
- itemstack = new ItemStack(Items.field_151160_bD);
|
||||
- ItemStack itemstack1 = itemframeentity.getItem();
|
||||
- if (itemstack1.isEmpty()) {
|
||||
- itemstack = new ItemStack(Items.ITEM_FRAME);
|
||||
- } else {
|
||||
- itemstack = itemstack1.func_77946_l();
|
||||
- itemstack = itemstack1.copy();
|
||||
- }
|
||||
- } else if (entity instanceof AbstractMinecartEntity) {
|
||||
- AbstractMinecartEntity abstractminecartentity = (AbstractMinecartEntity)entity;
|
||||
- Item item;
|
||||
- switch(abstractminecartentity.func_184264_v()) {
|
||||
- switch(abstractminecartentity.getMinecartType()) {
|
||||
- case FURNACE:
|
||||
- item = Items.field_151109_aJ;
|
||||
- item = Items.FURNACE_MINECART;
|
||||
- break;
|
||||
- case CHEST:
|
||||
- item = Items.field_151108_aI;
|
||||
- item = Items.CHEST_MINECART;
|
||||
- break;
|
||||
- case TNT:
|
||||
- item = Items.field_151142_bV;
|
||||
- item = Items.TNT_MINECART;
|
||||
- break;
|
||||
- case HOPPER:
|
||||
- item = Items.field_151140_bW;
|
||||
- item = Items.HOPPER_MINECART;
|
||||
- break;
|
||||
- case COMMAND_BLOCK:
|
||||
- item = Items.field_151095_cc;
|
||||
- item = Items.COMMAND_BLOCK_MINECART;
|
||||
- break;
|
||||
- default:
|
||||
- item = Items.field_151143_au;
|
||||
- item = Items.MINECART;
|
||||
- }
|
||||
-
|
||||
- itemstack = new ItemStack(item);
|
||||
- } else if (entity instanceof BoatEntity) {
|
||||
- itemstack = new ItemStack(((BoatEntity)entity).func_184455_j());
|
||||
- itemstack = new ItemStack(((BoatEntity)entity).getDropItem());
|
||||
- } else if (entity instanceof ArmorStandEntity) {
|
||||
- itemstack = new ItemStack(Items.field_179565_cj);
|
||||
- itemstack = new ItemStack(Items.ARMOR_STAND);
|
||||
- } else if (entity instanceof EnderCrystalEntity) {
|
||||
- itemstack = new ItemStack(Items.field_185158_cP);
|
||||
- itemstack = new ItemStack(Items.END_CRYSTAL);
|
||||
- } else {
|
||||
- SpawnEggItem spawneggitem = SpawnEggItem.func_200889_b(entity.func_200600_R());
|
||||
- SpawnEggItem spawneggitem = SpawnEggItem.byId(entity.getType());
|
||||
- if (spawneggitem == null) {
|
||||
- return;
|
||||
- }
|
||||
@@ -480,69 +495,69 @@
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (itemstack.func_190926_b()) {
|
||||
- if (itemstack.isEmpty()) {
|
||||
- String s = "";
|
||||
- if (raytraceresult$type == RayTraceResult.Type.BLOCK) {
|
||||
- s = Registry.field_212618_g.func_177774_c(this.field_71441_e.func_180495_p(((BlockRayTraceResult)this.field_71476_x).func_216350_a()).func_177230_c()).toString();
|
||||
- s = Registry.BLOCK.getKey(this.level.getBlockState(((BlockRayTraceResult)this.hitResult).getBlockPos()).getBlock()).toString();
|
||||
- } else if (raytraceresult$type == RayTraceResult.Type.ENTITY) {
|
||||
- s = Registry.field_212629_r.func_177774_c(((EntityRayTraceResult)this.field_71476_x).func_216348_a().func_200600_R()).toString();
|
||||
- s = Registry.ENTITY_TYPE.getKey(((EntityRayTraceResult)this.hitResult).getEntity().getType()).toString();
|
||||
- }
|
||||
-
|
||||
- field_147123_G.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s);
|
||||
- LOGGER.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s);
|
||||
- } else {
|
||||
- PlayerInventory playerinventory = this.field_71439_g.field_71071_by;
|
||||
- PlayerInventory playerinventory = this.player.inventory;
|
||||
- if (tileentity != null) {
|
||||
- this.func_184119_a(itemstack, tileentity);
|
||||
- this.addCustomNbtData(itemstack, tileentity);
|
||||
- }
|
||||
-
|
||||
- int i = playerinventory.func_184429_b(itemstack);
|
||||
- int i = playerinventory.findSlotMatchingItem(itemstack);
|
||||
- if (flag) {
|
||||
- playerinventory.func_184434_a(itemstack);
|
||||
- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(Hand.MAIN_HAND), 36 + playerinventory.field_70461_c);
|
||||
- playerinventory.setPickedItem(itemstack);
|
||||
- this.gameMode.handleCreativeModeItemAdd(this.player.getItemInHand(Hand.MAIN_HAND), 36 + playerinventory.selected);
|
||||
- } else if (i != -1) {
|
||||
- if (PlayerInventory.func_184435_e(i)) {
|
||||
- playerinventory.field_70461_c = i;
|
||||
- if (PlayerInventory.isHotbarSlot(i)) {
|
||||
- playerinventory.selected = i;
|
||||
- } else {
|
||||
- this.field_71442_b.func_187100_a(i);
|
||||
- this.gameMode.handlePickItem(i);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- }
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.field_71474_y.field_74322_I, Hand.MAIN_HAND).isCanceled())
|
||||
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e);
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.options.keyPickItem, Hand.MAIN_HAND).isCanceled())
|
||||
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.hitResult, this.player, this.level);
|
||||
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2140,6 +_,7 @@
|
||||
return field_71432_P;
|
||||
return instance;
|
||||
}
|
||||
|
||||
+ @Deprecated // Forge: Use selective scheduleResourceRefresh method in FMLClientHandler
|
||||
public CompletableFuture<Void> func_213245_w() {
|
||||
return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> {
|
||||
public CompletableFuture<Void> delayTextureReload() {
|
||||
return this.submit(this::reloadResourcePacks).thenCompose((p_229993_0_) -> {
|
||||
return p_229993_0_;
|
||||
@@ -2451,7 +_,7 @@
|
||||
supplier = func_228022_c_(supplier);
|
||||
supplier = adaptV4(supplier);
|
||||
}
|
||||
|
||||
- return new ResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_6_);
|
||||
+ return new ResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_6_, p_228011_3_.isHidden());
|
||||
}
|
||||
|
||||
private static Supplier<IResourcePack> func_228021_b_(Supplier<IResourcePack> p_228021_0_) {
|
||||
private static Supplier<IResourcePack> adaptV3(Supplier<IResourcePack> p_228021_0_) {
|
||||
@@ -2468,6 +_,14 @@
|
||||
|
||||
public void func_228020_b_(int p_228020_1_) {
|
||||
this.field_175617_aL.func_229355_a_(p_228020_1_);
|
||||
public void updateMaxMipLevel(int p_228020_1_) {
|
||||
this.modelManager.updateMaxMipLevel(p_228020_1_);
|
||||
+ }
|
||||
+
|
||||
+ public ItemColors getItemColors() {
|
||||
+ return this.field_184128_aI;
|
||||
+ return this.itemColors;
|
||||
+ }
|
||||
+
|
||||
+ public SearchTreeManager getSearchTreeManager() {
|
||||
+ return this.field_193995_ae;
|
||||
+ return this.searchRegistry;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -1,29 +1,29 @@
|
||||
--- a/net/minecraft/client/MouseHelper.java
|
||||
+++ b/net/minecraft/client/MouseHelper.java
|
||||
@@ -71,6 +_,7 @@
|
||||
this.field_198042_g = -1;
|
||||
this.activeButton = -1;
|
||||
}
|
||||
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_198023_3_, p_198023_4_, p_198023_5_)) return;
|
||||
boolean[] aboolean = new boolean[]{false};
|
||||
if (this.field_198036_a.field_213279_p == null) {
|
||||
if (this.field_198036_a.field_71462_r == null) {
|
||||
if (this.minecraft.overlay == null) {
|
||||
if (this.minecraft.screen == null) {
|
||||
@@ -82,11 +_,15 @@
|
||||
double d1 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
|
||||
double d1 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
if (flag) {
|
||||
Screen.func_231153_a_(() -> {
|
||||
- aboolean[0] = this.field_198036_a.field_71462_r.func_231044_a_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, i);
|
||||
+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.func_231044_a_(d0, d1, i);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, i);
|
||||
}, "mouseClicked event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName());
|
||||
Screen.wrapScreenError(() -> {
|
||||
- aboolean[0] = this.minecraft.screen.mouseClicked(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.minecraft.screen, d0, d1, i);
|
||||
+ if (!aboolean[0]) aboolean[0] = this.minecraft.screen.mouseClicked(d0, d1, i);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.minecraft.screen, d0, d1, i);
|
||||
}, "mouseClicked event handler", this.minecraft.screen.getClass().getCanonicalName());
|
||||
} else {
|
||||
Screen.func_231153_a_(() -> {
|
||||
- aboolean[0] = this.field_198036_a.field_71462_r.func_231048_c_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, i);
|
||||
+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.func_231048_c_(d0, d1, i);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, i);
|
||||
}, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName());
|
||||
Screen.wrapScreenError(() -> {
|
||||
- aboolean[0] = this.minecraft.screen.mouseReleased(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.minecraft.screen, d0, d1, i);
|
||||
+ if (!aboolean[0]) aboolean[0] = this.minecraft.screen.mouseReleased(d0, d1, i);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.minecraft.screen, d0, d1, i);
|
||||
}, "mouseReleased event handler", this.minecraft.screen.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -110,18 +_,26 @@
|
||||
@@ -35,68 +35,68 @@
|
||||
}
|
||||
}
|
||||
|
||||
private void func_198020_a(long p_198020_1_, double p_198020_3_, double p_198020_5_) {
|
||||
if (p_198020_1_ == Minecraft.func_71410_x().func_228018_at_().func_198092_i()) {
|
||||
- double d0 = (this.field_198036_a.field_71474_y.field_216843_O ? Math.signum(p_198020_5_) : p_198020_5_) * this.field_198036_a.field_71474_y.field_208033_V;
|
||||
private void onScroll(long p_198020_1_, double p_198020_3_, double p_198020_5_) {
|
||||
if (p_198020_1_ == Minecraft.getInstance().getWindow().getWindow()) {
|
||||
- double d0 = (this.minecraft.options.discreteMouseScroll ? Math.signum(p_198020_5_) : p_198020_5_) * this.minecraft.options.mouseWheelSensitivity;
|
||||
+ // FORGE: Allows for Horizontal Scroll to be recognized as Vertical Scroll - Fixes MC-121772
|
||||
+ double offset = p_198020_5_;
|
||||
+ if (Minecraft.field_142025_a && p_198020_5_ == 0) {
|
||||
+ if (Minecraft.ON_OSX && p_198020_5_ == 0) {
|
||||
+ offset = p_198020_3_;
|
||||
+ }
|
||||
+
|
||||
+ double d0 = (this.field_198036_a.field_71474_y.field_216843_O ? Math.signum(offset) : offset) * this.field_198036_a.field_71474_y.field_208033_V;
|
||||
if (this.field_198036_a.field_213279_p == null) {
|
||||
if (this.field_198036_a.field_71462_r != null) {
|
||||
double d1 = this.field_198040_e * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m();
|
||||
double d2 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
|
||||
- this.field_198036_a.field_71462_r.func_231043_a_(d1, d2, d0);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.field_198036_a.field_71462_r, d0)) return;
|
||||
+ if (this.field_198036_a.field_71462_r.func_231043_a_(d1, d2, d0)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.field_198036_a.field_71462_r, d0);
|
||||
} else if (this.field_198036_a.field_71439_g != null) {
|
||||
if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) {
|
||||
this.field_200542_o = 0.0D;
|
||||
+ double d0 = (this.minecraft.options.discreteMouseScroll ? Math.signum(offset) : offset) * this.minecraft.options.mouseWheelSensitivity;
|
||||
if (this.minecraft.overlay == null) {
|
||||
if (this.minecraft.screen != null) {
|
||||
double d1 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d2 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
- this.minecraft.screen.mouseScrolled(d1, d2, d0);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.minecraft.screen, d0)) return;
|
||||
+ if (this.minecraft.screen.mouseScrolled(d1, d2, d0)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.minecraft.screen, d0);
|
||||
} else if (this.minecraft.player != null) {
|
||||
if (this.accumulatedScroll != 0.0D && Math.signum(d0) != Math.signum(this.accumulatedScroll)) {
|
||||
this.accumulatedScroll = 0.0D;
|
||||
@@ -134,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.field_200542_o -= (double)f1;
|
||||
this.accumulatedScroll -= (double)f1;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onMouseScroll(this, d0)) return;
|
||||
if (this.field_198036_a.field_71439_g.func_175149_v()) {
|
||||
if (this.field_198036_a.field_71456_v.func_175187_g().func_175262_a()) {
|
||||
this.field_198036_a.field_71456_v.func_175187_g().func_195621_a((double)(-f1));
|
||||
if (this.minecraft.player.isSpectator()) {
|
||||
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.getSpectatorGui().onMouseScrolled((double)(-f1));
|
||||
@@ -202,7 +_,9 @@
|
||||
double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m();
|
||||
double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
|
||||
Screen.func_231153_a_(() -> {
|
||||
- iguieventlistener.func_231045_a_(d0, d1, this.field_198042_g, d2, d3);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3)) return;
|
||||
+ if (iguieventlistener.func_231045_a_(d0, d1, this.field_198042_g, d2, d3)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3);
|
||||
double d2 = (p_198022_3_ - this.xpos) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d3 = (p_198022_5_ - this.ypos) * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
Screen.wrapScreenError(() -> {
|
||||
- iguieventlistener.mouseDragged(d0, d1, this.activeButton, d2, d3);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.minecraft.screen, d0, d1, this.activeButton, d2, d3)) return;
|
||||
+ if (iguieventlistener.mouseDragged(d0, d1, this.activeButton, d2, d3)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.minecraft.screen, d0, d1, this.activeButton, d2, d3);
|
||||
}, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -267,12 +_,24 @@
|
||||
return this.field_198039_d;
|
||||
return this.isRightPressed;
|
||||
}
|
||||
|
||||
+ public boolean isMiddleDown() {
|
||||
+ return this.field_198038_c;
|
||||
+ return this.isMiddlePressed;
|
||||
+ }
|
||||
+
|
||||
public double func_198024_e() {
|
||||
return this.field_198040_e;
|
||||
public double xpos() {
|
||||
return this.xpos;
|
||||
}
|
||||
|
||||
public double func_198026_f() {
|
||||
return this.field_198041_f;
|
||||
public double ypos() {
|
||||
return this.ypos;
|
||||
+ }
|
||||
+
|
||||
+ public double getXVelocity() {
|
||||
+ return this.field_198048_m;
|
||||
+ return this.accumulatedDX;
|
||||
+ }
|
||||
+
|
||||
+ public double getYVelocity() {
|
||||
+ return this.field_198049_n;
|
||||
+ return this.accumulatedDY;
|
||||
}
|
||||
|
||||
public void func_198021_g() {
|
||||
public void setIgnoreFirstMove() {
|
||||
Loaded 100 of 1414 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user