mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 09:05:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41ea5b195b | ||
|
|
14e152579b | ||
|
|
dcf7bb1af2 | ||
|
|
456a48b12a | ||
|
|
aceb878a64 | ||
|
|
f451e21f39 | ||
|
|
c6ac740d31 | ||
|
|
dbf98d3888 | ||
|
|
1b7bdc3ec6 | ||
|
|
d414e31f08 | ||
|
|
b2036e9d23 | ||
|
|
abe4afe152 | ||
|
|
e7ad43c993 | ||
|
|
7631600b53 | ||
|
|
530a1e8eb0 | ||
|
|
54b2c18fcf | ||
|
|
eb1a9b57c6 | ||
|
|
5b6d54555e |
No files matched your search
+150
-30
@@ -5,7 +5,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:[5.1.26,)'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ plugins {
|
||||
id 'com.github.ben-manes.versions' version '0.36.0'
|
||||
id 'net.minecraftforge.gradleutils' version '1.+'
|
||||
id 'eclipse'
|
||||
id 'de.undercouch.download' version '4.1.2'
|
||||
}
|
||||
|
||||
Util.init() //Init all our extension methods!
|
||||
@@ -43,9 +44,9 @@ 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'
|
||||
@@ -55,7 +56,7 @@ ext {
|
||||
BOOTSTRAPLAUNCHER_VERSION = '0.1.17'
|
||||
ASM_VERSION = '9.1'
|
||||
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,7 +65,7 @@ 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'
|
||||
}
|
||||
@@ -83,6 +84,32 @@ 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'
|
||||
apply plugin: 'eclipse'
|
||||
@@ -247,21 +274,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'
|
||||
@@ -448,11 +476,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 +486,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 +524,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 +663,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 +727,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 +776,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}'
|
||||
],
|
||||
@@ -1136,6 +1216,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 +1288,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 +1337,7 @@ project(':forge') {
|
||||
'--classes', '--reverse-right'
|
||||
]
|
||||
], [
|
||||
sides: ['client'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
@@ -1245,6 +1350,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),
|
||||
@@ -1369,7 +1488,8 @@ project(':forge') {
|
||||
}
|
||||
|
||||
reobfJar {
|
||||
tool = SPECIAL_SOURCE + ':shaded'
|
||||
tool = FART
|
||||
args = ['--input', '{input}', '--output', '{output}', '--map', '{srg}']
|
||||
}
|
||||
|
||||
tasks.eclipse.dependsOn('genEclipseRuns')
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -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) {
|
||||
|
||||
@@ -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());
|
||||
@@ -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,7 +104,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,7 +_,48 @@
|
||||
@@ -764,7 +_,48 @@
|
||||
this.m_8853_(p_8846_);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,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 +163,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 +177,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 +198,7 @@
|
||||
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 @@
|
||||
@@ -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 +206,7 @@
|
||||
explosion.m_46061_();
|
||||
explosion.m_46075_(false);
|
||||
if (p_8661_ == Explosion.BlockInteraction.NONE) {
|
||||
@@ -1389,6 +_,12 @@
|
||||
@@ -1409,6 +_,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -219,23 +219,27 @@
|
||||
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_());
|
||||
|
||||
+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();
|
||||
}
|
||||
|
||||
+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,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);
|
||||
|
||||
@@ -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,7 @@
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -866,9 +_,10 @@
|
||||
@@ -865,9 +_,10 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -217,7 +217,7 @@
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@@ -955,6 +_,23 @@
|
||||
@@ -954,6 +_,23 @@
|
||||
|
||||
public boolean m_41614_() {
|
||||
return this.m_41720_().m_41472_();
|
||||
|
||||
@@ -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_) {
|
||||
|
||||
@@ -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);
|
||||
+ }
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -961,16 +961,16 @@ public class ForgeHooksClient
|
||||
return stackFont == null ? fallbackFont : stackFont;
|
||||
}
|
||||
|
||||
public static RenderTooltipEvent.Pre onRenderTooltipPre(@Nonnull ItemStack stack, PoseStack matrixStack, int x, int y, int screenWidth, int screenHeight, @Nonnull List<ClientTooltipComponent> components, @Nullable Font forcedFont, @Nonnull Font fallbackFont)
|
||||
public static RenderTooltipEvent.Pre onRenderTooltipPre(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @Nonnull List<ClientTooltipComponent> components, @Nullable Font forcedFont, @Nonnull Font fallbackFont)
|
||||
{
|
||||
var preEvent = new RenderTooltipEvent.Pre(stack, matrixStack, x, y, screenWidth, screenHeight, getTooltipFont(forcedFont, stack, fallbackFont), components);
|
||||
var preEvent = new RenderTooltipEvent.Pre(stack, poseStack, x, y, screenWidth, screenHeight, getTooltipFont(forcedFont, stack, fallbackFont), components);
|
||||
MinecraftForge.EVENT_BUS.post(preEvent);
|
||||
return preEvent;
|
||||
}
|
||||
|
||||
public static RenderTooltipEvent.Color onRenderTooltipColor(@Nonnull ItemStack stack, PoseStack matrixStack, int x, int y, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
|
||||
public static RenderTooltipEvent.Color onRenderTooltipColor(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
|
||||
{
|
||||
var colorEvent = new RenderTooltipEvent.Color(stack, matrixStack, x, y, font, 0xf0100010, 0x505000FF, 0x5028007f, components);
|
||||
var colorEvent = new RenderTooltipEvent.Color(stack, poseStack, x, y, font, 0xf0100010, 0x505000FF, 0x5028007f, components);
|
||||
MinecraftForge.EVENT_BUS.post(colorEvent);
|
||||
return colorEvent;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
{
|
||||
@Nonnull
|
||||
protected final ItemStack itemStack;
|
||||
protected final PoseStack poseStack;
|
||||
protected int x;
|
||||
protected int y;
|
||||
protected Font font;
|
||||
@@ -59,6 +60,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
public RenderTooltipEvent(@Nonnull ItemStack itemStack, PoseStack poseStack, int x, int y, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
|
||||
{
|
||||
this.itemStack = itemStack;
|
||||
this.poseStack = poseStack;
|
||||
this.components = Collections.unmodifiableList(components);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -74,6 +76,12 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return The PoseStack rendering context.
|
||||
*/
|
||||
public PoseStack getPoseStack() { return poseStack; }
|
||||
|
||||
/**
|
||||
* The components to be drawn.
|
||||
* To modify this list use {@link GatherComponents}.
|
||||
@@ -195,9 +203,9 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
private int screenWidth;
|
||||
private int screenHeight;
|
||||
|
||||
public Pre(@Nonnull ItemStack stack, PoseStack matrixStack, int x, int y, int screenWidth, int screenHeight, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
|
||||
public Pre(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
|
||||
{
|
||||
super(stack, matrixStack, x, y, font, components);
|
||||
super(stack, poseStack, x, y, font, components);
|
||||
this.screenWidth = screenWidth;
|
||||
this.screenHeight = screenHeight;
|
||||
}
|
||||
@@ -250,9 +258,9 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
private int borderStart;
|
||||
private int borderEnd;
|
||||
|
||||
public Color(@Nonnull ItemStack stack, PoseStack matrixStack, int x, int y, @Nonnull Font fr, int background, int borderStart, int borderEnd, @Nonnull List<ClientTooltipComponent> components)
|
||||
public Color(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, @Nonnull Font fr, int background, int borderStart, int borderEnd, @Nonnull List<ClientTooltipComponent> components)
|
||||
{
|
||||
super(stack, matrixStack, x, y, fr, components);
|
||||
super(stack, poseStack, x, y, fr, components);
|
||||
this.originalBackground = background;
|
||||
this.originalBorderStart = borderStart;
|
||||
this.originalBorderEnd = borderEnd;
|
||||
|
||||
@@ -302,6 +302,7 @@ public class BiomeDictionary
|
||||
addTypes(Biomes.OCEAN, OCEAN, OVERWORLD);
|
||||
addTypes(Biomes.PLAINS, PLAINS, OVERWORLD);
|
||||
addTypes(Biomes.DESERT, HOT, DRY, SANDY, OVERWORLD);
|
||||
addTypes(Biomes.WINDSWEPT_HILLS, MOUNTAIN, HILLS, OVERWORLD);
|
||||
addTypes(Biomes.FOREST, FOREST, OVERWORLD);
|
||||
addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD);
|
||||
addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD);
|
||||
@@ -310,17 +311,23 @@ public class BiomeDictionary
|
||||
addTypes(Biomes.THE_END, COLD, DRY, END);
|
||||
addTypes(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY, OVERWORLD);
|
||||
addTypes(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY, OVERWORLD);
|
||||
addTypes(Biomes.SNOWY_PLAINS, COLD, SNOWY, WASTELAND, OVERWORLD);
|
||||
addTypes(Biomes.MUSHROOM_FIELDS, MUSHROOM, RARE, OVERWORLD);
|
||||
addTypes(Biomes.BEACH, BEACH, OVERWORLD);
|
||||
addTypes(Biomes.JUNGLE, HOT, WET, DENSE, JUNGLE, OVERWORLD);
|
||||
addTypes(Biomes.SPARSE_JUNGLE, HOT, WET, JUNGLE, FOREST, RARE, OVERWORLD);
|
||||
addTypes(Biomes.DEEP_OCEAN, OCEAN, OVERWORLD);
|
||||
addTypes(Biomes.STONY_SHORE, BEACH, OVERWORLD);
|
||||
addTypes(Biomes.SNOWY_BEACH, COLD, BEACH, SNOWY, OVERWORLD);
|
||||
addTypes(Biomes.BIRCH_FOREST, FOREST, OVERWORLD);
|
||||
addTypes(Biomes.DARK_FOREST, SPOOKY, DENSE, FOREST, OVERWORLD);
|
||||
addTypes(Biomes.SNOWY_TAIGA, COLD, CONIFEROUS, FOREST, SNOWY, OVERWORLD);
|
||||
addTypes(Biomes.OLD_GROWTH_PINE_TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD);
|
||||
addTypes(Biomes.WINDSWEPT_FOREST, MOUNTAIN, FOREST, SPARSE, OVERWORLD);
|
||||
addTypes(Biomes.SAVANNA, HOT, SAVANNA, PLAINS, SPARSE, OVERWORLD);
|
||||
addTypes(Biomes.SAVANNA_PLATEAU, HOT, SAVANNA, PLAINS, SPARSE, RARE, OVERWORLD, PLATEAU);
|
||||
addTypes(Biomes.BADLANDS, MESA, SANDY, DRY, OVERWORLD);
|
||||
addTypes(Biomes.WOODED_BADLANDS, MESA, SANDY, DRY, SPARSE, OVERWORLD, PLATEAU);
|
||||
addTypes(Biomes.SMALL_END_ISLANDS, END);
|
||||
addTypes(Biomes.END_MIDLANDS, END);
|
||||
addTypes(Biomes.END_HIGHLANDS, END);
|
||||
@@ -333,8 +340,12 @@ public class BiomeDictionary
|
||||
addTypes(Biomes.DEEP_FROZEN_OCEAN, OCEAN, COLD, OVERWORLD);
|
||||
addTypes(Biomes.THE_VOID, VOID);
|
||||
addTypes(Biomes.SUNFLOWER_PLAINS, PLAINS, RARE, OVERWORLD);
|
||||
addTypes(Biomes.WINDSWEPT_GRAVELLY_HILLS, MOUNTAIN, SPARSE, RARE, OVERWORLD);
|
||||
addTypes(Biomes.FLOWER_FOREST, FOREST, HILLS, RARE, OVERWORLD);
|
||||
addTypes(Biomes.ICE_SPIKES, COLD, SNOWY, HILLS, RARE, OVERWORLD);
|
||||
addTypes(Biomes.OLD_GROWTH_BIRCH_FOREST, FOREST, DENSE, HILLS, RARE, OVERWORLD);
|
||||
addTypes(Biomes.OLD_GROWTH_SPRUCE_TAIGA, DENSE, FOREST, RARE, OVERWORLD);
|
||||
addTypes(Biomes.WINDSWEPT_SAVANNA, HOT, DRY, SPARSE, SAVANNA, MOUNTAIN, RARE, OVERWORLD);
|
||||
addTypes(Biomes.ERODED_BADLANDS, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD);
|
||||
addTypes(Biomes.BAMBOO_JUNGLE, HOT, WET, RARE, JUNGLE, OVERWORLD);
|
||||
addTypes(Biomes.SOUL_SAND_VALLEY, HOT, DRY, NETHER);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DungeonHooks
|
||||
if (type == mob.type)
|
||||
{
|
||||
itr.remove();
|
||||
rarity = /* mob.weight */ 0 + rarity;
|
||||
rarity = mob.getWeight().asInt() + rarity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class DungeonHooks
|
||||
if (name == mob.type)
|
||||
{
|
||||
dungeonMobs.remove(mob);
|
||||
return 0; // mob.weight;
|
||||
return mob.getWeight().asInt();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -95,7 +95,7 @@ public class DungeonHooks
|
||||
public static EntityType<?> getRandomDungeonMob(Random rand)
|
||||
{
|
||||
DungeonMob mob = WeightedRandom.getRandomItem(rand, dungeonMobs).orElseThrow();
|
||||
return null; // mob.type;
|
||||
return mob.type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -83,10 +84,16 @@ public abstract class CapabilityProvider<B extends ICapabilityProviderImpl<B>> i
|
||||
|
||||
private void doGatherCapabilities(@Nullable ICapabilityProvider parent)
|
||||
{
|
||||
this.capabilities = ForgeEventFactory.gatherCapabilities(baseClass, this, parent);
|
||||
this.capabilities = ForgeEventFactory.gatherCapabilities(baseClass, getProvider(), parent);
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
B getProvider()
|
||||
{
|
||||
return (B)this;
|
||||
}
|
||||
|
||||
protected final @Nullable CapabilityDispatcher getCapabilities()
|
||||
{
|
||||
if (isLazy && !initialized)
|
||||
@@ -196,14 +203,18 @@ public abstract class CapabilityProvider<B extends ICapabilityProviderImpl<B>> i
|
||||
*/
|
||||
public static class AsField<B extends ICapabilityProviderImpl<B>> extends CapabilityProvider<B>
|
||||
{
|
||||
public AsField(Class<B> baseClass)
|
||||
private final B owner;
|
||||
|
||||
public AsField(Class<B> baseClass, B owner)
|
||||
{
|
||||
super(baseClass);
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public AsField(Class<B> baseClass, boolean isLazy)
|
||||
public AsField(Class<B> baseClass, B owner, boolean isLazy)
|
||||
{
|
||||
super(baseClass, isLazy);
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public void initInternal()
|
||||
@@ -221,6 +232,13 @@ public abstract class CapabilityProvider<B extends ICapabilityProviderImpl<B>> i
|
||||
{
|
||||
deserializeCaps(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
B getProvider()
|
||||
{
|
||||
return owner;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
*
|
||||
* 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.common.capabilities;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -48,8 +48,11 @@ import net.minecraftforge.client.model.generators.ModelBuilder;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.resource.PathResourcePack;
|
||||
import net.minecraftforge.resource.ResourcePackLoader;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@@ -127,7 +130,7 @@ public class ExistingFileHelper {
|
||||
for (String existingMod : existingMods) {
|
||||
IModFileInfo modFileInfo = ModList.get().getModFileById(existingMod);
|
||||
if (modFileInfo != null) {
|
||||
PackResources pack = new PathResourcePack(modFileInfo.getFile().getFileName(), modFileInfo.getFile().findResource(""));
|
||||
PackResources pack = ResourcePackLoader.createPackForMod(modFileInfo);
|
||||
this.clientResources.add(pack);
|
||||
this.serverData.add(pack);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,9 @@ public class LootModifierManager extends SimpleJsonResourceReloadListener {
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
LootItemCondition[] lootConditions = GSON_INSTANCE.fromJson(object.get("conditions"), LootItemCondition[].class);
|
||||
|
||||
return ForgeRegistries.LOOT_MODIFIER_SERIALIZERS.getValue(location).read(location, object, lootConditions);
|
||||
ResourceLocation serializer = new ResourceLocation(GsonHelper.getAsString(object, "type"));
|
||||
|
||||
return ForgeRegistries.LOOT_MODIFIER_SERIALIZERS.getValue(serializer).read(location, object, lootConditions);
|
||||
}
|
||||
|
||||
public static GlobalLootModifierSerializer<?> getSerializerForName(ResourceLocation resourcelocation) {
|
||||
|
||||
@@ -130,7 +130,8 @@ public class HandshakeHandler
|
||||
}
|
||||
}
|
||||
|
||||
interface HandshakeConsumer<MSG extends IntSupplier>
|
||||
@FunctionalInterface
|
||||
public interface HandshakeConsumer<MSG extends IntSupplier>
|
||||
{
|
||||
void accept(HandshakeHandler handler, MSG msg, Supplier<NetworkEvent.Context> context);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
private final Set<ResourceLocation> dummies = Sets.newHashSet();
|
||||
private final Set<Integer> blocked = Sets.newHashSet();
|
||||
private final Multimap<ResourceLocation, V> overrides = ArrayListMultimap.create();
|
||||
private final BiMap<OverrideOwner, V> owners = HashBiMap.create();
|
||||
private final BiMap<OverrideOwner<V>, V> owners = HashBiMap.create();
|
||||
private final DummyFactory<V> dummyFactory;
|
||||
private final boolean isDelegated;
|
||||
private final int min;
|
||||
@@ -227,14 +227,14 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
@Override
|
||||
public ResourceLocation getKey(V value)
|
||||
{
|
||||
ResourceLocation ret = this.names.inverse().get(value);
|
||||
return ret == null ? this.defaultKey : ret;
|
||||
return getResourceKey(value).map(ResourceKey::location).orElse(this.defaultKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ResourceKey<V>> getResourceKey(V value)
|
||||
{
|
||||
return Optional.ofNullable(this.keys.inverse().get(value));
|
||||
// We use 'owners' here because we want to return the key for the inactive overridden items, not just the active set.
|
||||
return Optional.ofNullable(this.owners.inverse().get(value)).map(OverrideOwner::key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -374,11 +374,12 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
this.defaultValue = value;
|
||||
}
|
||||
|
||||
ResourceKey<V> rkey = ResourceKey.create(this.key, key);
|
||||
this.names.put(key, value);
|
||||
this.keys.put(ResourceKey.create(this.key, key), value);
|
||||
this.keys.put(rkey, value);
|
||||
this.ids.put(idToUse, value);
|
||||
this.availabilityMap.set(idToUse);
|
||||
this.owners.put(new OverrideOwner(owner == null ? key.getPath() : owner, key), value);
|
||||
this.owners.put(new OverrideOwner<V>(owner == null ? key.getPath() : owner, rkey), value);
|
||||
|
||||
if (isDelegated)
|
||||
{
|
||||
@@ -574,7 +575,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
overrides.add(entry.getValue());
|
||||
for (V value : overrides)
|
||||
{
|
||||
OverrideOwner owner = from.owners.inverse().get(value);
|
||||
OverrideOwner<V> owner = from.owners.inverse().get(value);
|
||||
if (owner == null)
|
||||
{
|
||||
LOGGER.warn(REGISTRIES,"Registry {}: Override did not have an associated owner object. Name: {} Value: {}", this.name, entry.getKey(), value);
|
||||
@@ -599,8 +600,6 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
throw new RuntimeException("One of more entry values did not copy to the correct id. Check log for details!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
@@ -762,7 +761,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
|
||||
for (V value : lst)
|
||||
{
|
||||
OverrideOwner owner = old.owners.inverse().get(value);
|
||||
OverrideOwner<V> owner = old.owners.inverse().get(value);
|
||||
if (owner == null)
|
||||
{
|
||||
LOGGER.warn(REGISTRIES,"Registry {}: Override did not have an associated owner object. Name: {} Value: {}", this.name, entry.getKey(), value);
|
||||
@@ -790,7 +789,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
String current = this.owners.inverse().get(this.getRaw(itemName)).owner;
|
||||
if (!owner.equals(current))
|
||||
{
|
||||
V _new = this.owners.get(new OverrideOwner(owner, itemName));
|
||||
V _new = this.owners.get(new OverrideOwner<V>(owner, ResourceKey.create(this.key, itemName)));
|
||||
if (_new == null)
|
||||
{
|
||||
LOGGER.warn(REGISTRIES,"Registry {}: Skipping override for {}, Unknown owner {}", this.name, itemName, owner);
|
||||
@@ -864,7 +863,7 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
for (ResourceLocation key : this.overrides.keySet())
|
||||
{
|
||||
V obj = this.names.get(key);
|
||||
OverrideOwner owner = this.owners.inverse().get(obj);
|
||||
OverrideOwner<V> owner = this.owners.inverse().get(obj);
|
||||
if (owner == null)
|
||||
LOGGER.debug(REGISTRIES,"Registry {} {}: Invalid override {} {}", this.name, this.stage.getName(), key, obj);
|
||||
ret.put(key, owner.owner);
|
||||
@@ -1104,31 +1103,5 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
LOGGER.debug(REGISTRIES,"There were {} missing mappings that have been ignored", ignored);
|
||||
}
|
||||
|
||||
private static class OverrideOwner
|
||||
{
|
||||
final String owner;
|
||||
final ResourceLocation key;
|
||||
private OverrideOwner(String owner, ResourceLocation key)
|
||||
{
|
||||
this.owner = owner;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o)
|
||||
return true;
|
||||
|
||||
if (!(o instanceof OverrideOwner))
|
||||
return false;
|
||||
|
||||
OverrideOwner oo = (OverrideOwner)o;
|
||||
return this.owner.equals(oo.owner) && this.key.equals(oo.key);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return 31 * this.key.hashCode() + this.owner.hashCode();
|
||||
}
|
||||
}
|
||||
private record OverrideOwner<V>(String owner, ResourceKey<V> key){};
|
||||
}
|
||||
@@ -19,16 +19,15 @@
|
||||
|
||||
package net.minecraftforge.resource;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -37,12 +36,13 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import net.minecraft.server.packs.repository.RepositorySource;
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.server.packs.repository.Pack.PackConstructor;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.resource.PathResourcePack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ResourcePackLoader {
|
||||
private static Map<IModFile, PathResourcePack> modResourcePacks;
|
||||
@@ -60,11 +60,25 @@ public class ResourcePackLoader {
|
||||
public static void loadResourcePacks(PackRepository resourcePacks, Function<Map<IModFile, ? extends PathResourcePack>, ? extends RepositorySource> packFinder) {
|
||||
modResourcePacks = ModList.get().getModFiles().stream()
|
||||
.filter(mf->mf.requiredLanguageLoaders().stream().noneMatch(ls->ls.languageName().equals("minecraft")))
|
||||
.map(mf -> Pair.of(mf, new PathResourcePack(mf.getFile().getFileName(), mf.getFile().getFilePath())))
|
||||
.map(mf -> Pair.of(mf, createPackForMod(mf)))
|
||||
.collect(Collectors.toMap(p -> p.getFirst().getFile(), Pair::getSecond, (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); }, LinkedHashMap::new));
|
||||
resourcePacks.addPackFinder(packFinder.apply(modResourcePacks));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PathResourcePack createPackForMod(IModFileInfo mf)
|
||||
{
|
||||
return new PathResourcePack(mf.getFile().getFileName(), mf.getFile().getFilePath()){
|
||||
final IModFile modFile = mf.getFile();
|
||||
@Nonnull
|
||||
@Override
|
||||
protected Path resolve(@Nonnull String... paths)
|
||||
{
|
||||
return modFile.findResource(paths);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static List<String> getPackNames() {
|
||||
return ModList.get().applyForEachModFile(mf->"mod:"+mf.getModInfos().get(0).getModId()).filter(n->!n.equals("mod:minecraft")).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
*
|
||||
* 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.debug;
|
||||
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.IntTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.*;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.util.thread.EffectiveSide;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
@Mod(CapabilitiesTest.MODID)
|
||||
public class CapabilitiesTest
|
||||
{
|
||||
public static final String MODID = "capabilities_test";
|
||||
|
||||
private static final boolean ENABLED = false;
|
||||
|
||||
public static Capability<CapClass> INSTANCE = CapabilityManager.get(new CapabilityToken<>(){});
|
||||
|
||||
private static ResourceLocation TEST_CAP_ID = new ResourceLocation("capabilities_test:test");
|
||||
|
||||
private static final ConcurrentLinkedQueue<String> messages = new ConcurrentLinkedQueue<>();
|
||||
|
||||
public CapabilitiesTest()
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
new AttachTest<>(BlockEntity.class);
|
||||
new AttachTest<>(Entity.class);
|
||||
new AttachTest<>(ItemStack.class);
|
||||
new AttachTest<>(LevelChunk.class);
|
||||
new AttachTest<>(Level.class);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CapClass
|
||||
{
|
||||
private final Object o;
|
||||
|
||||
public CapClass(Object o)
|
||||
{
|
||||
this.o = o;
|
||||
}
|
||||
}
|
||||
|
||||
public static class AttachTest<T extends ICapabilityProviderImpl<T>>
|
||||
{
|
||||
private final Class<T> cls;
|
||||
|
||||
public AttachTest(Class<T> cls)
|
||||
{
|
||||
this.cls = cls;
|
||||
|
||||
MinecraftForge.EVENT_BUS.addGenericListener(cls, this::attach);
|
||||
}
|
||||
|
||||
public void attach(AttachCapabilitiesEvent<T> event)
|
||||
{
|
||||
event.addCapability(TEST_CAP_ID, new ICapabilitySerializable<>()
|
||||
{
|
||||
final LazyOptional<CapClass> instance = LazyOptional.of(() -> new CapClass(this));
|
||||
|
||||
@Override
|
||||
public Tag serializeNBT()
|
||||
{
|
||||
return IntTag.valueOf(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT(Tag nbt)
|
||||
{
|
||||
if (nbt.getId() != Tag.TAG_INT)
|
||||
throw new IllegalStateException("Unexpected tag type");
|
||||
if (!(nbt instanceof IntTag it))
|
||||
throw new IllegalStateException("Unexpected tag class");
|
||||
if(it.getAsInt() != 1)
|
||||
throw new IllegalStateException("Unexpected tag type");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side)
|
||||
{
|
||||
if (cap == INSTANCE)
|
||||
return instance.cast();
|
||||
return LazyOptional.empty();
|
||||
}
|
||||
});
|
||||
|
||||
messages.add(String.format("Attached capability to %s in %s", event.getObject().getClass(), EffectiveSide.get()));
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(value= Dist.CLIENT, modid = CapabilitiesTest.MODID, bus= Mod.EventBusSubscriber.Bus.FORGE)
|
||||
public static class ClientEvents
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void clientTick(TickEvent.ClientTickEvent event)
|
||||
{
|
||||
if (event.phase == TickEvent.Phase.END)
|
||||
{
|
||||
while(messages.size() > 0)
|
||||
{
|
||||
Minecraft.getInstance().gui.handleChat(ChatType.SYSTEM, new TextComponent(messages.poll()), Util.NIL_UUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,5 +170,7 @@ license="LGPL v2.1"
|
||||
modId="full_pots_accessor_demo"
|
||||
[[mods]]
|
||||
modId="part_entity_test"
|
||||
[[mods]]
|
||||
modId="capabilities_test"
|
||||
|
||||
# ADD ABOVE THIS LINE
|
||||
@@ -24,12 +24,17 @@
|
||||
"features": [
|
||||
[],
|
||||
[
|
||||
"minecraft:lake_lava"
|
||||
"minecraft:lake_lava_underground",
|
||||
"minecraft:lake_lava_surface"
|
||||
],
|
||||
[],
|
||||
[
|
||||
"minecraft:fossil",
|
||||
"minecraft:monster_room"
|
||||
"minecraft:amethyst_geode"
|
||||
],
|
||||
[
|
||||
"minecraft:fossil_upper",
|
||||
"minecraft:fossil_lower",
|
||||
"minecraft:monster_room",
|
||||
"minecraft:monster_room_deep"
|
||||
],
|
||||
[
|
||||
"minecraft:desert_well"
|
||||
@@ -38,22 +43,40 @@
|
||||
[
|
||||
"minecraft:ore_dirt",
|
||||
"minecraft:ore_gravel",
|
||||
"minecraft:ore_granite",
|
||||
"minecraft:ore_diorite",
|
||||
"minecraft:ore_andesite",
|
||||
"minecraft:ore_coal",
|
||||
"minecraft:ore_iron",
|
||||
"minecraft:ore_granite_upper",
|
||||
"minecraft:ore_granite_lower",
|
||||
"minecraft:ore_diorite_upper",
|
||||
"minecraft:ore_diorite_lower",
|
||||
"minecraft:ore_andesite_upper",
|
||||
"minecraft:ore_andesite_lower",
|
||||
"minecraft:ore_tuff",
|
||||
"minecraft:ore_coal_upper",
|
||||
"minecraft:ore_coal_lower",
|
||||
"minecraft:ore_iron_upper",
|
||||
"minecraft:ore_iron_middle",
|
||||
"minecraft:ore_iron_small",
|
||||
"minecraft:ore_gold",
|
||||
"minecraft:ore_gold_lower",
|
||||
"minecraft:ore_redstone",
|
||||
"minecraft:ore_redstone_lower",
|
||||
"minecraft:ore_diamond",
|
||||
"minecraft:ore_diamond_large",
|
||||
"minecraft:ore_diamond_buried",
|
||||
"minecraft:ore_lapis",
|
||||
"minecraft:ore_lapis_buried",
|
||||
"minecraft:ore_copper",
|
||||
"minecraft:underwater_magma",
|
||||
"minecraft:disk_sand",
|
||||
"minecraft:disk_clay",
|
||||
"minecraft:disk_gravel"
|
||||
|
||||
],
|
||||
[],
|
||||
[
|
||||
"minecraft:spring_water",
|
||||
"minecraft:spring_lava"
|
||||
],
|
||||
[
|
||||
"minecraft:glow_lichen",
|
||||
"minecraft:flower_default",
|
||||
"minecraft:patch_grass_badlands",
|
||||
"minecraft:patch_dead_bush_2",
|
||||
@@ -61,22 +84,12 @@
|
||||
"minecraft:red_mushroom_normal",
|
||||
"minecraft:patch_sugar_cane_desert",
|
||||
"minecraft:patch_pumpkin",
|
||||
"minecraft:patch_cactus_desert",
|
||||
"minecraft:spring_water",
|
||||
"minecraft:spring_lava"
|
||||
"minecraft:patch_cactus_desert"
|
||||
],
|
||||
[
|
||||
"minecraft:freeze_top_layer"
|
||||
]
|
||||
],
|
||||
"starts": [
|
||||
"minecraft:village_desert",
|
||||
"minecraft:pillager_outpost",
|
||||
"minecraft:desert_pyramid",
|
||||
"minecraft:mineshaft",
|
||||
"minecraft:stronghold",
|
||||
"minecraft:ruined_portal_desert"
|
||||
],
|
||||
"spawners": {
|
||||
"monster": [
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
"seed": 12345,
|
||||
"settings": "dimension_settings_test:test_overworld",
|
||||
"biome_source": {
|
||||
"seed": 12345,
|
||||
"type": "minecraft:vanilla_layered"
|
||||
"preset": "minecraft:overworld",
|
||||
"type": "minecraft:multi_noise"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user