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 | ||
|
|
064ae6961b | ||
|
|
22d609ed6c | ||
|
|
315bbb74ff | ||
|
|
4e4d31b68c | ||
|
|
1a17fa6129 | ||
|
|
ca9df21258 | ||
|
|
93d7fa54fc | ||
|
|
f235d80d9f | ||
|
|
be34dd89a9 | ||
|
|
6663f23e13 | ||
|
|
f9f7ef2580 | ||
|
|
86352e9c19 | ||
|
|
8c8b31435b | ||
|
|
16b3e2780e | ||
|
|
1121f18413 | ||
|
|
96804fb4df | ||
|
|
03a6dbb405 | ||
|
|
77e8c72589 | ||
|
|
043e49a694 | ||
|
|
5169f1f6fe | ||
|
|
2bd83b26aa | ||
|
|
e6c1814122 | ||
|
|
7f2892de7e | ||
|
|
439ba462d6 | ||
|
|
7c6ae3e61e | ||
|
|
f9b894ecbf | ||
|
|
df53db351e | ||
|
|
9aa04c8036 | ||
|
|
626496cec0 | ||
|
|
022482a3bd | ||
|
|
dd228a9ac1 | ||
|
|
a6d1646591 | ||
|
|
39f9f393db | ||
|
|
d35784eb14 | ||
|
|
31fb15c88d | ||
|
|
29f175743b | ||
|
|
33499db93f | ||
|
|
84381553a9 | ||
|
|
2a7dde3d2e | ||
|
|
aa4f24c915 | ||
|
|
1d87831773 | ||
|
|
65e99f9b58 | ||
|
|
b98991dc70 | ||
|
|
435e65eb18 | ||
|
|
8211a5048a | ||
|
|
167f14f4a1 | ||
|
|
f332642409 | ||
|
|
77d41023b5 | ||
|
|
da2594289c | ||
|
|
6f3da80b5a | ||
|
|
474b47ea51 | ||
|
|
b6ce4fb066 | ||
|
|
1406f2bf1f | ||
|
|
5125775992 | ||
|
|
929c7b7a0b | ||
|
|
7bf02e7dcd | ||
|
|
9d0d249eaf | ||
|
|
c4b1df1fc7 | ||
|
|
b3f253df61 | ||
|
|
dc099069fa | ||
|
|
e80c785563 | ||
|
|
1f9611204f | ||
|
|
0120f6274d | ||
|
|
c0e74bc8a8 | ||
|
|
80feb0aeb2 | ||
|
|
f47429717d | ||
|
|
0239a736ec | ||
|
|
5c488c9007 | ||
|
|
53c039680c | ||
|
|
7379e8b9a4 | ||
|
|
2a0d9e8dac | ||
|
|
aacba8e38e | ||
|
|
f4fd1c2f16 | ||
|
|
813f3d630d | ||
|
|
76cea5a7da | ||
|
|
e33f794298 | ||
|
|
72d05d17a9 | ||
|
|
19f9b309a6 | ||
|
|
5b53616a47 | ||
|
|
5f9e6f3b56 | ||
|
|
0ad8e2c27f | ||
|
|
55f29764f8 | ||
|
|
a4f7087b92 | ||
|
|
a95b968c13 | ||
|
|
802298d99d | ||
|
|
5363dc5d99 | ||
|
|
9602c22083 | ||
|
|
17500032ae | ||
|
|
65bc41281f | ||
|
|
ba15737fe3 | ||
|
|
58f93263e2 | ||
|
|
d97f28141c | ||
|
|
0340664dbf | ||
|
|
d2cfda3fb4 | ||
|
|
48225e1bea | ||
|
|
37ea725749 | ||
|
|
733b812c7b | ||
|
|
9ab29ea8fe | ||
|
|
fe26b77e3b | ||
|
|
b8eca88f75 | ||
|
|
e039531497 | ||
|
|
9017e24b40 | ||
|
|
75570079ae | ||
|
|
e2167140db | ||
|
|
a89ce2d6f1 | ||
|
|
007cd42ec6 | ||
|
|
d16a8d6d5d | ||
|
|
69321a363e | ||
|
|
0e1ee4b1d2 | ||
|
|
cc1a9be2b4 | ||
|
|
1d7da4c595 | ||
|
|
1ac432c594 | ||
|
|
276871d5a3 | ||
|
|
8460227ddf | ||
|
|
f450d4025d | ||
|
|
93a815957d | ||
|
|
84b7cdc1cd | ||
|
|
83fee0b3d4 | ||
|
|
aeaebf5785 | ||
|
|
d88e660cbb | ||
|
|
ab949c7cca | ||
|
|
7728dde36b | ||
|
|
004ab59e6f | ||
|
|
7bfd2b8f34 | ||
|
|
f169c99348 | ||
|
|
d3d3bdc769 | ||
|
|
0a0f3232ea | ||
|
|
50d75a27e1 | ||
|
|
19f8d2a793 | ||
|
|
f173bde812 | ||
|
|
dd10933ab0 | ||
|
|
9ffa44f254 | ||
|
|
d8f41adf39 | ||
|
|
c3e84646db | ||
|
|
2094f99640 | ||
|
|
94f3bdaa69 | ||
|
|
7220e9d0b0 | ||
|
|
020102d87f | ||
|
|
f101700969 | ||
|
|
c4b148b84b | ||
|
|
b6a9274870 | ||
|
|
830d9699e3 | ||
|
|
fc68b81b21 | ||
|
|
2904772b16 | ||
|
|
e120b57032 | ||
|
|
b86b56260d | ||
|
|
b222b23557 | ||
|
|
8ec4253068 | ||
|
|
74ca88b7be | ||
|
|
a1119cd77a | ||
|
|
545723dc8c | ||
|
|
b64f4780c5 | ||
|
|
1c98b29087 | ||
|
|
33880331d2 | ||
|
|
74a43877e4 | ||
|
|
7542fbea48 | ||
|
|
2d9a1bc6f9 | ||
|
|
a57a240c13 | ||
|
|
b7fb6484d7 | ||
|
|
1a539ffebc | ||
|
|
27220a5ad8 | ||
|
|
e975fc8252 | ||
|
|
d85ea5a3b0 | ||
|
|
ccb7345084 | ||
|
|
93c00b67d9 | ||
|
|
cd393bbfdc | ||
|
|
fd045d4628 | ||
|
|
47e076071b | ||
|
|
a73e003dd3 |
No files matched your search
@@ -39,8 +39,6 @@ changelog.txt
|
||||
*.7z
|
||||
/logs/
|
||||
|
||||
gradle.properties
|
||||
!/mdk/gradle.properties
|
||||
/projects/forge/rejects/
|
||||
|
||||
# Srg2Source causes import bugs on these patches. If you intentionnally change these, remove the ignore.
|
||||
|
||||
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()
|
||||
}
|
||||
})
|
||||
Vendored
+17
-6
@@ -36,9 +36,11 @@ pipeline {
|
||||
}
|
||||
stage('setup') {
|
||||
steps {
|
||||
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue setup'
|
||||
withGradle {
|
||||
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue setup'
|
||||
}
|
||||
script {
|
||||
env.MYVERSION = sh(returnStdout: true, script: './gradlew :forge:properties -q | grep "version:" | awk \'{print $2}\'').trim()
|
||||
env.MYVERSION = sh(returnStdout: true, script: './gradlew :forge:properties -q | grep "^version:" | cut -d" " -f2').trim()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,15 +61,22 @@ pipeline {
|
||||
}
|
||||
}
|
||||
environment {
|
||||
FORGE_MAVEN = credentials('forge-maven-forge-user')
|
||||
CROWDIN = credentials('forge-crowdin')
|
||||
KEYSTORE = credentials('forge-jenkins-keystore-old')
|
||||
KEYSTORE_KEYPASS = credentials('forge-jenkins-keystore-old-keypass')
|
||||
KEYSTORE_STOREPASS = credentials('forge-jenkins-keystore-old-keypass')
|
||||
}
|
||||
steps {
|
||||
sh './gradlew ${GRADLE_ARGS} :forge:publish -PforgeMavenUser=${FORGE_MAVEN_USR} -PforgeMavenPassword=${FORGE_MAVEN_PSW} -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}'
|
||||
sh 'curl --user ${FORGE_MAVEN} http://files.minecraftforge.net/maven/manage/promote/latest/net.minecraftforge.forge/${MYVERSION}'
|
||||
withCredentials([usernamePassword(credentialsId: 'maven-forge-user', usernameVariable: 'MAVEN_USER', passwordVariable: 'MAVEN_PASSWORD')]) {
|
||||
withGradle {
|
||||
sh './gradlew ${GRADLE_ARGS} :forge:publish -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
build job: 'filegenerator', parameters: [string(name: 'COMMAND', value: "promote net.minecraftforge:forge ${env.MYVERSION} latest")], propagate: false, wait: false
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('test_publish_pr') { //Publish to local repo to test full process, but don't include credentials so it can't sign/publish to maven
|
||||
@@ -78,7 +87,9 @@ pipeline {
|
||||
CROWDIN = credentials('forge-crowdin')
|
||||
}
|
||||
steps {
|
||||
sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}'
|
||||
withGradle {
|
||||
sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-16
@@ -1,16 +1,2 @@
|
||||
Minecraft Forge
|
||||
Copyright (c) 2016-2020.
|
||||
|
||||
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
|
||||
+444
-230
File diff suppressed because it is too large.
Load diff
@@ -1,10 +1,11 @@
|
||||
repositories {
|
||||
//mavenCentral() //TODO: Update Gradle to use HTTPS by default
|
||||
maven {
|
||||
name 'maven_central'
|
||||
url 'https://repo.maven.apache.org/maven2/'
|
||||
}
|
||||
maven { url = 'https://maven.minecraftforge.net/' }
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
implementation 'org.ow2.asm:asm:7.2'
|
||||
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'
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
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.Internal
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.tree.ClassNode
|
||||
import org.objectweb.asm.tree.FieldNode
|
||||
import org.objectweb.asm.tree.MethodNode
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
abstract class BytecodeFinder extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getJar()
|
||||
// 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") })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
|
||||
def outputFile = output.get().asFile
|
||||
if (outputFile.exists())
|
||||
outputFile.delete()
|
||||
|
||||
pre()
|
||||
|
||||
jar.get().asFile.withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) != null) {
|
||||
if (zein.name.endsWith('.class')) {
|
||||
def node = new ClassNode(Opcodes.ASM9)
|
||||
new ClassReader(zin).accept(node, 0)
|
||||
process(node)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post()
|
||||
outputFile.text = new JsonBuilder(getData()).toPrettyString()
|
||||
}
|
||||
|
||||
|
||||
protected process(ClassNode node) {
|
||||
if (node.fields != null) node.fields.each { process(node, it) }
|
||||
if (node.methods != null) node.methods.each { process(node, it) }
|
||||
}
|
||||
|
||||
protected pre() {}
|
||||
protected process(ClassNode parent, FieldNode node) {}
|
||||
protected process(ClassNode parent, MethodNode node) {}
|
||||
protected post() {}
|
||||
protected abstract Object getData()
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.TreeMap
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
public class CheckATs extends DefaultTask {
|
||||
@InputFile File inheritance
|
||||
@InputFiles File[] ats
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
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.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.equals('*') && !desc.equals('*()') && !desc.equals('<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 ('*'.equals(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 ('*()'.equals(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>'))
|
||||
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>'.equals(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 = []
|
||||
lines.each { key,value ->
|
||||
if (!value.group) {
|
||||
data.add(value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
|
||||
} else {
|
||||
data.add('#group ' + value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
|
||||
value.children.each{ data.add(value.modifier + ' ' + it) }
|
||||
data.add('#endgroup')
|
||||
}
|
||||
}
|
||||
f.text = data.join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.TreeMap
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.ClassVisitor
|
||||
import org.objectweb.asm.MethodVisitor
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.Type
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
public class CheckExcs extends DefaultTask {
|
||||
@InputFile File binary
|
||||
@InputFiles File[] excs
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def known = []
|
||||
binary.withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
def visitor = new ClassVisitor(Opcodes.ASM7) {
|
||||
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(key)
|
||||
println('Invalid: ' + 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,218 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
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
|
||||
|
||||
public class CheckPatches extends DefaultTask {
|
||||
@InputDirectory File patchDir
|
||||
@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;
|
||||
project.fileTree(patchDir).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,64 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.TreeMap
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
public class CheckSAS extends DefaultTask {
|
||||
@InputFile File inheritance
|
||||
@InputFiles File[] sass
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def json = inheritance.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,31 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import java.util.function.BiConsumer
|
||||
|
||||
public class ClosureHelper {
|
||||
BiConsumer<String, Closure> callback
|
||||
|
||||
public ClosureHelper(Closure cl, BiConsumer<String, Closure> callback) {
|
||||
this.callback = callback
|
||||
apply(this, cl)
|
||||
}
|
||||
|
||||
|
||||
def methodMissing(String name, Object args) {
|
||||
if (!args.class.isArray()) return
|
||||
Object[] aargs = (Object[])args
|
||||
|
||||
if (aargs.length == 1 && aargs[0] instanceof Closure) {
|
||||
this.callback.accept(name, (Closure)aargs[0])
|
||||
} else {
|
||||
throw new IllegalArgumentException('Unknown method: "' + name + '" with arguments ' + args + ' for ' + this)
|
||||
}
|
||||
}
|
||||
|
||||
static <T> T apply(T obj, Closure cl) {
|
||||
cl.delegate = obj
|
||||
cl.resolveStrategy = Closure.DELEGATE_FIRST
|
||||
cl()
|
||||
return obj
|
||||
}
|
||||
}
|
||||
+25
-17
@@ -1,47 +1,55 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.Optional
|
||||
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
|
||||
import java.net.URL
|
||||
|
||||
public class CrowdinTask extends DefaultTask {
|
||||
@Input String id = 'minecraft-forge'
|
||||
@Input @Optional String key
|
||||
abstract class Crowdin extends DefaultTask {
|
||||
@Input abstract Property<String> getId()
|
||||
@Input @Optional abstract Property<String> getKey()
|
||||
@Input boolean json = true
|
||||
@OutputFile output = project.file("build/${name}/output.zip")
|
||||
@OutputFile export = project.file("build/${name}/export.json")
|
||||
|
||||
CrowdinTask() {
|
||||
@OutputFile abstract RegularFileProperty getOutput()
|
||||
@OutputFile abstract RegularFileProperty getExport()
|
||||
|
||||
Crowdin() {
|
||||
outputs.upToDateWhen{ false }
|
||||
id.convention('minecraft-forge')
|
||||
output.convention(project.layout.buildDirectory.dir(name).map {it.file("output.zip") })
|
||||
export.convention(project.layout.buildDirectory.dir(name).map {it.file("export.json") })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
def run() {
|
||||
if (output.exists())
|
||||
output.delete()
|
||||
File outputFile = output.get().asFile
|
||||
File exportFile = export.get().asFile
|
||||
if (outputFile.exists())
|
||||
outputFile.delete()
|
||||
|
||||
if (key == null)
|
||||
if (!key.isPresent())
|
||||
return
|
||||
String key = this.key.get()
|
||||
String id = this.id.get()
|
||||
|
||||
// Force an export
|
||||
new URL("https://api.crowdin.com/api/project/${id}/export?key=${key}").withInputStream { i ->
|
||||
export.withOutputStream { it << i }
|
||||
new URL("https://api.crowdin.com/api/project/${id}/export?key=${key}").withInputStream { i ->
|
||||
exportFile.withOutputStream { it << i }
|
||||
}
|
||||
|
||||
if (!export.text.contains('success')) {
|
||||
throw new RuntimeException("Crowdin export failed, see ${export} for more info")
|
||||
if (!exportFile.text.contains('success')) {
|
||||
throw new RuntimeException("Crowdin export failed, see ${exportFile} for more info")
|
||||
}
|
||||
|
||||
new URL("https://api.crowdin.com/api/project/${id}/download/all.zip?key=${key}").withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
output.withOutputStream { out ->
|
||||
outputFile.withOutputStream { out ->
|
||||
new ZipOutputStream(out).withCloseable { zout ->
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) != null) {
|
||||
@@ -0,0 +1,51 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.nio.file.Files
|
||||
|
||||
abstract class DownloadLibraries extends DefaultTask {
|
||||
@InputFile abstract RegularFileProperty getInput()
|
||||
@OutputDirectory abstract DirectoryProperty getOutput()
|
||||
@OutputFile abstract RegularFileProperty getLibrariesOutput()
|
||||
|
||||
DownloadLibraries() {
|
||||
output.convention(project.layout.buildDirectory.dir(name))
|
||||
librariesOutput.convention(project.layout.buildDirectory.dir(name).map(d -> d.file('libraries.txt')))
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
def run() {
|
||||
Util.init()
|
||||
File outputDir = output.get().asFile
|
||||
def libraries = new ArrayList()
|
||||
|
||||
def json = input.get().asFile.json().libraries.each { lib ->
|
||||
//TODO: Thread?
|
||||
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
|
||||
artifacts.each{ art ->
|
||||
def target = new File(outputDir, art.path)
|
||||
libraries.add(target.absolutePath)
|
||||
if (!target.exists() || !art.sha1.equals(target.sha1())) {
|
||||
project.logger.lifecycle("Downloading ${art.url}")
|
||||
if (!target.parentFile.exists()) {
|
||||
target.parentFile.mkdirs()
|
||||
}
|
||||
new URL(art.url).withInputStream { i ->
|
||||
target.withOutputStream { it << i }
|
||||
}
|
||||
if (!art.sha1.equals(target.sha1())) {
|
||||
throw new IllegalStateException("Failed to download ${art.url} to ${target.canonicalPath} SHA Mismatch")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Files.write(librariesOutput.get().asFile.toPath(), libraries)
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
|
||||
import java.io.File
|
||||
import java.util.HashSet
|
||||
import java.util.Set
|
||||
import java.net.URL
|
||||
|
||||
public class DownloadLibrariesTask extends DefaultTask {
|
||||
@InputFile File input
|
||||
@OutputDirectory File output = project.file("build/${name}/")
|
||||
Set<File> libraries = new HashSet<>()
|
||||
|
||||
@TaskAction
|
||||
def run() {
|
||||
Util.init()
|
||||
|
||||
def json = input.json().libraries.each { lib ->
|
||||
//TODO: Thread?
|
||||
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
|
||||
artifacts.each{ art ->
|
||||
def target = new File(output, art.path)
|
||||
libraries.add(target)
|
||||
if (!target.exists() || !art.sha1.equals(target.sha1())) {
|
||||
project.logger.lifecycle("Downloading ${art.url}")
|
||||
if (!target.parentFile.exists()) {
|
||||
target.parentFile.mkdirs()
|
||||
}
|
||||
new URL(art.url).withInputStream { i ->
|
||||
target.withOutputStream { it << i }
|
||||
}
|
||||
if (!art.sha1.equals(target.sha1())) {
|
||||
throw new IllegalStateException("Failed to download ${art.url} to ${target.canonicalPath} SHA Mismatch")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import groovy.transform.EqualsAndHashCode
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.Nested
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.objectweb.asm.tree.ClassNode
|
||||
import org.objectweb.asm.tree.MethodNode
|
||||
|
||||
import static org.objectweb.asm.Opcodes.*
|
||||
|
||||
abstract class FieldCompareFinder extends BytecodeFinder {
|
||||
@Nested
|
||||
Map<String, Search> fields = [:] as HashMap
|
||||
@Internal
|
||||
Map<Search, String> fieldsReverse = [:] as HashMap
|
||||
@Internal
|
||||
Map<String, Set<ObjectTarget>> targets = [:] as TreeMap
|
||||
|
||||
@Override
|
||||
protected pre() {
|
||||
//fields.each{ k,v -> logger.lifecycle("Fields: " + k + ' ' + v) }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected process(ClassNode parent, MethodNode node) {
|
||||
def last = null
|
||||
def parentInstance = new ObjectTarget(owner: parent.name, name: '', desc: '')
|
||||
for (int x = 0; x < node.instructions.size(); x++) {
|
||||
def current = node.instructions.get(x)
|
||||
if (current.opcode == IF_ACMPEQ || current.opcode == IF_ACMPNE) {
|
||||
if (last != null && (last.opcode == GETSTATIC || last.opcode == GETFIELD)) {
|
||||
def target = new Search(cls: last.owner, name: last.name)
|
||||
def wanted = fieldsReverse.get(target)
|
||||
def original = fields.get(wanted)
|
||||
def instance = new ObjectTarget(owner: parent.name, name: node.name, desc: node.desc)
|
||||
if (wanted != null && (original.blacklist == null || (!original.blacklist.contains(instance) && !original.blacklist.contains(parentInstance)))) {
|
||||
targets.computeIfAbsent(wanted, { k -> new TreeSet() }).add(instance)
|
||||
}
|
||||
}
|
||||
}
|
||||
last = current
|
||||
}
|
||||
}
|
||||
|
||||
@Internal
|
||||
@Override
|
||||
protected Object getData() {
|
||||
def ret = [:] as HashMap
|
||||
targets.forEach{ k, v ->
|
||||
def e = fields.get(k)
|
||||
ret[k] = [
|
||||
cls: e.cls,
|
||||
name: e.name,
|
||||
replacement: e.replacement,
|
||||
targets: v
|
||||
]
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@EqualsAndHashCode(excludes = ['replacement', 'blacklist'])
|
||||
public static class Search {
|
||||
@Input
|
||||
String cls
|
||||
|
||||
@Input
|
||||
String name
|
||||
|
||||
@Input
|
||||
String replacement
|
||||
|
||||
@Nested
|
||||
@Optional
|
||||
Set<ObjectTarget> blacklist
|
||||
|
||||
@Override
|
||||
String toString() {
|
||||
return cls + '.' + name
|
||||
}
|
||||
|
||||
def blacklist(def owner, def name, def desc) {
|
||||
if (blacklist == null)
|
||||
blacklist = new HashSet()
|
||||
blacklist.add(new ObjectTarget(owner: owner, name: name, desc: desc))
|
||||
}
|
||||
def blacklist(def owner) {
|
||||
blacklist(owner, '', '')
|
||||
}
|
||||
}
|
||||
|
||||
def fields(Closure cl) {
|
||||
new ClosureHelper(cl, {name, ccl ->
|
||||
def search = ClosureHelper.apply(new Search(), ccl)
|
||||
this.fields.put(name, search)
|
||||
this.fieldsReverse.put(search, name)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import groovy.transform.EqualsAndHashCode
|
||||
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Nested
|
||||
import org.gradle.api.tasks.Optional
|
||||
|
||||
@EqualsAndHashCode
|
||||
public class ObjectTarget implements Comparable<ObjectTarget> {
|
||||
@Input
|
||||
String owner
|
||||
|
||||
@Input
|
||||
String name
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
String desc
|
||||
|
||||
@Override
|
||||
String toString() {
|
||||
if (desc == null)
|
||||
return owner + '.' + name
|
||||
return owner + '.' + name + desc
|
||||
}
|
||||
|
||||
@Override
|
||||
int compareTo(ObjectTarget o) {
|
||||
return toString().compareTo(o.toString())
|
||||
}
|
||||
}
|
||||
+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()
|
||||
}
|
||||
@@ -2,10 +2,8 @@ package net.minecraftforge.forge.tasks
|
||||
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
public class Util {
|
||||
static void init() {
|
||||
@@ -24,6 +22,18 @@ public class Util {
|
||||
def result = format.format(delegate)
|
||||
return result[0..21] + ':' + result[22..-1]
|
||||
}
|
||||
|
||||
String.metaClass.rsplit = { String del, int limit = -1 ->
|
||||
def lst = new ArrayList()
|
||||
def x = 0, idx
|
||||
def tmp = delegate
|
||||
while ((idx = tmp.lastIndexOf(del)) != -1 && (limit == -1 || x++ < limit)) {
|
||||
lst.add(0, tmp.substring(idx + del.length(), tmp.length()))
|
||||
tmp = tmp.substring(0, idx)
|
||||
}
|
||||
lst.add(0, tmp)
|
||||
return lst
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getClasspath(project, libs, artifact) {
|
||||
@@ -56,14 +66,15 @@ public class Util {
|
||||
def path = "${folder}${filename}"
|
||||
def url = "https://libraries.minecraft.net/${path}"
|
||||
if (!checkExists(url)) {
|
||||
url = "https://files.minecraftforge.net/maven/${path}"
|
||||
url = "https://maven.minecraftforge.net/${path}"
|
||||
}
|
||||
//TODO remove when Mojang launcher is updated
|
||||
if (!classifiers && art.classifier != null) { //Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
|
||||
if (!classifiers && art.classifier != null) {
|
||||
//Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
|
||||
// However, keep the path normal so that our mirror system works.
|
||||
art.version = "${art.version}-${art.classifier}"
|
||||
art.classifier = null
|
||||
art.extension = 'jar'
|
||||
path = "${art.group.replace('.', '/')}/${art.name}/${art.version}/${art.name}-${art.version}.jar"
|
||||
}
|
||||
ret[key] = [
|
||||
name: "${art.group}:${art.name}:${art.version}" + (art.classifier == null ? '' : ":${art.classifier}") + (art.extension == 'jar' ? '' : "@${art.extension}"),
|
||||
@@ -114,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") }
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net) [](https://discord.gg/UvedJ9m) [](https://www.patreon.com/LexManos)
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# 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
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
|
||||
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
@@ -66,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -109,10 +126,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -138,19 +156,19 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -159,14 +177,9 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+24
-19
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -35,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -45,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
+22
-29
@@ -1,53 +1,46 @@
|
||||
-------------------------------------------
|
||||
|
||||
Source installation information for modders
|
||||
-------------------------------------------
|
||||
This code follows the Minecraft Forge installation methodology. It will apply
|
||||
some small patches to the vanilla MCP source code, giving you and it access
|
||||
to some of the data and functions you need to build a successful mod.
|
||||
|
||||
Note also that the patches are built against "unrenamed" MCP source code (aka
|
||||
srgnames) - this means that you will not be able to read them directly against
|
||||
Note also that the patches are built against "un-renamed" MCP source code (aka
|
||||
SRG Names) - this means that you will not be able to read them directly against
|
||||
normal code.
|
||||
|
||||
Source pack installation information:
|
||||
|
||||
Standalone source installation
|
||||
Setup Process:
|
||||
==============================
|
||||
|
||||
See the Forge Documentation online for more detailed instructions:
|
||||
http://mcforge.readthedocs.io/en/latest/gettingstarted/
|
||||
|
||||
Step 1: Open your command-line and browse to the folder where you extracted the zip file.
|
||||
|
||||
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.
|
||||
(Current Issue)
|
||||
4. Open Project > Run/Debug Settings > Edit runClient and runServer > Environment
|
||||
5. Edit MOD_CLASSES to show [modid]%%[Path]; 2 times rather then the generated 4.
|
||||
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 run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again.
|
||||
If at any point you are missing libraries in your IDE, or you've run into problems you can
|
||||
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
|
||||
{this does not affect your code} and then start the process again.
|
||||
|
||||
Should it still not work,
|
||||
Refer to #ForgeGradle on EsperNet for more information about the gradle environment.
|
||||
or the Forge Project Discord discord.gg/UvedJ9m
|
||||
Mapping Names:
|
||||
=============================
|
||||
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
|
||||
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
|
||||
license, if you do not agree with it you can change your mapping names to other crowdsourced names in your
|
||||
build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here:
|
||||
https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
|
||||
Forge source installation
|
||||
Additional Resources:
|
||||
=========================
|
||||
MinecraftForge ships with this code and installs it as part of the forge
|
||||
installation process, no further action is required on your part.
|
||||
|
||||
LexManos' Install Video
|
||||
=======================
|
||||
https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be
|
||||
|
||||
For more details update more often refer to the Forge Forums:
|
||||
http://www.minecraftforge.net/forum/index.php/topic,14048.0.html
|
||||
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/
|
||||
+140
-96
@@ -1,88 +1,100 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||
jcenter()
|
||||
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: '3.+', 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)
|
||||
|
||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
|
||||
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.
|
||||
// snapshot_YYYYMMDD Snapshot are built nightly.
|
||||
// stable_# Stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// The mappings can be changed at any time and must be in the following format.
|
||||
// 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 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
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
// 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.
|
||||
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 {
|
||||
"${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
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
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
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
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/')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,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'
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class ExampleMod
|
||||
|
||||
private void doClientStuff(final FMLClientSetupEvent event) {
|
||||
// do something that can only be done on the client
|
||||
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
|
||||
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options);
|
||||
}
|
||||
|
||||
private void enqueueIMC(final InterModEnqueueEvent event)
|
||||
|
||||
@@ -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="http://my.issue.tracker/" #optional
|
||||
#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 <here>
|
||||
updateJSONURL="http://myurl.me/" #optional
|
||||
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="http://example.com/" #optional
|
||||
#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."
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
@@ -572,10 +572,17 @@
|
||||
@@ -572,10 +_,17 @@
|
||||
GL13.glClientActiveTexture(p_227747_0_);
|
||||
}
|
||||
|
||||
@@ -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_) {
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/com/mojang/blaze3d/vertex/IVertexBuilder.java
|
||||
+++ b/com/mojang/blaze3d/vertex/IVertexBuilder.java
|
||||
@@ -18,7 +18,7 @@
|
||||
@@ -18,7 +_,7 @@
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
|
||||
@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_);
|
||||
@@ -96,11 +96,12 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,18 +1,18 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
@@ -63,6 +63,15 @@
|
||||
@@ -63,6 +_,15 @@
|
||||
}));
|
||||
}
|
||||
|
||||
+ @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
|
||||
@@ -309,6 +309,7 @@
|
||||
@@ -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;
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/advancements/AdvancementList.java
|
||||
+++ b/net/minecraft/advancements/AdvancementList.java
|
||||
@@ -96,6 +96,7 @@
|
||||
@@ -96,6 +_,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());
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/advancements/AdvancementManager.java
|
||||
+++ b/net/minecraft/advancements/AdvancementManager.java
|
||||
@@ -36,6 +36,10 @@
|
||||
@@ -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());
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/advancements/AdvancementRewards.java
|
||||
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
||||
@@ -39,7 +39,7 @@
|
||||
@@ -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) {
|
||||
@@ -1,30 +1,30 @@
|
||||
--- a/net/minecraft/advancements/PlayerAdvancements.java
|
||||
+++ b/net/minecraft/advancements/PlayerAdvancements.java
|
||||
@@ -159,6 +159,10 @@
|
||||
@@ -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 +196,8 @@
|
||||
@@ -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();
|
||||
@@ -204,6 +210,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_);
|
||||
AdvancementProgress advancementprogress = this.getOrStartProgress(p_192750_1_);
|
||||
boolean flag1 = advancementprogress.isDone();
|
||||
@@ -204,6 +_,7 @@
|
||||
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_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
--- a/net/minecraft/advancements/criterion/ItemPredicate.java
|
||||
+++ b/net/minecraft/advancements/criterion/ItemPredicate.java
|
||||
@@ -26,6 +26,8 @@
|
||||
@@ -26,6 +_,8 @@
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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;
|
||||
@@ -105,6 +107,11 @@
|
||||
public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) {
|
||||
private final ITag<Item> tag;
|
||||
@@ -105,6 +_,11 @@
|
||||
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")) {
|
||||
@@ -204,6 +211,14 @@
|
||||
@@ -202,6 +_,14 @@
|
||||
} else {
|
||||
return new ItemPredicate[0];
|
||||
}
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public static void register(ResourceLocation name, java.util.function.Function<JsonObject, ItemPredicate> deserializer) {
|
||||
+ custom_predicates.put(name, deserializer);
|
||||
+ }
|
||||
+
|
||||
+ public static Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> getPredicates() {
|
||||
+ return unmod_predicates;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final List<EnchantmentPredicate> field_200312_a = Lists.newArrayList();
|
||||
private final List<EnchantmentPredicate> field_226657_b_ = Lists.newArrayList();
|
||||
@@ -1,76 +1,76 @@
|
||||
--- a/net/minecraft/block/AbstractBlock.java
|
||||
+++ b/net/minecraft/block/AbstractBlock.java
|
||||
@@ -60,7 +60,8 @@
|
||||
@@ -60,7 +_,8 @@
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
-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_;
|
||||
@@ -87,6 +88,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());
|
||||
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.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 +132,7 @@
|
||||
@@ -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 +194,7 @@
|
||||
@@ -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
|
||||
@@ -294,8 +297,8 @@
|
||||
@@ -294,8 +_,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,14 +324,14 @@
|
||||
@@ -321,14 +_,14 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ @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;
|
||||
@@ -346,6 +349,14 @@
|
||||
return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P());
|
||||
return this.drops;
|
||||
@@ -346,6 +_,14 @@
|
||||
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,48 +78,57 @@
|
||||
+ /* ========================================= FORGE END ====================================== */
|
||||
+
|
||||
public abstract static class AbstractBlockState extends StateHolder<Block, BlockState> {
|
||||
private final int field_215708_d;
|
||||
private final boolean field_215709_e;
|
||||
@@ -428,14 +439,18 @@
|
||||
return this.field_215708_d;
|
||||
private final int lightEmission;
|
||||
private final boolean useShapeForLightOcclusion;
|
||||
@@ -424,18 +_,24 @@
|
||||
return this.useShapeForLightOcclusion;
|
||||
}
|
||||
|
||||
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */
|
||||
+ /** @deprecated use {@link BlockState#getLightValue(IBlockReader, BlockPos)} */
|
||||
+ @Deprecated
|
||||
public boolean func_196958_f() {
|
||||
- return this.field_235702_f_;
|
||||
+ return this.func_177230_c().isAir((BlockState)this);
|
||||
public int getLightEmission() {
|
||||
return this.lightEmission;
|
||||
}
|
||||
|
||||
public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
|
||||
return this.field_235704_h_;
|
||||
}
|
||||
|
||||
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */
|
||||
+ /** @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 BlockState func_185907_a(Rotation p_185907_1_) {
|
||||
return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_);
|
||||
public boolean isAir() {
|
||||
- return this.isAir;
|
||||
+ return this.getBlock().isAir((BlockState)this);
|
||||
}
|
||||
@@ -802,6 +817,9 @@
|
||||
private ResourceLocation field_222381_j;
|
||||
private boolean field_226895_m_ = true;
|
||||
private boolean field_235813_o_;
|
||||
|
||||
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 rotate(Rotation p_185907_1_) {
|
||||
return this.getBlock().rotate(this.asState(), p_185907_1_);
|
||||
}
|
||||
@@ -802,8 +_,11 @@
|
||||
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;
|
||||
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;
|
||||
};
|
||||
@@ -863,6 +881,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;
|
||||
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.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;
|
||||
}
|
||||
|
||||
@@ -877,6 +897,24 @@
|
||||
@@ -877,6 +_,24 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -141,15 +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;
|
||||
@@ -933,7 +971,7 @@
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -932,9 +_,15 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
+ @Deprecated // FORGE: Use the variant that takes a Supplier below
|
||||
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().getLootTable();
|
||||
+ return this;
|
||||
}
|
||||
|
||||
public AbstractBlock.Properties air() {
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/block/AbstractFireBlock.java
|
||||
+++ b/net/minecraft/block/AbstractFireBlock.java
|
||||
@@ -124,6 +124,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);
|
||||
@@ -124,6 +_,7 @@
|
||||
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;
|
||||
@@ -1,58 +1,58 @@
|
||||
--- a/net/minecraft/block/AbstractRailBlock.java
|
||||
+++ b/net/minecraft/block/AbstractRailBlock.java
|
||||
@@ -13,7 +13,7 @@
|
||||
@@ -13,7 +_,7 @@
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
-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;
|
||||
@@ -37,6 +37,7 @@
|
||||
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 +62,7 @@
|
||||
@@ -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_);
|
||||
@@ -110,7 +111,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_) {
|
||||
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 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 +130,20 @@
|
||||
return blockstate.func_206870_a(this.func_176560_l(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
|
||||
@@ -129,5 +_,20 @@
|
||||
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 ======================================*/
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/block/AbstractTopPlantBlock.java
|
||||
+++ b/net/minecraft/block/AbstractTopPlantBlock.java
|
||||
@@ -32,10 +32,11 @@
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/block/BambooBlock.java
|
||||
+++ b/net/minecraft/block/BambooBlock.java
|
||||
@@ -100,10 +100,11 @@
|
||||
@@ -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_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/block/BeehiveBlock.java
|
||||
+++ b/net/minecraft/block/BeehiveBlock.java
|
||||
@@ -65,6 +_,9 @@
|
||||
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 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 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_.getEntitiesOfClass(BeeEntity.class, (new AxisAlignedBB(p_226881_2_)).inflate(8.0D, 6.0D, 8.0D));
|
||||
if (!list.isEmpty()) {
|
||||
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();
|
||||
|
||||
for(BeeEntity beeentity : list) {
|
||||
@@ -1,109 +1,105 @@
|
||||
--- a/net/minecraft/block/Block.java
|
||||
+++ b/net/minecraft/block/Block.java
|
||||
@@ -54,9 +54,10 @@
|
||||
@@ -54,9 +_,10 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
-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_);
|
||||
@@ -151,6 +152,8 @@
|
||||
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 +264,7 @@
|
||||
@@ -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;
|
||||
@@ -273,7 +276,7 @@
|
||||
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 +286,7 @@
|
||||
@@ -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 +336,7 @@
|
||||
p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D));
|
||||
@@ -332,6 +_,7 @@
|
||||
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 +368,7 @@
|
||||
public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) {
|
||||
@@ -363,6 +_,7 @@
|
||||
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 +388,7 @@
|
||||
return this.field_196275_y;
|
||||
@@ -382,6 +_,7 @@
|
||||
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 +398,7 @@
|
||||
this.field_220086_i = Item.func_150898_a(this);
|
||||
@@ -391,7 +_,7 @@
|
||||
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() {
|
||||
@@ -399,7 +406,7 @@
|
||||
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)
|
||||
@@ -410,6 +417,83 @@
|
||||
@@ -409,6 +_,78 @@
|
||||
protected Block asBlock() {
|
||||
return this;
|
||||
}
|
||||
|
||||
+
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+ 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);
|
||||
+
|
||||
+ @Override
|
||||
+ public float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) {
|
||||
+ return this.field_149765_K;
|
||||
+ }
|
||||
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Block> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::getAllTags);
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
@@ -118,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.
|
||||
+ }
|
||||
@@ -170,7 +166,6 @@
|
||||
+ });
|
||||
+ }
|
||||
+ /* ========================================= FORGE END ======================================*/
|
||||
+
|
||||
|
||||
public static final class RenderSideCacheKey {
|
||||
private final BlockState field_212164_a;
|
||||
private final BlockState field_212165_b;
|
||||
private final BlockState first;
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/BlockState.java
|
||||
+++ b/net/minecraft/block/BlockState.java
|
||||
@@ -6,7 +6,7 @@
|
||||
@@ -6,7 +_,7 @@
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
-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_) {
|
||||
@@ -1,35 +1,36 @@
|
||||
--- a/net/minecraft/block/Blocks.java
|
||||
+++ b/net/minecraft/block/Blocks.java
|
||||
@@ -25,6 +25,7 @@
|
||||
@@ -25,6 +_,7 @@
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.gen.feature.Features;
|
||||
|
||||
[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)));
|
||||
@@ -119,7 +120,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)));
|
||||
@@ -937,15 +938,4 @@
|
||||
public static void func_235419_a_() {
|
||||
Block.field_176229_d.forEach(AbstractBlock.AbstractBlockState::func_215692_c);
|
||||
}
|
||||
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 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 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();
|
||||
- }
|
||||
-
|
||||
- }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/block/BushBlock.java
|
||||
+++ b/net/minecraft/block/BushBlock.java
|
||||
@@ -7,7 +7,7 @@
|
||||
@@ -7,7 +_,7 @@
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
|
||||
@@ -9,24 +9,25 @@
|
||||
public BushBlock(AbstractBlock.Properties p_i48437_1_) {
|
||||
super(p_i48437_1_);
|
||||
}
|
||||
@@ -22,6 +22,8 @@
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -32,4 +34,11 @@
|
||||
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_);
|
||||
}
|
||||
@@ -31,5 +_,12 @@
|
||||
|
||||
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;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,33 @@
|
||||
--- a/net/minecraft/block/CactusBlock.java
|
||||
+++ b/net/minecraft/block/CactusBlock.java
|
||||
@@ -19,7 +19,7 @@
|
||||
@@ -19,7 +_,7 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
-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);
|
||||
@@ -30,6 +30,7 @@
|
||||
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 +46,7 @@
|
||||
@@ -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));
|
||||
@@ -53,7 +55,8 @@
|
||||
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_);
|
||||
@@ -35,19 +35,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +87,7 @@
|
||||
@@ -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_) {
|
||||
@@ -98,4 +101,14 @@
|
||||
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_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 isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
return false;
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
|
||||
@@ -56,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 +181,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);
|
||||
@@ -181,7 +_,7 @@
|
||||
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);
|
||||
@@ -208,7 +208,7 @@
|
||||
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);
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/net/minecraft/block/ChestBlock.java
|
||||
+++ b/net/minecraft/block/ChestBlock.java
|
||||
@@ -325,7 +_,8 @@
|
||||
}
|
||||
|
||||
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 createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
@@ -1,47 +1,47 @@
|
||||
--- a/net/minecraft/block/ChorusFlowerBlock.java
|
||||
+++ b/net/minecraft/block/ChorusFlowerBlock.java
|
||||
@@ -40,7 +40,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);
|
||||
@@ -40,7 +_,7 @@
|
||||
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());
|
||||
@@ -65,7 +65,7 @@
|
||||
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 +97,7 @@
|
||||
@@ -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_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,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())) {
|
||||
@@ -133,7 +_,7 @@
|
||||
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;
|
||||
@@ -146,7 +146,7 @@
|
||||
@@ -146,7 +_,7 @@
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/block/CocoaBlock.java
|
||||
+++ b/net/minecraft/block/CocoaBlock.java
|
||||
@@ -35,10 +35,11 @@
|
||||
@@ -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 +154,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);
|
||||
@@ -154,4 +_,16 @@
|
||||
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);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
@@ -1,39 +1,39 @@
|
||||
--- a/net/minecraft/block/CropsBlock.java
|
||||
+++ b/net/minecraft/block/CropsBlock.java
|
||||
@@ -61,12 +61,14 @@
|
||||
@@ -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_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,9 +97,9 @@
|
||||
@@ -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 +135,7 @@
|
||||
@@ -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_);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/DeadBushBlock.java
|
||||
+++ b/net/minecraft/block/DeadBushBlock.java
|
||||
@@ -5,7 +5,7 @@
|
||||
@@ -5,7 +_,7 @@
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
-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_) {
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/DetectorRailBlock.java
|
||||
+++ b/net/minecraft/block/DetectorRailBlock.java
|
||||
@@ -131,6 +131,8 @@
|
||||
@@ -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 +51,7 @@
|
||||
return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_);
|
||||
@@ -51,6 +_,7 @@
|
||||
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 +37,7 @@
|
||||
p_176439_1_.func_217379_c(1001, p_176439_2_, 0);
|
||||
@@ -37,7 +_,7 @@
|
||||
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;
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/EnchantingTableBlock.java
|
||||
+++ b/net/minecraft/block/EnchantingTableBlock.java
|
||||
@@ -54,7 +54,7 @@
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/block/FallingBlock.java
|
||||
+++ b/net/minecraft/block/FallingBlock.java
|
||||
@@ -30,7 +30,7 @@
|
||||
@@ -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);
|
||||
@@ -59,7 +59,7 @@
|
||||
public void func_180655_c(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) {
|
||||
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 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();
|
||||
@@ -1,29 +1,29 @@
|
||||
--- a/net/minecraft/block/FarmlandBlock.java
|
||||
+++ b/net/minecraft/block/FarmlandBlock.java
|
||||
@@ -77,7 +77,7 @@
|
||||
@@ -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 +88,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_));
|
||||
@@ -88,9 +_,10 @@
|
||||
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_) {
|
||||
@@ -100,7 +101,7 @@
|
||||
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,107 +1,107 @@
|
||||
--- a/net/minecraft/block/FireBlock.java
|
||||
+++ b/net/minecraft/block/FireBlock.java
|
||||
@@ -92,13 +92,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();
|
||||
@@ -92,13 +_,13 @@
|
||||
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 +121,7 @@
|
||||
@@ -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);
|
||||
@@ -142,7 +142,7 @@
|
||||
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 +150,12 @@
|
||||
@@ -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 +193,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());
|
||||
@@ -193,16 +_,18 @@
|
||||
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_)) {
|
||||
@@ -212,11 +214,7 @@
|
||||
p_176536_1_.func_217377_a(p_176536_2_, false);
|
||||
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_.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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -228,7 +226,7 @@
|
||||
@@ -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 +242,14 @@
|
||||
@@ -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,18 +109,18 @@
|
||||
}
|
||||
|
||||
+ @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,10 +268,23 @@
|
||||
}
|
||||
|
||||
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_);
|
||||
@@ -269,8 +_,21 @@
|
||||
}
|
||||
|
||||
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_);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Side sensitive version that calls the block function.
|
||||
+ *
|
||||
@@ -130,9 +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);
|
||||
+ }
|
||||
+
|
||||
public static void func_149843_e() {
|
||||
FireBlock fireblock = (FireBlock)Blocks.field_150480_ab;
|
||||
fireblock.func_180686_a(Blocks.field_196662_n, 5, 20);
|
||||
+ return world.getBlockState(pos).isFlammable(world, pos, face);
|
||||
}
|
||||
|
||||
public static void bootStrap() {
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/block/FlowerPotBlock.java
|
||||
+++ b/net/minecraft/block/FlowerPotBlock.java
|
||||
@@ -24,12 +24,35 @@
|
||||
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;
|
||||
@@ -24,10 +_,33 @@
|
||||
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);
|
||||
+ }
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * For mod use, eliminates the need to extend this class, and prevents modded
|
||||
+ * flower pots from altering vanilla behavior.
|
||||
@@ -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();
|
||||
@@ -34,38 +34,36 @@
|
||||
+ this.fullPots = java.util.Collections.emptyMap();
|
||||
+ this.emptyPot = emptyPot;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
|
||||
return field_196450_a;
|
||||
}
|
||||
@@ -41,7 +64,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 VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
|
||||
@@ -41,7 +_,7 @@
|
||||
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 +82,7 @@
|
||||
p_225533_4_.func_71019_a(itemstack1, false);
|
||||
@@ -59,7 +_,7 @@
|
||||
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 +100,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;
|
||||
}
|
||||
+
|
||||
@@ -84,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
|
||||
}
|
||||
@@ -1,68 +1,68 @@
|
||||
--- a/net/minecraft/block/FlowingFluidBlock.java
|
||||
+++ b/net/minecraft/block/FlowingFluidBlock.java
|
||||
@@ -29,10 +29,11 @@
|
||||
@@ -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_;
|
||||
@@ -45,8 +46,21 @@
|
||||
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;
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param supplier A fluid supplier such as {@link net.minecraftforge.fml.RegistryObject<Fluid>}
|
||||
+ */
|
||||
+ 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_) {
|
||||
return p_220071_4_.func_216378_a(field_235510_c_, p_220071_3_, true) && p_220071_1_.func_177229_b(field_176367_b) == 0 && p_220071_4_.func_230426_a_(p_220071_2_.func_204610_c(p_220071_3_.func_177984_a()), this.field_204517_c) ? field_235510_c_ : VoxelShapes.func_197880_a();
|
||||
}
|
||||
@@ -69,6 +83,7 @@
|
||||
|
||||
public FluidState func_204507_t(BlockState p_204507_1_) {
|
||||
int i = p_204507_1_.func_177229_b(field_176367_b);
|
||||
public VoxelShape getCollisionShape(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, ISelectionContext p_220071_4_) {
|
||||
@@ -69,6 +_,7 @@
|
||||
|
||||
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 +135,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_);
|
||||
@@ -120,13 +_,13 @@
|
||||
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;
|
||||
}
|
||||
@@ -153,4 +168,23 @@
|
||||
return Fluids.field_204541_a;
|
||||
}
|
||||
}
|
||||
@@ -151,6 +_,25 @@
|
||||
return this.fluid;
|
||||
} else {
|
||||
return Fluids.EMPTY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Forge start
|
||||
+ private final java.util.function.Supplier<? extends Fluid> supplier;
|
||||
@@ -73,13 +73,13 @@
|
||||
+ 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;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/block/ITileEntityProvider.java
|
||||
+++ b/net/minecraft/block/ITileEntityProvider.java
|
||||
@@ -4,6 +4,7 @@
|
||||
@@ -4,6 +_,7 @@
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
+@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_);
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/net/minecraft/block/LadderBlock.java
|
||||
+++ b/net/minecraft/block/LadderBlock.java
|
||||
@@ -93,6 +93,11 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
public BlockState func_185499_a(BlockState p_185499_1_, Rotation p_185499_2_) {
|
||||
return p_185499_1_.func_206870_a(field_176382_a, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176382_a)));
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/LeavesBlock.java
|
||||
+++ b/net/minecraft/block/LeavesBlock.java
|
||||
@@ -19,7 +19,7 @@
|
||||
@@ -19,7 +_,7 @@
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
-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 +64,7 @@
|
||||
if (blockstate.func_235714_a_(BlockTags.field_242171_aD)) {
|
||||
@@ -64,7 +_,7 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/block/NetherWartBlock.java
|
||||
+++ b/net/minecraft/block/NetherWartBlock.java
|
||||
@@ -35,9 +35,10 @@
|
||||
@@ -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_);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
--- a/net/minecraft/block/NoteBlock.java
|
||||
+++ b/net/minecraft/block/NoteBlock.java
|
||||
@@ -50,7 +50,7 @@
|
||||
@@ -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 +60,9 @@
|
||||
if (p_225533_2_.field_72995_K) {
|
||||
@@ -60,7 +_,9 @@
|
||||
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);
|
||||
@@ -76,6 +78,9 @@
|
||||
+ 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);
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/block/OreBlock.java
|
||||
+++ b/net/minecraft/block/OreBlock.java
|
||||
@@ -31,12 +31,10 @@
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,55 @@
|
||||
--- a/net/minecraft/block/PistonBlock.java
|
||||
+++ b/net/minecraft/block/PistonBlock.java
|
||||
@@ -158,6 +158,7 @@
|
||||
@@ -158,6 +_,7 @@
|
||||
}
|
||||
|
||||
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 +166,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);
|
||||
@@ -165,6 +_,7 @@
|
||||
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();
|
||||
@@ -204,6 +206,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);
|
||||
((PistonTileEntity)tileentity1).finalTick();
|
||||
@@ -204,6 +_,7 @@
|
||||
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));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -234,7 +237,7 @@
|
||||
@@ -234,7 +_,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 {
|
||||
return false;
|
||||
@@ -273,7 +276,7 @@
|
||||
@@ -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;
|
||||
@@ -337,6 +340,10 @@
|
||||
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)));
|
||||
}
|
||||
@@ -335,6 +_,10 @@
|
||||
|
||||
+ 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);
|
||||
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 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_176387_N)));
|
||||
+ public BlockState rotate(BlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) {
|
||||
+ return state.getValue(EXTENDED) ? state : super.rotate(state, world, pos, direction);
|
||||
}
|
||||
|
||||
public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) {
|
||||
@@ -1,81 +1,81 @@
|
||||
--- a/net/minecraft/block/PistonBlockStructureHelper.java
|
||||
+++ b/net/minecraft/block/PistonBlockStructureHelper.java
|
||||
@@ -48,7 +48,7 @@
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -57,24 +57,9 @@
|
||||
@@ -57,24 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- 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 +72,12 @@
|
||||
if (i + this.field_177258_e.size() > 12) {
|
||||
@@ -87,12 +_,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 +104,7 @@
|
||||
@@ -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 +113,7 @@
|
||||
@@ -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 +158,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)) {
|
||||
@@ -173,7 +_,7 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/PortalSize.java
|
||||
+++ b/net/minecraft/block/PortalSize.java
|
||||
@@ -16,7 +16,7 @@
|
||||
@@ -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;
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/block/PoweredRailBlock.java
|
||||
+++ b/net/minecraft/block/PoweredRailBlock.java
|
||||
@@ -14,10 +14,16 @@
|
||||
@@ -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,44 +13,45 @@
|
||||
+
|
||||
+ 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_) {
|
||||
@@ -99,13 +105,13 @@
|
||||
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 +162,9 @@
|
||||
return p_185499_1_.func_206870_a(field_176568_b, RailShape.SOUTH_EAST);
|
||||
@@ -156,6 +_,9 @@
|
||||
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)) {
|
||||
@@ -255,4 +264,8 @@
|
||||
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.func_206894_a(field_176568_b, field_176569_M);
|
||||
}
|
||||
switch((RailShape)p_185499_1_.getValue(SHAPE)) {
|
||||
@@ -254,5 +_,9 @@
|
||||
|
||||
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.add(SHAPE, POWERED);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isActivatorRail() {
|
||||
+ return isActivator;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/block/RailBlock.java
|
||||
+++ b/net/minecraft/block/RailBlock.java
|
||||
@@ -49,6 +49,9 @@
|
||||
return p_185499_1_.func_206870_a(field_176565_b, RailShape.SOUTH_EAST);
|
||||
@@ -49,6 +_,9 @@
|
||||
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,57 +1,57 @@
|
||||
--- a/net/minecraft/block/RailState.java
|
||||
+++ b/net/minecraft/block/RailState.java
|
||||
@@ -15,14 +15,16 @@
|
||||
private BlockState field_196923_d;
|
||||
private final boolean field_208513_e;
|
||||
private final List<BlockPos> field_196924_e = Lists.newArrayList();
|
||||
@@ -15,14 +_,16 @@
|
||||
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 +180,7 @@
|
||||
@@ -178,7 +_,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 +190,7 @@
|
||||
@@ -188,7 +_,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 +306,7 @@
|
||||
@@ -304,7 +_,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 +316,7 @@
|
||||
@@ -314,7 +_,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;
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/block/RedstoneDiodeBlock.java
|
||||
+++ b/net/minecraft/block/RedstoneDiodeBlock.java
|
||||
@@ -65,7 +65,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_);
|
||||
@@ -65,7 +_,7 @@
|
||||
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 +163,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())
|
||||
@@ -163,6 +_,8 @@
|
||||
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);
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/block/RedstoneOreBlock.java
|
||||
+++ b/net/minecraft/block/RedstoneOreBlock.java
|
||||
@@ -71,11 +71,11 @@
|
||||
@@ -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 +184,7 @@
|
||||
BlockState blockstate = p_235545_1_.func_180495_p(blockpos);
|
||||
@@ -184,7 +_,7 @@
|
||||
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 +193,7 @@
|
||||
@@ -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_) {
|
||||
@@ -335,11 +335,7 @@
|
||||
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)) {
|
||||
@@ -348,7 +344,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.REPEATER)) {
|
||||
@@ -348,7 +_,7 @@
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/block/SaplingBlock.java
|
||||
+++ b/net/minecraft/block/SaplingBlock.java
|
||||
@@ -29,6 +29,7 @@
|
||||
@@ -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 +39,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);
|
||||
@@ -38,6 +_,7 @@
|
||||
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_);
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/block/ScaffoldingBlock.java
|
||||
+++ b/net/minecraft/block/ScaffoldingBlock.java
|
||||
@@ -138,6 +138,8 @@
|
||||
return i;
|
||||
}
|
||||
|
||||
+ @Override public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { return true; }
|
||||
+
|
||||
static {
|
||||
VoxelShape voxelshape = Block.func_208617_a(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D);
|
||||
VoxelShape voxelshape1 = Block.func_208617_a(0.0D, 0.0D, 0.0D, 2.0D, 16.0D, 2.0D);
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/SeaGrassBlock.java
|
||||
+++ b/net/minecraft/block/SeaGrassBlock.java
|
||||
@@ -17,7 +17,7 @@
|
||||
@@ -17,7 +_,7 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
-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_) {
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/block/SoundType.java
|
||||
+++ b/net/minecraft/block/SoundType.java
|
||||
@@ -59,6 +_,7 @@
|
||||
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.volume = p_i46679_1_;
|
||||
this.pitch = p_i46679_2_;
|
||||
@@ -1,18 +1,16 @@
|
||||
--- a/net/minecraft/block/SpawnerBlock.java
|
||||
+++ b/net/minecraft/block/SpawnerBlock.java
|
||||
@@ -18,10 +18,13 @@
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -18,8 +_,11 @@
|
||||
|
||||
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
|
||||
+ public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune, int silktouch) {
|
||||
+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
|
||||
+ }
|
||||
+
|
||||
public BlockRenderType func_149645_b(BlockState p_149645_1_) {
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
public BlockRenderType getRenderShape(BlockState p_149645_1_) {
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/block/SpongeBlock.java
|
||||
+++ b/net/minecraft/block/SpongeBlock.java
|
||||
@@ -64,7 +64,7 @@
|
||||
@@ -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;
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/block/SpreadableSnowyDirtBlock.java
|
||||
+++ b/net/minecraft/block/SpreadableSnowyDirtBlock.java
|
||||
@@ -33,6 +33,7 @@
|
||||
@@ -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) {
|
||||
Loaded 100 of 1483 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user