mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 09:05:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
104daf8ef0 | ||
|
|
d9a04b881a | ||
|
|
ae62362d49 | ||
|
|
2f8c3ea738 | ||
|
|
f0c2554b1c | ||
|
|
bb547a5748 | ||
|
|
5dd3842b77 | ||
|
|
2ab4685149 | ||
|
|
edbc07ed22 | ||
|
|
e225dbc8d1 | ||
|
|
117be913da | ||
|
|
512d4d7271 | ||
|
|
a9237cff75 | ||
|
|
bc24487d0e | ||
|
|
c3e0b071a2 | ||
|
|
21787234f4 | ||
|
|
a9958b19db | ||
|
|
b25d9562f2 | ||
|
|
2765c0d8d9 | ||
|
|
82a20911cb | ||
|
|
f19f7e4670 | ||
|
|
e10f5c637e | ||
|
|
4bfe562f14 | ||
|
|
5e64ef9ecb | ||
|
|
dda1be91ea | ||
|
|
4f4849b60c | ||
|
|
3b754fef5e | ||
|
|
5e295f2485 | ||
|
|
5c9258491f | ||
|
|
af87677516 | ||
|
|
a68c886ea2 | ||
|
|
b129e385cc | ||
|
|
fdc921923c | ||
|
|
476e20ae96 | ||
|
|
d63516f2ac | ||
|
|
fd522d38b0 | ||
|
|
5f0d4abf23 | ||
|
|
8e3e8b2120 | ||
|
|
72fd6808d8 | ||
|
|
2c35d04495 | ||
|
|
f704d65d5a | ||
|
|
6c6a4817e7 | ||
|
|
ef3408c1eb | ||
|
|
0ea593c50e | ||
|
|
643b972e97 | ||
|
|
93ce9e72f7 | ||
|
|
f1bafce275 | ||
|
|
75408c1a70 | ||
|
|
00fafb07ce | ||
|
|
e49a347aea | ||
|
|
2c8ca313a0 | ||
|
|
fe7dcdf637 | ||
|
|
15daa2955d | ||
|
|
03af8a53a2 | ||
|
|
c7e4e4b5b4 | ||
|
|
d477425f70 | ||
|
|
a3449f2866 | ||
|
|
2a1f98aec2 | ||
|
|
bc9bd40d03 | ||
|
|
58344b0b15 | ||
|
|
edcc8b3c97 | ||
|
|
d494ba9be4 | ||
|
|
b92f56503e | ||
|
|
5a9be79785 | ||
|
|
225c2125c6 | ||
|
|
e2a932108e | ||
|
|
ec38717702 | ||
|
|
3009f5350c | ||
|
|
a24dd3c8ee | ||
|
|
3fae26a470 | ||
|
|
a44ac01aee | ||
|
|
b09f8d0fc8 | ||
|
|
57a916bf09 | ||
|
|
15d3df2818 | ||
|
|
63a42bad98 | ||
|
|
28d3c491a0 | ||
|
|
551296813e | ||
|
|
62b99be117 | ||
|
|
6683e9e660 | ||
|
|
3b9df7df1b | ||
|
|
a9a8d7ed8c | ||
|
|
80770898c6 | ||
|
|
335cb5edc4 | ||
|
|
7259887176 | ||
|
|
0320c185b5 | ||
|
|
2f5f696b68 | ||
|
|
d33e9c8251 | ||
|
|
21c50da8ec | ||
|
|
e2a205d2e7 | ||
|
|
950e7b032a | ||
|
|
d1a55a147e | ||
|
|
1fd8b1a4b8 | ||
|
|
41ea5b195b | ||
|
|
14e152579b | ||
|
|
dcf7bb1af2 | ||
|
|
456a48b12a | ||
|
|
aceb878a64 | ||
|
|
f451e21f39 | ||
|
|
c6ac740d31 | ||
|
|
dbf98d3888 | ||
|
|
1b7bdc3ec6 | ||
|
|
d414e31f08 | ||
|
|
b2036e9d23 | ||
|
|
abe4afe152 | ||
|
|
e7ad43c993 | ||
|
|
7631600b53 | ||
|
|
530a1e8eb0 | ||
|
|
54b2c18fcf | ||
|
|
eb1a9b57c6 | ||
|
|
5b6d54555e |
No files matched your search
Vendored
+104
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0"?>
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>MinecraftForge_Forge Config DSL Script</name>
|
||||
<groupId>MinecraftForge_Forge</groupId>
|
||||
<artifactId>MinecraftForge_Forge_dsl</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.jetbrains.teamcity</groupId>
|
||||
<artifactId>configs-dsl-kotlin-parent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jetbrains-all</id>
|
||||
<url>https://download.jetbrains.com/teamcity-repository</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>teamcity-server</id>
|
||||
<url>https://teamcity.minecraftforge.net/app/dsl-plugins-repository</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>JetBrains</id>
|
||||
<url>https://download.jetbrains.com/teamcity-repository</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${basedir}</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<version>${kotlin.version}</version>
|
||||
|
||||
<configuration/>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>process-test-sources</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.teamcity</groupId>
|
||||
<artifactId>teamcity-configs-maven-plugin</artifactId>
|
||||
<version>${teamcity.dsl.version}</version>
|
||||
<configuration>
|
||||
<format>kotlin</format>
|
||||
<dstDir>target/generated-configs</dstDir>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.teamcity</groupId>
|
||||
<artifactId>configs-dsl-kotlin</artifactId>
|
||||
<version>${teamcity.dsl.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.teamcity</groupId>
|
||||
<artifactId>configs-dsl-kotlin-plugins</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-script-runtime</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
Vendored
+136
@@ -0,0 +1,136 @@
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues
|
||||
|
||||
/*
|
||||
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)
|
||||
|
||||
params {
|
||||
text("docker_jdk_version", "17", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("docker_gradle_version", "7.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.18.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_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_FML_ARTIFACT_ID", "fmlonly", label = "Published fmlonly artifact id", description = "The maven coordinate artifact id for fml only that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||
text("env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION", "0.0.0-SNAPSHOT", label = "Published fmlonly artifact version", description = "The version for fml only 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.KEYSTORE_URL", "credentialsJSON:a7ae1c82-8058-4061-8d12-7f6bc2618d2e", display = ParameterDisplay.HIDDEN)
|
||||
password("env.KEYSTORE_PASSWORD", "credentialsJSON:d7b964e3-a1fd-47a8-b892-6f601fe47479", display = ParameterDisplay.HIDDEN)
|
||||
text("additional_publishing_gradle_parameters", "-PcrowdinKey=%env.CROWDIN_KEY% -PkeystoreKeyPass=%env.KEYSTORE_PASSWORD% -PkeystoreStorePass=%env.KEYSTORE_PASSWORD% -Pkeystore=%env.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."
|
||||
|
||||
features {
|
||||
feature {
|
||||
id = "trigger_fml_only_files_generator"
|
||||
type = "triggerBuildFeature"
|
||||
param("triggers", "MinecraftForge_FilesGenerator_GeneratePages")
|
||||
param("parameters", """
|
||||
env.PUBLISHED_JAVA_FML_ARTIFACT_ID~env.PUBLISHED_JAVA_ARTIFACT_ID
|
||||
env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION~env.PUBLISHED_JAVA_ARTIFACT_VERSION
|
||||
env.PUBLISHED_JAVA_GROUP
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
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
|
||||
)
|
||||
}
|
||||
|
||||
vcs {
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:1.*
|
||||
-:<default>
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
+2
-16
@@ -1,16 +1,2 @@
|
||||
Minecraft Forge
|
||||
Copyright (c) 2016-${year}.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation version 2.1
|
||||
of the License.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Minecraft Forge - Forge Development LLC
|
||||
SPDX-License-Identifier: LGPL-2.1-only
|
||||
+213
-62
@@ -5,7 +5,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:[5.1.26,)'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||
plugins {
|
||||
id 'org.cadixdev.licenser' version '0.6.1'
|
||||
id 'com.github.ben-manes.versions' version '0.36.0'
|
||||
id 'net.minecraftforge.gradleutils' version '1.+'
|
||||
id 'net.minecraftforge.gradleutils' version '2.+'
|
||||
id 'eclipse'
|
||||
id 'de.undercouch.download' version '4.1.2'
|
||||
}
|
||||
|
||||
Util.init() //Init all our extension methods!
|
||||
@@ -43,19 +44,19 @@ ext {
|
||||
]
|
||||
}
|
||||
MAPPING_CHANNEL = 'official'
|
||||
MAPPING_VERSION = '1.18'
|
||||
MC_VERSION = '1.18'
|
||||
MCP_VERSION = '20211130.085255'
|
||||
MAPPING_VERSION = '1.18.1'
|
||||
MC_VERSION = '1.18.1'
|
||||
MCP_VERSION = '20211210.034407'
|
||||
SPI_VERSION = '4.0.10'
|
||||
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
||||
COREMODS_VERSION = '5.0.1'
|
||||
EVENTBUS_VERSION = '5.0.3'
|
||||
MODLAUNCHER_VERSION = '9.0.7'
|
||||
SECUREJARHANDLER_VERSION = '0.9.54'
|
||||
BOOTSTRAPLAUNCHER_VERSION = '0.1.17'
|
||||
ASM_VERSION = '9.1'
|
||||
MODLAUNCHER_VERSION = '9.1.0'
|
||||
SECUREJARHANDLER_VERSION = '1.0.1'
|
||||
BOOTSTRAPLAUNCHER_VERSION = '1.0.0'
|
||||
ASM_VERSION = '9.2'
|
||||
INSTALLER_VERSION = '2.1.+'
|
||||
MIXIN_VERSION = '0.8.4'
|
||||
MIXIN_VERSION = '0.8.5'
|
||||
|
||||
GIT_INFO = gradleutils.gitInfo
|
||||
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
||||
@@ -64,9 +65,10 @@ ext {
|
||||
|
||||
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.10.0'
|
||||
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar'
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.2.7'
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.2.10'
|
||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.17:all'
|
||||
MIN_TAG_FOR_CHANGELOG = "39.0"
|
||||
}
|
||||
|
||||
println('Version: ' + VERSION +
|
||||
@@ -76,12 +78,35 @@ println('Version: ' + VERSION +
|
||||
|
||||
def extraTxts = [
|
||||
rootProject.file('CREDITS.txt'),
|
||||
rootProject.file('LICENSE.txt')
|
||||
rootProject.file('LICENSE.txt'),
|
||||
rootProject.file('build/changelog.txt') //Now gets generated on build.
|
||||
]
|
||||
|
||||
def changelog = rootProject.file('build/changelog.txt')
|
||||
if (changelog.exists())
|
||||
extraTxts += changelog
|
||||
task downloadVersionManifest(type: Download) {
|
||||
src 'https://launchermeta.mojang.com/mc/game/version_manifest_v2.json'
|
||||
dest file('build/versions/version_manifest.json')
|
||||
useETag 'all'
|
||||
onlyIfModified true
|
||||
quiet true
|
||||
}
|
||||
task downloadJson(type: Download, dependsOn: downloadVersionManifest) {
|
||||
inputs.file downloadVersionManifest.dest
|
||||
src { downloadVersionManifest.dest.json.versions.find{ it.id == MC_VERSION }.url }
|
||||
dest file("build/versions/${MC_VERSION}/version.json")
|
||||
useETag 'all'
|
||||
onlyIfModified true
|
||||
quiet true
|
||||
}
|
||||
['client', 'server'].each { id ->
|
||||
task "download${id.capitalize()}Raw"(type: Download, dependsOn: downloadJson) {
|
||||
inputs.file downloadJson.dest
|
||||
src { downloadJson.dest.json.downloads.get(id).url }
|
||||
dest file("build/versions/${MC_VERSION}/${id}.jar")
|
||||
useETag 'all'
|
||||
onlyIfModified true
|
||||
quiet true
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'maven-publish'
|
||||
@@ -154,20 +179,7 @@ subprojects {
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
if (System.env.MAVEN_USER) {
|
||||
url 'https://maven.minecraftforge.net/releases/'
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
credentials {
|
||||
username = System.env.MAVEN_USER ?: 'not'
|
||||
password = System.env.MAVEN_PASSWORD ?: 'set'
|
||||
}
|
||||
} else {
|
||||
url 'file://' + rootProject.file('repo').getAbsolutePath()
|
||||
}
|
||||
}
|
||||
maven gradleutils.getPublishingForgeMaven()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,21 +259,22 @@ def sharedDeps = {
|
||||
installer "net.minecraftforge:coremods:${COREMODS_VERSION}"
|
||||
installer "cpw.mods:modlauncher:${MODLAUNCHER_VERSION}"
|
||||
installer 'net.minecraftforge:unsafe:0.2.+'
|
||||
installer 'com.electronwill.night-config:core:3.6.3'
|
||||
installer 'com.electronwill.night-config:toml:3.6.3'
|
||||
installer 'com.electronwill.night-config:core:3.6.4'
|
||||
installer 'com.electronwill.night-config:toml:3.6.4'
|
||||
installer 'org.apache.maven:maven-artifact:3.6.3'
|
||||
installer 'org.apache.commons:commons-lang3:3.8.1'
|
||||
installer 'org.apache.commons:commons-lang3:3.12.0'
|
||||
installer 'net.jodah:typetools:0.8.3'
|
||||
installer 'org.apache.logging.log4j:log4j-api:2.14.1'
|
||||
installer 'org.apache.logging.log4j:log4j-core:2.14.1'
|
||||
installer 'org.apache.logging.log4j:log4j-api:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
|
||||
installer 'org.apache.logging.log4j:log4j-core:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
|
||||
installer 'org.apache.logging.log4j:log4j-slf4j18-impl:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
|
||||
installer 'net.minecrell:terminalconsoleappender:1.2.0'
|
||||
installer 'org.jline:jline-reader:3.12.+' //Dep of TerminaalConsoleeAppender
|
||||
installer 'org.jline:jline-terminal:3.12.+' //Dep of TerminaalConsoleeAppender
|
||||
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
|
||||
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
|
||||
installer 'org.openjdk.nashorn:nashorn-core:15.3'
|
||||
installer 'com.google.guava:guava:21.0'
|
||||
installer 'com.google.code.gson:gson:2.8.0'
|
||||
installer 'com.google.guava:guava:31.0.1-jre'
|
||||
installer 'com.google.code.gson:gson:2.8.8'
|
||||
|
||||
/*
|
||||
installer 'org.lwjgl:lwjgl:3.2.2'
|
||||
@@ -355,6 +368,9 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
environment 'MCP_MAPPINGS', '{mcp_mappings}'
|
||||
|
||||
property 'nativesDirectory', '{natives}'
|
||||
if (prj.name == 'forge') {
|
||||
property 'forge.enableGameTest', 'true'
|
||||
}
|
||||
|
||||
args '--launchTarget', "${launchPrefix}clientuserdev"
|
||||
args '--version', 'MOD_DEV'
|
||||
@@ -366,9 +382,22 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
environment 'MOD_CLASSES', '{source_roots}'
|
||||
environment 'MCP_MAPPINGS', '{mcp_mappings}'
|
||||
|
||||
if (prj.name == 'forge') {
|
||||
property 'forge.enableGameTest', 'true'
|
||||
}
|
||||
|
||||
args '--launchTarget', "${launchPrefix}serveruserdev"
|
||||
}
|
||||
|
||||
if (prj.name == 'forge') {
|
||||
gameTestServer {
|
||||
environment 'MOD_CLASSES', '{source_roots}'
|
||||
environment 'MCP_MAPPINGS', '{mcp_mappings}'
|
||||
|
||||
args '--launchTarget', "${launchPrefix}gametestserveruserdev"
|
||||
}
|
||||
}
|
||||
|
||||
data {
|
||||
environment 'MOD_CLASSES', '{source_roots}'
|
||||
environment 'MCP_MAPPINGS', '{mcp_mappings}'
|
||||
@@ -448,11 +477,6 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
|
||||
def MODULE_PATH = Util.getArtifacts(prj, prj.configurations.moduleonly, false).values().collect{"libraries/${it.downloads.artifact.path}"}
|
||||
def CLASS_PATH = Util.getArtifacts(prj, prj.configurations.installer, false).values().collect{"libraries/${it.downloads.artifact.path}"} +
|
||||
[
|
||||
'libraries/' + Util.getMavenPath(rootProject.tasks.findByPath(':fmlloader:jar')),
|
||||
"libraries/net/minecraft/server/${MC_VERSION}-${MCP_VERSION}/server-${MC_VERSION}-${MCP_VERSION}-extra.jar"
|
||||
]
|
||||
def tokens = [
|
||||
TASK: prj.name.equals('forge') ? 'forgeserver' : 'fmlserver',
|
||||
MAVEN_PATH: prj.ext.MAVEN_PATH.toString(),
|
||||
@@ -463,9 +487,37 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
IGNORE_LIST: Util.getArtifacts(prj, prj.configurations.moduleonly, false).values().collect{it.downloads.artifact.path.rsplit('/', 1)[1]}.join(','),
|
||||
MODULES: 'ALL-MODULE-PATH'
|
||||
]
|
||||
|
||||
prj.task([dependsOn: rootProject.downloadServerRaw], 'makeClasspathFiles') {
|
||||
doLast {
|
||||
def CLASS_PATH = Util.getArtifacts(prj, prj.configurations.installer, false).values().collect{"libraries/${it.downloads.artifact.path}"} +
|
||||
[
|
||||
'libraries/' + Util.getMavenPath(rootProject.tasks.findByPath(':fmlloader:jar')),
|
||||
"libraries/net/minecraft/server/${MC_VERSION}-${MCP_VERSION}/server-${MC_VERSION}-${MCP_VERSION}-extra.jar"
|
||||
]
|
||||
def claimed = CLASS_PATH.collect{ it.rsplit('/', 2)[0] }.toSet() // Allow us to override versions
|
||||
try (def zip = new java.util.zip.ZipFile(rootProject.downloadServerRaw.dest)) {
|
||||
CLASS_PATH += zip.getInputStream(zip.getEntry('META-INF/classpath-joined')).text.split(';')
|
||||
.findAll{ it.startsWith('libraries/') && !claimed.contains(it.rsplit('/', 2)[0]) }
|
||||
}
|
||||
|
||||
configure(prj.installerJar) {
|
||||
from(rootProject.file('server_files/args.txt')) {
|
||||
filter(ReplaceTokens, tokens: tokens + [MODULE_PATH: MODULE_PATH.join(';'), CLASS_PATH: CLASS_PATH.join(';')])
|
||||
rename { 'data/win_args.txt' }
|
||||
}
|
||||
|
||||
from(rootProject.file('server_files/args.txt')) {
|
||||
filter(ReplaceTokens, tokens: tokens + [MODULE_PATH: MODULE_PATH.join(':'), CLASS_PATH: CLASS_PATH.join(':')])
|
||||
rename { 'data/unix_args.txt' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prj.afterEvaluate {
|
||||
prj.installerJar {
|
||||
dependsOn('makeClasspathFiles')
|
||||
from(rootProject.file('server_files/')) {
|
||||
exclude 'args.txt'
|
||||
filter(ReplaceTokens, tokens: tokens)
|
||||
@@ -473,16 +525,6 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
//rename 'run.sh', "run_forge_${VERSION.replace('-', '_').sh"
|
||||
//rename 'run.bat', "run_forge_${VERSION.replace('-', '_').bat"
|
||||
}
|
||||
|
||||
from(rootProject.file('server_files/args.txt')) {
|
||||
filter(ReplaceTokens, tokens: tokens + [MODULE_PATH: MODULE_PATH.join(';'), CLASS_PATH: CLASS_PATH.join(';')])
|
||||
rename { 'data/win_args.txt' }
|
||||
}
|
||||
|
||||
from(rootProject.file('server_files/args.txt')) {
|
||||
filter(ReplaceTokens, tokens: tokens + [MODULE_PATH: MODULE_PATH.join(':'), CLASS_PATH: CLASS_PATH.join(':')])
|
||||
rename { 'data/unix_args.txt' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -622,6 +664,10 @@ project(':fmlonly') {
|
||||
client: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings-merged@txt]",
|
||||
server: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings-merged@txt]"
|
||||
],
|
||||
MC_UNPACKED: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:unpacked]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:unpacked]"
|
||||
],
|
||||
MC_SLIM: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:slim]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:slim]"
|
||||
@@ -682,6 +728,26 @@ project(':fmlonly') {
|
||||
'--from', 'data/unix_args.txt',
|
||||
'--to', "{ROOT}/libraries/${MAVEN_PATH}/unix_args.txt"
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'BUNDLER_EXTRACT',
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--output', '{ROOT}/libraries/',
|
||||
'--libraries'
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'BUNDLER_EXTRACT',
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--output', '{MC_UNPACKED}',
|
||||
'--jar-only'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
@@ -711,11 +777,26 @@ project(':fmlonly') {
|
||||
'--classes', '--reverse-right'
|
||||
]
|
||||
], [
|
||||
sides: ['client'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
'--extra', '{MC_EXTRA}',
|
||||
'--srg', '{MERGED_MAPPINGS}'
|
||||
],
|
||||
outputs: [
|
||||
'{MC_SLIM}': '{MC_SLIM_SHA}',
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
'--input', '{MC_UNPACKED}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
'--extra', '{MC_EXTRA}',
|
||||
'--srg', '{MERGED_MAPPINGS}'
|
||||
],
|
||||
@@ -861,6 +942,7 @@ project(':forge') {
|
||||
parent runs.forge_client
|
||||
taskName 'forge_test_client'
|
||||
|
||||
property 'forge.enableGameTest', 'true'
|
||||
environment 'MOD_CLASSES', 'dummy' // Needed to work around FG limitation, FG will replace this!
|
||||
|
||||
ideaModule "${rootProject.name}.${project.name}.test"
|
||||
@@ -883,6 +965,7 @@ project(':forge') {
|
||||
parent runs.forge_server
|
||||
taskName 'forge_test_server'
|
||||
|
||||
property 'forge.enableGameTest', 'true'
|
||||
environment 'MOD_CLASSES', 'dummy' // Needed to work around FG limitation, FG will replace this!
|
||||
|
||||
ideaModule "${rootProject.name}.${project.name}.test"
|
||||
@@ -892,6 +975,27 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
|
||||
forge_gameTestServer {
|
||||
taskName 'forge_gameTestServer'
|
||||
args '--launchTarget', 'forgegametestserverdev'
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
|
||||
mods {
|
||||
minecraft { source sourceSets.main }
|
||||
}
|
||||
}
|
||||
|
||||
forge_test_gameTestServer {
|
||||
parent runs.forge_gameTestServer
|
||||
taskName 'forge_test_gameTestServer'
|
||||
|
||||
ideaModule "${rootProject.name}.${project.name}.test"
|
||||
|
||||
mods {
|
||||
tests { sources sourceSets.test }
|
||||
}
|
||||
}
|
||||
|
||||
def forgeDataArgs = [
|
||||
'--mod', 'forge',
|
||||
'--all',
|
||||
@@ -1136,6 +1240,10 @@ project(':forge') {
|
||||
client: '/data/client.lzma',
|
||||
server: '/data/server.lzma'
|
||||
],
|
||||
MC_UNPACKED: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:unpacked]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:unpacked]"
|
||||
],
|
||||
MC_SLIM: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:slim]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:slim]"
|
||||
@@ -1204,6 +1312,26 @@ project(':forge') {
|
||||
'--from', 'data/unix_args.txt',
|
||||
'--to', "{ROOT}/libraries/${MAVEN_PATH}/unix_args.txt"
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'BUNDLER_EXTRACT',
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--output', '{ROOT}/libraries/',
|
||||
'--libraries'
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'BUNDLER_EXTRACT',
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--output', '{MC_UNPACKED}',
|
||||
'--jar-only'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
@@ -1233,6 +1361,7 @@ project(':forge') {
|
||||
'--classes', '--reverse-right'
|
||||
]
|
||||
], [
|
||||
sides: ['client'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
@@ -1245,6 +1374,20 @@ project(':forge') {
|
||||
'{MC_SLIM}': '{MC_SLIM_SHA}',
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
'--input', '{MC_UNPACKED}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
'--extra', '{MC_EXTRA}',
|
||||
'--srg', '{MERGED_MAPPINGS}'
|
||||
],
|
||||
outputs: [
|
||||
'{MC_SLIM}': '{MC_SLIM_SHA}',
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
jar: FART,
|
||||
classpath: getClasspath(project, libs, FART),
|
||||
@@ -1345,10 +1488,6 @@ project(':forge') {
|
||||
license {
|
||||
header = file("$rootDir/LICENSE-header.txt")
|
||||
|
||||
ext {
|
||||
year = new Date().format("yyyy")
|
||||
}
|
||||
|
||||
include 'net/minecraftforge/'
|
||||
exclude 'net/minecraftforge/server/terminalconsole/'
|
||||
exclude 'net/minecraftforge/api/' // exclude API here because it's validated in the SPI build
|
||||
@@ -1369,7 +1508,8 @@ project(':forge') {
|
||||
}
|
||||
|
||||
reobfJar {
|
||||
tool = SPECIAL_SOURCE + ':shaded'
|
||||
tool = FART
|
||||
args = ['--input', '{input}', '--output', '{output}', '--map', '{srg}']
|
||||
}
|
||||
|
||||
tasks.eclipse.dependsOn('genEclipseRuns')
|
||||
@@ -1389,11 +1529,6 @@ project(':forge') {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact universalJar
|
||||
if (changelog.exists()) {
|
||||
artifact(changelog) {
|
||||
classifier = 'changelog'
|
||||
}
|
||||
}
|
||||
artifact installerJar
|
||||
//TODO: installer-win
|
||||
artifact makeMdk
|
||||
@@ -1413,3 +1548,19 @@ task setup() { //These must be strings so that we can do lazy resolution. Else
|
||||
dependsOn ':fmlonly:extractMapped'
|
||||
dependsOn ':forge:extractMapped'
|
||||
}
|
||||
|
||||
//Also output FMLOnly when building a version.
|
||||
if (System.env.TEAMCITY_VERSION) {
|
||||
//Only setup the CI environment if and only if the environment variables are set.
|
||||
tasks.configureTeamCity {
|
||||
doLast {
|
||||
println "##teamcity[buildNumber '${project(':forge').version}']"
|
||||
println "##teamcity[setParameter name='env.PUBLISHED_JAVA_ARTIFACT_VERSION' value='${project(':forge').version}']"
|
||||
println "##teamcity[setParameter name='env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION' value='${project(':fmlonly').version}']"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changelog {
|
||||
fromTag MIN_TAG_FOR_CHANGELOG
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import groovy.json.JsonBuilder
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
import java.io.File
|
||||
@@ -16,8 +17,11 @@ public class Util {
|
||||
}
|
||||
return md.digest().collect {String.format "%02x", it}.join()
|
||||
}
|
||||
File.metaClass.getSha1 = { !delegate.exists() ? null : delegate.sha1() }
|
||||
|
||||
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
|
||||
File.metaClass.getJson = { return delegate.exists() ? new JsonSlurper().parse(delegate) : [:] }
|
||||
File.metaClass.setJson = { json -> delegate.text = new JsonBuilder(json).toPrettyString() }
|
||||
|
||||
Date.metaClass.iso8601 = { ->
|
||||
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -37,6 +37,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -85,7 +86,7 @@ public class ModList
|
||||
}
|
||||
|
||||
private String fileToLine(IModFile mf) {
|
||||
return String.format("%-50.50s|%-30.30s|%-30.30s|%-20.20s|%-10.10s|Manifest: %s", mf.getFileName(),
|
||||
return String.format(Locale.ENGLISH, "%-50.50s|%-30.30s|%-30.30s|%-20.20s|%-10.10s|Manifest: %s", mf.getFileName(),
|
||||
mf.getModInfos().get(0).getDisplayName(),
|
||||
mf.getModInfos().get(0).getModId(),
|
||||
mf.getModInfos().get(0).getVersion(),
|
||||
|
||||
@@ -81,6 +81,7 @@ public class ConfigFileTypeHandler {
|
||||
}
|
||||
|
||||
private boolean setupConfigFile(final ModConfig modConfig, final Path file, final ConfigFormat<?> conf) throws IOException {
|
||||
Files.createDirectories(file.getParent());
|
||||
Path p = defaultConfigPath.resolve(modConfig.getFileName());
|
||||
if (Files.exists(p)) {
|
||||
LOGGER.info(CONFIG, "Loading default config file from path {}", p);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -27,6 +27,7 @@ import net.minecraftforge.fml.loading.StringUtils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class ModConfig
|
||||
@@ -54,7 +55,7 @@ public class ModConfig
|
||||
|
||||
private static String defaultConfigName(Type type, String modId) {
|
||||
// config file name would be "forge-client.toml" and "forge-server.toml"
|
||||
return String.format("%s-%s.toml", modId, type.extension());
|
||||
return String.format(Locale.ROOT, "%s-%s.toml", modId, type.extension());
|
||||
}
|
||||
public Type getType() {
|
||||
return type;
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.*;
|
||||
@@ -233,6 +234,13 @@ public class ModSorter
|
||||
LOGGER.debug(LOADING, "Found {} mod requirements missing ({} mandatory, {} optional)", missingVersions.size(), mandatoryMissing, missingVersions.size() - mandatoryMissing);
|
||||
|
||||
if (!missingVersions.isEmpty()) {
|
||||
if (mandatoryMissing > 0) {
|
||||
LOGGER.error(LOADING, "Missing mandatory dependencies: {}", missingVersions.stream().filter(IModInfo.ModVersion::isMandatory).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
|
||||
}
|
||||
if (missingVersions.size() - mandatoryMissing > 0) {
|
||||
LOGGER.error(LOADING, "Unsupported installed optional dependencies: {}", missingVersions.stream().filter(ver -> !ver.isMandatory()).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
|
||||
}
|
||||
|
||||
return missingVersions.stream()
|
||||
.map(mv -> new ExceptionData(mv.isMandatory() ? "fml.modloading.missingdependency" : "fml.modloading.missingdependency.optional",
|
||||
mv.getOwner(), mv.getModId(), mv.getOwner().getModId(), mv.getVersionRange(),
|
||||
|
||||
+2
-69
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -43,10 +43,8 @@ import java.util.jar.Manifest;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public abstract class AbstractJarFileLocator implements IModLocator {
|
||||
public abstract class AbstractJarFileLocator extends AbstractModLocator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
protected static final String MODS_TOML = "META-INF/mods.toml";
|
||||
protected static final String MANIFEST = "META-INF/MANIFEST.MF";
|
||||
|
||||
@Override
|
||||
public void scanFile(final IModFile file, final Consumer<Path> pathConsumer) {
|
||||
@@ -70,69 +68,4 @@ public abstract class AbstractJarFileLocator implements IModLocator {
|
||||
}
|
||||
|
||||
public abstract Stream<Path> scanCandidates();
|
||||
|
||||
@Override
|
||||
public boolean isValid(final IModFile modFile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private Optional<IModFile> createMod(Path path) {
|
||||
var mjm = new ModJarMetadata();
|
||||
var sj = SecureJar.from(
|
||||
Manifest::new,
|
||||
jar -> jar.findFile(MODS_TOML).isPresent() ? mjm : JarMetadata.from(jar, path),
|
||||
(root, p) -> true,
|
||||
path
|
||||
);
|
||||
|
||||
IModFile mod = null;
|
||||
var type = sj.getManifest().getMainAttributes().getValue(ModFile.TYPE);
|
||||
if (sj.findFile(MODS_TOML).isPresent()) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
|
||||
mod = new ModFile(sj, this, ModFileParser::modsTomlParser);
|
||||
} else if (type != null) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MANIFEST, type, path);
|
||||
mod = new ModFile(sj, this, this::manifestParser);
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
mjm.setModFile(mod);
|
||||
return Optional.ofNullable(mod);
|
||||
}
|
||||
|
||||
private IModFileInfo manifestParser(final IModFile mod) {
|
||||
Function<String, Optional<String>> cfg = name -> Optional.ofNullable(mod.getSecureJar().getManifest().getMainAttributes().getValue(name));
|
||||
var license = cfg.apply("LICENSE").orElse("");
|
||||
var dummy = new IConfigurable() {
|
||||
@Override
|
||||
public <T> Optional<T> getConfigElement(String... key) {
|
||||
return Optional.empty();
|
||||
}
|
||||
@Override
|
||||
public List<? extends IConfigurable> getConfigList(String... key) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
};
|
||||
|
||||
return new IModFileInfo() {
|
||||
@Override public List<IModInfo> getMods() { return Collections.emptyList(); }
|
||||
@Override public List<LanguageSpec> requiredLanguageLoaders() { return Collections.emptyList(); }
|
||||
@Override public boolean showAsResourcePack() { return false; }
|
||||
@Override public Map<String, Object> getFileProperties() { return Collections.emptyMap(); }
|
||||
@Override public String getLicense() { return license; }
|
||||
@Override public IModFile getFile() { return mod; }
|
||||
@Override public IConfigurable getConfig() { return dummy; }
|
||||
|
||||
// These Should never be called as it's only called from ModJarMetadata.version and we bypass that
|
||||
@Override public String moduleName() { return mod.getSecureJar().name(); }
|
||||
@Override public String versionString() { return null; }
|
||||
@Override public List<String> usesServices() { return null; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IModFileInfo(" + mod.getFilePath() + ")";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import cpw.mods.jarhandling.JarMetadata;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
public abstract class AbstractModLocator implements IModLocator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
protected static final String MODS_TOML = "META-INF/mods.toml";
|
||||
protected static final String MANIFEST = "META-INF/MANIFEST.MF";
|
||||
|
||||
protected Optional<IModFile> createMod(Path... path) {
|
||||
var mjm = new ModJarMetadata();
|
||||
var sj = SecureJar.from(
|
||||
Manifest::new,
|
||||
jar -> jar.findFile(MODS_TOML).isPresent() ? mjm : JarMetadata.from(jar, path),
|
||||
(root, p) -> true,
|
||||
path
|
||||
);
|
||||
|
||||
IModFile mod;
|
||||
var type = sj.getManifest().getMainAttributes().getValue(ModFile.TYPE);
|
||||
if (sj.findFile(MODS_TOML).isPresent()) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
|
||||
mod = new ModFile(sj, this, ModFileParser::modsTomlParser);
|
||||
} else if (type != null) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MANIFEST, type, path);
|
||||
mod = new ModFile(sj, this, this::manifestParser);
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
mjm.setModFile(mod);
|
||||
return Optional.of(mod);
|
||||
}
|
||||
|
||||
protected IModFileInfo manifestParser(final IModFile mod) {
|
||||
Function<String, Optional<String>> cfg = name -> Optional.ofNullable(mod.getSecureJar().getManifest().getMainAttributes().getValue(name));
|
||||
var license = cfg.apply("LICENSE").orElse("");
|
||||
var dummy = new IConfigurable() {
|
||||
@Override
|
||||
public <T> Optional<T> getConfigElement(String... key) {
|
||||
return Optional.empty();
|
||||
}
|
||||
@Override
|
||||
public List<? extends IConfigurable> getConfigList(String... key) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
};
|
||||
|
||||
return new IModFileInfo() {
|
||||
@Override public List<IModInfo> getMods() { return Collections.emptyList(); }
|
||||
@Override public List<LanguageSpec> requiredLanguageLoaders() { return Collections.emptyList(); }
|
||||
@Override public boolean showAsResourcePack() { return false; }
|
||||
@Override public Map<String, Object> getFileProperties() { return Collections.emptyMap(); }
|
||||
@Override public String getLicense() { return license; }
|
||||
@Override public IModFile getFile() { return mod; }
|
||||
@Override public IConfigurable getConfig() { return dummy; }
|
||||
|
||||
// These Should never be called as it's only called from ModJarMetadata.version and we bypass that
|
||||
@Override public String moduleName() { return mod.getSecureJar().name(); }
|
||||
@Override public String versionString() { return null; }
|
||||
@Override public List<String> usesServices() { return null; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IModFileInfo(" + mod.getFilePath() + ")";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(final IModFile modFile) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -21,13 +21,15 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class InvalidModFileException extends RuntimeException
|
||||
{
|
||||
private final IModFileInfo modFileInfo;
|
||||
|
||||
public InvalidModFileException(String message, IModFileInfo modFileInfo)
|
||||
{
|
||||
super(String.format("%s (%s)", message, ((ModFileInfo)modFileInfo).getFile().getFileName()));
|
||||
super(String.format(Locale.ENGLISH, "%s (%s)", message, ((ModFileInfo)modFileInfo).getFile().getFileName()));
|
||||
this.modFileInfo = modFileInfo;
|
||||
}
|
||||
}
|
||||
+22
-7
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.electronwill.nightconfig.core.Config;
|
||||
@@ -18,7 +37,7 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class MinecraftLocator implements IModLocator {
|
||||
public class MinecraftLocator extends AbstractModLocator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@Override
|
||||
@@ -31,7 +50,8 @@ public class MinecraftLocator implements IModLocator {
|
||||
.map(sj -> new ModFile(sj, this, ModFileParser::modsTomlParser))
|
||||
.collect(Collectors.<IModFile>toList());
|
||||
var othermods = baseMC.otherModPaths().stream()
|
||||
.map(p->ModJarMetadata.buildFile(this, p.toArray(Path[]::new)))
|
||||
.map(p -> createMod(p.toArray(Path[]::new)).orElse(null))
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
artifacts.add(mcjar);
|
||||
artifacts.addAll(othermods);
|
||||
@@ -112,9 +132,4 @@ public class MinecraftLocator implements IModLocator {
|
||||
public void initArguments(final Map<String, ?> arguments) {
|
||||
// no op
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(final IModFile modFile) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,8 @@ public class ModInfo implements IModInfo, IConfigurable
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final DefaultArtifactVersion DEFAULT_VERSION = new DefaultArtifactVersion("1");
|
||||
private static final Pattern VALID_LABEL = Pattern.compile("^[a-z][a-z0-9_-]{1,63}$");
|
||||
private static final Pattern VALID_MODID = Pattern.compile("^[a-z][a-z0-9_]{1,63}$");
|
||||
private static final Pattern VALID_NAMESPACE = Pattern.compile("^[a-z][a-z0-9_.-]{1,63}$");
|
||||
|
||||
private final ModFileInfo owningFile;
|
||||
private final String modId;
|
||||
@@ -64,13 +65,13 @@ public class ModInfo implements IModInfo, IConfigurable
|
||||
this.config = config;
|
||||
this.modId = config.<String>getConfigElement("modId")
|
||||
.orElseThrow(() -> new InvalidModFileException("Missing modId", owningFile));
|
||||
if (!VALID_LABEL.matcher(this.modId).matches()) {
|
||||
LOGGER.fatal("Invalid modId found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.modId, VALID_LABEL.pattern());
|
||||
if (!VALID_MODID.matcher(this.modId).matches()) {
|
||||
LOGGER.fatal("Invalid modId found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.modId, VALID_MODID.pattern());
|
||||
throw new InvalidModFileException("Invalid modId found : " + this.modId, owningFile);
|
||||
}
|
||||
this.namespace = config.<String>getConfigElement("namespace").orElse(this.modId);
|
||||
if (!VALID_LABEL.matcher(this.namespace).matches()) {
|
||||
LOGGER.fatal("Invalid override namespace found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.namespace, VALID_LABEL.pattern());
|
||||
if (!VALID_NAMESPACE.matcher(this.namespace).matches()) {
|
||||
LOGGER.fatal("Invalid override namespace found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.namespace, VALID_NAMESPACE.pattern());
|
||||
throw new InvalidModFileException("Invalid override namespace found : " + this.namespace, owningFile);
|
||||
}
|
||||
this.version = config.<String>getConfigElement("version")
|
||||
|
||||
+13
-23
@@ -17,33 +17,23 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.server.permission.context;
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class TargetContext extends PlayerContext
|
||||
{
|
||||
private final Entity target;
|
||||
|
||||
public TargetContext(Player ep, @Nullable Entity entity)
|
||||
{
|
||||
super(ep);
|
||||
target = entity;
|
||||
}
|
||||
public class ForgeGametestDevLaunchHandler extends CommonDevLaunchHandler {
|
||||
@Override public String name() { return "forgegametestserverdev"; }
|
||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T get(ContextKey<T> key)
|
||||
{
|
||||
return key.equals(ContextKeys.TARGET) ? (T) target : super.get(key);
|
||||
}
|
||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
||||
return () -> {
|
||||
var args = preLaunch(arguments, layer);
|
||||
|
||||
@Override
|
||||
protected boolean covers(ContextKey<?> key)
|
||||
{
|
||||
return target != null && key.equals(ContextKeys.TARGET);
|
||||
Class.forName(layer.findModule("forge").orElseThrow(), "net.minecraftforge.gametest.GameTestMain").getMethod("main", String[].class).invoke(null, (Object)args);
|
||||
return null;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-23
@@ -17,33 +17,23 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.server.permission.context;
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class WorldContext extends Context
|
||||
{
|
||||
private final Level world;
|
||||
|
||||
public WorldContext(Level w)
|
||||
{
|
||||
world = Preconditions.checkNotNull(w, "World can't be null in WorldContext!");
|
||||
}
|
||||
public class ForgeGametestUserdevLaunchHandler extends ForgeUserdevLaunchHandler {
|
||||
@Override public String name() { return "forgegametestserveruserdev"; }
|
||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||
|
||||
@Override
|
||||
public Level getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
||||
return () -> {
|
||||
var args = preLaunch(arguments, layer);
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Player getPlayer()
|
||||
{
|
||||
return null;
|
||||
Class.forName(layer.findModule("forge").orElseThrow(), "net.minecraftforge.gametest.GameTestMain").getMethod("main", String[].class).invoke(null, (Object)args);
|
||||
return null;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -14,3 +14,5 @@ net.minecraftforge.fml.loading.targets.ForgeServerDevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.ForgeServerUserdevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.ForgeDataDevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.ForgeDataUserdevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.ForgeGametestDevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.ForgeGametestUserdevLaunchHandler
|
||||
@@ -20,24 +20,24 @@
|
||||
<Appenders>
|
||||
<TerminalConsole name="Console">
|
||||
<PatternLayout>
|
||||
<LoggerNamePatternSelector defaultPattern="%highlightForge{[%d{HH:mm:ss}] [%t/%level] [%c{2.}/%markerSimpleName]: %minecraftFormatting{%msg}%n%tEx}">
|
||||
<LoggerNamePatternSelector defaultPattern="%highlightForge{[%d{HH:mm:ss}] [%t/%level] [%c{2.}/%markerSimpleName]: %minecraftFormatting{%msg{nolookup}}%n%tEx}">
|
||||
<!-- don't include the full logger name for Mojang's logs since they use full class names and it's very verbose -->
|
||||
<PatternMatch key="net.minecraft." pattern="%highlightForge{[%d{HH:mm:ss}] [%t/%level] [minecraft/%logger{1}]: %minecraftFormatting{%msg}%n%tEx}"/>
|
||||
<PatternMatch key="com.mojang." pattern="%highlightForge{[%d{HH:mm:ss}] [%t/%level] [mojang/%logger{1}]: %minecraftFormatting{%msg}%n%tEx}"/>
|
||||
<PatternMatch key="net.minecraft." pattern="%highlightForge{[%d{HH:mm:ss}] [%t/%level] [minecraft/%logger{1}]: %minecraftFormatting{%msg{nolookup}}%n%tEx}"/>
|
||||
<PatternMatch key="com.mojang." pattern="%highlightForge{[%d{HH:mm:ss}] [%t/%level] [mojang/%logger{1}]: %minecraftFormatting{%msg{nolookup}}%n%tEx}"/>
|
||||
</LoggerNamePatternSelector>
|
||||
</PatternLayout>
|
||||
</TerminalConsole>
|
||||
<Queue name="ServerGuiConsole" ignoreExceptions="true">
|
||||
<PatternLayout>
|
||||
<LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss}] [%t/%level] [%c{2.}/%markerSimpleName]: %minecraftFormatting{%msg}{strip}%n">
|
||||
<LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss}] [%t/%level] [%c{2.}/%markerSimpleName]: %minecraftFormatting{%msg{nolookup}}{strip}%n">
|
||||
<!-- don't include the full logger name for Mojang's logs since they use full class names and it's very verbose -->
|
||||
<PatternMatch key="net.minecraft." pattern="[%d{HH:mm:ss}] [%t/%level] [minecraft/%logger{1}]: %minecraftFormatting{%msg}{strip}%n"/>
|
||||
<PatternMatch key="com.mojang." pattern="[%d{HH:mm:ss}] [%t/%level] [mojang/%logger{1}]: %minecraftFormatting{%msg}{strip}%n"/>
|
||||
<PatternMatch key="net.minecraft." pattern="[%d{HH:mm:ss}] [%t/%level] [minecraft/%logger{1}]: %minecraftFormatting{%msg{nolookup}}{strip}%n"/>
|
||||
<PatternMatch key="com.mojang." pattern="[%d{HH:mm:ss}] [%t/%level] [mojang/%logger{1}]: %minecraftFormatting{%msg{nolookup}}{strip}%n"/>
|
||||
</LoggerNamePatternSelector>
|
||||
</PatternLayout>
|
||||
</Queue>
|
||||
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
||||
<PatternLayout pattern="[%d{ddMMMyyyy HH:mm:ss.SSS}] [%t/%level] [%logger/%markerSimpleName]: %minecraftFormatting{%msg}{strip}%n%xEx"/>
|
||||
<PatternLayout pattern="[%d{ddMMMyyyy HH:mm:ss.SSS}] [%t/%level] [%logger/%markerSimpleName]: %minecraftFormatting{%msg{nolookup}}{strip}%n%xEx"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy/>
|
||||
<OnStartupTriggeringPolicy/>
|
||||
@@ -45,7 +45,7 @@
|
||||
<DefaultRolloverStrategy max="99" fileIndex="min"/>
|
||||
</RollingRandomAccessFile>
|
||||
<RollingRandomAccessFile name="DebugFile" fileName="logs/debug.log" filePattern="logs/debug-%i.log.gz">
|
||||
<PatternLayout pattern="[%d{ddMMMyyyy HH:mm:ss.SSS}] [%t/%level] [%logger/%markerSimpleName]: %minecraftFormatting{%msg}{strip}%n%xEx"/>
|
||||
<PatternLayout pattern="[%d{ddMMMyyyy HH:mm:ss.SSS}] [%t/%level] [%logger/%markerSimpleName]: %minecraftFormatting{%msg{nolookup}}{strip}%n%xEx"/>
|
||||
<Policies>
|
||||
<OnStartupTriggeringPolicy/>
|
||||
<SizeBasedTriggeringPolicy size="200MB"/>
|
||||
|
||||
@@ -55,6 +55,9 @@ minecraft {
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
property 'forge.enabledGameTestNamespaces', 'examplemod'
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
@@ -77,6 +80,37 @@ minecraft {
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
property 'forge.enabledGameTestNamespaces', 'examplemod'
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||
// By default, the server will crash when no gametests are provided.
|
||||
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||
gameTestServer {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// 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'
|
||||
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
property 'forge.enabledGameTestNamespaces', 'examplemod'
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -58,7 +58,7 @@ public class ExampleMod
|
||||
}
|
||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(FMLServerStartingEvent event) {
|
||||
public void onServerStarting(ServerStartingEvent event) {
|
||||
// do something when the server starts
|
||||
LOGGER.info("HELLO from server starting");
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
@@ -69,6 +_,15 @@
|
||||
return (new TextComponent("")).m_7220_(this.f_88666_).m_130946_(": ").m_7220_(this.f_88667_);
|
||||
@@ -67,6 +_,15 @@
|
||||
return (new TextComponent("")).m_7220_(this.f_200947_.getFirst()).m_130946_(": ").m_7220_(this.f_200947_.getSecond());
|
||||
}
|
||||
|
||||
+ @Override
|
||||
@@ -15,4 +15,4 @@
|
||||
+
|
||||
public void m_6305_(PoseStack p_88679_, int p_88680_, int p_88681_, float p_88682_) {
|
||||
this.m_7333_(p_88679_);
|
||||
m_93215_(p_88679_, this.f_96547_, this.f_88666_, this.f_96543_ / 2, 80, 16777215);
|
||||
m_93215_(p_88679_, this.f_96547_, this.f_200947_.getFirst(), this.f_96543_ / 2, 80, 16777215);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/Util.java
|
||||
+++ b/net/minecraft/Util.java
|
||||
@@ -149,6 +_,9 @@
|
||||
@@ -158,6 +_,9 @@
|
||||
return 255;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
public static ExecutorService m_183988_() {
|
||||
return f_137443_;
|
||||
}
|
||||
@@ -227,7 +_,7 @@
|
||||
@@ -236,7 +_,7 @@
|
||||
try {
|
||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
|
||||
} catch (IllegalArgumentException illegalargumentexception) {
|
||||
|
||||
@@ -25,20 +25,20 @@
|
||||
if (p_90897_ != 1 && (p_90897_ != 2 || !this.f_90868_)) {
|
||||
if (p_90897_ == 0) {
|
||||
- aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(screen, p_90895_, p_90896_, p_90898_);
|
||||
}
|
||||
} else {
|
||||
screen.m_169416_();
|
||||
- aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(screen, p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(screen, p_90895_, p_90896_, p_90898_);
|
||||
}
|
||||
|
||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||
@@ -406,7 +_,7 @@
|
||||
@@ -406,22 +_,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,22 +47,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,12 +_,16 @@
|
||||
private void m_90889_(long p_90890_, int p_90891_, int p_90892_) {
|
||||
if (p_90890_ == this.f_90867_.m_91268_().m_85439_()) {
|
||||
- GuiEventListener guieventlistener = this.f_90867_.f_91080_;
|
||||
+ Screen guieventlistener = this.f_90867_.f_91080_;
|
||||
if (guieventlistener != null && this.f_90867_.m_91265_() == null) {
|
||||
if (Character.charCount(p_90891_) == 1) {
|
||||
Screen.m_96579_(() -> {
|
||||
- guieventlistener.m_5534_((char)p_90891_, p_90892_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(this.f_90867_.f_91080_, (char)p_90891_, p_90892_)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, (char)p_90891_, p_90892_)) return;
|
||||
+ if (guieventlistener.m_5534_((char)p_90891_, p_90892_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(this.f_90867_.f_91080_, (char)p_90891_, p_90892_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_);
|
||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||
} else {
|
||||
for(char c0 : Character.toChars(p_90891_)) {
|
||||
Screen.m_96579_(() -> {
|
||||
- guieventlistener.m_5534_(c0, p_90892_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(this.f_90867_.f_91080_, c0, p_90892_)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, c0, p_90892_)) return;
|
||||
+ if (guieventlistener.m_5534_(c0, p_90892_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(this.f_90867_.f_91080_, c0, p_90892_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, c0, p_90892_);
|
||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -67,10 +67,11 @@
|
||||
this.f_91064_ = new DebugRenderer(this);
|
||||
RenderSystem.m_69900_(this::m_91113_);
|
||||
if (this.f_91042_.f_83915_ == this.f_90990_.m_85441_() && this.f_91042_.f_83916_ == this.f_90990_.m_85442_()) {
|
||||
@@ -529,6 +_,10 @@
|
||||
@@ -529,6 +_,11 @@
|
||||
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.gametest.ForgeGameTestHooks.registerGametests();
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterClientReloadListenersEvent(this.f_91036_));
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterLayerDefinitions());
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers());
|
||||
@@ -307,12 +308,13 @@
|
||||
}
|
||||
|
||||
private boolean m_91278_() {
|
||||
@@ -1821,11 +_,11 @@
|
||||
@@ -1821,11 +_,12 @@
|
||||
}
|
||||
|
||||
public void m_91200_(String p_91201_) {
|
||||
- this.m_91219_(p_91201_, RegistryAccess.m_123086_(), Minecraft::m_91133_, Minecraft::m_91135_, false, Minecraft.ExperimentalDialogType.BACKUP);
|
||||
+ this.doLoadLevel(p_91201_, RegistryAccess.m_123086_(), Minecraft::m_91133_, Minecraft::m_91135_, false, Minecraft.ExperimentalDialogType.BACKUP, false);
|
||||
+ // We need to delay the call to RegistryAccess.builtin() as long as possible, in order to allow our world persistence hooks to run. So we pass in null here, and fix it later, only in the case where creating = false
|
||||
+ this.doLoadLevel(p_91201_, null, Minecraft::m_91133_, Minecraft::m_91135_, false, Minecraft.ExperimentalDialogType.BACKUP, false);
|
||||
}
|
||||
|
||||
public void m_91202_(String p_91203_, LevelSettings p_91204_, RegistryAccess.RegistryHolder p_91205_, WorldGenSettings p_91206_) {
|
||||
@@ -334,18 +336,16 @@
|
||||
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess;
|
||||
try {
|
||||
levelstoragesource$levelstorageaccess = this.f_91031_.m_78260_(p_91220_);
|
||||
@@ -1850,12 +_,17 @@
|
||||
@@ -1850,12 +_,15 @@
|
||||
}
|
||||
|
||||
Minecraft.ServerStem minecraft$serverstem;
|
||||
+ final RegistryAccess.RegistryHolder dyn_f;
|
||||
+ final RegistryAccess.RegistryHolder registryHolder;
|
||||
try {
|
||||
- minecraft$serverstem = this.m_91190_(p_91221_, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess);
|
||||
+ Minecraft.ServerStem mgr = this.m_91190_(p_91221_, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess);
|
||||
+ // We need to rebuild this if we're loading world, so that it gets all the information from AFTER we inject our mappings from the save.
|
||||
+ dyn_f = creating ? p_91221_ : RegistryAccess.m_123086_();
|
||||
+ minecraft$serverstem = creating ? mgr : this.m_91190_(dyn_f, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess); //Note this runs the injection again... which isn't good.. but hey.. we need a better spot to hook in.
|
||||
+
|
||||
+ if (!creating) levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData();
|
||||
+ registryHolder = creating ? p_91221_ : RegistryAccess.m_123086_();
|
||||
+ minecraft$serverstem = this.m_91190_(registryHolder, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess);
|
||||
} catch (Exception exception) {
|
||||
f_90982_.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception);
|
||||
this.m_91152_(new DatapackLoadFailureScreen(() -> {
|
||||
@@ -359,7 +359,7 @@
|
||||
|
||||
try {
|
||||
- levelstoragesource$levelstorageaccess.m_78287_(p_91221_, worlddata);
|
||||
+ levelstoragesource$levelstorageaccess.m_78287_(dyn_f, worlddata);
|
||||
+ levelstoragesource$levelstorageaccess.m_78287_(registryHolder, worlddata);
|
||||
minecraft$serverstem.m_91433_().m_136179_();
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_);
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
@@ -368,7 +368,7 @@
|
||||
GameProfileCache.m_11004_(false);
|
||||
this.f_91007_ = MinecraftServer.m_129872_((p_167898_) -> {
|
||||
- return new IntegratedServer(p_167898_, this, p_91221_, levelstoragesource$levelstorageaccess, minecraft$serverstem.m_91432_(), minecraft$serverstem.m_91433_(), worlddata, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_168000_) -> {
|
||||
+ return new IntegratedServer(p_167898_, this, dyn_f, levelstoragesource$levelstorageaccess, minecraft$serverstem.m_91432_(), minecraft$serverstem.m_91433_(), worlddata, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_168000_) -> {
|
||||
+ return new IntegratedServer(p_167898_, this, registryHolder, levelstoragesource$levelstorageaccess, minecraft$serverstem.m_91432_(), minecraft$serverstem.m_91433_(), worlddata, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_168000_) -> {
|
||||
StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_168000_ + 0);
|
||||
this.f_90999_.set(storingchunkprogresslistener);
|
||||
return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add);
|
||||
@@ -387,7 +387,7 @@
|
||||
} else {
|
||||
this.m_91143_(p_91225_, p_91220_, flag, () -> {
|
||||
- this.m_91219_(p_91220_, p_91221_, p_91222_, p_91223_, p_91224_, Minecraft.ExperimentalDialogType.NONE);
|
||||
+ this.doLoadLevel(p_91220_, dyn_f, p_91222_, p_91223_, p_91224_, Minecraft.ExperimentalDialogType.NONE, creating);
|
||||
+ this.doLoadLevel(p_91220_, registryHolder, p_91222_, p_91223_, p_91224_, Minecraft.ExperimentalDialogType.NONE, creating);
|
||||
});
|
||||
minecraft$serverstem.close();
|
||||
|
||||
|
||||
@@ -13,19 +13,19 @@
|
||||
screen.m_169415_();
|
||||
Screen.m_96579_(() -> {
|
||||
- aboolean[0] = screen.m_6375_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPre(this.f_91503_.f_91080_, d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPre(screen, d0, d1, i);
|
||||
+ if (!aboolean[0]) {
|
||||
+ aboolean[0] = this.f_91503_.f_91080_.m_6375_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPost(this.f_91503_.f_91080_, d0, d1, i, aboolean[0]);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPost(screen, d0, d1, i, aboolean[0]);
|
||||
+ }
|
||||
}, "mouseClicked event handler", screen.getClass().getCanonicalName());
|
||||
} else {
|
||||
Screen.m_96579_(() -> {
|
||||
- aboolean[0] = screen.m_6348_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPre(this.f_91503_.f_91080_, d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPre(screen, d0, d1, i);
|
||||
+ if (!aboolean[0]) {
|
||||
+ aboolean[0] = this.f_91503_.f_91080_.m_6348_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPost(this.f_91503_.f_91080_, d0, d1, i, aboolean[0]);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPost(screen, d0, d1, i, aboolean[0]);
|
||||
+ }
|
||||
}, "mouseReleased event handler", screen.getClass().getCanonicalName());
|
||||
}
|
||||
@@ -73,9 +73,9 @@
|
||||
double d3 = (p_91564_ - this.f_91508_) * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
|
||||
Screen.m_96579_(() -> {
|
||||
- screen.m_7979_(d0, d1, this.f_91510_, d2, d3);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPre(this.f_91503_.f_91080_, d0, d1, this.f_91510_, d2, d3)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPre(screen, d0, d1, this.f_91510_, d2, d3)) return;
|
||||
+ if (screen.m_7979_(d0, d1, this.f_91510_, d2, d3)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPost(this.f_91503_.f_91080_, d0, d1, this.f_91510_, d2, d3);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPost(screen, d0, d1, this.f_91510_, d2, d3);
|
||||
}, "mouseDragged event handler", screen.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -186,6 +_,7 @@
|
||||
@@ -187,6 +_,7 @@
|
||||
public boolean f_92076_;
|
||||
|
||||
public Options(Minecraft p_92138_, File p_92139_) {
|
||||
@@ -8,7 +8,7 @@
|
||||
this.f_92060_ = p_92138_;
|
||||
this.f_92110_ = new File(p_92139_, "options.txt");
|
||||
if (p_92138_.m_91103_() && Runtime.getRuntime().maxMemory() >= 1000000000L) {
|
||||
@@ -299,10 +_,14 @@
|
||||
@@ -300,10 +_,14 @@
|
||||
this.f_193762_ = p_168428_.m_142682_("allowServerListing", this.f_193762_);
|
||||
|
||||
for(KeyMapping keymapping : this.f_92059_) {
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,6 +_,7 @@
|
||||
@@ -491,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_92169_() {
|
||||
@@ -33,7 +33,7 @@
|
||||
try {
|
||||
final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8));
|
||||
|
||||
@@ -638,6 +_,23 @@
|
||||
@@ -639,6 +_,23 @@
|
||||
}
|
||||
|
||||
p_92146_.m_10509_(set);
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
if (p_96614_) {
|
||||
this.f_96541_.f_91065_.m_93076_().m_93783_(p_96613_);
|
||||
}
|
||||
+ //if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.player, msg) != 0) return; //Forge: TODO Client command re-write
|
||||
+ if (net.minecraftforge.client.ClientCommandHandler.sendMessage(p_96613_)) return;
|
||||
|
||||
this.f_96541_.f_91074_.m_108739_(p_96613_);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
if (this.m_96789_() && f1 >= 1.0F) {
|
||||
this.f_96726_.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||
}
|
||||
+ modUpdateNotification.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||
+ if (f1 >= 1.0f) modUpdateNotification.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@
|
||||
if (keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) {
|
||||
flag1 = true;
|
||||
- break;
|
||||
+ keyCodeModifierConflict &= keymapping.hasKeyModifierConflict(keymapping);
|
||||
+ keyCodeModifierConflict &= keymapping.hasKeyModifierConflict(this.f_193910_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,14 @@
|
||||
|
||||
if (p_194239_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) {
|
||||
((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_();
|
||||
@@ -1139,6 +_,7 @@
|
||||
public void m_7443_(ClientboundCommandsPacket p_104990_) {
|
||||
PacketUtils.m_131363_(p_104990_, this, this.f_104888_);
|
||||
this.f_104899_ = new CommandDispatcher<>(p_104990_.m_131884_());
|
||||
+ this.f_104899_ = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.f_104899_);
|
||||
}
|
||||
|
||||
public void m_7183_(ClientboundStopSoundPacket p_105116_) {
|
||||
@@ -1160,6 +_,7 @@
|
||||
clientrecipebook.m_90625_(this.f_104900_.m_44051_());
|
||||
clientrecipebook.m_90639_().forEach(mutablesearchtree::m_8080_);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/net/minecraft/client/particle/BreakingItemParticle.java
|
||||
+++ b/net/minecraft/client/particle/BreakingItemParticle.java
|
||||
@@ -31,7 +_,8 @@
|
||||
|
||||
protected BreakingItemParticle(ClientLevel p_105665_, double p_105666_, double p_105667_, double p_105668_, ItemStack p_105669_) {
|
||||
super(p_105665_, p_105666_, p_105667_, p_105668_, 0.0D, 0.0D, 0.0D);
|
||||
- this.m_108337_(Minecraft.m_91087_().m_91291_().m_174264_(p_105669_, p_105665_, (LivingEntity)null, 0).m_6160_());
|
||||
+ var model = Minecraft.m_91087_().m_91291_().m_174264_(p_105669_, p_105665_, (LivingEntity)null, 0);
|
||||
+ this.m_108337_(model.m_7343_().m_173464_(model, p_105669_, p_105665_, null, 0).getParticleIcon(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE));
|
||||
this.f_107226_ = 1.0F;
|
||||
this.f_107663_ /= 2.0F;
|
||||
this.f_105643_ = this.f_107223_.nextFloat() * 3.0F;
|
||||
@@ -1,6 +1,11 @@
|
||||
--- a/net/minecraft/client/particle/ParticleEngine.java
|
||||
+++ b/net/minecraft/client/particle/ParticleEngine.java
|
||||
@@ -70,7 +_,7 @@
|
||||
@@ -66,11 +_,11 @@
|
||||
private static final int f_172264_ = 16384;
|
||||
private static final List<ParticleRenderType> f_107288_ = ImmutableList.of(ParticleRenderType.f_107429_, ParticleRenderType.f_107430_, ParticleRenderType.f_107432_, ParticleRenderType.f_107431_, ParticleRenderType.f_107433_);
|
||||
protected ClientLevel f_107287_;
|
||||
- private final Map<ParticleRenderType, Queue<Particle>> f_107289_ = Maps.newIdentityHashMap();
|
||||
+ private final Map<ParticleRenderType, Queue<Particle>> f_107289_ = Maps.newTreeMap(net.minecraftforge.client.ForgeHooksClient.makeParticleRenderTypeComparator(f_107288_));
|
||||
private final Queue<TrackingEmitter> f_107290_ = Queues.newArrayDeque();
|
||||
private final TextureManager f_107291_;
|
||||
private final Random f_107292_ = new Random();
|
||||
@@ -34,7 +39,7 @@
|
||||
return particleprovider == null ? null : particleprovider.m_6966_(p_107396_, this.f_107287_, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
|
||||
}
|
||||
|
||||
@@ -381,7 +_,13 @@
|
||||
@@ -381,15 +_,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +52,11 @@
|
||||
+ public void render(PoseStack p_107337_, MultiBufferSource.BufferSource p_107338_, LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum clippingHelper) {
|
||||
p_107339_.m_109896_();
|
||||
RenderSystem.m_69482_();
|
||||
+ RenderSystem.m_69388_(org.lwjgl.opengl.GL13.GL_TEXTURE2);
|
||||
+ RenderSystem.m_69493_();
|
||||
+ RenderSystem.m_69388_(org.lwjgl.opengl.GL13.GL_TEXTURE0);
|
||||
PoseStack posestack = RenderSystem.m_157191_();
|
||||
@@ -389,7 +_,8 @@
|
||||
posestack.m_85836_();
|
||||
posestack.m_166854_(p_107337_.m_85850_().m_85861_());
|
||||
RenderSystem.m_157182_();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
if (fogtype == FogType.WATER) {
|
||||
float f = 192.0F;
|
||||
if (entity instanceof LocalPlayer) {
|
||||
@@ -244,6 +_,7 @@
|
||||
@@ -245,6 +_,7 @@
|
||||
|
||||
RenderSystem.m_157445_(f2);
|
||||
RenderSystem.m_157443_(f3);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/GameRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/GameRenderer.java
|
||||
@@ -285,6 +_,8 @@
|
||||
@@ -286,6 +_,8 @@
|
||||
this.m_109128_(new ResourceLocation("shaders/post/spider.json"));
|
||||
} else if (p_109107_ instanceof EnderMan) {
|
||||
this.m_109128_(new ResourceLocation("shaders/post/invert.json"));
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -541,6 +_,7 @@
|
||||
@@ -542,6 +_,7 @@
|
||||
list1.add(Pair.of(new ShaderInstance(p_172768_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_172733_) -> {
|
||||
f_172607_ = p_172733_;
|
||||
}));
|
||||
@@ -17,7 +17,7 @@
|
||||
} catch (IOException ioexception) {
|
||||
list1.forEach((p_172772_) -> {
|
||||
p_172772_.getFirst().close();
|
||||
@@ -703,7 +_,7 @@
|
||||
@@ -704,7 +_,7 @@
|
||||
d0 *= (double)Mth.m_14179_(this.f_109059_.f_91066_.f_92070_, 1.0F, 0.85714287F);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,11 +_,11 @@
|
||||
@@ -841,11 +_,11 @@
|
||||
|
||||
Window window = this.f_109059_.m_91268_();
|
||||
RenderSystem.m_69421_(256, Minecraft.f_91002_);
|
||||
@@ -40,7 +40,7 @@
|
||||
RenderSystem.m_157182_();
|
||||
Lighting.m_84931_();
|
||||
PoseStack posestack1 = new PoseStack();
|
||||
@@ -879,7 +_,7 @@
|
||||
@@ -880,7 +_,7 @@
|
||||
}
|
||||
} else if (this.f_109059_.f_91080_ != null) {
|
||||
try {
|
||||
@@ -49,7 +49,7 @@
|
||||
} catch (Throwable throwable1) {
|
||||
CrashReport crashreport1 = CrashReport.m_127521_(throwable1, "Rendering screen");
|
||||
CrashReportCategory crashreportcategory1 = crashreport1.m_127514_("Screen render details");
|
||||
@@ -1036,10 +_,17 @@
|
||||
@@ -1037,6 +_,11 @@
|
||||
Matrix4f matrix4f = posestack.m_85850_().m_85861_();
|
||||
this.m_109111_(matrix4f);
|
||||
camera.m_90575_(this.f_109059_.f_91073_, (Entity)(this.f_109059_.m_91288_() == null ? this.f_109059_.f_91074_ : this.f_109059_.m_91288_()), !this.f_109059_.f_91066_.m_92176_().m_90612_(), this.f_109059_.f_91066_.m_92176_().m_90613_(), p_109090_);
|
||||
@@ -60,6 +60,9 @@
|
||||
+
|
||||
p_109092_.m_85845_(Vector3f.f_122223_.m_122240_(camera.m_90589_()));
|
||||
p_109092_.m_85845_(Vector3f.f_122225_.m_122240_(camera.m_90590_() + 180.0F));
|
||||
Matrix3f matrix3f = p_109092_.m_85850_().m_85864_().m_8183_();
|
||||
@@ -1046,6 +_,8 @@
|
||||
|
||||
this.f_109059_.f_91060_.m_172961_(p_109092_, camera.m_90583_(), this.m_172716_(Math.max(d0, this.f_109059_.f_91066_.f_92068_)));
|
||||
this.f_109059_.f_91060_.m_109599_(p_109092_, p_109090_, p_109091_, flag, camera, this, this.f_109074_, matrix4f);
|
||||
+ this.f_109059_.m_91307_().m_6182_("forge_render_last");
|
||||
|
||||
@@ -28,15 +28,16 @@
|
||||
RenderSystem.m_69421_(16640, Minecraft.f_91002_);
|
||||
float f = p_109605_.m_109152_();
|
||||
boolean flag2 = this.f_109461_.f_91073_.m_104583_().m_5781_(Mth.m_14107_(d0), Mth.m_14107_(d1)) || this.f_109461_.f_91065_.m_93090_().m_93715_();
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag1, p_109601_);
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_);
|
||||
profilerfiller.m_6182_("sky");
|
||||
RenderSystem.m_157427_(GameRenderer::m_172808_);
|
||||
this.m_181409_(p_109600_, p_109607_, p_109601_, () -> {
|
||||
FogRenderer.m_109024_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2);
|
||||
- FogRenderer.m_109024_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2);
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_);
|
||||
});
|
||||
profilerfiller.m_6182_("fog");
|
||||
- FogRenderer.m_109024_(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f - 16.0F, 32.0F), flag2);
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f - 16.0F, 32.0F), flag1, p_109601_);
|
||||
- FogRenderer.m_109024_(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f, 32.0F), flag2);
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f, 32.0F), flag2, p_109601_);
|
||||
profilerfiller.m_6182_("terrain_setup");
|
||||
this.m_194338_(p_109604_, frustum, flag1, this.f_109461_.f_91074_.m_5833_());
|
||||
profilerfiller.m_6182_("compilechunks");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/ShaderInstance.java
|
||||
+++ b/net/minecraft/client/renderer/ShaderInstance.java
|
||||
@@ -91,10 +_,14 @@
|
||||
@@ -94,10 +_,14 @@
|
||||
@Nullable
|
||||
public final Uniform f_173320_;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
Resource resource = null;
|
||||
|
||||
try {
|
||||
@@ -202,8 +_,9 @@
|
||||
@@ -206,8 +_,9 @@
|
||||
Program program1 = p_173342_.m_85570_().get(p_173343_);
|
||||
Program program;
|
||||
if (program1 == null) {
|
||||
|
||||
+9
-11
@@ -1,12 +1,10 @@
|
||||
--- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java
|
||||
@@ -44,19 +_,20 @@
|
||||
if (itemstack.m_41720_() instanceof ArmorItem) {
|
||||
ArmorItem armoritem = (ArmorItem)itemstack.m_41720_();
|
||||
@@ -46,17 +_,18 @@
|
||||
if (armoritem.m_40402_() == p_117122_) {
|
||||
+ p_117124_ = getArmorModelHook(p_117121_, itemstack, p_117122_, p_117124_);
|
||||
this.m_117386_().m_102872_(p_117124_);
|
||||
this.m_117125_(p_117124_, p_117122_);
|
||||
+ net.minecraft.client.model.Model model = getArmorModelHook(p_117121_, itemstack, p_117122_, p_117124_);
|
||||
boolean flag = this.m_117128_(p_117122_);
|
||||
boolean flag1 = itemstack.m_41790_();
|
||||
- if (armoritem instanceof DyeableArmorItem) {
|
||||
@@ -18,11 +16,11 @@
|
||||
float f2 = (float)(i & 255) / 255.0F;
|
||||
- this.m_117106_(p_117119_, p_117120_, p_117123_, armoritem, flag1, p_117124_, flag, f, f1, f2, (String)null);
|
||||
- this.m_117106_(p_117119_, p_117120_, p_117123_, armoritem, flag1, p_117124_, flag, 1.0F, 1.0F, 1.0F, "overlay");
|
||||
+ this.renderModel(p_117119_, p_117120_, p_117123_, flag1, p_117124_, f, f1, f2, this.getArmorResource(p_117121_, itemstack, p_117122_, null));
|
||||
+ this.renderModel(p_117119_, p_117120_, p_117123_, flag1, p_117124_, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, "overlay"));
|
||||
+ this.renderModel(p_117119_, p_117120_, p_117123_, flag1, model, f, f1, f2, this.getArmorResource(p_117121_, itemstack, p_117122_, null));
|
||||
+ this.renderModel(p_117119_, p_117120_, p_117123_, flag1, model, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, "overlay"));
|
||||
} else {
|
||||
- this.m_117106_(p_117119_, p_117120_, p_117123_, armoritem, flag1, p_117124_, flag, 1.0F, 1.0F, 1.0F, (String)null);
|
||||
+ this.renderModel(p_117119_, p_117120_, p_117123_, flag1, p_117124_, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, null));
|
||||
+ this.renderModel(p_117119_, p_117120_, p_117123_, flag1, model, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,7 +31,7 @@
|
||||
- VertexConsumer vertexconsumer = ItemRenderer.m_115184_(p_117108_, RenderType.m_110431_(this.m_117080_(p_117110_, p_117113_, p_117117_)), false, p_117111_);
|
||||
+ renderModel(p_117107_, p_117108_, p_117109_, p_117111_, p_117112_, p_117114_, p_117115_, p_117116_, this.m_117080_(p_117110_, p_117113_, p_117117_));
|
||||
+ }
|
||||
+ private void renderModel(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, A p_117112_, float p_117114_, float p_117115_, float p_117116_, ResourceLocation armorResource) {
|
||||
+ private void renderModel(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, net.minecraft.client.model.Model p_117112_, float p_117114_, float p_117115_, float p_117116_, ResourceLocation armorResource) {
|
||||
+ VertexConsumer vertexconsumer = ItemRenderer.m_115184_(p_117108_, RenderType.m_110431_(armorResource), false, p_117111_);
|
||||
p_117112_.m_7695_(p_117107_, vertexconsumer, p_117109_, OverlayTexture.f_118083_, p_117114_, p_117115_, p_117116_, 1.0F);
|
||||
}
|
||||
@@ -51,9 +49,9 @@
|
||||
+ /*=================================== FORGE START =========================================*/
|
||||
+
|
||||
+ /**
|
||||
+ * Hook to allow item-sensitive armor model. for LayerBipedArmor.
|
||||
+ * Hook to allow item-sensitive armor model. for HumanoidArmorLayer.
|
||||
+ */
|
||||
+ protected A getArmorModelHook(T entity, ItemStack itemStack, EquipmentSlot slot, A model) {
|
||||
+ protected net.minecraft.client.model.Model getArmorModelHook(T entity, ItemStack itemStack, EquipmentSlot slot, A model) {
|
||||
+ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model);
|
||||
+ }
|
||||
+
|
||||
@@ -75,7 +73,7 @@
|
||||
+ domain = texture.substring(0, idx);
|
||||
+ texture = texture.substring(idx + 1);
|
||||
+ }
|
||||
+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (m_117128_(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type));
|
||||
+ String s1 = String.format(java.util.Locale.ROOT, "%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (m_117128_(slot) ? 2 : 1), type == null ? "" : String.format(java.util.Locale.ROOT, "_%s", type));
|
||||
+
|
||||
+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type);
|
||||
+ ResourceLocation resourcelocation = f_117070_.get(s1);
|
||||
|
||||
+13
@@ -10,3 +10,16 @@
|
||||
}
|
||||
|
||||
public Vec3 m_7860_(AbstractClientPlayer p_117785_, float p_117786_) {
|
||||
@@ -158,10 +_,12 @@
|
||||
}
|
||||
|
||||
public void m_117770_(PoseStack p_117771_, MultiBufferSource p_117772_, int p_117773_, AbstractClientPlayer p_117774_) {
|
||||
+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonArm(p_117771_, p_117772_, p_117773_, p_117774_, HumanoidArm.RIGHT))
|
||||
this.m_117775_(p_117771_, p_117772_, p_117773_, p_117774_, (this.f_115290_).f_102811_, (this.f_115290_).f_103375_);
|
||||
}
|
||||
|
||||
public void m_117813_(PoseStack p_117814_, MultiBufferSource p_117815_, int p_117816_, AbstractClientPlayer p_117817_) {
|
||||
+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonArm(p_117814_, p_117815_, p_117816_, p_117817_, HumanoidArm.LEFT))
|
||||
this.m_117775_(p_117814_, p_117815_, p_117816_, p_117817_, (this.f_115290_).f_102812_, (this.f_115290_).f_103374_);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -35,7 +_,7 @@
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
-public class CommandSourceStack implements SharedSuggestionProvider {
|
||||
+public class CommandSourceStack implements SharedSuggestionProvider, net.minecraftforge.common.extensions.IForgeCommandSourceStack {
|
||||
public static final SimpleCommandExceptionType f_81286_ = new SimpleCommandExceptionType(new TranslatableComponent("permissions.requires.player"));
|
||||
public static final SimpleCommandExceptionType f_81287_ = new SimpleCommandExceptionType(new TranslatableComponent("permissions.requires.entity"));
|
||||
private final CommandSource f_81288_;
|
||||
@@ -1,5 +1,14 @@
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -175,7 +_,7 @@
|
||||
JfrCommand.m_183645_(this.f_82090_);
|
||||
}
|
||||
|
||||
- if (SharedConstants.f_136183_) {
|
||||
+ if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) {
|
||||
TestCommand.m_127946_(this.f_82090_);
|
||||
}
|
||||
|
||||
@@ -199,6 +_,7 @@
|
||||
if (p_82093_.f_82144_) {
|
||||
PublishCommand.m_138184_(this.f_82090_);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/commands/arguments/ObjectiveArgument.java
|
||||
+++ b/net/minecraft/commands/arguments/ObjectiveArgument.java
|
||||
@@ -31,7 +_,7 @@
|
||||
|
||||
public static Objective m_101960_(CommandContext<CommandSourceStack> p_101961_, String p_101962_) throws CommandSyntaxException {
|
||||
String s = p_101961_.getArgument(p_101962_, String.class);
|
||||
- Scoreboard scoreboard = p_101961_.getSource().m_81377_().m_129896_();
|
||||
+ Scoreboard scoreboard = p_101961_.getSource().getScoreboard();
|
||||
Objective objective = scoreboard.m_83477_(s);
|
||||
if (objective == null) {
|
||||
throw f_101953_.create(s);
|
||||
@@ -55,7 +_,7 @@
|
||||
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> p_101974_, SuggestionsBuilder p_101975_) {
|
||||
if (p_101974_.getSource() instanceof CommandSourceStack) {
|
||||
- return SharedSuggestionProvider.m_82970_(((CommandSourceStack)p_101974_.getSource()).m_81377_().m_129896_().m_83474_(), p_101975_);
|
||||
+ return SharedSuggestionProvider.m_82970_(((CommandSourceStack)p_101974_.getSource()).getScoreboard().m_83474_(), p_101975_);
|
||||
} else if (p_101974_.getSource() instanceof SharedSuggestionProvider) {
|
||||
SharedSuggestionProvider sharedsuggestionprovider = (SharedSuggestionProvider)p_101974_.getSource();
|
||||
return sharedsuggestionprovider.m_5497_((CommandContext<SharedSuggestionProvider>)p_101974_, p_101975_);
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/commands/arguments/ResourceLocationArgument.java
|
||||
+++ b/net/minecraft/commands/arguments/ResourceLocationArgument.java
|
||||
@@ -44,7 +_,7 @@
|
||||
|
||||
public static Advancement m_106987_(CommandContext<CommandSourceStack> p_106988_, String p_106989_) throws CommandSyntaxException {
|
||||
ResourceLocation resourcelocation = p_106988_.getArgument(p_106989_, ResourceLocation.class);
|
||||
- Advancement advancement = p_106988_.getSource().m_81377_().m_129889_().m_136041_(resourcelocation);
|
||||
+ Advancement advancement = p_106988_.getSource().getAdvancement(resourcelocation);
|
||||
if (advancement == null) {
|
||||
throw f_106978_.create(resourcelocation);
|
||||
} else {
|
||||
@@ -53,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static Recipe<?> m_106994_(CommandContext<CommandSourceStack> p_106995_, String p_106996_) throws CommandSyntaxException {
|
||||
- RecipeManager recipemanager = p_106995_.getSource().m_81377_().m_129894_();
|
||||
+ RecipeManager recipemanager = p_106995_.getSource().getRecipeManager();
|
||||
ResourceLocation resourcelocation = p_106995_.getArgument(p_106996_, ResourceLocation.class);
|
||||
return recipemanager.m_44043_(resourcelocation).orElseThrow(() -> {
|
||||
return f_106979_.create(resourcelocation);
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/commands/arguments/TeamArgument.java
|
||||
+++ b/net/minecraft/commands/arguments/TeamArgument.java
|
||||
@@ -28,7 +_,7 @@
|
||||
|
||||
public static PlayerTeam m_112091_(CommandContext<CommandSourceStack> p_112092_, String p_112093_) throws CommandSyntaxException {
|
||||
String s = p_112092_.getArgument(p_112093_, String.class);
|
||||
- Scoreboard scoreboard = p_112092_.getSource().m_81377_().m_129896_();
|
||||
+ Scoreboard scoreboard = p_112092_.getSource().getScoreboard();
|
||||
PlayerTeam playerteam = scoreboard.m_83489_(s);
|
||||
if (playerteam == null) {
|
||||
throw f_112085_.create(s);
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/commands/arguments/coordinates/BlockPosArgument.java
|
||||
+++ b/net/minecraft/commands/arguments/coordinates/BlockPosArgument.java
|
||||
@@ -30,9 +_,9 @@
|
||||
|
||||
public static BlockPos m_118242_(CommandContext<CommandSourceStack> p_118243_, String p_118244_) throws CommandSyntaxException {
|
||||
BlockPos blockpos = p_118243_.getArgument(p_118244_, Coordinates.class).m_119568_(p_118243_.getSource());
|
||||
- if (!p_118243_.getSource().m_81372_().m_46805_(blockpos)) {
|
||||
+ if (!p_118243_.getSource().getUnsidedLevel().m_46805_(blockpos)) {
|
||||
throw f_118234_.create();
|
||||
- } else if (!p_118243_.getSource().m_81372_().m_46739_(blockpos)) {
|
||||
+ } else if (!p_118243_.getSource().getUnsidedLevel().m_46739_(blockpos)) {
|
||||
throw f_118235_.create();
|
||||
} else {
|
||||
return blockpos;
|
||||
@@ -1,11 +1,21 @@
|
||||
--- a/net/minecraft/commands/synchronization/ArgumentTypes.java
|
||||
+++ b/net/minecraft/commands/synchronization/ArgumentTypes.java
|
||||
@@ -257,4 +_,8 @@
|
||||
@@ -118,7 +_,7 @@
|
||||
m_121601_("dimension", DimensionArgument.class, new EmptyArgumentSerializer<>(DimensionArgument::m_88805_));
|
||||
m_121601_("time", TimeArgument.class, new EmptyArgumentSerializer<>(TimeArgument::m_113037_));
|
||||
m_121601_("uuid", UuidArgument.class, new EmptyArgumentSerializer<>(UuidArgument::m_113850_));
|
||||
- if (SharedConstants.f_136183_) {
|
||||
+ if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) {
|
||||
m_121601_("test_argument", TestFunctionArgument.class, new EmptyArgumentSerializer<>(TestFunctionArgument::m_128088_));
|
||||
m_121601_("test_class", TestClassNameArgument.class, new EmptyArgumentSerializer<>(TestClassNameArgument::m_127917_));
|
||||
}
|
||||
@@ -256,5 +_,9 @@
|
||||
this.f_121619_ = p_121623_;
|
||||
this.f_121620_ = p_121624_;
|
||||
}
|
||||
}
|
||||
+ }
|
||||
+ @javax.annotation.Nullable public static ResourceLocation getId(ArgumentType<?> type) {
|
||||
+ Entry<?> entry = m_121616_(type);
|
||||
+ return entry == null ? null : entry.f_121620_;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@
|
||||
return StructureFeature.f_67014_;
|
||||
});
|
||||
public static final ResourceKey<Registry<StructurePieceType>> f_122842_ = m_122978_("worldgen/structure_piece");
|
||||
@@ -311,7 +_,7 @@
|
||||
@@ -311,16 +_,16 @@
|
||||
public static final ResourceKey<Registry<Codec<? extends SurfaceRules.RuleSource>>> f_194572_ = m_122978_("worldgen/material_rule");
|
||||
public static final ResourceKey<Registry<StructureProcessorType<?>>> f_122854_ = m_122978_("worldgen/structure_processor");
|
||||
public static final ResourceKey<Registry<StructurePoolElementType<?>>> f_122855_ = m_122978_("worldgen/structure_pool_element");
|
||||
@@ -148,7 +148,18 @@
|
||||
+ @Deprecated public static final Registry<BlockStateProviderType<?>> f_122856_ = forge(f_122846_, () -> {
|
||||
return BlockStateProviderType.f_68752_;
|
||||
});
|
||||
public static final Registry<FoliagePlacerType<?>> f_122858_ = m_122999_(f_122848_, () -> {
|
||||
- public static final Registry<FoliagePlacerType<?>> f_122858_ = m_122999_(f_122848_, () -> {
|
||||
+ @Deprecated public static final Registry<FoliagePlacerType<?>> f_122858_ = forge(f_122848_, () -> {
|
||||
return FoliagePlacerType.f_68591_;
|
||||
});
|
||||
public static final Registry<TrunkPlacerType<?>> f_122859_ = m_122999_(f_122849_, () -> {
|
||||
return TrunkPlacerType.f_70315_;
|
||||
});
|
||||
- public static final Registry<TreeDecoratorType<?>> f_122860_ = m_122999_(f_122850_, () -> {
|
||||
+ @Deprecated public static final Registry<TreeDecoratorType<?>> f_122860_ = forge(f_122850_, () -> {
|
||||
return TreeDecoratorType.f_70043_;
|
||||
});
|
||||
public static final Registry<FeatureSizeType<?>> f_122888_ = m_122999_(f_122851_, () -> {
|
||||
@@ -365,16 +_,32 @@
|
||||
return m_122981_(p_123000_, Lifecycle.experimental(), p_123001_);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/gametest/framework/GameTest.java
|
||||
+++ b/net/minecraft/gametest/framework/GameTest.java
|
||||
@@ -16,6 +_,11 @@
|
||||
|
||||
boolean m_177045_() default true;
|
||||
|
||||
+ /**
|
||||
+ * The namespace of where to grab the structure from, generally a mod id.
|
||||
+ */
|
||||
+ String templateNamespace() default "";
|
||||
+
|
||||
String m_177046_() default "";
|
||||
|
||||
long m_177047_() default 0L;
|
||||
@@ -0,0 +1,72 @@
|
||||
--- a/net/minecraft/gametest/framework/GameTestRegistry.java
|
||||
+++ b/net/minecraft/gametest/framework/GameTestRegistry.java
|
||||
@@ -25,21 +_,33 @@
|
||||
private static final Map<String, Consumer<ServerLevel>> f_177498_ = Maps.newHashMap();
|
||||
private static final Collection<TestFunction> f_177499_ = Sets.newHashSet();
|
||||
|
||||
+ /** @deprecated Forge: Use {@link net.minecraftforge.event.RegisterGameTestsEvent RegisterGameTestsEvent} to register game tests */
|
||||
+ @Deprecated
|
||||
public static void m_177501_(Class<?> p_177502_) {
|
||||
Arrays.stream(p_177502_.getDeclaredMethods()).forEach(GameTestRegistry::m_177503_);
|
||||
}
|
||||
|
||||
+ /** @deprecated Forge: Use {@link net.minecraftforge.event.RegisterGameTestsEvent RegisterGameTestsEvent} to register game tests */
|
||||
+ @Deprecated
|
||||
public static void m_177503_(Method p_177504_) {
|
||||
+ register(p_177504_, java.util.Set.of());
|
||||
+ }
|
||||
+ /** @deprecated Forge: Use {@link net.minecraftforge.event.RegisterGameTestsEvent RegisterGameTestsEvent} to register game tests */
|
||||
+ @Deprecated
|
||||
+ public static void register(Method p_177504_, java.util.Set<String> allowedNamespaces) {
|
||||
String s = p_177504_.getDeclaringClass().getSimpleName();
|
||||
GameTest gametest = p_177504_.getAnnotation(GameTest.class);
|
||||
- if (gametest != null) {
|
||||
+ if (gametest != null && (allowedNamespaces.isEmpty() || allowedNamespaces.contains(net.minecraftforge.gametest.ForgeGameTestHooks.getTemplateNamespace(p_177504_)))) {
|
||||
f_177495_.add(m_177515_(p_177504_));
|
||||
f_177496_.add(s);
|
||||
}
|
||||
|
||||
GameTestGenerator gametestgenerator = p_177504_.getAnnotation(GameTestGenerator.class);
|
||||
if (gametestgenerator != null) {
|
||||
- f_177495_.addAll(m_177513_(p_177504_));
|
||||
+ Collection<TestFunction> testFunctions = new java.util.ArrayList<>(m_177513_(p_177504_));
|
||||
+ if (!allowedNamespaces.isEmpty())
|
||||
+ testFunctions.removeIf(t -> !allowedNamespaces.contains(new net.minecraft.resources.ResourceLocation(t.m_128078_()).m_135827_()));
|
||||
+ f_177495_.addAll(testFunctions);
|
||||
f_177496_.add(s);
|
||||
}
|
||||
|
||||
@@ -104,7 +_,9 @@
|
||||
|
||||
private static Collection<TestFunction> m_177513_(Method p_177514_) {
|
||||
try {
|
||||
- Object object = p_177514_.getDeclaringClass().newInstance();
|
||||
+ Object object = null;
|
||||
+ if (!java.lang.reflect.Modifier.isStatic(p_177514_.getModifiers()))
|
||||
+ object = p_177514_.getDeclaringClass().newInstance();
|
||||
return (Collection)p_177514_.invoke(object);
|
||||
} catch (ReflectiveOperationException reflectiveoperationexception) {
|
||||
throw new RuntimeException(reflectiveoperationexception);
|
||||
@@ -115,8 +_,9 @@
|
||||
GameTest gametest = p_177516_.getAnnotation(GameTest.class);
|
||||
String s = p_177516_.getDeclaringClass().getSimpleName();
|
||||
String s1 = s.toLowerCase();
|
||||
- String s2 = s1 + "." + p_177516_.getName().toLowerCase();
|
||||
- String s3 = gametest.m_177046_().isEmpty() ? s2 : s1 + "." + gametest.m_177046_();
|
||||
+ boolean prefixGameTestTemplate = net.minecraftforge.gametest.ForgeGameTestHooks.prefixGameTestTemplate(p_177516_);
|
||||
+ String s2 = (prefixGameTestTemplate ? s1 + "." : "") + p_177516_.getName().toLowerCase();
|
||||
+ String s3 = net.minecraftforge.gametest.ForgeGameTestHooks.getTemplateNamespace(p_177516_) + ":" + (gametest.m_177046_().isEmpty() ? s2 : (prefixGameTestTemplate ? s1 + "." : "") + gametest.m_177046_());
|
||||
String s4 = gametest.m_177043_();
|
||||
Rotation rotation = StructureUtils.m_127835_(gametest.m_177044_());
|
||||
return new TestFunction(s4, s2, s3, rotation, gametest.m_177042_(), gametest.m_177047_(), gametest.m_177045_(), gametest.m_177049_(), gametest.m_177048_(), (Consumer<net.minecraft.gametest.framework.GameTestHelper>)m_177519_(p_177516_));
|
||||
@@ -125,7 +_,9 @@
|
||||
private static Consumer<?> m_177519_(Method p_177520_) {
|
||||
return (p_177512_) -> {
|
||||
try {
|
||||
- Object object = p_177520_.getDeclaringClass().newInstance();
|
||||
+ Object object = null;
|
||||
+ if (!java.lang.reflect.Modifier.isStatic(p_177520_.getModifiers()))
|
||||
+ object = p_177520_.getDeclaringClass().newInstance();
|
||||
p_177520_.invoke(object, p_177512_);
|
||||
} catch (InvocationTargetException invocationtargetexception) {
|
||||
if (invocationtargetexception.getCause() instanceof RuntimeException) {
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/gametest/framework/GameTestServer.java
|
||||
+++ b/net/minecraft/gametest/framework/GameTestServer.java
|
||||
@@ -69,12 +_,13 @@
|
||||
public boolean m_7038_() {
|
||||
this.m_129823_(new PlayerList(this, this.f_129746_, this.f_129745_, 1) {
|
||||
});
|
||||
+ if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false;
|
||||
this.m_130006_();
|
||||
ServerLevel serverlevel = this.m_129783_();
|
||||
serverlevel.m_8733_(this.f_177588_, 0.0F);
|
||||
int i = 20000000;
|
||||
serverlevel.m_8606_(20000000, 20000000, false, false);
|
||||
- return true;
|
||||
+ return net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(this);
|
||||
}
|
||||
|
||||
public void m_5705_(BooleanSupplier p_177619_) {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/gametest/framework/StructureUtils.java
|
||||
+++ b/net/minecraft/gametest/framework/StructureUtils.java
|
||||
@@ -238,7 +_,7 @@
|
||||
if (optional.isPresent()) {
|
||||
return optional.get();
|
||||
} else {
|
||||
- String s = p_127881_ + ".snbt";
|
||||
+ String s = new ResourceLocation(p_127881_).m_135815_() + ".snbt";
|
||||
Path path = Paths.get(f_127833_, s);
|
||||
CompoundTag compoundtag = m_127902_(path);
|
||||
if (compoundtag == null) {
|
||||
+25
-1
@@ -9,11 +9,35 @@
|
||||
private static final int f_178834_ = 1048576;
|
||||
public static final ResourceLocation f_132012_ = new ResourceLocation("brand");
|
||||
public static final ResourceLocation f_132013_ = new ResourceLocation("debug/path");
|
||||
@@ -26,6 +_,7 @@
|
||||
public static final ResourceLocation f_178833_ = new ResourceLocation("debug/game_event_listeners");
|
||||
private final ResourceLocation f_132029_;
|
||||
private final FriendlyByteBuf f_132030_;
|
||||
+ private final boolean shouldRelease;
|
||||
|
||||
public ClientboundCustomPayloadPacket(ResourceLocation p_132034_, FriendlyByteBuf p_132035_) {
|
||||
this.f_132029_ = p_132034_;
|
||||
@@ -33,6 +_,7 @@
|
||||
if (p_132035_.writerIndex() > 1048576) {
|
||||
throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes");
|
||||
}
|
||||
+ this.shouldRelease = false; //We are not the owner of the buffer, don't release it, it might be reused.
|
||||
}
|
||||
|
||||
public ClientboundCustomPayloadPacket(FriendlyByteBuf p_178836_) {
|
||||
@@ -43,6 +_,7 @@
|
||||
} else {
|
||||
throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes");
|
||||
}
|
||||
+ this.shouldRelease = true; //We are the owner of the buffer, release it when we are done.
|
||||
}
|
||||
|
||||
public void m_5779_(FriendlyByteBuf p_132044_) {
|
||||
@@ -52,6 +_,7 @@
|
||||
|
||||
public void m_5797_(ClientGamePacketListener p_132041_) {
|
||||
p_132041_.m_7413_(this);
|
||||
+ this.f_132030_.release(); // FORGE: Fix impl buffer leaks (MC-121884)
|
||||
+ if (this.shouldRelease) this.f_132030_.release(); // FORGE: Fix impl buffer leaks (MC-121884), can only be fixed partially, because else you get problems in LAN-Worlds
|
||||
}
|
||||
|
||||
public ResourceLocation m_132042_() {
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
+ if (jsonobject.has("forgeData")) {
|
||||
+ serverstatus.setForgeData(net.minecraftforge.network.ServerStatusPing.Serializer.deserialize(GsonHelper.m_13930_(jsonobject, "forgeData"), p_134949_));
|
||||
+ serverstatus.setForgeData(net.minecraftforge.network.ServerStatusPing.Serializer.deserialize(GsonHelper.m_13930_(jsonobject, "forgeData")));
|
||||
+ }
|
||||
+
|
||||
return serverstatus;
|
||||
@@ -104,7 +104,7 @@
|
||||
+ }
|
||||
+
|
||||
+ if(p_134951_.getForgeData() != null){
|
||||
+ jsonobject.add("forgeData", net.minecraftforge.network.ServerStatusPing.Serializer.serialize(p_134951_.getForgeData(), p_134953_));
|
||||
+ jsonobject.add("forgeData", net.minecraftforge.network.ServerStatusPing.Serializer.serialize(p_134951_.getForgeData()));
|
||||
}
|
||||
|
||||
return jsonobject;
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/Eula.java
|
||||
+++ b/net/minecraft/server/Eula.java
|
||||
@@ -16,7 +_,7 @@
|
||||
|
||||
public Eula(Path p_135943_) {
|
||||
this.f_135939_ = p_135943_;
|
||||
- this.f_135940_ = SharedConstants.f_136183_ || this.m_135945_();
|
||||
+ this.f_135940_ = SharedConstants.f_136183_ || net.minecraftforge.gametest.ForgeGameTestHooks.isGametestServer() || this.m_135945_(); // Forge: Automatically agree to EULA for gametest servers to aid CI
|
||||
}
|
||||
|
||||
private boolean m_135945_() {
|
||||
@@ -1,11 +1,18 @@
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -76,6 +_,8 @@
|
||||
@@ -76,6 +_,15 @@
|
||||
OptionSpec<String> optionspec12 = optionparser.accepts("serverId").withRequiredArg();
|
||||
OptionSpec<Void> optionspec13 = optionparser.accepts("jfrProfile");
|
||||
OptionSpec<String> optionspec14 = optionparser.nonOptions();
|
||||
+ optionparser.accepts("allowUpdates").withRequiredArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE); // Forge: allow mod updates to proceed
|
||||
+ optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side.
|
||||
+ final OptionSpec<net.minecraft.core.BlockPos> spawnPosOpt;
|
||||
+ boolean gametestEnabled = Boolean.getBoolean("forge.gameTestServer");
|
||||
+ if (gametestEnabled) {
|
||||
+ spawnPosOpt = optionparser.accepts("spawnPos").withRequiredArg().withValuesConvertedBy(new net.minecraftforge.gametest.BlockPosValueConverter()).defaultsTo(new net.minecraft.core.BlockPos(0, 60, 0));
|
||||
+ } else {
|
||||
+ spawnPosOpt = null;
|
||||
+ }
|
||||
|
||||
try {
|
||||
OptionSet optionset = optionparser.parse(p_129699_);
|
||||
@@ -23,12 +30,13 @@
|
||||
|
||||
CrashReport.m_127529_();
|
||||
if (optionset.has(optionspec13)) {
|
||||
@@ -92,28 +_,26 @@
|
||||
@@ -92,30 +_,30 @@
|
||||
Bootstrap.m_135870_();
|
||||
Bootstrap.m_135889_();
|
||||
Util.m_137584_();
|
||||
- RegistryAccess.RegistryHolder registryaccess$registryholder = RegistryAccess.m_123086_();
|
||||
+ if (!optionset.has(optionspec1)) net.minecraftforge.server.loading.ServerModLoader.load(); // Load mods before we load almost anything else anymore. Single spot now. Only loads if they haven't passed the initserver param
|
||||
RegistryAccess.RegistryHolder registryaccess$registryholder = RegistryAccess.m_123086_();
|
||||
+ RegistryAccess.RegistryHolder registryaccess$registryholder; // RegistryAccess.builtin(); // Delay initialization until after we read additional save data
|
||||
Path path = Paths.get("server.properties");
|
||||
DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path);
|
||||
dedicatedserversettings.m_139780_();
|
||||
@@ -56,7 +64,11 @@
|
||||
+ }
|
||||
LevelStorageSource levelstoragesource = LevelStorageSource.m_78242_(file1.toPath());
|
||||
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = levelstoragesource.m_78260_(s);
|
||||
+ levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData();
|
||||
+ registryaccess$registryholder = RegistryAccess.m_123086_();
|
||||
LevelSummary levelsummary = levelstoragesource$levelstorageaccess.m_78308_();
|
||||
if (levelsummary != null) {
|
||||
if (levelsummary.m_193020_()) {
|
||||
@@ -164,6 +_,8 @@
|
||||
worldgensettings = optionset.has(optionspec3) ? dedicatedserverproperties.m_180927_(registryaccess$registryholder).m_64671_() : dedicatedserverproperties.m_180927_(registryaccess$registryholder);
|
||||
}
|
||||
@@ -66,9 +78,39 @@
|
||||
worlddata = new PrimaryLevelData(levelsettings, worldgensettings, Lifecycle.stable());
|
||||
}
|
||||
|
||||
@@ -191,6 +_,7 @@
|
||||
@@ -175,22 +_,33 @@
|
||||
|
||||
levelstoragesource$levelstorageaccess.m_78287_(registryaccess$registryholder, worlddata);
|
||||
WorldData worlddata1 = worlddata;
|
||||
- final DedicatedServer dedicatedserver = MinecraftServer.m_129872_((p_129697_) -> {
|
||||
- DedicatedServer dedicatedserver1 = new DedicatedServer(p_129697_, registryaccess$registryholder, levelstoragesource$levelstorageaccess, packrepository, serverresources, worlddata1, dedicatedserversettings, DataFixers.m_14512_(), minecraftsessionservice, gameprofilerepository, gameprofilecache, LoggerChunkProgressListener::new);
|
||||
+ final MinecraftServer dedicatedserver = MinecraftServer.m_129872_((p_129697_) -> {
|
||||
+ MinecraftServer dedicatedserver1;
|
||||
+ if (gametestEnabled) {
|
||||
+ net.minecraftforge.gametest.ForgeGameTestHooks.registerGametests();
|
||||
+ java.util.Collection<net.minecraft.gametest.framework.GameTestBatch> testBatches = net.minecraft.gametest.framework.GameTestRunner.m_127724_(net.minecraft.gametest.framework.GameTestRegistry.m_127658_());
|
||||
+ net.minecraft.core.BlockPos spawnPos = optionset.valueOf(spawnPosOpt);
|
||||
+ dedicatedserver1 = new net.minecraft.gametest.framework.GameTestServer(p_129697_, levelstoragesource$levelstorageaccess, packrepository, serverresources, testBatches, spawnPos, registryaccess$registryholder);
|
||||
+ } else {
|
||||
+ dedicatedserver1 = new DedicatedServer(p_129697_, registryaccess$registryholder, levelstoragesource$levelstorageaccess, packrepository, serverresources, worlddata1, dedicatedserversettings, DataFixers.m_14512_(), minecraftsessionservice, gameprofilerepository, gameprofilecache, LoggerChunkProgressListener::new);
|
||||
+ }
|
||||
dedicatedserver1.m_129981_(optionset.valueOf(optionspec8));
|
||||
dedicatedserver1.m_129801_(optionset.valueOf(optionspec11));
|
||||
dedicatedserver1.m_129975_(optionset.has(optionspec2));
|
||||
dedicatedserver1.m_129948_(optionset.valueOf(optionspec12));
|
||||
boolean flag1 = !optionset.has(optionspec) && !optionset.valuesOf(optionspec14).contains("nogui");
|
||||
- if (flag1 && !GraphicsEnvironment.isHeadless()) {
|
||||
- dedicatedserver1.m_139667_();
|
||||
+ if (dedicatedserver1 instanceof DedicatedServer dedicatedServer && flag1 && !GraphicsEnvironment.isHeadless()) {
|
||||
+ dedicatedServer.m_139667_();
|
||||
}
|
||||
|
||||
return dedicatedserver1;
|
||||
});
|
||||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
+ // FORGE: Halting as GameTestServer will cause issues as it always calls System#exit on both crash and normal exit, so skip it
|
||||
+ if (!(dedicatedserver instanceof net.minecraft.gametest.framework.GameTestServer))
|
||||
dedicatedserver.m_7570_(true);
|
||||
+ LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end.
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
try {
|
||||
serverlevel.m_8793_(p_129954_);
|
||||
@@ -854,9 +_,11 @@
|
||||
@@ -854,16 +_,18 @@
|
||||
serverlevel.m_6026_(crashreport);
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
@@ -146,6 +146,14 @@
|
||||
}
|
||||
|
||||
this.f_129754_.m_6182_("connection");
|
||||
this.m_129919_().m_9721_();
|
||||
this.f_129754_.m_6182_("players");
|
||||
this.f_129763_.m_11288_();
|
||||
- if (SharedConstants.f_136183_) {
|
||||
+ if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) {
|
||||
GameTestTicker.f_177648_.m_127790_();
|
||||
}
|
||||
|
||||
@@ -931,7 +_,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/ServerAdvancementManager.java
|
||||
+++ b/net/minecraft/server/ServerAdvancementManager.java
|
||||
@@ -39,6 +_,10 @@
|
||||
@@ -38,6 +_,10 @@
|
||||
try {
|
||||
JsonObject jsonobject = GsonHelper.m_13918_(p_136040_, "advancement");
|
||||
Advancement.Builder advancement$builder = Advancement.Builder.m_138380_(jsonobject, new DeserializationContext(p_136039_, this.f_136024_));
|
||||
@@ -9,5 +9,5 @@
|
||||
+ return;
|
||||
+ }
|
||||
map.put(p_136039_, advancement$builder);
|
||||
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
|
||||
f_136021_.error("Parsing error loading custom advancement {}: {}", p_136039_, jsonparseexception.getMessage());
|
||||
} catch (Exception exception) {
|
||||
f_136021_.error("Parsing error loading custom advancement {}: {}", p_136039_, exception.getMessage());
|
||||
@@ -5,7 +5,7 @@
|
||||
ThreadInfo[] athreadinfo = threadmxbean.dumpAllThreads(true, true);
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
- Error error = new Error("Watchdog");
|
||||
+ Error error = new Error(String.format("ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error
|
||||
+ Error error = new Error(String.format(java.util.Locale.ENGLISH, "ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error
|
||||
|
||||
for(ThreadInfo threadinfo : athreadinfo) {
|
||||
if (threadinfo.getThreadId() == this.f_139782_.m_6304_().getId()) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -473,6 +_,7 @@
|
||||
@@ -440,6 +_,7 @@
|
||||
if (this.f_140131_.remove(p_140182_, p_140183_) && p_198809_ != null) {
|
||||
if (p_198809_ instanceof LevelChunk) {
|
||||
((LevelChunk)p_198809_).m_62913_(false);
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
|
||||
this.m_140258_(p_198809_);
|
||||
@@ -654,8 +_,14 @@
|
||||
@@ -621,8 +_,14 @@
|
||||
levelchunk.m_62952_();
|
||||
if (this.f_140132_.add(chunkpos.m_45588_())) {
|
||||
levelchunk.m_62913_(true);
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
return levelchunk;
|
||||
@@ -745,6 +_,7 @@
|
||||
@@ -712,6 +_,7 @@
|
||||
|
||||
this.f_140133_.m_46473_().m_6174_("chunkSave");
|
||||
CompoundTag compoundtag = ChunkSerializer.m_63454_(this.f_140133_, p_140259_);
|
||||
@@ -31,15 +31,15 @@
|
||||
this.m_63502_(chunkpos, compoundtag);
|
||||
this.m_140229_(chunkpos, chunkstatus.m_62494_());
|
||||
return true;
|
||||
@@ -800,6 +_,7 @@
|
||||
@@ -768,6 +_,7 @@
|
||||
|
||||
protected void m_183754_(ServerPlayer p_183755_, ChunkPos p_183756_, MutableObject<ClientboundLevelChunkWithLightPacket> p_183757_, boolean p_183758_, boolean p_183759_) {
|
||||
if (p_183755_.f_19853_ == this.f_140133_) {
|
||||
+ // tODO: net.minecraftforge.event.ForgeEventFactory.fireChunkWatch(p_140190_, p_140191_, p_140187_, p_140188_, this.level);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.fireChunkWatch(p_183758_, p_183759_, p_183755_, p_183756_, this.f_140133_);
|
||||
if (p_183759_ && !p_183758_) {
|
||||
ChunkHolder chunkholder = this.m_140327_(p_183756_.m_45588_());
|
||||
if (chunkholder != null) {
|
||||
@@ -1054,7 +_,7 @@
|
||||
@@ -1020,7 +_,7 @@
|
||||
}
|
||||
|
||||
protected void m_140199_(Entity p_140200_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -176,10 +_,11 @@
|
||||
@@ -179,10 +_,11 @@
|
||||
private final List<CustomSpawner> f_8558_;
|
||||
@Nullable
|
||||
private final EndDragonFight f_8559_;
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
public ServerLevel(MinecraftServer p_8571_, Executor p_8572_, LevelStorageSource.LevelStorageAccess p_8573_, ServerLevelData p_8574_, ResourceKey<Level> p_8575_, DimensionType p_8576_, ChunkProgressListener p_8577_, ChunkGenerator p_8578_, boolean p_8579_, long p_8580_, List<CustomSpawner> p_8581_, boolean p_8582_) {
|
||||
super(p_8574_, p_8575_, p_8576_, p_8571_::m_129905_, false, p_8579_, p_8580_);
|
||||
@@ -217,6 +_,7 @@
|
||||
@@ -220,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.f_143245_ = new SleepStatus();
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
public void m_8606_(int p_8607_, int p_8608_, boolean p_8609_, boolean p_8610_) {
|
||||
@@ -245,8 +_,8 @@
|
||||
@@ -248,8 +_,8 @@
|
||||
int i = this.m_46469_().m_46215_(GameRules.f_151486_);
|
||||
if (this.f_143245_.m_144002_(i) && this.f_143245_.m_144004_(i, this.f_8546_)) {
|
||||
if (this.m_46469_().m_46207_(GameRules.f_46140_)) {
|
||||
@@ -32,7 +32,7 @@
|
||||
}
|
||||
|
||||
this.m_8804_();
|
||||
@@ -275,7 +_,7 @@
|
||||
@@ -278,7 +_,7 @@
|
||||
this.m_8807_();
|
||||
this.f_8557_ = false;
|
||||
profilerfiller.m_7238_();
|
||||
@@ -41,7 +41,7 @@
|
||||
if (flag) {
|
||||
this.m_8886_();
|
||||
}
|
||||
@@ -307,7 +_,9 @@
|
||||
@@ -310,7 +_,9 @@
|
||||
}
|
||||
|
||||
profilerfiller.m_6180_("tick");
|
||||
@@ -52,7 +52,7 @@
|
||||
profilerfiller.m_7238_();
|
||||
}
|
||||
}
|
||||
@@ -396,6 +_,7 @@
|
||||
@@ -399,6 +_,7 @@
|
||||
BlockPos blockpos2 = this.m_5452_(Heightmap.Types.MOTION_BLOCKING, this.m_46496_(i, 0, j, 15));
|
||||
BlockPos blockpos3 = blockpos2.m_7495_();
|
||||
Biome biome = this.m_46857_(blockpos2);
|
||||
@@ -60,7 +60,7 @@
|
||||
if (biome.m_47477_(this, blockpos3)) {
|
||||
this.m_46597_(blockpos3, Blocks.f_50126_.m_49966_());
|
||||
}
|
||||
@@ -586,15 +_,19 @@
|
||||
@@ -589,15 +_,19 @@
|
||||
this.f_8548_.m_6846_().m_11270_(new ClientboundGameEventPacket(ClientboundGameEventPacket.f_132161_, this.f_46440_), this.m_46472_());
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -650,9 +_,10 @@
|
||||
@@ -653,9 +_,10 @@
|
||||
++p_8664_.f_19797_;
|
||||
ProfilerFiller profilerfiller = this.m_46473_();
|
||||
profilerfiller.m_6521_(() -> {
|
||||
@@ -96,7 +96,7 @@
|
||||
p_8664_.m_6083_();
|
||||
profilerfiller.m_7238_();
|
||||
|
||||
@@ -689,6 +_,7 @@
|
||||
@@ -692,6 +_,7 @@
|
||||
this.f_143244_.m_157554_();
|
||||
}
|
||||
|
||||
@@ -104,15 +104,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,7 +_,48 @@
|
||||
@@ -764,7 +_,55 @@
|
||||
this.m_8853_(p_8846_);
|
||||
}
|
||||
|
||||
+ /** @deprecated To be removed in 1.19. See {@link #removePlayerImmediately(ServerPlayer, Entity.RemovalReason)} as a possible replacement. */
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.1")
|
||||
+ public void removePlayer(ServerPlayer p_8850_, boolean keepData) {
|
||||
+ p_8850_.m_146870_();
|
||||
+ this.removeEntity(p_8850_, keepData);
|
||||
+ }
|
||||
+
|
||||
+ /** @deprecated To be removed in 1.19. See {@link Entity#setRemoved(Entity.RemovalReason)} as a possible replacement. */
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.1")
|
||||
+ public void removeEntityComplete(Entity p_8865_, boolean keepData) {
|
||||
+ if(p_8865_.isMultipartEntity()) {
|
||||
+ for(net.minecraftforge.entity.PartEntity<?> parts : p_8865_.getParts()) {
|
||||
@@ -131,15 +135,18 @@
|
||||
+ this.f_143246_.remove(((Mob)p_8865_).m_21573_());
|
||||
+ }
|
||||
+
|
||||
+ p_8865_.onRemovedFromWorld();
|
||||
+ p_8865_.m_146870_();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveWorldEvent(p_8865_, this));
|
||||
+ // onRemovedFromWorld and EntityLeaveWorldEvent are called by discard, so no need to do it ourselves here lest we double-call
|
||||
+ }
|
||||
+
|
||||
+ /** @deprecated To be removed in 1.19. See {@link Entity#setRemoved(Entity.RemovalReason)} as a possible replacement. */
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.1")
|
||||
+ public void removeEntity(Entity entity) {
|
||||
+ removeEntity(entity, false);
|
||||
+ }
|
||||
+
|
||||
+ /** @deprecated To be removed in 1.19. See {@link Entity#setRemoved(Entity.RemovalReason)} as a possible replacement. */
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.1")
|
||||
+ public void removeEntity(Entity p_8868_, boolean keepData) {
|
||||
+ if (this.f_8557_) {
|
||||
+ throw (IllegalStateException) net.minecraft.Util.m_137570_(new IllegalStateException("Removing entity while ticking!"));
|
||||
@@ -153,7 +160,7 @@
|
||||
Entity entity = this.m_142646_().m_142694_(p_8854_.m_142081_());
|
||||
if (entity != null) {
|
||||
f_8566_.warn("Force-added player with duplicate UUID {}", (Object)p_8854_.m_142081_().toString());
|
||||
@@ -769,7 +_,8 @@
|
||||
@@ -772,7 +_,8 @@
|
||||
this.m_143261_((ServerPlayer)entity, Entity.RemovalReason.DISCARDED);
|
||||
}
|
||||
|
||||
@@ -163,7 +170,7 @@
|
||||
}
|
||||
|
||||
private boolean m_8872_(Entity p_8873_) {
|
||||
@@ -777,7 +_,12 @@
|
||||
@@ -780,7 +_,12 @@
|
||||
f_8566_.warn("Tried to add entity {} but it was marked as removed already", (Object)EntityType.m_20613_(p_8873_.m_6095_()));
|
||||
return false;
|
||||
} else {
|
||||
@@ -177,7 +184,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -814,10 +_,20 @@
|
||||
@@ -817,10 +_,20 @@
|
||||
}
|
||||
|
||||
public void m_6263_(@Nullable Player p_8675_, double p_8676_, double p_8677_, double p_8678_, SoundEvent p_8679_, SoundSource p_8680_, float p_8681_, float p_8682_) {
|
||||
@@ -198,7 +205,15 @@
|
||||
this.f_8548_.m_6846_().m_11241_(p_8689_, p_8690_.m_20185_(), p_8690_.m_20186_(), p_8690_.m_20189_(), p_8693_ > 1.0F ? (double)(16.0F * p_8693_) : 16.0D, this.m_46472_(), new ClientboundSoundEntityPacket(p_8691_, p_8692_, p_8690_, p_8693_, p_8694_));
|
||||
}
|
||||
|
||||
@@ -862,6 +_,7 @@
|
||||
@@ -837,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_142346_(@Nullable Entity p_143268_, GameEvent p_143269_, BlockPos p_143270_) {
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onVanillaGameEvent(this, p_143268_, p_143269_, p_143270_))
|
||||
this.m_151513_(p_143268_, p_143269_, p_143270_, p_143269_.m_157827_());
|
||||
}
|
||||
|
||||
@@ -882,6 +_,7 @@
|
||||
|
||||
public Explosion m_7703_(@Nullable Entity p_8653_, @Nullable DamageSource p_8654_, @Nullable ExplosionDamageCalculator p_8655_, double p_8656_, double p_8657_, double p_8658_, float p_8659_, boolean p_8660_, Explosion.BlockInteraction p_8661_) {
|
||||
Explosion explosion = new Explosion(this, p_8653_, p_8654_, p_8655_, p_8656_, p_8657_, p_8658_, p_8659_, p_8660_, p_8661_);
|
||||
@@ -206,7 +221,7 @@
|
||||
explosion.m_46061_();
|
||||
explosion.m_46075_(false);
|
||||
if (p_8661_ == Explosion.BlockInteraction.NONE) {
|
||||
@@ -1389,6 +_,12 @@
|
||||
@@ -1409,6 +_,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -219,25 +234,38 @@
|
||||
public LevelEntityGetter<Entity> m_142646_() {
|
||||
return this.f_143244_.m_157567_();
|
||||
}
|
||||
@@ -1463,8 +_,8 @@
|
||||
ServerLevel.this.f_143246_.add((Mob)p_143371_);
|
||||
@@ -1490,10 +_,8 @@
|
||||
ServerLevel.this.f_143246_.add(mob);
|
||||
}
|
||||
|
||||
- if (p_143371_ instanceof EnderDragon) {
|
||||
- for(EnderDragonPart enderdragonpart : ((EnderDragon)p_143371_).m_31156_()) {
|
||||
- EnderDragon enderdragon = (EnderDragon)p_143371_;
|
||||
-
|
||||
- for(EnderDragonPart enderdragonpart : enderdragon.m_31156_()) {
|
||||
+ if (p_143371_.isMultipartEntity()) {
|
||||
+ for(net.minecraftforge.entity.PartEntity<?> enderdragonpart : p_143371_.getParts()) {
|
||||
ServerLevel.this.f_143247_.put(enderdragonpart.m_142049_(), enderdragonpart);
|
||||
}
|
||||
}
|
||||
@@ -1483,8 +_,8 @@
|
||||
ServerLevel.this.f_143246_.remove(p_143375_);
|
||||
@@ -1518,10 +_,8 @@
|
||||
ServerLevel.this.f_143246_.remove(mob);
|
||||
}
|
||||
|
||||
- if (p_143375_ instanceof EnderDragon) {
|
||||
- for(EnderDragonPart enderdragonpart : ((EnderDragon)p_143375_).m_31156_()) {
|
||||
- EnderDragon enderdragon = (EnderDragon)p_143375_;
|
||||
-
|
||||
- for(EnderDragonPart enderdragonpart : enderdragon.m_31156_()) {
|
||||
+ if (p_143375_.isMultipartEntity()) {
|
||||
+ for(net.minecraftforge.entity.PartEntity<?> enderdragonpart : p_143375_.getParts()) {
|
||||
ServerLevel.this.f_143247_.remove(enderdragonpart.m_142049_());
|
||||
}
|
||||
}
|
||||
@@ -1531,6 +_,8 @@
|
||||
gameeventlistenerregistrar.m_157854_(p_143375_.f_19853_);
|
||||
}
|
||||
|
||||
+ p_143375_.onRemovedFromWorld();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveWorldEvent(p_143375_, ServerLevel.this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
boolean flag = this.f_19853_.m_46469_().m_46207_(GameRules.f_46142_);
|
||||
if (flag) {
|
||||
Component component = this.m_21231_().m_19293_();
|
||||
@@ -685,13 +_,14 @@
|
||||
@@ -685,11 +_,12 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -21,19 +21,14 @@
|
||||
- if (resourcekey == Level.f_46430_ && p_9180_.m_46472_() == Level.f_46428_) {
|
||||
+ if (resourcekey == Level.f_46430_ && p_9180_.m_46472_() == Level.f_46428_ && teleporter.isVanilla()) { //Forge: Fix non-vanilla teleporters triggering end credits
|
||||
this.m_19877_();
|
||||
- this.m_183503_().m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
+ this.m_183503_().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom
|
||||
this.m_183503_().m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.f_8944_) {
|
||||
this.f_8944_ = true;
|
||||
this.f_8906_.m_141995_(new ClientboundGameEventPacket(ClientboundGameEventPacket.f_132157_, this.f_8928_ ? 0.0F : 1.0F));
|
||||
@@ -705,14 +_,15 @@
|
||||
this.f_8906_.m_141995_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_()));
|
||||
@@ -706,13 +_,14 @@
|
||||
PlayerList playerlist = this.f_8924_.m_6846_();
|
||||
playerlist.m_11289_(this);
|
||||
- serverlevel.m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
serverlevel.m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
- this.m_146912_();
|
||||
- PortalInfo portalinfo = this.m_7937_(p_9180_);
|
||||
+ serverlevel.removeEntity(this, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call.
|
||||
+ this.revive();
|
||||
+ PortalInfo portalinfo = teleporter.getPortalInfo(this, p_9180_, this::m_7937_);
|
||||
if (portalinfo != null) {
|
||||
@@ -52,7 +47,7 @@
|
||||
this.m_9209_(serverlevel);
|
||||
+ return this;//forge: this is part of the ITeleporter patch
|
||||
+ });//Forge: End vanilla logic
|
||||
+ if (e != this) throw new java.lang.IllegalArgumentException(String.format("Teleporter %s returned not the player entity but instead %s, expected PlayerEntity %s", teleporter, e, this));
|
||||
+ if (e != this) throw new java.lang.IllegalArgumentException(String.format(java.util.Locale.ENGLISH, "Teleporter %s returned not the player entity but instead %s, expected PlayerEntity %s", teleporter, e, this));
|
||||
this.f_8906_.m_141995_(new ClientboundPlayerAbilitiesPacket(this.m_150110_()));
|
||||
playerlist.m_11229_(this, p_9180_);
|
||||
playerlist.m_11292_(this);
|
||||
@@ -134,11 +129,12 @@
|
||||
}
|
||||
|
||||
protected void m_142540_(MobEffectInstance p_143393_, @Nullable Entity p_143394_) {
|
||||
@@ -1181,6 +_,7 @@
|
||||
@@ -1181,6 +_,8 @@
|
||||
}
|
||||
|
||||
public boolean m_143403_(GameType p_143404_) {
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onChangeGameMode(this, this.f_8941_.m_9290_(), p_143404_)) return false;
|
||||
+ p_143404_ = net.minecraftforge.common.ForgeHooks.onChangeGameType(this, this.f_8941_.m_9290_(), p_143404_);
|
||||
+ if (p_143404_ == null) return false;
|
||||
if (!this.f_8941_.m_143473_(p_143404_)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -182,9 +178,8 @@
|
||||
this.f_8906_.m_141995_(new ClientboundRespawnPacket(p_9000_.m_6042_(), p_9000_.m_46472_(), BiomeManager.m_47877_(p_9000_.m_7328_()), this.f_8941_.m_9290_(), this.f_8941_.m_9293_(), p_9000_.m_46659_(), p_9000_.m_8584_(), true));
|
||||
this.f_8906_.m_141995_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_()));
|
||||
this.f_8924_.m_6846_().m_11289_(this);
|
||||
- serverlevel.m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
serverlevel.m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
- this.m_146912_();
|
||||
+ serverlevel.removePlayer(this, true); //Forge: The player entity itself is moved, and not cloned. So we need to keep the data alive with no matching invalidate call later.
|
||||
+ this.revive();
|
||||
this.m_7678_(p_9001_, p_9002_, p_9003_, p_9004_, p_9005_);
|
||||
this.m_143425_(p_9000_);
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -379,9 +_,11 @@
|
||||
@@ -380,9 +_,11 @@
|
||||
}
|
||||
|
||||
entity.m_19890_(d3, d4, d5, f, f1);
|
||||
@@ -12,7 +12,7 @@
|
||||
this.f_9742_.m_129512_(new ClientboundMoveVehiclePacket(entity));
|
||||
return;
|
||||
}
|
||||
@@ -398,7 +_,7 @@
|
||||
@@ -399,7 +_,7 @@
|
||||
}
|
||||
|
||||
private boolean m_9793_(Entity p_9794_) {
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
public void m_7376_(ServerboundAcceptTeleportationPacket p_9835_) {
|
||||
@@ -966,7 +_,9 @@
|
||||
@@ -967,7 +_,9 @@
|
||||
this.f_9743_.m_9243_();
|
||||
int i = this.f_9743_.f_19853_.m_151558_();
|
||||
if (blockpos.m_123342_() < i) {
|
||||
@@ -32,7 +32,7 @@
|
||||
InteractionResult interactionresult = this.f_9743_.f_8941_.m_7179_(this.f_9743_, serverlevel, itemstack, interactionhand, blockhitresult);
|
||||
if (direction == Direction.UP && !interactionresult.m_19077_() && blockpos.m_123342_() >= i - 1 && m_9790_(this.f_9743_, itemstack)) {
|
||||
Component component = (new TranslatableComponent("build.tooHigh", i - 1)).m_130940_(ChatFormatting.RED);
|
||||
@@ -1080,7 +_,7 @@
|
||||
@@ -1081,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_7388_(ServerboundChatPacket p_9841_) {
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
for(int i = 0; i < s.length(); ++i) {
|
||||
if (!SharedConstants.m_136188_(s.charAt(i))) {
|
||||
@@ -1110,8 +_,10 @@
|
||||
@@ -1111,8 +_,10 @@
|
||||
String s1 = p_143629_.m_143722_();
|
||||
Component component = s1.isEmpty() ? null : new TranslatableComponent("chat.type.text", this.f_9743_.m_5446_(), s1);
|
||||
Component component1 = new TranslatableComponent("chat.type.text", this.f_9743_.m_5446_(), s);
|
||||
@@ -53,7 +53,7 @@
|
||||
}, ChatType.CHAT, this.f_9743_.m_142081_());
|
||||
}
|
||||
|
||||
@@ -1203,6 +_,7 @@
|
||||
@@ -1204,6 +_,7 @@
|
||||
private void m_143678_(InteractionHand p_143679_, ServerGamePacketListenerImpl.EntityInteraction p_143680_) {
|
||||
ItemStack itemstack = ServerGamePacketListenerImpl.this.f_9743_.m_21120_(p_143679_).m_41777_();
|
||||
InteractionResult interactionresult = p_143680_.m_143694_(ServerGamePacketListenerImpl.this.f_9743_, entity, p_143679_);
|
||||
@@ -61,7 +61,7 @@
|
||||
if (interactionresult.m_19077_()) {
|
||||
CriteriaTriggers.f_10565_.m_61494_(ServerGamePacketListenerImpl.this.f_9743_, itemstack, entity);
|
||||
if (interactionresult.m_19080_()) {
|
||||
@@ -1404,6 +_,8 @@
|
||||
@@ -1405,6 +_,8 @@
|
||||
}
|
||||
|
||||
public void m_7423_(ServerboundCustomPayloadPacket p_9860_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/packs/AbstractPackResources.java
|
||||
+++ b/net/minecraft/server/packs/AbstractPackResources.java
|
||||
@@ -120,4 +_,10 @@
|
||||
@@ -119,4 +_,10 @@
|
||||
public String m_8017_() {
|
||||
return this.f_10203_.getName();
|
||||
}
|
||||
@@ -8,6 +8,6 @@
|
||||
+ @Override
|
||||
+ public String toString()
|
||||
+ {
|
||||
+ return String.format("%s: %s", getClass().getName(), f_10203_.getPath());
|
||||
+ return String.format(java.util.Locale.ROOT, "%s: %s", getClass().getName(), f_10203_.getPath());
|
||||
+ }
|
||||
}
|
||||
@@ -63,7 +63,7 @@
|
||||
+ OptionalNamedTag<T> optionalNamedTag = (OptionalNamedTag<T>) namedTag;
|
||||
+ optionalNamedTag.defaulted = true;
|
||||
+ return optionalNamedTag.resolveDefaulted();
|
||||
+ }));
|
||||
+ }, (existingTag, newTag) -> SetTag.m_13222_(ImmutableSet.<T>builder().addAll(existingTag.m_6497_()).addAll(newTag.m_6497_()).build())));
|
||||
+ if (!missingOptionals.isEmpty()) {
|
||||
+ missingOptionals.putAll(currentTags);
|
||||
+ return TagCollection.m_13396_(missingOptionals);
|
||||
|
||||
@@ -16,3 +16,11 @@
|
||||
if (optional.isPresent()) {
|
||||
map.put(p_144481_, p_144482_.m_144411_(optional.get()));
|
||||
} else {
|
||||
@@ -102,6 +_,7 @@
|
||||
|
||||
private static <T> void m_144444_(RegistryAccess p_144445_, TagContainer.Builder p_144446_, ResourceKey<? extends Registry<? extends T>> p_144447_, TagCollection.NetworkPayload p_144448_) {
|
||||
Optional<? extends Registry<? extends T>> optional = p_144445_.m_6632_(p_144447_);
|
||||
+ optional = net.minecraftforge.common.ForgeTagHandler.getWrapperRegistry((ResourceKey<? extends Registry<T>>) p_144447_, (Optional<? extends Registry<T>>) optional);
|
||||
if (optional.isPresent()) {
|
||||
p_144446_.m_144486_(p_144447_, TagCollection.m_144408_(p_144448_, optional.get()));
|
||||
} else {
|
||||
@@ -17,12 +17,22 @@
|
||||
}
|
||||
|
||||
public void m_6742_(LivingEntity p_19467_, int p_19468_) {
|
||||
@@ -179,4 +_,29 @@
|
||||
@@ -179,4 +_,39 @@
|
||||
public boolean m_19486_() {
|
||||
return this.f_19447_ == MobEffectCategory.BENEFICIAL;
|
||||
}
|
||||
+
|
||||
+ // FORGE START
|
||||
+ private final net.minecraftforge.common.util.ReverseTagWrapper<MobEffect> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.SerializationTags.m_13199_().m_144452_(Registry.f_122900_));
|
||||
+
|
||||
+ public java.util.Set<net.minecraft.resources.ResourceLocation> getTags() {
|
||||
+ return reverseTags.getTagNames();
|
||||
+ }
|
||||
+
|
||||
+ public boolean is(net.minecraft.tags.Tag<MobEffect> tag) {
|
||||
+ return tag.m_8110_(this);
|
||||
+ }
|
||||
+
|
||||
+ private Object effectRenderer;
|
||||
+
|
||||
+ /*
|
||||
|
||||
@@ -123,6 +123,29 @@
|
||||
if (this.m_6673_(p_21016_)) {
|
||||
return false;
|
||||
} else if (this.f_19853_.f_46443_) {
|
||||
@@ -998,9 +_,11 @@
|
||||
boolean flag = false;
|
||||
float f1 = 0.0F;
|
||||
if (p_21017_ > 0.0F && this.m_21275_(p_21016_)) {
|
||||
- this.m_7909_(p_21017_);
|
||||
- f1 = p_21017_;
|
||||
- p_21017_ = 0.0F;
|
||||
+ net.minecraftforge.event.entity.living.ShieldBlockEvent ev = net.minecraftforge.common.ForgeHooks.onShieldBlock(this, p_21016_, p_21017_);
|
||||
+ if(!ev.isCanceled()) {
|
||||
+ if(ev.shieldTakesDamage()) this.m_7909_(p_21017_);
|
||||
+ f1 = ev.getBlockedDamage();
|
||||
+ p_21017_ -= ev.getBlockedDamage();
|
||||
if (!p_21016_.m_19360_()) {
|
||||
Entity entity = p_21016_.m_7640_();
|
||||
if (entity instanceof LivingEntity) {
|
||||
@@ -1010,6 +_,7 @@
|
||||
|
||||
flag = true;
|
||||
}
|
||||
+ }
|
||||
|
||||
this.f_20924_ = 1.5F;
|
||||
boolean flag1 = true;
|
||||
@@ -1044,11 +_,11 @@
|
||||
if (entity1 instanceof Player) {
|
||||
this.f_20889_ = 100;
|
||||
@@ -205,6 +228,16 @@
|
||||
}
|
||||
|
||||
protected void m_5907_() {
|
||||
@@ -1306,7 +_,8 @@
|
||||
|
||||
protected void m_21226_() {
|
||||
if (this.f_19853_ instanceof ServerLevel && (this.m_6124_() || this.f_20889_ > 0 && this.m_6149_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46135_))) {
|
||||
- ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), this.m_6552_(this.f_20888_));
|
||||
+ int reward = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.f_20888_, this.m_6552_(this.f_20888_));
|
||||
+ ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), reward);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1322,7 +_,8 @@
|
||||
ResourceLocation resourcelocation = this.m_5743_();
|
||||
LootTable loottable = this.f_19853_.m_142572_().m_129898_().m_79217_(resourcelocation);
|
||||
@@ -227,7 +260,7 @@
|
||||
p_147241_ *= 1.0D - this.m_21133_(Attributes.f_22278_);
|
||||
if (!(p_147241_ <= 0.0D)) {
|
||||
this.f_19812_ = true;
|
||||
@@ -1388,15 +_,7 @@
|
||||
@@ -1388,15 +_,9 @@
|
||||
} else {
|
||||
BlockPos blockpos = this.m_142538_();
|
||||
BlockState blockstate = this.m_146900_();
|
||||
@@ -240,7 +273,9 @@
|
||||
- } else {
|
||||
- return false;
|
||||
- }
|
||||
+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, f_19853_, blockpos, this);
|
||||
+ Optional<BlockPos> ladderPos = net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, f_19853_, blockpos, this);
|
||||
+ if (ladderPos.isPresent()) this.f_20957_ = ladderPos;
|
||||
+ return ladderPos.isPresent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
+++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
@@ -229,10 +_,10 @@
|
||||
@@ -225,10 +_,10 @@
|
||||
Vec3 vec3 = this.m_7475_();
|
||||
this.f_26505_ = this.f_26494_.m_20205_() > 0.75F ? this.f_26494_.m_20205_() / 2.0F : 0.75F - this.f_26494_.m_20205_() / 2.0F;
|
||||
Vec3i vec3i = this.f_26496_.m_77400_();
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
--- a/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -646,13 +_,16 @@
|
||||
}
|
||||
|
||||
protected void m_6668_(DamageSource p_28536_) {
|
||||
+ super.m_6668_(p_28536_);
|
||||
+ }
|
||||
+ protected void m_5907_() { // Forge: move extra drops to dropEquipment to allow them to be captured by LivingDropsEvent
|
||||
+ super.m_5907_();
|
||||
ItemStack itemstack = this.m_6844_(EquipmentSlot.MAINHAND);
|
||||
if (!itemstack.m_41619_()) {
|
||||
this.m_19983_(itemstack);
|
||||
this.m_8061_(EquipmentSlot.MAINHAND, ItemStack.f_41583_);
|
||||
}
|
||||
|
||||
- super.m_6668_(p_28536_);
|
||||
}
|
||||
|
||||
public static boolean m_28471_(Fox p_28472_, LivingEntity p_28473_) {
|
||||
@@ -802,6 +_,17 @@
|
||||
protected void m_8026_() {
|
||||
ServerLevel serverlevel = (ServerLevel)this.f_25114_;
|
||||
|
||||
@@ -18,12 +18,13 @@
|
||||
this.m_5851_(SoundSource.PLAYERS);
|
||||
this.m_146852_(GameEvent.f_157781_, p_28941_);
|
||||
if (!this.f_19853_.f_46443_) {
|
||||
@@ -145,7 +_,16 @@
|
||||
@@ -145,7 +_,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(@javax.annotation.Nullable Player player, @javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos, int fortune) {
|
||||
+ this.m_146852_(GameEvent.f_157781_, player);
|
||||
+ return shearInternal(player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS);
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
if (!this.f_19853_.f_46443_ && this.m_6220_()) {
|
||||
this.m_5851_(SoundSource.PLAYERS);
|
||||
this.m_146852_(GameEvent.f_157781_, p_29853_);
|
||||
@@ -357,5 +_,27 @@
|
||||
@@ -357,5 +_,28 @@
|
||||
|
||||
protected float m_6431_(Pose p_29850_, EntityDimensions p_29851_) {
|
||||
return 0.95F * p_29851_.f_20378_;
|
||||
@@ -33,6 +33,7 @@
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(@Nullable Player player, @javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos, int fortune) {
|
||||
+ world.m_6269_(null, this, SoundEvents.f_12344_, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, 1.0F, 1.0F);
|
||||
+ this.m_146852_(GameEvent.f_157781_, player);
|
||||
+ if (!world.f_46443_) {
|
||||
+ this.m_29878_(true);
|
||||
+ int i = 1 + this.f_19796_.nextInt(3);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
this.m_5851_(SoundSource.PLAYERS);
|
||||
this.m_146852_(GameEvent.f_157781_, p_29920_);
|
||||
if (!this.f_19853_.f_46443_) {
|
||||
@@ -193,5 +_,21 @@
|
||||
@@ -193,5 +_,22 @@
|
||||
|
||||
public Vec3 m_7939_() {
|
||||
return new Vec3(0.0D, (double)(0.75F * this.m_20192_()), (double)(this.m_20205_() * 0.4F));
|
||||
@@ -51,6 +51,7 @@
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(@Nullable Player player, @javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos, int fortune) {
|
||||
+ world.m_6269_(null, this, SoundEvents.f_12480_, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, 1.0F, 1.0F);
|
||||
+ this.m_146852_(GameEvent.f_157781_, player);
|
||||
+ if (!world.m_5776_()) {
|
||||
+ m_29936_(false);
|
||||
+ return java.util.Collections.singletonList(new ItemStack(Items.f_42047_));
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -150,7 +_,11 @@
|
||||
return adouble;
|
||||
}
|
||||
|
||||
+ @javax.annotation.Nullable private Player unlimitedLastHurtByPlayer = null;
|
||||
public void m_8107_() {
|
||||
+ // lastHurtByPlayer is cleared after 100 ticks, capture it indefinitely in unlimitedLastHurtByPlayer for LivingExperienceDropEvent
|
||||
+ if (this.f_20888_ != null) this.unlimitedLastHurtByPlayer = f_20888_;
|
||||
+ if (this.unlimitedLastHurtByPlayer != null && this.unlimitedLastHurtByPlayer.m_146910_()) this.unlimitedLastHurtByPlayer = null;
|
||||
this.m_146874_();
|
||||
if (this.f_19853_.f_46443_) {
|
||||
this.m_21153_(this.m_21223_());
|
||||
@@ -420,7 +_,7 @@
|
||||
BlockPos blockpos = new BlockPos(k1, l1, i2);
|
||||
BlockState blockstate = this.f_19853_.m_8055_(blockpos);
|
||||
@@ -9,6 +21,26 @@
|
||||
flag1 = this.f_19853_.m_7471_(blockpos, false) || flag1;
|
||||
} else {
|
||||
flag = true;
|
||||
@@ -514,7 +_,8 @@
|
||||
|
||||
if (this.f_19853_ instanceof ServerLevel) {
|
||||
if (this.f_31084_ > 150 && this.f_31084_ % 5 == 0 && flag) {
|
||||
- ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), Mth.m_14143_((float)i * 0.08F));
|
||||
+ int award = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.unlimitedLastHurtByPlayer, Mth.m_14143_((float)i * 0.08F));
|
||||
+ ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), award);
|
||||
}
|
||||
|
||||
if (this.f_31084_ == 1 && !this.m_20067_()) {
|
||||
@@ -527,7 +_,8 @@
|
||||
this.f_20883_ = this.m_146908_();
|
||||
if (this.f_31084_ == 200 && this.f_19853_ instanceof ServerLevel) {
|
||||
if (flag) {
|
||||
- ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), Mth.m_14143_((float)i * 0.2F));
|
||||
+ int award = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.unlimitedLastHurtByPlayer, Mth.m_14143_((float)i * 0.2F));
|
||||
+ ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), award);
|
||||
}
|
||||
|
||||
if (this.f_31073_ != null) {
|
||||
@@ -847,6 +_,16 @@
|
||||
|
||||
public boolean m_6072_() {
|
||||
|
||||
@@ -69,6 +69,15 @@
|
||||
if (this.m_6673_(p_32013_)) {
|
||||
return false;
|
||||
} else if (!this.m_32055_().m_41619_() && this.m_32055_().m_150930_(Items.f_42686_) && p_32013_.m_19372_()) {
|
||||
@@ -248,7 +_,7 @@
|
||||
this.f_31987_ = (int)((float)this.f_31987_ - p_32014_);
|
||||
this.m_146852_(GameEvent.f_157808_, p_32013_.m_7639_());
|
||||
if (this.f_31987_ <= 0) {
|
||||
- this.m_32055_().m_150924_(this);
|
||||
+ this.m_32055_().onDestroyed(this, p_32013_);
|
||||
this.m_146870_();
|
||||
}
|
||||
|
||||
@@ -260,6 +_,7 @@
|
||||
p_32050_.m_128376_("Health", (short)this.f_31987_);
|
||||
p_32050_.m_128376_("Age", (short)this.f_31985_);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/monster/Shulker.java
|
||||
+++ b/net/minecraft/world/entity/monster/Shulker.java
|
||||
@@ -356,6 +_,12 @@
|
||||
if (blockpos1.m_123342_() > this.f_19853_.m_141937_() && this.f_19853_.m_46859_(blockpos1) && this.f_19853_.m_6857_().m_61937_(blockpos1) && this.f_19853_.m_45756_(this, (new AABB(blockpos1)).m_82406_(1.0E-6D))) {
|
||||
Direction direction = this.m_149810_(blockpos1);
|
||||
if (direction != null) {
|
||||
+ net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity event = net.minecraftforge.event.ForgeEventFactory.onEnderTeleport(this, blockpos1.m_123341_(), blockpos1.m_123342_(), blockpos1.m_123343_());
|
||||
+ if (event.isCanceled()) direction = null;
|
||||
+ blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
+ }
|
||||
+
|
||||
+ if (direction != null) {
|
||||
this.m_19877_();
|
||||
this.m_149788_(direction);
|
||||
this.m_5496_(SoundEvents.f_12418_, 1.0F, 1.0F);
|
||||
@@ -5,7 +5,7 @@
|
||||
if (this.m_34329_()) {
|
||||
--this.f_34266_;
|
||||
- if (this.f_34266_ < 0) {
|
||||
+ if (this.f_34266_ < 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.f_20501_, (timer) -> this.f_34266_ = timer)) {
|
||||
+ if (this.f_34266_ < 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.f_20562_, (timer) -> this.f_34266_ = timer)) {
|
||||
this.m_7595_();
|
||||
}
|
||||
} else if (this.m_7593_()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/BeaconMenu.java
|
||||
+++ b/net/minecraft/world/inventory/BeaconMenu.java
|
||||
@@ -89,10 +_,8 @@
|
||||
@@ -90,10 +_,8 @@
|
||||
}
|
||||
|
||||
slot.m_40234_(itemstack1, itemstack);
|
||||
|
||||
@@ -29,6 +29,15 @@
|
||||
if (blockhitresult.m_6662_() == HitResult.Type.MISS) {
|
||||
return InteractionResultHolder.m_19098_(itemstack);
|
||||
} else if (blockhitresult.m_6662_() != HitResult.Type.BLOCK) {
|
||||
@@ -56,7 +_,7 @@
|
||||
ItemStack itemstack1 = bucketpickup.m_142598_(p_40703_, blockpos, blockstate1);
|
||||
if (!itemstack1.m_41619_()) {
|
||||
p_40704_.m_36246_(Stats.f_12982_.m_12902_(this));
|
||||
- bucketpickup.m_142298_().ifPresent((p_150709_) -> {
|
||||
+ bucketpickup.getPickupSound(blockstate1).ifPresent((p_150709_) -> {
|
||||
p_40704_.m_5496_(p_150709_, 1.0F, 1.0F);
|
||||
});
|
||||
p_40703_.m_142346_(p_40704_, GameEvent.f_157816_, blockpos);
|
||||
@@ -72,7 +_,7 @@
|
||||
return InteractionResultHolder.m_19100_(itemstack);
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ElytraItem.java
|
||||
+++ b/net/minecraft/world/item/ElytraItem.java
|
||||
@@ -43,6 +_,19 @@
|
||||
@@ -43,6 +_,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,14 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean elytraFlightTick(ItemStack stack, net.minecraft.world.entity.LivingEntity entity, int flightTicks) {
|
||||
+ if (!entity.f_19853_.f_46443_ && (flightTicks + 1) % 20 == 0) {
|
||||
+ stack.m_41622_(1, entity, e -> e.m_21166_(net.minecraft.world.entity.EquipmentSlot.CHEST));
|
||||
+ if (!entity.f_19853_.f_46443_) {
|
||||
+ int nextFlightTick = flightTicks + 1;
|
||||
+ if (nextFlightTick % 10 == 0) {
|
||||
+ if (nextFlightTick % 20 == 0) {
|
||||
+ stack.m_41622_(1, entity, e -> e.m_21166_(net.minecraft.world.entity.EquipmentSlot.CHEST));
|
||||
+ }
|
||||
+ entity.m_146850_(net.minecraft.world.level.gameevent.GameEvent.f_157807_);
|
||||
+ }
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
|
||||
@@ -1,25 +1,14 @@
|
||||
--- a/net/minecraft/world/item/HoeItem.java
|
||||
+++ b/net/minecraft/world/item/HoeItem.java
|
||||
@@ -33,6 +_,9 @@
|
||||
@@ -30,6 +_,8 @@
|
||||
}
|
||||
|
||||
public InteractionResult m_6225_(UseOnContext p_41341_) {
|
||||
+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_41341_);
|
||||
+ if (hook != 0) return hook > 0 ? InteractionResult.SUCCESS : InteractionResult.FAIL;
|
||||
Level level = p_41341_.m_43725_();
|
||||
BlockPos blockpos = p_41341_.m_8083_();
|
||||
Pair<Predicate<UseOnContext>, Consumer<UseOnContext>> pair = f_41332_.get(level.m_8055_(blockpos).m_60734_());
|
||||
+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_41341_);
|
||||
+ if (hook != 0) return hook > 0 ? InteractionResult.SUCCESS : InteractionResult.FAIL;
|
||||
+ if (p_41341_.m_43719_() != Direction.DOWN && level.m_46859_(blockpos.m_7494_())) {
|
||||
if (pair == null) {
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
@@ -55,6 +_,9 @@
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
public static Consumer<UseOnContext> m_150858_(BlockState p_150859_) {
|
||||
@@ -72,5 +_,10 @@
|
||||
|
||||
public static boolean m_150856_(UseOnContext p_150857_) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
protected static final UUID f_41374_ = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
protected static final UUID f_41375_ = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3");
|
||||
public static final int f_150884_ = 64;
|
||||
@@ -95,7 +_,8 @@
|
||||
@@ -95,12 +_,15 @@
|
||||
f_150883_.error("Item classes should end with Item and {} doesn't.", (Object)s);
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,13 @@
|
||||
}
|
||||
|
||||
public void m_5929_(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) {
|
||||
}
|
||||
|
||||
+ /** @deprecated Forge: Use damage source sensitive version */
|
||||
+ @Deprecated
|
||||
public void m_142023_(ItemEntity p_150887_) {
|
||||
}
|
||||
|
||||
@@ -141,10 +_,12 @@
|
||||
return this.m_41472_() ? p_41411_.m_5584_(p_41410_, p_41409_) : p_41409_;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -71,7 +_,7 @@
|
||||
@@ -70,7 +_,7 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public static final Codec<ItemStack> f_41582_ = RecordCodecBuilder.create((p_41697_) -> {
|
||||
return p_41697_.group(Registry.f_122827_.m_194605_().fieldOf("id").forGetter((p_150946_) -> {
|
||||
return p_150946_.f_41589_;
|
||||
@@ -81,6 +_,9 @@
|
||||
@@ -80,6 +_,9 @@
|
||||
return Optional.ofNullable(p_150939_.f_41590_);
|
||||
})).apply(p_41697_, ItemStack::new);
|
||||
});
|
||||
@@ -19,7 +19,7 @@
|
||||
private static final Logger f_41585_ = LogManager.getLogger();
|
||||
public static final ItemStack f_41583_ = new ItemStack((Item)null);
|
||||
public static final DecimalFormat f_41584_ = Util.m_137469_(new DecimalFormat("#.##"), (p_41704_) -> {
|
||||
@@ -127,10 +_,15 @@
|
||||
@@ -126,10 +_,15 @@
|
||||
p_41606_.ifPresent(this::m_41751_);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
this.m_41721_(this.m_41773_());
|
||||
}
|
||||
|
||||
@@ -143,14 +_,19 @@
|
||||
@@ -142,14 +_,19 @@
|
||||
}
|
||||
|
||||
private ItemStack(CompoundTag p_41608_) {
|
||||
@@ -60,7 +60,7 @@
|
||||
this.m_41721_(this.m_41773_());
|
||||
}
|
||||
|
||||
@@ -185,7 +_,7 @@
|
||||
@@ -184,7 +_,7 @@
|
||||
}
|
||||
|
||||
public Item m_41720_() {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
|
||||
public boolean m_150922_(Tag<Item> p_150923_) {
|
||||
@@ -197,6 +_,15 @@
|
||||
@@ -196,6 +_,15 @@
|
||||
}
|
||||
|
||||
public InteractionResult m_41661_(UseOnContext p_41662_) {
|
||||
@@ -85,7 +85,7 @@
|
||||
Player player = p_41662_.m_43723_();
|
||||
BlockPos blockpos = p_41662_.m_8083_();
|
||||
BlockInWorld blockinworld = new BlockInWorld(p_41662_.m_43725_(), blockpos, false);
|
||||
@@ -204,7 +_,7 @@
|
||||
@@ -203,7 +_,7 @@
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
Item item = this.m_41720_();
|
||||
@@ -94,7 +94,7 @@
|
||||
if (player != null && interactionresult.m_146666_()) {
|
||||
player.m_36246_(Stats.f_12982_.m_12902_(item));
|
||||
}
|
||||
@@ -233,11 +_,15 @@
|
||||
@@ -232,11 +_,15 @@
|
||||
p_41740_.m_128365_("tag", this.f_41590_.m_6426_());
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
}
|
||||
|
||||
public boolean m_41753_() {
|
||||
@@ -245,7 +_,7 @@
|
||||
@@ -244,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean m_41763_() {
|
||||
@@ -120,7 +120,7 @@
|
||||
CompoundTag compoundtag = this.m_41783_();
|
||||
return compoundtag == null || !compoundtag.m_128471_("Unbreakable");
|
||||
} else {
|
||||
@@ -254,19 +_,19 @@
|
||||
@@ -253,19 +_,19 @@
|
||||
}
|
||||
|
||||
public boolean m_41768_() {
|
||||
@@ -144,7 +144,7 @@
|
||||
}
|
||||
|
||||
public boolean m_41629_(int p_41630_, Random p_41631_, @Nullable ServerPlayer p_41632_) {
|
||||
@@ -302,6 +_,7 @@
|
||||
@@ -301,6 +_,7 @@
|
||||
public <T extends LivingEntity> void m_41622_(int p_41623_, T p_41624_, Consumer<T> p_41625_) {
|
||||
if (!p_41624_.f_19853_.f_46443_ && (!(p_41624_ instanceof Player) || !((Player)p_41624_).m_150110_().f_35937_)) {
|
||||
if (this.m_41763_()) {
|
||||
@@ -152,7 +152,7 @@
|
||||
if (this.m_41629_(p_41623_, p_41624_.m_21187_(), p_41624_ instanceof ServerPlayer ? (ServerPlayer)p_41624_ : null)) {
|
||||
p_41625_.accept(p_41624_);
|
||||
Item item = this.m_41720_();
|
||||
@@ -354,7 +_,7 @@
|
||||
@@ -353,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean m_41735_(BlockState p_41736_) {
|
||||
@@ -161,7 +161,7 @@
|
||||
}
|
||||
|
||||
public InteractionResult m_41647_(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) {
|
||||
@@ -365,7 +_,7 @@
|
||||
@@ -364,7 +_,7 @@
|
||||
if (this.m_41619_()) {
|
||||
return f_41583_;
|
||||
} else {
|
||||
@@ -170,7 +170,7 @@
|
||||
itemstack.m_41754_(this.m_41612_());
|
||||
if (this.f_41590_ != null) {
|
||||
itemstack.f_41590_ = this.f_41590_.m_6426_();
|
||||
@@ -382,7 +_,7 @@
|
||||
@@ -381,7 +_,7 @@
|
||||
if (p_41659_.f_41590_ == null && p_41660_.f_41590_ != null) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -179,7 +179,7 @@
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
@@ -405,7 +_,7 @@
|
||||
@@ -404,7 +_,7 @@
|
||||
} else if (this.f_41590_ == null && p_41745_.f_41590_ != null) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -188,7 +188,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +_,7 @@
|
||||
@@ -528,7 +_,7 @@
|
||||
|
||||
public void m_41751_(@Nullable CompoundTag p_41752_) {
|
||||
this.f_41590_ = p_41752_;
|
||||
@@ -197,7 +197,7 @@
|
||||
this.m_41721_(this.m_41773_());
|
||||
}
|
||||
|
||||
@@ -729,6 +_,7 @@
|
||||
@@ -728,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +205,16 @@
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -866,9 +_,10 @@
|
||||
@@ -736,7 +_,7 @@
|
||||
}
|
||||
|
||||
private int m_41618_() {
|
||||
- return this.m_41782_() && this.f_41590_.m_128425_("HideFlags", 99) ? this.f_41590_.m_128451_("HideFlags") : 0;
|
||||
+ return this.m_41782_() && this.f_41590_.m_128425_("HideFlags", 99) ? this.f_41590_.m_128451_("HideFlags") : this.m_41720_().getDefaultTooltipHideFlags(this);
|
||||
}
|
||||
|
||||
public void m_41654_(ItemStack.TooltipPart p_41655_) {
|
||||
@@ -865,9 +_,10 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -217,7 +226,15 @@
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@@ -955,6 +_,23 @@
|
||||
@@ -948,12 +_,31 @@
|
||||
this.m_41720_().m_5929_(p_41732_, p_41733_, this, p_41734_);
|
||||
}
|
||||
|
||||
+ /** @deprecated Forge: Use damage source sensitive version */
|
||||
+ @Deprecated
|
||||
public void m_150924_(ItemEntity p_150925_) {
|
||||
this.m_41720_().m_142023_(p_150925_);
|
||||
}
|
||||
|
||||
public boolean m_41614_() {
|
||||
return this.m_41720_().m_41472_();
|
||||
|
||||
@@ -1,40 +1,61 @@
|
||||
--- a/net/minecraft/world/item/MobBucketItem.java
|
||||
+++ b/net/minecraft/world/item/MobBucketItem.java
|
||||
@@ -25,11 +_,24 @@
|
||||
@@ -23,13 +_,18 @@
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
|
||||
public class MobBucketItem extends BucketItem {
|
||||
private final EntityType<?> f_151134_;
|
||||
private final SoundEvent f_151135_;
|
||||
+ private final java.util.function.Supplier<? extends EntityType<?>> fishTypeSupplier;
|
||||
- private final EntityType<?> f_151134_;
|
||||
- private final SoundEvent f_151135_;
|
||||
+ private final java.util.function.Supplier<? extends EntityType<?>> entityTypeSupplier;
|
||||
+ private final java.util.function.Supplier<? extends SoundEvent> emptySoundSupplier;
|
||||
|
||||
+ @Deprecated
|
||||
public MobBucketItem(EntityType<?> p_151137_, Fluid p_151138_, SoundEvent p_151139_, Item.Properties p_151140_) {
|
||||
super(p_151138_, p_151140_);
|
||||
this.f_151134_ = p_151137_;
|
||||
this.f_151135_ = p_151139_;
|
||||
+ this.emptySoundSupplier = null;
|
||||
+ this.fishTypeSupplier = () -> p_151137_;
|
||||
- super(p_151138_, p_151140_);
|
||||
- this.f_151134_ = p_151137_;
|
||||
- this.f_151135_ = p_151139_;
|
||||
+ this(() -> p_151137_, () -> p_151138_, () -> p_151139_, p_151140_);
|
||||
+ }
|
||||
+
|
||||
+ public MobBucketItem(java.util.function.Supplier<? extends EntityType<?>> entitySupplier, java.util.function.Supplier<? extends Fluid> fluidSupplier, java.util.function.Supplier<? extends SoundEvent> soundSupplier, Item.Properties properties) {
|
||||
+ super(fluidSupplier, properties);
|
||||
+ this.f_151134_ = null;
|
||||
+ this.f_151135_ = null;
|
||||
+ this.emptySoundSupplier = soundSupplier;
|
||||
+ this.fishTypeSupplier = entitySupplier;
|
||||
+ this.entityTypeSupplier = entitySupplier;
|
||||
}
|
||||
|
||||
public void m_142131_(@Nullable Player p_151146_, Level p_151147_, ItemStack p_151148_, BlockPos p_151149_) {
|
||||
@@ -80,6 +_,14 @@
|
||||
p_151157_.add(mutablecomponent);
|
||||
@@ -41,11 +_,11 @@
|
||||
}
|
||||
|
||||
protected void m_7718_(@Nullable Player p_151151_, LevelAccessor p_151152_, BlockPos p_151153_) {
|
||||
- p_151152_.m_5594_(p_151151_, p_151153_, this.f_151135_, SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
+ p_151152_.m_5594_(p_151151_, p_151153_, getEmptySound(), SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private void m_151141_(ServerLevel p_151142_, ItemStack p_151143_, BlockPos p_151144_) {
|
||||
- Entity entity = this.f_151134_.m_20592_(p_151142_, p_151143_, (Player)null, p_151144_, MobSpawnType.BUCKET, true, false);
|
||||
+ Entity entity = getFishType().m_20592_(p_151142_, p_151143_, (Player)null, p_151144_, MobSpawnType.BUCKET, true, false);
|
||||
if (entity instanceof Bucketable) {
|
||||
Bucketable bucketable = (Bucketable)entity;
|
||||
bucketable.m_142278_(p_151143_.m_41784_());
|
||||
@@ -55,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_7373_(ItemStack p_151155_, @Nullable Level p_151156_, List<Component> p_151157_, TooltipFlag p_151158_) {
|
||||
- if (this.f_151134_ == EntityType.f_20489_) {
|
||||
+ if (getFishType() == EntityType.f_20489_) {
|
||||
CompoundTag compoundtag = p_151155_.m_41783_();
|
||||
if (compoundtag != null && compoundtag.m_128425_("BucketVariantTag", 3)) {
|
||||
int i = compoundtag.m_128451_("BucketVariantTag");
|
||||
@@ -81,5 +_,14 @@
|
||||
}
|
||||
}
|
||||
-
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Forge Start
|
||||
+ protected EntityType<?> getFishType() {
|
||||
+ return fishTypeSupplier.get();
|
||||
+ return entityTypeSupplier.get();
|
||||
+ }
|
||||
+
|
||||
+ protected SoundEvent getEmptySound() {
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
public class Ingredient implements Predicate<ItemStack> {
|
||||
+ //Because Mojang caches things... we need to invalidate them.. so... here we go..
|
||||
+ private static final java.util.Set<Ingredient> INSTANCES = java.util.Collections.newSetFromMap(new java.util.WeakHashMap<Ingredient, Boolean>());
|
||||
+ private static final java.util.concurrent.atomic.AtomicInteger INVALIDATION_COUNTER = new java.util.concurrent.atomic.AtomicInteger();
|
||||
+ public static void invalidateAll() {
|
||||
+ INSTANCES.stream().filter(e -> e != null).forEach(i -> i.invalidate());
|
||||
+ INVALIDATION_COUNTER.incrementAndGet();
|
||||
+ }
|
||||
+
|
||||
public static final Ingredient f_43901_ = new Ingredient(Stream.empty());
|
||||
@@ -16,6 +16,7 @@
|
||||
private ItemStack[] f_43903_;
|
||||
@Nullable
|
||||
private IntList f_43904_;
|
||||
+ private int invalidationCounter;
|
||||
+ private final boolean isSimple;
|
||||
|
||||
protected Ingredient(Stream<? extends Ingredient.Value> p_43907_) {
|
||||
@@ -23,10 +24,19 @@
|
||||
return new Ingredient.Value[p_43933_];
|
||||
});
|
||||
+ this.isSimple = !net.minecraftforge.data.loading.DatagenModLoader.isRunningDataGen() && !Arrays.stream(f_43902_).anyMatch(list -> list.m_6223_().stream().anyMatch(stack -> stack.m_41720_().isDamageable(stack)));
|
||||
+ Ingredient.INSTANCES.add(this);
|
||||
}
|
||||
|
||||
public ItemStack[] m_43908_() {
|
||||
@@ -78,7 +_,8 @@
|
||||
}
|
||||
|
||||
public IntList m_43931_() {
|
||||
- if (this.f_43904_ == null) {
|
||||
+ if (this.f_43904_ == null || checkInvalidation()) {
|
||||
+ this.markValid();
|
||||
this.m_43948_();
|
||||
this.f_43904_ = new IntArrayList(this.f_43903_.length);
|
||||
|
||||
@@ -94,6 +_,10 @@
|
||||
|
||||
public final void m_43923_(FriendlyByteBuf p_43924_) {
|
||||
@@ -38,10 +48,23 @@
|
||||
p_43924_.m_178352_(Arrays.asList(this.f_43903_), FriendlyByteBuf::m_130055_);
|
||||
}
|
||||
|
||||
@@ -115,6 +_,25 @@
|
||||
@@ -115,6 +_,38 @@
|
||||
return this.f_43902_.length == 0 && (this.f_43903_ == null || this.f_43903_.length == 0) && (this.f_43904_ == null || this.f_43904_.isEmpty());
|
||||
}
|
||||
|
||||
+ public final boolean checkInvalidation() {
|
||||
+ int currentInvalidationCounter = INVALIDATION_COUNTER.get();
|
||||
+ if (this.invalidationCounter != currentInvalidationCounter) {
|
||||
+ invalidate();
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ protected final void markValid() {
|
||||
+ this.invalidationCounter = INVALIDATION_COUNTER.get();
|
||||
+ }
|
||||
+
|
||||
+ protected void invalidate() {
|
||||
+ this.f_43903_ = null;
|
||||
+ this.f_43904_ = null;
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
- return new ItemStack(item, i);
|
||||
- }
|
||||
- }
|
||||
+ return net.minecraftforge.common.crafting.CraftingHelper.getItemStack(p_151275_, true, false); // TODO: Swap false to true in 1.18 to mimic vanilla behavior
|
||||
+ return net.minecraftforge.common.crafting.CraftingHelper.getItemStack(p_151275_, true, true);
|
||||
}
|
||||
|
||||
public static Item m_151278_(JsonObject p_151279_) {
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
--- a/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -125,11 +_,12 @@
|
||||
@@ -125,11 +_,15 @@
|
||||
entity.m_7678_(entity.m_20185_(), entity.m_20186_(), entity.m_20189_(), p_151312_.f_46441_.nextFloat() * 360.0F, 0.0F);
|
||||
if (entity instanceof Mob) {
|
||||
Mob mob = (Mob)entity;
|
||||
- if (this.f_45444_.m_186574_().isEmpty() && !mob.m_5545_(p_151312_, MobSpawnType.SPAWNER) || !mob.m_6914_(p_151312_)) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(mob, p_151312_, (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), this)) {
|
||||
+ net.minecraftforge.eventbus.api.Event.Result res = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(mob, p_151312_, (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), this, MobSpawnType.SPAWNER);
|
||||
+ if (res == net.minecraftforge.eventbus.api.Event.Result.DENY) continue;
|
||||
+ if (res == net.minecraftforge.eventbus.api.Event.Result.DEFAULT)
|
||||
if (this.f_45444_.m_186574_().isEmpty() && !mob.m_5545_(p_151312_, MobSpawnType.SPAWNER) || !mob.m_6914_(p_151312_)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.f_45444_.m_186567_().m_128440_() == 1 && this.f_45444_.m_186567_().m_128425_("id", 8)) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, p_151312_, (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), this, MobSpawnType.SPAWNER))
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, (LevelAccessor)p_151312_, (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), this, MobSpawnType.SPAWNER))
|
||||
((Mob)entity).m_6518_(p_151312_, p_151312_.m_6436_(entity.m_142538_()), MobSpawnType.SPAWNER, (SpawnGroupData)null, (CompoundTag)null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -263,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static WeightedRandomList<MobSpawnSettings.SpawnerData> m_151591_(ServerLevel p_151592_, StructureFeatureManager p_151593_, ChunkGenerator p_151594_, MobCategory p_151595_, BlockPos p_151596_, @Nullable Biome p_151597_) {
|
||||
- return m_186529_(p_151596_, p_151592_, p_151595_, p_151593_) ? NetherFortressFeature.f_66381_ : p_151594_.m_142184_(p_151597_ != null ? p_151597_ : p_151592_.m_46857_(p_151596_), p_151593_, p_151595_, p_151596_);
|
||||
+ return m_186529_(p_151596_, p_151592_, p_151595_, p_151593_) ? StructureFeature.f_67025_.getSpawnList(MobCategory.MONSTER) : p_151594_.m_142184_(p_151597_ != null ? p_151597_ : p_151592_.m_46857_(p_151596_), p_151593_, p_151595_, p_151596_);
|
||||
}
|
||||
|
||||
public static boolean m_186529_(BlockPos p_186530_, ServerLevel p_186531_, MobCategory p_186532_, StructureFeatureManager p_186533_) {
|
||||
@@ -297,6 +_,13 @@
|
||||
if (p_47052_ == SpawnPlacements.Type.NO_RESTRICTIONS) {
|
||||
return true;
|
||||
|
||||
@@ -146,11 +146,11 @@
|
||||
+ } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) {
|
||||
+ return state.m_60783_(world, pos, Direction.UP);
|
||||
+ } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) {
|
||||
+ return this == Blocks.f_50440_ || net.minecraftforge.common.Tags.Blocks.DIRT.m_8110_(this) || this == Blocks.f_50093_;
|
||||
+ return this == Blocks.f_50440_ || BlockTags.f_144274_.m_8110_(this) || this == Blocks.f_50093_;
|
||||
+ } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) {
|
||||
+ return state.m_60767_() == net.minecraft.world.level.material.Material.f_76305_; //&& state.getValue(BlockLiquidWrapper)
|
||||
+ } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) {
|
||||
+ boolean isBeach = state.m_60713_(Blocks.f_50440_) || net.minecraftforge.common.Tags.Blocks.DIRT.m_8110_(this) || state.m_60713_(Blocks.f_49992_) || state.m_60713_(Blocks.f_49993_);
|
||||
+ boolean isBeach = state.m_60713_(Blocks.f_50440_) || BlockTags.f_144274_.m_8110_(this) || state.m_60713_(Blocks.f_49992_) || state.m_60713_(Blocks.f_49993_);
|
||||
+ boolean hasWater = false;
|
||||
+ for (Direction face : Direction.Plane.HORIZONTAL) {
|
||||
+ BlockState blockState = world.m_8055_(pos.m_142300_(face));
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--- a/net/minecraft/world/level/block/BucketPickup.java
|
||||
+++ b/net/minecraft/world/level/block/BucketPickup.java
|
||||
@@ -7,8 +_,9 @@
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
-public interface BucketPickup {
|
||||
+public interface BucketPickup extends net.minecraftforge.common.extensions.IForgeBucketPickup {
|
||||
ItemStack m_142598_(LevelAccessor p_152719_, BlockPos p_152720_, BlockState p_152721_);
|
||||
|
||||
+ @Deprecated//Forge: Use state sensitive variant instead
|
||||
Optional<SoundEvent> m_142298_();
|
||||
}
|
||||
+5
-2
@@ -1,10 +1,13 @@
|
||||
--- a/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
||||
@@ -35,6 +_,7 @@
|
||||
@@ -35,8 +_,10 @@
|
||||
|
||||
public void m_7455_(BlockState p_56819_, ServerLevel p_56820_, BlockPos p_56821_, Random p_56822_) {
|
||||
if (!m_56823_(p_56819_, p_56820_, p_56821_)) {
|
||||
+ if (!p_56820_.isAreaLoaded(p_56821_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
|
||||
+ if (!p_56820_.isAreaLoaded(p_56821_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
|
||||
p_56820_.m_46597_(p_56821_, Blocks.f_50493_.m_49966_());
|
||||
} else {
|
||||
+ if (!p_56820_.isAreaLoaded(p_56821_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
|
||||
if (p_56820_.m_46803_(p_56821_.m_7494_()) >= 9) {
|
||||
BlockState blockstate = this.m_49966_();
|
||||
|
||||
@@ -24,17 +24,12 @@
|
||||
}
|
||||
|
||||
public static BlockPos m_187472_(CompoundTag p_187473_) {
|
||||
@@ -48,6 +_,13 @@
|
||||
@@ -48,6 +_,8 @@
|
||||
}
|
||||
|
||||
public void m_142466_(CompoundTag p_155245_) {
|
||||
+ if (p_155245_.m_128441_("ForgeData")) this.customTileData = p_155245_.m_128469_("ForgeData");
|
||||
+ if (getCapabilities() != null && p_155245_.m_128441_("ForgeCaps")) deserializeCaps(p_155245_.m_128469_("ForgeCaps"));
|
||||
+ }
|
||||
+
|
||||
+ public CompoundTag save(CompoundTag tag) {
|
||||
+ m_187478_(tag);
|
||||
+ return tag;
|
||||
}
|
||||
|
||||
protected void m_183515_(CompoundTag p_187471_) {
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
static final Logger f_62771_ = LogManager.getLogger();
|
||||
private static final TickingBlockEntity f_156361_ = new TickingBlockEntity() {
|
||||
public void m_142224_() {
|
||||
@@ -123,6 +_,7 @@
|
||||
|
||||
this.m_8094_(p_196851_.m_6332_());
|
||||
this.f_187603_ = true;
|
||||
@@ -97,6 +_,7 @@
|
||||
this.f_62791_ = p_196861_;
|
||||
this.f_62784_ = p_196857_;
|
||||
this.f_187943_ = p_196858_;
|
||||
+ this.capProvider.initInternal();
|
||||
}
|
||||
|
||||
public TickContainerAccess<Block> m_183531_() {
|
||||
public LevelChunk(ServerLevel p_196850_, ProtoChunk p_196851_, @Nullable LevelChunk.PostLoadProcessor p_196852_) {
|
||||
@@ -233,14 +_,14 @@
|
||||
boolean flag2 = blockstate.m_155947_();
|
||||
if (!this.f_62776_.f_46443_) {
|
||||
@@ -78,6 +78,15 @@
|
||||
} else {
|
||||
CompoundTag compoundtag = this.f_187609_.get(p_62932_);
|
||||
if (compoundtag != null) {
|
||||
@@ -433,7 +_,7 @@
|
||||
p_187974_.accept((p_187968_, p_187969_, p_187970_) -> {
|
||||
BlockEntity blockentity = this.m_5685_(p_187968_, LevelChunk.EntityCreationType.IMMEDIATE);
|
||||
if (blockentity != null && p_187970_ != null && blockentity.m_58903_() == p_187969_) {
|
||||
- blockentity.m_142466_(p_187970_);
|
||||
+ blockentity.handleUpdateTag(p_187970_);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -453,7 +_,7 @@
|
||||
|
||||
public Stream<BlockPos> m_6267_() {
|
||||
@@ -108,7 +117,7 @@
|
||||
}
|
||||
|
||||
+ // FORGE START
|
||||
+ private final net.minecraftforge.common.capabilities.CapabilityProvider.AsField<LevelChunk> capProvider = new net.minecraftforge.common.capabilities.CapabilityProvider.AsField<>(LevelChunk.class);
|
||||
+ private final net.minecraftforge.common.capabilities.CapabilityProvider.AsField<LevelChunk> capProvider = new net.minecraftforge.common.capabilities.CapabilityProvider.AsField<>(LevelChunk.class, this);
|
||||
+
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ @Override
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@
|
||||
+ LevelChunk levelChunk = (LevelChunk) p_63456_;
|
||||
+ try {
|
||||
+ final CompoundTag capTag = levelChunk.writeCapsToNBT();
|
||||
+ if (capTag != null) capTag.m_128365_("ForgeCaps", capTag);
|
||||
+ if (capTag != null) compoundtag.m_128365_("ForgeCaps", capTag);
|
||||
+ } catch (Exception exception) {
|
||||
+ LogManager.getLogger().error("A capability provider has thrown an exception trying to write state. It will not persist. Report this to the mod author", exception);
|
||||
+ }
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--- a/net/minecraft/world/level/dimension/LevelStem.java
|
||||
+++ b/net/minecraft/world/level/dimension/LevelStem.java
|
||||
@@ -24,7 +_,9 @@
|
||||
|
||||
public final class LevelStem {
|
||||
public static final Codec<LevelStem> f_63970_ = RecordCodecBuilder.create((p_63986_) -> {
|
||||
+ return net.minecraftforge.common.ForgeHooks.expandLevelStemCodec(p_63986_, () -> { // forge: reroute the codec builder here to add extra json fields
|
||||
return p_63986_.group(DimensionType.f_63853_.fieldOf("type").flatXmap(ExtraCodecs.m_181037_(), ExtraCodecs.m_181037_()).forGetter(LevelStem::m_63981_), ChunkGenerator.f_62136_.fieldOf("generator").forGetter(LevelStem::m_63990_)).apply(p_63986_, p_63986_.stable(LevelStem::new));
|
||||
+ }); // forge: we're wrapping the original codec builder in our expansion up there
|
||||
});
|
||||
public static final ResourceKey<LevelStem> f_63971_ = ResourceKey.m_135785_(Registry.f_122820_, new ResourceLocation("overworld"));
|
||||
public static final ResourceKey<LevelStem> f_63972_ = ResourceKey.m_135785_(Registry.f_122820_, new ResourceLocation("the_nether"));
|
||||
@@ -34,6 +_,12 @@
|
||||
private final ChunkGenerator f_63976_;
|
||||
|
||||
public LevelStem(Supplier<DimensionType> p_63979_, ChunkGenerator p_63980_) {
|
||||
+ this(p_63979_, p_63980_, false); // forge: by default, dimension jsons use the fixed seed required by the vanilla format
|
||||
+ } // forge: reroute the vanilla constructor to our expanded constructor with default args
|
||||
+ private final boolean useServerSeed; // forge: whether the dimension parser should use the server seed instead of the fixed seed
|
||||
+ public boolean useServerSeed() { return this.useServerSeed; }
|
||||
+ public LevelStem(Supplier<DimensionType> p_63979_, ChunkGenerator p_63980_, boolean useServerSeed) { // forge: allow dimension jsons to specify that they should use the server seed instead of the fixed seed field
|
||||
+ this.useServerSeed = useServerSeed; // forge
|
||||
this.f_63975_ = p_63979_;
|
||||
this.f_63976_ = p_63980_;
|
||||
}
|
||||
+23
@@ -17,6 +17,29 @@
|
||||
if (!this.m_157557_(p_157539_)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -104,12 +_,14 @@
|
||||
public void m_157552_(Stream<T> p_157553_) {
|
||||
p_157553_.forEach((p_157607_) -> {
|
||||
this.m_157538_(p_157607_, true);
|
||||
+ if (p_157607_ instanceof Entity entity) entity.onAddedToWorld();
|
||||
});
|
||||
}
|
||||
|
||||
public void m_157559_(Stream<T> p_157560_) {
|
||||
p_157560_.forEach((p_157605_) -> {
|
||||
this.m_157538_(p_157605_, false);
|
||||
+ if (p_157605_ instanceof Entity entity) entity.onAddedToWorld();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -248,6 +_,7 @@
|
||||
while((chunkentities = this.f_157500_.poll()) != null) {
|
||||
chunkentities.m_156792_().forEach((p_157593_) -> {
|
||||
this.m_157538_(p_157593_, true);
|
||||
+ if (p_157593_ instanceof Entity entity) entity.onAddedToWorld();
|
||||
});
|
||||
this.f_157498_.put(chunkentities.m_156791_().m_45588_(), PersistentEntitySectionManager.ChunkLoadStatus.LOADED);
|
||||
}
|
||||
@@ -350,11 +_,13 @@
|
||||
|
||||
class Callback implements EntityInLevelCallback {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
--- a/net/minecraft/world/level/levelgen/WorldGenSettings.java
|
||||
+++ b/net/minecraft/world/level/levelgen/WorldGenSettings.java
|
||||
@@ -39,6 +_,7 @@
|
||||
return p_64626_.group(Codec.LONG.fieldOf("seed").stable().forGetter(WorldGenSettings::m_64619_), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(WorldGenSettings::m_64657_), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(WorldGenSettings::m_64660_), MappedRegistry.m_122747_(Registry.f_122820_, Lifecycle.stable(), LevelStem.f_63970_).xmap(LevelStem::m_63987_, Function.identity()).fieldOf("dimensions").forGetter(WorldGenSettings::m_64663_), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((p_158959_) -> {
|
||||
return p_158959_.f_64606_;
|
||||
})).apply(p_64626_, p_64626_.stable(WorldGenSettings::new));
|
||||
+ }).xmap(net.minecraftforge.common.ForgeHooks::loadDimensionsWithServerSeed, wgs -> {return wgs; // forge: when loading/registering json dimensions, replace hardcoded seeds of custom dimensions with the server/overworld's seed, where requested; fixes MC-195717
|
||||
}).comapFlatMap(WorldGenSettings::m_64674_, Function.identity());
|
||||
private static final Logger f_64601_ = LogManager.getLogger();
|
||||
private final long f_64602_;
|
||||
@@ -198,7 +_,7 @@
|
||||
String s3 = (String)p_64649_.get("level-type");
|
||||
String s4 = Optional.ofNullable(s3).map((p_190047_) -> {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public static final Feature<NoneFeatureConfiguration> f_65759_ = m_65807_("no_op", new NoOpFeature(NoneFeatureConfiguration.f_67815_));
|
||||
public static final Feature<TreeConfiguration> f_65760_ = m_65807_("tree", new TreeFeature(TreeConfiguration.f_68184_));
|
||||
public static final Feature<RandomPatchConfiguration> f_65761_ = m_65807_("flower", new RandomPatchFeature(RandomPatchConfiguration.f_67902_));
|
||||
@@ -157,11 +_,11 @@
|
||||
@@ -157,7 +_,7 @@
|
||||
public abstract boolean m_142674_(FeaturePlaceContext<FC> p_159749_);
|
||||
|
||||
protected static boolean m_159747_(BlockState p_159748_) {
|
||||
@@ -18,8 +18,3 @@
|
||||
}
|
||||
|
||||
public static boolean m_159759_(BlockState p_159760_) {
|
||||
- return p_159760_.m_60620_(BlockTags.f_144274_);
|
||||
+ return p_159760_.m_60620_(net.minecraftforge.common.Tags.Blocks.DIRT);
|
||||
}
|
||||
|
||||
public static boolean m_65788_(LevelSimulatedReader p_65789_, BlockPos p_65790_) {
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java
|
||||
@@ -42,4 +_,11 @@
|
||||
|
||||
p_197129_.m_192792_(p_197130_.f_192708_(), 48, 70);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public List<MobSpawnSettings.SpawnerData> getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) {
|
||||
+ if (category == net.minecraft.world.entity.MobCategory.MONSTER)
|
||||
+ return f_66381_.m_146338_();
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ }
|
||||
}
|
||||
+6
-8
@@ -1,16 +1,14 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java
|
||||
@@ -28,8 +_,11 @@
|
||||
super(p_66472_, PieceGeneratorSupplier.m_197349_(OceanMonumentFeature::m_197131_, OceanMonumentFeature::m_191045_));
|
||||
@@ -74,4 +_,11 @@
|
||||
return structurepiecesbuilder.m_192780_();
|
||||
}
|
||||
}
|
||||
|
||||
- protected boolean m_5910_() {
|
||||
- return false;
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<MobSpawnSettings.SpawnerData> getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) {
|
||||
+ if (category == net.minecraft.world.entity.MobCategory.MONSTER)
|
||||
+ return f_66469_.m_146338_();
|
||||
+ return java.util.Collections.emptyList();
|
||||
}
|
||||
|
||||
private static boolean m_197131_(PieceGeneratorSupplier.Context<NoneFeatureConfiguration> p_197132_) {
|
||||
+ }
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java
|
||||
@@ -52,4 +_,11 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<MobSpawnSettings.SpawnerData> getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) {
|
||||
+ if (category == net.minecraft.world.entity.MobCategory.MONSTER)
|
||||
+ return f_66559_.m_146338_();
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ }
|
||||
}
|
||||
+23
@@ -9,6 +9,29 @@
|
||||
public static final BiMap<String, StructureFeature<?>> f_67012_ = HashBiMap.create();
|
||||
private static final Map<StructureFeature<?>, GenerationStep.Decoration> f_67032_ = Maps.newHashMap();
|
||||
private static final Logger f_67033_ = LogManager.getLogger();
|
||||
@@ -79,6 +_,7 @@
|
||||
public static final StructureFeature<JigsawConfiguration> f_67030_ = m_67089_("Bastion_Remnant", new BastionFeature(JigsawConfiguration.f_67756_), GenerationStep.Decoration.SURFACE_STRUCTURES);
|
||||
public static final List<StructureFeature<?>> f_67031_ = ImmutableList.of(f_67013_, f_67028_, f_67029_, f_67022_);
|
||||
public static final int f_160446_ = 8;
|
||||
+ private final net.minecraftforge.common.util.ReverseTagWrapper<StructureFeature<?>> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.SerializationTags.m_13199_().m_144452_(Registry.f_122840_));
|
||||
private final Codec<ConfiguredStructureFeature<C, StructureFeature<C>>> f_67036_;
|
||||
private final PieceGeneratorSupplier<C> f_191106_;
|
||||
private final PostPlacementProcessor f_191107_;
|
||||
@@ -103,6 +_,14 @@
|
||||
this.f_191107_ = p_197170_;
|
||||
}
|
||||
|
||||
+ public java.util.Set<net.minecraft.resources.ResourceLocation> getTags() {
|
||||
+ return reverseTags.getTagNames();
|
||||
+ }
|
||||
+
|
||||
+ public boolean is(net.minecraft.tags.Tag<StructureFeature<?>> tag) {
|
||||
+ return tag.m_8110_(this);
|
||||
+ }
|
||||
+
|
||||
public GenerationStep.Decoration m_67095_() {
|
||||
return f_67032_.get(this);
|
||||
}
|
||||
@@ -256,6 +_,11 @@
|
||||
|
||||
public String m_67098_() {
|
||||
|
||||
Loaded 100 of 935 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user