mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03082c361a | ||
|
|
65372e3123 | ||
|
|
0f923fa51f | ||
|
|
d1e3567c6b | ||
|
|
af75547d37 | ||
|
|
37be3aff2d | ||
|
|
b9b17d8331 | ||
|
|
2a433a5c8c | ||
|
|
e344fd08a5 | ||
|
|
0484f695fb | ||
|
|
e55bd86dff | ||
|
|
b1247df4dc | ||
|
|
91dda36b08 | ||
|
|
ac19d1bf2b | ||
|
|
e0e0302ece | ||
|
|
6eb3e20abb | ||
|
|
738491c25d | ||
|
|
2686b7a9ab | ||
|
|
4b93e3a224 | ||
|
|
873c490470 | ||
|
|
11e3281b3f | ||
|
|
ce6c664acd | ||
|
|
c75eb9e7cf | ||
|
|
2353cd982a | ||
|
|
dbcf8bd075 | ||
|
|
9f3141ea16 | ||
|
|
c382527ba2 | ||
|
|
45f8dc5245 | ||
|
|
43391c009c | ||
|
|
15733a18e4 | ||
|
|
f68344cd7c | ||
|
|
e421ea164c | ||
|
|
178e3d244a | ||
|
|
bd5e107628 | ||
|
|
a477671c03 | ||
|
|
887bc37209 | ||
|
|
47f05a4fcd | ||
|
|
47ba5b7a89 | ||
|
|
05480843cd | ||
|
|
0e1ed8c936 | ||
|
|
edf41bda19 | ||
|
|
051416b823 | ||
|
|
84fe2cbcc4 | ||
|
|
4ff0d246ce | ||
|
|
9051021474 | ||
|
|
cc473be332 | ||
|
|
b1f73a0760 | ||
|
|
de03eb6e3c | ||
|
|
bef8c2da3d | ||
|
|
3820d1b66f | ||
|
|
7dbae7ea4a | ||
|
|
be5885155c | ||
|
|
5dac065994 | ||
|
|
1d7db95539 | ||
|
|
de24783152 | ||
|
|
bfeec0c7bd | ||
|
|
2e42340dfa | ||
|
|
16b82bb97b | ||
|
|
d76ee4edd7 | ||
|
|
cf09f3eeb9 | ||
|
|
d8eaeabf3c | ||
|
|
600e68cace | ||
|
|
625cd746ef | ||
|
|
fc000fe913 | ||
|
|
e3db429763 | ||
|
|
e803006360 | ||
|
|
07ffc890e5 | ||
|
|
5a20705f05 | ||
|
|
aaa1deeef2 | ||
|
|
50197b1fa5 | ||
|
|
797791c2af | ||
|
|
c2de232703 | ||
|
|
9118c3dd24 | ||
|
|
c6d512afe8 | ||
|
|
5037adede9 | ||
|
|
a5aca97e31 | ||
|
|
edca0c7293 | ||
|
|
132cc3659d | ||
|
|
680c4062f4 | ||
|
|
e1efab0452 | ||
|
|
bd428de4fa | ||
|
|
978b3c7fb1 | ||
|
|
ff752ab14b | ||
|
|
19a38f5cb9 |
No files matched your search
+69
-551
@@ -15,45 +15,32 @@ buildscript {
|
||||
classpath 'org.ow2.asm:asm-tree:7.2'
|
||||
}
|
||||
}
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
import groovy.json.JsonBuilder
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.LinkedHashMap
|
||||
import java.util.TreeSet
|
||||
import java.util.stream.Collectors
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
import java.security.MessageDigest
|
||||
import java.net.URL
|
||||
import net.minecraftforge.forge.tasks.*
|
||||
import net.minecraftforge.gradle.common.task.ArchiveChecksum
|
||||
import static net.minecraftforge.forge.tasks.Util.*
|
||||
import net.minecraftforge.gradle.common.task.DownloadMavenArtifact
|
||||
import net.minecraftforge.gradle.common.task.ExtractInheritance
|
||||
import net.minecraftforge.gradle.common.task.SignJar
|
||||
import net.minecraftforge.gradle.common.util.HashStore
|
||||
import net.minecraftforge.gradle.mcp.function.MCPFunction
|
||||
import net.minecraftforge.gradle.mcp.util.MCPEnvironment
|
||||
import net.minecraftforge.gradle.patcher.task.ApplyBinPatches
|
||||
import net.minecraftforge.gradle.patcher.task.TaskReobfuscateJar
|
||||
import net.minecraftforge.gradle.userdev.tasks.RenameJar
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
plugins {
|
||||
id 'net.minecrell.licenser' version '0.4'
|
||||
id 'org.ajoberstar.grgit' version '3.1.1'
|
||||
id 'de.undercouch.download' version '3.3.0'
|
||||
id 'com.github.ben-manes.versions' version '0.22.0'
|
||||
}
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
Util.init() //Init all our extension methods!
|
||||
|
||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
|
||||
ext {
|
||||
@@ -67,8 +54,8 @@ ext {
|
||||
}
|
||||
MAPPING_CHANNEL = 'snapshot'
|
||||
MAPPING_VERSION = '20200514-1.16'
|
||||
MC_VERSION = '1.16.2'
|
||||
MCP_VERSION = '20200812.004259'
|
||||
MC_VERSION = '1.16.3'
|
||||
MCP_VERSION = '20200911.084530'
|
||||
}
|
||||
|
||||
project(':mcp') {
|
||||
@@ -138,7 +125,6 @@ project(':forge') {
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'net.minecraftforge.gradle.patcher'
|
||||
apply plugin: 'net.minecrell.licenser'
|
||||
apply plugin: 'de.undercouch.download'
|
||||
|
||||
compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
group = 'net.minecraftforge'
|
||||
@@ -211,7 +197,7 @@ project(':forge') {
|
||||
}
|
||||
|
||||
ext {
|
||||
SPEC_VERSION = '33.0' // This is overwritten by git tag, but here so dev time doesnt explode
|
||||
SPEC_VERSION = '34.1' // This is overwritten by git tag, but here so dev time doesnt explode
|
||||
// The new versioning sceme is <MCVersion>-<ForgeMC>.<RB>.<CommitsSinceRB>
|
||||
// ForgeMC is a unique identifier for every MC version we have supported.
|
||||
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
|
||||
@@ -363,7 +349,10 @@ project(':forge') {
|
||||
|
||||
args '--flat', '--all', '--validate',
|
||||
'--mod', 'data_gen_test',
|
||||
'--mod', 'piston_event_test',
|
||||
'--mod', 'piston_event_test',
|
||||
'--mod', 'global_loot_test',
|
||||
'--mod', 'scaffolding_test',
|
||||
'--mod', 'custom_tag_types_test',
|
||||
'--output', rootProject.file('src/generated_test/resources/'),
|
||||
'--existing', sourceSets.main.resources.srcDirs[0]
|
||||
}
|
||||
@@ -446,7 +435,7 @@ project(':forge') {
|
||||
installer 'org.ow2.asm:asm-tree:7.2'
|
||||
installer 'org.ow2.asm:asm-util:7.2'
|
||||
installer 'org.ow2.asm:asm-analysis:7.2'
|
||||
installer 'cpw.mods:modlauncher:6.1.+'
|
||||
installer 'cpw.mods:modlauncher:7.0.+'
|
||||
installer 'cpw.mods:grossjava9hacks:1.3.+'
|
||||
installer 'net.minecraftforge:accesstransformers:2.2.+:shadowed'
|
||||
installer 'net.minecraftforge:eventbus:3.0.+:service'
|
||||
@@ -462,7 +451,7 @@ project(':forge') {
|
||||
installer 'org.apache.logging.log4j:log4j-core:2.11.2'
|
||||
installer 'net.minecrell:terminalconsoleappender:1.2.+'
|
||||
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
|
||||
installer 'org.spongepowered:mixin:0.8'
|
||||
installer 'org.spongepowered:mixin:0.8.1'
|
||||
fmllauncherImplementation 'com.google.guava:guava:21.0'
|
||||
fmllauncherImplementation 'com.google.code.gson:gson:2.8.0'
|
||||
fmllauncherImplementation 'org.lwjgl:lwjgl:3.2.2'
|
||||
@@ -484,419 +473,59 @@ project(':forge') {
|
||||
if (changelog.exists())
|
||||
extraTxts += changelog
|
||||
|
||||
task downloadCrowdin() {
|
||||
ext {
|
||||
output = file('build/crowdin_raw.zip')
|
||||
update = file('build/crowdin.json')
|
||||
id = 'minecraft-forge'
|
||||
}
|
||||
onlyIf {
|
||||
project.hasProperty('crowdinKey') && !project.gradle.startParameter.isOffline()
|
||||
}
|
||||
doLast {
|
||||
download {
|
||||
src "https://api.crowdin.com/api/project/${id}/export?key=${project.crowdinKey}&json"
|
||||
dest update
|
||||
overwrite true
|
||||
}
|
||||
if (!update.text.contains('success')) {
|
||||
throw new RuntimeException("Crowdin export failed, see ${update} for more info")
|
||||
}
|
||||
download {
|
||||
src "https://api.crowdin.com/api/project/${id}/download/all.zip?key=${project.crowdinKey}"
|
||||
dest output
|
||||
overwrite true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task crowdin(type: Zip) {
|
||||
dependsOn downloadCrowdin
|
||||
onlyIf {
|
||||
!downloadCrowdin.state.skipped
|
||||
}
|
||||
baseName = project.name
|
||||
version = project.version
|
||||
classifier = 'crowdin'
|
||||
destinationDir = file('build/distributions')
|
||||
from(zipTree(downloadCrowdin.output)){
|
||||
eachFile { //Tired of waiting for crowdin API, rename things myself. Remove once crowdin stops being dumb
|
||||
if (it.name.equals('en_us.json') && !it.path.startsWith('assets/')) {
|
||||
it.name = it.path.split('/')[0] + '.json'
|
||||
it.path = 'assets/forge/lang/' + it.name
|
||||
}
|
||||
}
|
||||
exclude { it.isDirectory() }
|
||||
rename { it.toLowerCase() }//Minecraft needs it lowercase.
|
||||
exclude '**/*.lang' //Pre-1.13 format
|
||||
}
|
||||
}
|
||||
task crowdin(type: CrowdinTask) {
|
||||
key = project.hasProperty('crowdinKey') ? project.crowdinKey : null
|
||||
//TODO: Merge our english.json?
|
||||
}
|
||||
|
||||
// We apply the bin patches we just created to make a jar that is JUST our changes
|
||||
genClientBinPatches.tool = BINPATCH_TOOL
|
||||
task applyClientBinPatches(type: ApplyBinPatches, dependsOn: genClientBinPatches) {
|
||||
clean = { genClientBinPatches.cleanJar }
|
||||
input = genClientBinPatches.output
|
||||
tool = BINPATCH_TOOL
|
||||
}
|
||||
genServerBinPatches.tool = BINPATCH_TOOL
|
||||
task applyServerBinPatches(type: ApplyBinPatches, dependsOn: genServerBinPatches) {
|
||||
clean = { genServerBinPatches.cleanJar }
|
||||
input = genServerBinPatches.output
|
||||
tool = BINPATCH_TOOL
|
||||
}
|
||||
genJoinedBinPatches.tool = BINPATCH_TOOL
|
||||
task applyJoinedBinPatches(type: ApplyBinPatches, dependsOn: genJoinedBinPatches) {
|
||||
clean = { genJoinedBinPatches.cleanJar }
|
||||
input = genJoinedBinPatches.output
|
||||
tool = BINPATCH_TOOL
|
||||
}
|
||||
// Create SRG named Vanilla jars, using the SpecialSource we have in the installer
|
||||
task createClientSRG(type: RenameJar, dependsOn: genClientBinPatches) {
|
||||
tool = SPECIAL_SOURCE + ':shaded'
|
||||
args = ['--stable', '--in-jar', '{input}', '--out-jar', '{output}', '--srg-in', '{mappings}']
|
||||
mappings = { genClientBinPatches.srg }
|
||||
input = { genClientBinPatches.cleanJar }
|
||||
output = file('build/createClientSRG/output.jar')
|
||||
}
|
||||
task createServerSRG(type: RenameJar, dependsOn: genServerBinPatches) {
|
||||
tool = SPECIAL_SOURCE + ':shaded'
|
||||
args = ['--stable', '--in-jar', '{input}', '--out-jar', '{output}', '--srg-in', '{mappings}']
|
||||
mappings = { genServerBinPatches.srg }
|
||||
input = { genServerBinPatches.cleanJar }
|
||||
output = file('build/createServerSRG/output.jar')
|
||||
}
|
||||
// Checksum tasks so that we can know if the vanilla classes are what we expect them to do!
|
||||
task clientBaseChecksum(type: ArchiveChecksum, dependsOn: genClientBinPatches) {
|
||||
input = { genClientBinPatches.cleanJar} //Lazy because Patcher Plugin sets the value afterEvaluate
|
||||
name = 'client'
|
||||
}
|
||||
task serverBaseChecksum(type: ArchiveChecksum, dependsOn: genServerBinPatches) {
|
||||
input = { genServerBinPatches.cleanJar }
|
||||
name = 'server'
|
||||
}
|
||||
task joinedBaseChecksum(type: ArchiveChecksum, dependsOn: genJoinedBinPatches) {
|
||||
input = { genJoinedBinPatches.cleanJar }
|
||||
name = 'joined'
|
||||
}
|
||||
task clientPatchedChecksum(type: ArchiveChecksum, dependsOn: applyClientBinPatches) {
|
||||
input = applyClientBinPatches.output
|
||||
name = 'client_patched'
|
||||
}
|
||||
task serverPatchedChecksum(type: ArchiveChecksum, dependsOn: applyServerBinPatches) {
|
||||
input = applyServerBinPatches.output
|
||||
name = 'server_patched'
|
||||
}
|
||||
task joinedPatchedChecksum(type: ArchiveChecksum, dependsOn: applyJoinedBinPatches) {
|
||||
input = applyJoinedBinPatches.output
|
||||
name = 'joined_patched'
|
||||
}
|
||||
// Utility methods for testing checksums
|
||||
task cleanChecksums() {
|
||||
['client', 'server', 'joined'].each { side ->
|
||||
['Base', 'Patched'].each { type ->
|
||||
def clean = "clean${side.capitalize()}${type}Checksum"
|
||||
dependsOn(clean)
|
||||
tasks.findByName("${side}${type}Checksum").mustRunAfter(clean)
|
||||
}
|
||||
}
|
||||
}
|
||||
task checksums() {
|
||||
['client', 'server', 'joined'].each { side ->
|
||||
['Base', 'Patched'].each { type ->
|
||||
dependsOn("${side}${type}Checksum")
|
||||
}
|
||||
}
|
||||
}
|
||||
['Client', 'Server', 'Joined'].each { side ->
|
||||
def gen = tasks.getByName("gen${side}BinPatches")
|
||||
gen.tool = BINPATCH_TOOL
|
||||
task "apply${side}BinPatches"(type: ApplyBinPatches, dependsOn: gen) {
|
||||
clean = { gen.cleanJar }
|
||||
input = gen.output
|
||||
tool = BINPATCH_TOOL
|
||||
}
|
||||
if (side != 'Joined') {
|
||||
// Create SRG named Vanilla jars, using the SpecialSource we have in the installer
|
||||
task "create${side}SRG"(type: RenameJar, dependsOn: gen) {
|
||||
tool = SPECIAL_SOURCE + ':shaded'
|
||||
args = ['--stable', '--in-jar', '{input}', '--out-jar', '{output}', '--srg-in', '{mappings}']
|
||||
mappings = { gen.srg }
|
||||
input = { gen.cleanJar }
|
||||
output = file("build/create${name}SRG/output.jar")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task downloadLibraries(dependsOn: ':mcp:setupMCP') {
|
||||
inputs.file VERSION_JSON
|
||||
doLast {
|
||||
def json = new JsonSlurper().parseText(VERSION_JSON.text)
|
||||
json.libraries.each {lib ->
|
||||
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
|
||||
artifacts.each{ art ->
|
||||
def target = file('build/libraries/' + art.path)
|
||||
if (!target.exists()) {
|
||||
download {
|
||||
src art.url
|
||||
dest target
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
task downloadLibraries(type: DownloadLibrariesTask, dependsOn: ':mcp:setupMCP') {
|
||||
input = VERSION_JSON
|
||||
output = rootProject.file('build/libraries/')
|
||||
}
|
||||
|
||||
task extractInheritance(type: ExtractInheritance, dependsOn: [genJoinedBinPatches, downloadLibraries]) {
|
||||
tool = INSTALLER_TOOLS + ':fatjar'
|
||||
input { genJoinedBinPatches.cleanJar }
|
||||
doFirst {
|
||||
def json = new JsonSlurper().parseText(VERSION_JSON.text)
|
||||
json.libraries.each {lib ->
|
||||
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
|
||||
artifacts.each{ art ->
|
||||
def target = file('build/libraries/' + art.path)
|
||||
if (target.exists())
|
||||
addLibrary(target)
|
||||
}
|
||||
}
|
||||
}
|
||||
doFirst { downloadLibraries.libraries.each{ addLibrary(it) } }
|
||||
}
|
||||
task checkATs(dependsOn: extractInheritance) {
|
||||
inputs.file { extractInheritance.output }
|
||||
inputs.files patcher.accessTransformers
|
||||
doLast {
|
||||
def parse = { line ->
|
||||
def idx = line.indexOf('#')
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
def (modifier, cls, desc) = (line.trim() + ' ').split(' ', -1)
|
||||
def key = cls + (desc.isEmpty() ? '' : ' ' + desc)
|
||||
return [modifier, cls, desc, comment, key]
|
||||
}
|
||||
def accessLevel = { access ->
|
||||
if ((access & Opcodes.ACC_PUBLIC) != 0) return 3
|
||||
if ((access & Opcodes.ACC_PROTECTED) != 0) return 2
|
||||
if ((access & Opcodes.ACC_PRIVATE) != 0) return 0
|
||||
return 1
|
||||
}
|
||||
def accessStr = { access ->
|
||||
if (access.endsWith('-f') || access.endsWith('+f'))
|
||||
return 4
|
||||
switch (access.toLowerCase()) {
|
||||
case 'public': return 3
|
||||
case 'protected': return 2
|
||||
case 'default': return 1
|
||||
case 'private': return 0
|
||||
default: return -1
|
||||
}
|
||||
}
|
||||
def json = new JsonSlurper().parseText(extractInheritance.output.text)
|
||||
|
||||
patcher.accessTransformers.each { f ->
|
||||
TreeMap lines = [:]
|
||||
def group = null
|
||||
for (def line : f.readLines()) {
|
||||
if (line.isEmpty()) continue
|
||||
if (line.startsWith('#group ')) {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line.substring(7))
|
||||
|
||||
if (!desc.equals('*') && !desc.equals('*()') && !desc.equals('<init>'))
|
||||
throw new IllegalStateException('Invalid group: ' + line)
|
||||
|
||||
group = [modifier: modifier, cls: cls, desc: desc, comment: comment,
|
||||
'existing': [] as Set,
|
||||
'children': [] as TreeSet,
|
||||
group: true
|
||||
]
|
||||
if (lines.containsKey(key))
|
||||
throw new IllegalStateException('Duplicate group: ' + line)
|
||||
|
||||
lines[key] = group
|
||||
} else if (group != null) {
|
||||
if (line.startsWith('#endgroup')) {
|
||||
group = null
|
||||
} else {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line)
|
||||
group['existing'].add(key)
|
||||
}
|
||||
} else if (line.startsWith('#endgroup')) {
|
||||
throw new IllegalStateException('Invalid group ending: ' + line)
|
||||
} else if (line.startsWith('#')) {
|
||||
//Nom
|
||||
} else {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line)
|
||||
if (lines.containsKey(key)) {
|
||||
println('Duplicate: ' + line)
|
||||
continue
|
||||
}
|
||||
lines[key] = [modifier: modifier, cls: cls, desc: desc, comment: comment, group: false]
|
||||
}
|
||||
}
|
||||
|
||||
// Process Groups, this will remove any entries outside the group that is covered by the group
|
||||
for (def key : new ArrayList<>(lines.keySet())) {
|
||||
def entry = lines.get(key)
|
||||
if (entry != null && entry['group']) {
|
||||
def cls = entry['cls']
|
||||
def jcls = json.get(cls.replaceAll('\\.', '/'))
|
||||
if (jcls == null) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group: ' + key)
|
||||
} else if ('*'.equals(entry['desc'])) {
|
||||
if (!jcls.containsKey('fields')) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group, Class has no fields: ' + key)
|
||||
} else {
|
||||
jcls['fields'].each { field, value ->
|
||||
def fkey = cls + ' ' + field
|
||||
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
|
||||
if (lines.containsKey(fkey)) {
|
||||
lines.remove(fkey)
|
||||
} else if (!entry['existing'].contains(fkey)) {
|
||||
println('Added: ' + fkey)
|
||||
}
|
||||
entry['children'].add(fkey)
|
||||
} else if (lines.containsKey(fkey)) {
|
||||
lines.remove(fkey)
|
||||
println('Removed: ' + fkey)
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('*()'.equals(entry['desc'])) {
|
||||
if (!jcls.containsKey('methods')) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group, Class has no methods: ' + key)
|
||||
} else {
|
||||
jcls['methods'].each{ mtd, value ->
|
||||
if (mtd.startsWith('<clinit>'))
|
||||
return
|
||||
key = cls + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
|
||||
if (lines.containsKey(key)) {
|
||||
lines.remove(key)
|
||||
} else if (!entry['existing'].contains(key)) {
|
||||
println('Added: ' + key)
|
||||
}
|
||||
entry['children'].add(key)
|
||||
} else if (lines.containsKey(key)) {
|
||||
lines.remove(key)
|
||||
println('Removed: ' + key)
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('<init>'.equals(entry['desc'])) { //Make all public non-abstract subclasses
|
||||
json.each{ tcls,value ->
|
||||
if (!value.containsKey('methods') || ((value['access'] & Opcodes.ACC_ABSTRACT) != 0))
|
||||
return
|
||||
def parents = [] as Set
|
||||
def parent = tcls
|
||||
while (parent != null && json.containsKey(parent)) {
|
||||
parents.add(parent)
|
||||
def p = json[parent]
|
||||
parent = p == null ? null : p['superName']
|
||||
}
|
||||
if (parents.contains(cls.replaceAll('\\.', '/'))) {
|
||||
value['methods'].each{ mtd, v ->
|
||||
if (mtd.startsWith('<init>')) {
|
||||
def child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel.call(v['access']) < 3) {
|
||||
if (lines.containsKey(child)) {
|
||||
lines.remove(child)
|
||||
} else if (!entry['existing'].contains(child)) {
|
||||
println('Added: ' + child)
|
||||
}
|
||||
entry['children'].add(child)
|
||||
} else if (lines.containsKey(child)) {
|
||||
lines.remove(child)
|
||||
println('Removed: ' + child)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process normal lines, remove invalid and remove narrowing
|
||||
for (def key : new ArrayList<>(lines.keySet())) {
|
||||
def entry = lines.get(key)
|
||||
if (entry != null && !entry['group']) {
|
||||
def cls = entry['cls']
|
||||
def jcls = json.get(cls.replaceAll('\\.', '/'))
|
||||
if (jcls == null) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else if (entry['desc'] == '') {
|
||||
if (accessLevel.call(jcls['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
}
|
||||
} else if (!entry['desc'].contains('(')) {
|
||||
if (!jcls.containsKey('fields') || !jcls['fields'].containsKey(entry['desc'])) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else {
|
||||
def value = jcls['fields'][entry['desc']]
|
||||
if (accessLevel.call(value['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
println(entry.comment)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
def jdesc = entry['desc'].replace('(', ' (')
|
||||
if (!jcls.containsKey('methods') || !jcls['methods'].containsKey(jdesc)) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else {
|
||||
def value = jcls['methods'][jdesc]
|
||||
if (accessLevel.call(value['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def data = []
|
||||
lines.each { key,value ->
|
||||
if (!value.group) {
|
||||
data.add(value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
|
||||
} else {
|
||||
data.add('#group ' + value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
|
||||
value.children.each{ data.add(value.modifier + ' ' + it) }
|
||||
data.add('#endgroup')
|
||||
}
|
||||
}
|
||||
f.text = data.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
task checkATs(type: CheckATs, dependsOn: extractInheritance) {
|
||||
inheritance = extractInheritance.output
|
||||
ats = patcher.accessTransformers
|
||||
}
|
||||
task checkSAS(dependsOn: extractInheritance) {
|
||||
inputs.file { extractInheritance.output }
|
||||
inputs.files patcher.sideAnnotationStrippers
|
||||
doLast {
|
||||
def json = new JsonSlurper().parseText(extractInheritance.output.text)
|
||||
|
||||
patcher.sideAnnotationStrippers.each { f ->
|
||||
def lines = []
|
||||
f.eachLine { line ->
|
||||
if (line[0] == '\t') return //Skip any tabed lines, those are ones we add
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
lines.add(line)
|
||||
return
|
||||
}
|
||||
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
|
||||
def (cls, desc) = (line.trim() + ' ').split(' ', -1)
|
||||
cls = cls.replaceAll('\\.', '/')
|
||||
desc = desc.replace('(', ' (')
|
||||
if (desc.isEmpty() || json[cls] == null || json[cls]['methods'] == null || json[cls]['methods'][desc] == null) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
def mtd = json[cls]['methods'][desc]
|
||||
lines.add(cls + ' ' + desc.replace(' ', '') + (comment == null ? '' : ' ' + comment))
|
||||
def children = json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls}
|
||||
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
|
||||
children.each { lines.add('\t' + it) }
|
||||
}
|
||||
f.text = lines.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
task checkSAS(type: CheckSAS, dependsOn: extractInheritance) {
|
||||
inheritance = extractInheritance.output
|
||||
sass = patcher.sideAnnotationStrippers
|
||||
}
|
||||
|
||||
task checkExcs(type: CheckExcs, dependsOn: jar) {
|
||||
binary = jar.archivePath
|
||||
excs = patcher.excs
|
||||
}
|
||||
|
||||
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs]){}
|
||||
|
||||
task checkPatchesAndFix(type: CheckPatches) {
|
||||
patchDir = file("$rootDir/patches")
|
||||
@@ -915,7 +544,7 @@ project(':forge') {
|
||||
ext {
|
||||
output = file('build/version.json')
|
||||
vanilla = project(':mcp').file('build/mcp/downloadJson/version.json')
|
||||
timestamp = dateToIso8601(new Date())
|
||||
timestamp = iso8601Now()
|
||||
comment = [
|
||||
"Please do not automate the download and installation of Forge.",
|
||||
"Our efforts are supported by ads from the download page.",
|
||||
@@ -927,7 +556,7 @@ project(':forge') {
|
||||
inputs.file vanilla
|
||||
outputs.file output
|
||||
doLast {
|
||||
def json_vanilla = new JsonSlurper().parseText(vanilla.text)
|
||||
def json_vanilla = vanilla.json()
|
||||
def json = [
|
||||
_comment_: comment,
|
||||
id: id,
|
||||
@@ -948,7 +577,7 @@ project(':forge') {
|
||||
artifact: [
|
||||
path: "${project.group.replace('.', '/')}/${project.name}/${project.version}/${project.name}-${project.version}.jar",
|
||||
url: "", //Do not include the URL so that the installer/launcher won't grab it. This is also why we don't have the universal classifier
|
||||
sha1: sha1(launcherJar.archivePath),
|
||||
sha1: launcherJar.archivePath.sha1(),
|
||||
size: launcherJar.archivePath.length()
|
||||
]
|
||||
]
|
||||
@@ -990,7 +619,7 @@ project(':forge') {
|
||||
artifact: [
|
||||
path: "${project.group.replace('.', '/')}/${project.name}/${project.version}/${project.name}-${project.version}-universal.jar",
|
||||
url: "", //Do not include the URL so that the installer/launcher won't grab it. This is also why we don't have the universal classifier
|
||||
sha1: sha1(universalJar.archivePath),
|
||||
sha1: universalJar.archivePath.sha1(),
|
||||
size: universalJar.archivePath.length()
|
||||
]
|
||||
]
|
||||
@@ -1021,32 +650,32 @@ project(':forge') {
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:slim]"
|
||||
],
|
||||
MC_SLIM_SHA: [
|
||||
client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'",
|
||||
server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'"
|
||||
client: "'${tasks.getByName('downloadClientSlim').output.sha1()}'",
|
||||
server: "'${tasks.getByName('downloadServerSlim').output.sha1()}'"
|
||||
],
|
||||
MC_EXTRA: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:extra]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:extra]"
|
||||
],
|
||||
MC_EXTRA_SHA: [
|
||||
client: "'${sha1(tasks.getByName('downloadClientExtra').output)}'",
|
||||
server: "'${sha1(tasks.getByName('downloadServerExtra').output)}'"
|
||||
client: "'${tasks.getByName('downloadClientExtra').output.sha1()}'",
|
||||
server: "'${tasks.getByName('downloadServerExtra').output.sha1()}'"
|
||||
],
|
||||
MC_SRG: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:srg]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:srg]"
|
||||
],
|
||||
/*MC_SRG_SHA: [
|
||||
client: "'${sha1(createClientSRG.output)}'",
|
||||
server: "'${sha1(createServerSRG.output)}'"
|
||||
client: "'${createClientSRG.output.sha1()}'",
|
||||
server: "'${createServerSRG.output.sha1()}'"
|
||||
],*/
|
||||
PATCHED: [
|
||||
client: "[${project.group}:${project.name}:${project.version}:client]",
|
||||
server: "[${project.group}:${project.name}:${project.version}:server]"
|
||||
],
|
||||
PATCHED_SHA: [
|
||||
client: "'${sha1(applyClientBinPatches.output)}'",
|
||||
server: "'${sha1(applyServerBinPatches.output)}'"
|
||||
client: "'${applyClientBinPatches.output.sha1()}'",
|
||||
server: "'${applyServerBinPatches.output.sha1()}'"
|
||||
],
|
||||
MCP_VERSION: [
|
||||
client: "'${MCP_VERSION}'",
|
||||
@@ -1124,28 +753,10 @@ project(':forge') {
|
||||
universalJar {
|
||||
from extraTxts
|
||||
|
||||
/* TODO: Annotation Cache? need to talk to cpw about his new design.
|
||||
from(fixAnnotationsJson){
|
||||
into 'META-INF'
|
||||
}
|
||||
dependsOn fixAnnotationsJson
|
||||
*/
|
||||
|
||||
/* We do not actually check this anywhere, so it's 400KB of uselless data
|
||||
// Add checksum files of clean and patched vanilla classes.
|
||||
['client', 'server'].each { side ->
|
||||
['Base', 'Patched'].each { type ->
|
||||
from(tasks.getByName("${side}${type}Checksum").output) {
|
||||
into 'checksums/'
|
||||
}
|
||||
}
|
||||
}
|
||||
dependsOn checksums
|
||||
*/
|
||||
|
||||
// add crowdin locales
|
||||
from { !crowdin.state.skipped ? zipTree(crowdin.archivePath) : null}
|
||||
from { crowdin.output.exists() ? zipTree(crowdin.output) : null}
|
||||
dependsOn crowdin
|
||||
duplicatesStrategy = 'exclude'
|
||||
|
||||
doFirst {
|
||||
MANIFESTS.each{ pkg, values ->
|
||||
@@ -1446,99 +1057,6 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
|
||||
def dateToIso8601(date) {
|
||||
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
def result = format.format(date)
|
||||
return result[0..21] + ':' + result[22..-1]
|
||||
}
|
||||
|
||||
def sha1(file) {
|
||||
MessageDigest md = MessageDigest.getInstance('SHA-1')
|
||||
file.eachByte 4096, {bytes, size ->
|
||||
md.update(bytes, 0, size)
|
||||
}
|
||||
return md.digest().collect {String.format "%02x", it}.join()
|
||||
}
|
||||
|
||||
def artifactTree(project, artifact) {
|
||||
if (!project.ext.has('tree_resolver'))
|
||||
project.ext.tree_resolver = 1
|
||||
def cfg = project.configurations.create('tree_resolver_' + project.ext.tree_resolver++)
|
||||
def dep = project.dependencies.create(artifact)
|
||||
cfg.dependencies.add(dep)
|
||||
def files = cfg.resolve()
|
||||
return getArtifacts(project, cfg, true)
|
||||
}
|
||||
|
||||
def getArtifacts(project, config, classifiers) {
|
||||
def ret = [:]
|
||||
config.resolvedConfiguration.resolvedArtifacts.each {
|
||||
def art = [
|
||||
group: it.moduleVersion.id.group,
|
||||
name: it.moduleVersion.id.name,
|
||||
version: it.moduleVersion.id.version,
|
||||
classifier: it.classifier,
|
||||
extension: it.extension,
|
||||
file: it.file
|
||||
]
|
||||
def key = art.group + ':' + art.name
|
||||
def folder = "${art.group.replace('.', '/')}/${art.name}/${art.version}/"
|
||||
def filename = "${art.name}-${art.version}"
|
||||
if (art.classifier != null)
|
||||
filename += "-${art.classifier}"
|
||||
filename += ".${art.extension}"
|
||||
def path = "${folder}${filename}"
|
||||
def url = "https://libraries.minecraft.net/${path}"
|
||||
if (!checkExists(url)) {
|
||||
url = "https://files.minecraftforge.net/maven/${path}"
|
||||
}
|
||||
//TODO remove when Mojang launcher is updated
|
||||
if (!classifiers && art.classifier != null) { //Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
|
||||
art.version = "${art.version}-${art.classifier}"
|
||||
art.classifier = null
|
||||
art.extension = 'jar'
|
||||
path = "${art.group.replace('.', '/')}/${art.name}/${art.version}/${art.name}-${art.version}.jar"
|
||||
}
|
||||
ret[key] = [
|
||||
name: "${art.group}:${art.name}:${art.version}" + (art.classifier == null ? '' : ":${art.classifier}") + (art.extension == 'jar' ? '' : "@${art.extension}"),
|
||||
downloads: [
|
||||
artifact: [
|
||||
path: path,
|
||||
url: url,
|
||||
sha1: sha1(art.file),
|
||||
size: art.file.length()
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
def checkExists(url) {
|
||||
try {
|
||||
def code = new URL(url).openConnection().with {
|
||||
requestMethod = 'HEAD'
|
||||
connect()
|
||||
responseCode
|
||||
}
|
||||
return code == 200
|
||||
} catch (Exception e) {
|
||||
if (e.toString().contains('unable to find valid certification path to requested target'))
|
||||
throw new RuntimeException('Failed to connect to ' + url + ': Missing certificate root authority, try updating java')
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
def getClasspath(project, libs, artifact) {
|
||||
def ret = []
|
||||
artifactTree(project, artifact).each { key, lib ->
|
||||
libs[lib.name] = lib
|
||||
if (lib.name != artifact)
|
||||
ret.add(lib.name)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
//evaluationDependsOnChildren()
|
||||
task setup() {
|
||||
dependsOn ':clean:extractMapped'
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
repositories {
|
||||
//mavenCentral() //TODO: Update Gradle to use HTTPS by default
|
||||
maven {
|
||||
name 'maven_central'
|
||||
url 'https://repo.maven.apache.org/maven2/'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation 'org.ow2.asm:asm:7.2'
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.TreeMap
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
public class CheckATs extends DefaultTask {
|
||||
@InputFile File inheritance
|
||||
@InputFiles File[] ats
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def parse = { line ->
|
||||
def idx = line.indexOf('#')
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
def (modifier, cls, desc) = (line.trim() + ' ').split(' ', -1)
|
||||
def key = cls + (desc.isEmpty() ? '' : ' ' + desc)
|
||||
return [modifier, cls, desc, comment, key]
|
||||
}
|
||||
def accessLevel = { access ->
|
||||
if ((access & Opcodes.ACC_PUBLIC) != 0) return 3
|
||||
if ((access & Opcodes.ACC_PROTECTED) != 0) return 2
|
||||
if ((access & Opcodes.ACC_PRIVATE) != 0) return 0
|
||||
return 1
|
||||
}
|
||||
def accessStr = { access ->
|
||||
if (access.endsWith('-f') || access.endsWith('+f'))
|
||||
return 4
|
||||
switch (access.toLowerCase()) {
|
||||
case 'public': return 3
|
||||
case 'protected': return 2
|
||||
case 'default': return 1
|
||||
case 'private': return 0
|
||||
default: return -1
|
||||
}
|
||||
}
|
||||
def json = inheritance.json()
|
||||
|
||||
ats.each { f ->
|
||||
TreeMap lines = [:]
|
||||
def group = null
|
||||
for (def line : f.readLines()) {
|
||||
if (line.isEmpty()) continue
|
||||
if (line.startsWith('#group ')) {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line.substring(7))
|
||||
|
||||
if (!desc.equals('*') && !desc.equals('*()') && !desc.equals('<init>'))
|
||||
throw new IllegalStateException('Invalid group: ' + line)
|
||||
|
||||
group = [modifier: modifier, cls: cls, desc: desc, comment: comment,
|
||||
'existing': [] as Set,
|
||||
'children': [] as TreeSet,
|
||||
group: true
|
||||
]
|
||||
if (lines.containsKey(key))
|
||||
throw new IllegalStateException('Duplicate group: ' + line)
|
||||
|
||||
lines[key] = group
|
||||
} else if (group != null) {
|
||||
if (line.startsWith('#endgroup')) {
|
||||
group = null
|
||||
} else {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line)
|
||||
group['existing'].add(key)
|
||||
}
|
||||
} else if (line.startsWith('#endgroup')) {
|
||||
throw new IllegalStateException('Invalid group ending: ' + line)
|
||||
} else if (line.startsWith('#')) {
|
||||
//Nom
|
||||
} else {
|
||||
def (modifier, cls, desc, comment, key) = parse.call(line)
|
||||
if (lines.containsKey(key)) {
|
||||
println('Duplicate: ' + line)
|
||||
continue
|
||||
}
|
||||
lines[key] = [modifier: modifier, cls: cls, desc: desc, comment: comment, group: false]
|
||||
}
|
||||
}
|
||||
|
||||
// Process Groups, this will remove any entries outside the group that is covered by the group
|
||||
for (def key : new ArrayList<>(lines.keySet())) {
|
||||
def entry = lines.get(key)
|
||||
if (entry != null && entry['group']) {
|
||||
def cls = entry['cls']
|
||||
def jcls = json.get(cls.replaceAll('\\.', '/'))
|
||||
if (jcls == null) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group: ' + key)
|
||||
} else if ('*'.equals(entry['desc'])) {
|
||||
if (!jcls.containsKey('fields')) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group, Class has no fields: ' + key)
|
||||
} else {
|
||||
jcls['fields'].each { field, value ->
|
||||
def fkey = cls + ' ' + field
|
||||
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
|
||||
if (lines.containsKey(fkey)) {
|
||||
lines.remove(fkey)
|
||||
} else if (!entry['existing'].contains(fkey)) {
|
||||
println('Added: ' + fkey)
|
||||
}
|
||||
entry['children'].add(fkey)
|
||||
} else if (lines.containsKey(fkey)) {
|
||||
lines.remove(fkey)
|
||||
println('Removed: ' + fkey)
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('*()'.equals(entry['desc'])) {
|
||||
if (!jcls.containsKey('methods')) {
|
||||
lines.remove(key)
|
||||
println('Invalid Group, Class has no methods: ' + key)
|
||||
} else {
|
||||
jcls['methods'].each{ mtd, value ->
|
||||
if (mtd.startsWith('<clinit>'))
|
||||
return
|
||||
key = cls + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
|
||||
if (lines.containsKey(key)) {
|
||||
lines.remove(key)
|
||||
} else if (!entry['existing'].contains(key)) {
|
||||
println('Added: ' + key)
|
||||
}
|
||||
entry['children'].add(key)
|
||||
} else if (lines.containsKey(key)) {
|
||||
lines.remove(key)
|
||||
println('Removed: ' + key)
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('<init>'.equals(entry['desc'])) { //Make all public non-abstract subclasses
|
||||
json.each{ tcls,value ->
|
||||
if (!value.containsKey('methods') || ((value['access'] & Opcodes.ACC_ABSTRACT) != 0))
|
||||
return
|
||||
def parents = [] as Set
|
||||
def parent = tcls
|
||||
while (parent != null && json.containsKey(parent)) {
|
||||
parents.add(parent)
|
||||
def p = json[parent]
|
||||
parent = p == null ? null : p['superName']
|
||||
}
|
||||
if (parents.contains(cls.replaceAll('\\.', '/'))) {
|
||||
value['methods'].each{ mtd, v ->
|
||||
if (mtd.startsWith('<init>')) {
|
||||
def child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel.call(v['access']) < 3) {
|
||||
if (lines.containsKey(child)) {
|
||||
lines.remove(child)
|
||||
} else if (!entry['existing'].contains(child)) {
|
||||
println('Added: ' + child)
|
||||
}
|
||||
entry['children'].add(child)
|
||||
} else if (lines.containsKey(child)) {
|
||||
lines.remove(child)
|
||||
println('Removed: ' + child)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process normal lines, remove invalid and remove narrowing
|
||||
for (def key : new ArrayList<>(lines.keySet())) {
|
||||
def entry = lines.get(key)
|
||||
if (entry != null && !entry['group']) {
|
||||
def cls = entry['cls']
|
||||
def jcls = json.get(cls.replaceAll('\\.', '/'))
|
||||
if (jcls == null) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else if (entry['desc'] == '') {
|
||||
if (accessLevel.call(jcls['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
}
|
||||
} else if (!entry['desc'].contains('(')) {
|
||||
if (!jcls.containsKey('fields') || !jcls['fields'].containsKey(entry['desc'])) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else {
|
||||
def value = jcls['fields'][entry['desc']]
|
||||
if (accessLevel.call(value['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
println(entry.comment)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
def jdesc = entry['desc'].replace('(', ' (')
|
||||
if (!jcls.containsKey('methods') || !jcls['methods'].containsKey(jdesc)) {
|
||||
lines.remove(key)
|
||||
println('Invalid: ' + key)
|
||||
} else {
|
||||
def value = jcls['methods'][jdesc]
|
||||
if (accessLevel.call(value['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
|
||||
lines.remove(key)
|
||||
println('Invalid Narrowing: ' + key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def data = []
|
||||
lines.each { key,value ->
|
||||
if (!value.group) {
|
||||
data.add(value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
|
||||
} else {
|
||||
data.add('#group ' + value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
|
||||
value.children.each{ data.add(value.modifier + ' ' + it) }
|
||||
data.add('#endgroup')
|
||||
}
|
||||
}
|
||||
f.text = data.join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.TreeMap
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.ClassVisitor
|
||||
import org.objectweb.asm.MethodVisitor
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.Type
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
public class CheckExcs extends DefaultTask {
|
||||
@InputFile File binary
|
||||
@InputFiles File[] excs
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def known = []
|
||||
binary.withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
def visitor = new ClassVisitor(Opcodes.ASM7) {
|
||||
private String cls
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||
this.cls = name
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
known.add(this.cls + '.' + name + descriptor)
|
||||
super.visitMethod(access, name, descriptor, signature, exceptions)
|
||||
}
|
||||
}
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) != null) {
|
||||
if (zein.name.endsWith('.class')) {
|
||||
ClassReader reader = new ClassReader(zin)
|
||||
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
excs.each { f ->
|
||||
def lines = []
|
||||
f.eachLine { line ->
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
|
||||
if (!line.contains('=')) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
def (key, value) = line.split('=', 2)
|
||||
if (!known.contains(key)) {
|
||||
println(key)
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
def (cls, desc) = key.split('\\.', 2)
|
||||
if (!desc.contains('(')) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
def name = desc.split('\\(', 2)[0]
|
||||
desc = '(' + desc.split('\\(', 2)[1]
|
||||
|
||||
def (exceptions, args) = value.contains('|') ? value.split('|', 2) : [value, '']
|
||||
|
||||
if (args.split(',').length != Type.getArgumentTypes(desc).length) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
lines.add(line)
|
||||
}
|
||||
f.text = lines.sort().join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.TreeMap
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
public class CheckSAS extends DefaultTask {
|
||||
@InputFile File inheritance
|
||||
@InputFiles File[] sass
|
||||
|
||||
@TaskAction
|
||||
protected void exec() {
|
||||
Util.init()
|
||||
def json = inheritance.json()
|
||||
|
||||
sass.each { f ->
|
||||
def lines = []
|
||||
f.eachLine { line ->
|
||||
if (line[0] == '\t') return //Skip any tabed lines, those are ones we add
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
lines.add(line)
|
||||
return
|
||||
}
|
||||
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
|
||||
def (cls, desc) = (line.trim() + ' ').split(' ', -1)
|
||||
cls = cls.replaceAll('\\.', '/')
|
||||
desc = desc.replace('(', ' (')
|
||||
if (desc.isEmpty() || json[cls] == null || json[cls]['methods'] == null || json[cls]['methods'][desc] == null) {
|
||||
println('Invalid: ' + line)
|
||||
return
|
||||
}
|
||||
|
||||
def mtd = json[cls]['methods'][desc]
|
||||
lines.add(cls + ' ' + desc.replace(' ', '') + (comment == null ? '' : ' ' + comment))
|
||||
def children = json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls}
|
||||
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
|
||||
children.each { lines.add('\t' + it) }
|
||||
}
|
||||
f.text = lines.join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
import java.net.URL
|
||||
|
||||
public class CrowdinTask extends DefaultTask {
|
||||
@Input String id = 'minecraft-forge'
|
||||
@Input @Optional String key
|
||||
@Input boolean json = true
|
||||
@OutputFile output = project.file("build/${name}/output.zip")
|
||||
@OutputFile export = project.file("build/${name}/export.json")
|
||||
|
||||
CrowdinTask() {
|
||||
outputs.upToDateWhen{ false }
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
def run() {
|
||||
if (output.exists())
|
||||
output.delete()
|
||||
|
||||
if (key == null)
|
||||
return
|
||||
|
||||
// Force an export
|
||||
new URL("https://api.crowdin.com/api/project/${id}/export?key=${key}").withInputStream { i ->
|
||||
export.withOutputStream { it << i }
|
||||
}
|
||||
|
||||
if (!export.text.contains('success')) {
|
||||
throw new RuntimeException("Crowdin export failed, see ${export} for more info")
|
||||
}
|
||||
|
||||
new URL("https://api.crowdin.com/api/project/${id}/download/all.zip?key=${key}").withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
output.withOutputStream { out ->
|
||||
new ZipOutputStream(out).withCloseable { zout ->
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) != null) {
|
||||
if (zein.isDirectory()) {
|
||||
zout.putNextEntry(new ZipEntry(zein.name))
|
||||
} else {
|
||||
// 1.13+ uses json
|
||||
if (zein.name.endsWith('.json') == json) {
|
||||
ZipEntry zeout = new ZipEntry(json ? zein.name.toLowerCase() : zein.name)
|
||||
zeout.time = 1
|
||||
zout.putNextEntry(zeout)
|
||||
zout << zin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
|
||||
import java.io.File
|
||||
import java.util.HashSet
|
||||
import java.util.Set
|
||||
import java.net.URL
|
||||
|
||||
public class DownloadLibrariesTask extends DefaultTask {
|
||||
@InputFile File input
|
||||
@OutputDirectory File output = project.file("build/${name}/")
|
||||
Set<File> libraries = new HashSet<>()
|
||||
|
||||
@TaskAction
|
||||
def run() {
|
||||
Util.init()
|
||||
|
||||
def json = input.json().libraries.each { lib ->
|
||||
//TODO: Thread?
|
||||
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
|
||||
artifacts.each{ art ->
|
||||
def target = new File(output, art.path)
|
||||
libraries.add(target)
|
||||
if (!target.exists() || !art.sha1.equals(target.sha1())) {
|
||||
project.logger.lifecycle("Downloading ${art.url}")
|
||||
if (!target.parentFile.exists()) {
|
||||
target.parentFile.mkdirs()
|
||||
}
|
||||
new URL(art.url).withInputStream { i ->
|
||||
target.withOutputStream { it << i }
|
||||
}
|
||||
if (!art.sha1.equals(target.sha1())) {
|
||||
throw new IllegalStateException("Failed to download ${art.url} to ${target.canonicalPath} SHA Mismatch")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
public class Util {
|
||||
static void init() {
|
||||
File.metaClass.sha1 = { ->
|
||||
MessageDigest md = MessageDigest.getInstance('SHA-1')
|
||||
delegate.eachByte 4096, {bytes, size ->
|
||||
md.update(bytes, 0, size)
|
||||
}
|
||||
return md.digest().collect {String.format "%02x", it}.join()
|
||||
}
|
||||
|
||||
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
|
||||
|
||||
Date.metaClass.iso8601 = { ->
|
||||
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
def result = format.format(delegate)
|
||||
return result[0..21] + ':' + result[22..-1]
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getClasspath(project, libs, artifact) {
|
||||
def ret = []
|
||||
artifactTree(project, artifact).each { key, lib ->
|
||||
libs[lib.name] = lib
|
||||
if (lib.name != artifact)
|
||||
ret.add(lib.name)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
public static def getArtifacts(project, config, classifiers) {
|
||||
def ret = [:]
|
||||
config.resolvedConfiguration.resolvedArtifacts.each {
|
||||
def art = [
|
||||
group: it.moduleVersion.id.group,
|
||||
name: it.moduleVersion.id.name,
|
||||
version: it.moduleVersion.id.version,
|
||||
classifier: it.classifier,
|
||||
extension: it.extension,
|
||||
file: it.file
|
||||
]
|
||||
def key = art.group + ':' + art.name
|
||||
def folder = "${art.group.replace('.', '/')}/${art.name}/${art.version}/"
|
||||
def filename = "${art.name}-${art.version}"
|
||||
if (art.classifier != null)
|
||||
filename += "-${art.classifier}"
|
||||
filename += ".${art.extension}"
|
||||
def path = "${folder}${filename}"
|
||||
def url = "https://libraries.minecraft.net/${path}"
|
||||
if (!checkExists(url)) {
|
||||
url = "https://files.minecraftforge.net/maven/${path}"
|
||||
}
|
||||
//TODO remove when Mojang launcher is updated
|
||||
if (!classifiers && art.classifier != null) { //Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
|
||||
art.version = "${art.version}-${art.classifier}"
|
||||
art.classifier = null
|
||||
art.extension = 'jar'
|
||||
path = "${art.group.replace('.', '/')}/${art.name}/${art.version}/${art.name}-${art.version}.jar"
|
||||
}
|
||||
ret[key] = [
|
||||
name: "${art.group}:${art.name}:${art.version}" + (art.classifier == null ? '' : ":${art.classifier}") + (art.extension == 'jar' ? '' : "@${art.extension}"),
|
||||
downloads: [
|
||||
artifact: [
|
||||
path: path,
|
||||
url: url,
|
||||
sha1: sha1(art.file),
|
||||
size: art.file.length()
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
public static def iso8601Now() { new Date().iso8601() }
|
||||
|
||||
public static def sha1(file) {
|
||||
MessageDigest md = MessageDigest.getInstance('SHA-1')
|
||||
file.eachByte 4096, {bytes, size ->
|
||||
md.update(bytes, 0, size)
|
||||
}
|
||||
return md.digest().collect {String.format "%02x", it}.join()
|
||||
}
|
||||
|
||||
private static def artifactTree(project, artifact) {
|
||||
if (!project.ext.has('tree_resolver'))
|
||||
project.ext.tree_resolver = 1
|
||||
def cfg = project.configurations.create('tree_resolver_' + project.ext.tree_resolver++)
|
||||
def dep = project.dependencies.create(artifact)
|
||||
cfg.dependencies.add(dep)
|
||||
def files = cfg.resolve()
|
||||
return getArtifacts(project, cfg, true)
|
||||
}
|
||||
|
||||
private static boolean checkExists(url) {
|
||||
try {
|
||||
def code = new URL(url).openConnection().with {
|
||||
requestMethod = 'HEAD'
|
||||
connect()
|
||||
responseCode
|
||||
}
|
||||
return code == 200
|
||||
} catch (Exception e) {
|
||||
if (e.toString().contains('unable to find valid certification path to requested target'))
|
||||
throw new RuntimeException('Failed to connect to ' + url + ': Missing certificate root authority, try updating java')
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net) [](https://discord.gg/UvedJ9m) [](https://www.patreon.com/LexManos)
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[34,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license="All rights reserved"
|
||||
@@ -45,7 +45,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="[32,)" #mandatory
|
||||
versionRange="[34,)" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||
ordering="NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||
@@ -54,6 +54,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
|
||||
[[dependencies.examplemod]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.16.1]"
|
||||
versionRange="[1.16.3]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "examplemod resources",
|
||||
"pack_format": 5,
|
||||
"_comment": "A pack_format of 5 requires json lang files and some texture changes from 1.15. Note: we require v5 pack meta for all mods."
|
||||
"pack_format": 6,
|
||||
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
@Deprecated
|
||||
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
|
||||
- if (this.func_235695_q_() && !p_196243_1_.func_203425_a(p_196243_4_.func_177230_c())) {
|
||||
+ if (p_196243_1_.hasTileEntity() && (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c() || !p_196243_4_.hasTileEntity())) {
|
||||
+ if (p_196243_1_.hasTileEntity() && (!p_196243_1_.func_203425_a(p_196243_4_.func_177230_c()) || !p_196243_4_.hasTileEntity())) {
|
||||
p_196243_2_.func_175713_t(p_196243_3_);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
|
||||
RailShape railshape = p_220053_1_.func_203425_a(this) ? p_220053_1_.func_177229_b(this.func_176560_l()) : null;
|
||||
+ RailShape railShape2 = p_220053_1_.func_177230_c() == this ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null;
|
||||
+ RailShape railShape2 = p_220053_1_.func_203425_a(this) ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null;
|
||||
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
--- a/net/minecraft/block/BambooBlock.java
|
||||
+++ b/net/minecraft/block/BambooBlock.java
|
||||
@@ -102,8 +102,9 @@
|
||||
@@ -100,10 +100,11 @@
|
||||
|
||||
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
|
||||
if (p_225542_1_.func_177229_b(field_220266_f) == 0) {
|
||||
if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
|
||||
- if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
|
||||
+ if (p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
|
||||
int i = this.func_220260_b(p_225542_2_, p_225542_3_) + 1;
|
||||
- if (i < 16) {
|
||||
+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9)) {
|
||||
+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(3) == 0)) {
|
||||
this.func_220258_a(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i);
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
return false;
|
||||
} else {
|
||||
- return p_212570_2_ instanceof PlayerEntity || p_212570_1_.func_82736_K().func_223586_b(GameRules.field_223599_b);
|
||||
+ return p_212570_2_ instanceof LivingEntity && !(p_212570_2_ instanceof PlayerEntity) ? net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_212570_1_, p_212570_2_) : true;
|
||||
+ return p_212570_2_ instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_212570_1_, p_212570_2_);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
@@ -16,7 +16,7 @@
|
||||
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
|
||||
this.field_238175_ae_ = !p_i45547_1_.field_178741_d.field_239099_d_;
|
||||
this.field_238176_af_ = !p_i45547_1_.field_178741_d.field_239100_e_;
|
||||
@@ -415,14 +415,15 @@
|
||||
@@ -415,13 +415,13 @@
|
||||
|
||||
this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i);
|
||||
this.field_71417_B = new MouseHelper(this);
|
||||
@@ -29,11 +29,9 @@
|
||||
this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax);
|
||||
this.field_110448_aq.func_198983_a();
|
||||
+ DatapackCodec.field_234880_a_.addModPacks(net.minecraftforge.common.ForgeHooks.getModPacks());
|
||||
this.field_71474_y.func_198017_a(this.field_110448_aq);
|
||||
this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab);
|
||||
this.field_110451_am.func_219534_a(this.field_135017_as);
|
||||
@@ -462,6 +463,7 @@
|
||||
@@ -462,6 +462,7 @@
|
||||
this.func_193986_ar();
|
||||
this.field_110451_am.func_219534_a(this.field_193995_ae);
|
||||
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
|
||||
@@ -41,7 +39,7 @@
|
||||
this.field_110451_am.func_219534_a(this.field_71452_i);
|
||||
this.field_213272_aL = new PaintingSpriteUploader(this.field_71446_o);
|
||||
this.field_110451_am.func_219534_a(this.field_213272_aL);
|
||||
@@ -469,7 +471,8 @@
|
||||
@@ -469,7 +470,8 @@
|
||||
this.field_110451_am.func_219534_a(this.field_213273_aM);
|
||||
this.field_241557_ar_ = new GPUWarning();
|
||||
this.field_110451_am.func_219534_a(this.field_241557_ar_);
|
||||
@@ -51,7 +49,7 @@
|
||||
this.field_184132_p = new DebugRenderer(this);
|
||||
RenderSystem.setErrorCallback(this::func_195545_a);
|
||||
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
|
||||
@@ -481,11 +484,6 @@
|
||||
@@ -481,11 +483,6 @@
|
||||
this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E);
|
||||
this.field_195558_d.func_227801_c_();
|
||||
this.func_213226_a();
|
||||
@@ -63,7 +61,7 @@
|
||||
|
||||
ResourceLoadProgressGui.func_212970_a(this);
|
||||
List<IResourcePack> list = this.field_110448_aq.func_232623_f_();
|
||||
@@ -494,7 +492,14 @@
|
||||
@@ -494,7 +491,14 @@
|
||||
if (SharedConstants.field_206244_b) {
|
||||
this.func_213256_aB();
|
||||
}
|
||||
@@ -79,7 +77,7 @@
|
||||
});
|
||||
}, false));
|
||||
}
|
||||
@@ -533,7 +538,7 @@
|
||||
@@ -533,7 +537,7 @@
|
||||
}
|
||||
|
||||
private void func_229988_a_(Throwable p_229988_1_) {
|
||||
@@ -88,7 +86,7 @@
|
||||
ITextComponent itextcomponent;
|
||||
if (p_229988_1_ instanceof SimpleReloadableResourceManager.FailedPackException) {
|
||||
itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).func_241203_a().func_195762_a());
|
||||
@@ -621,7 +626,7 @@
|
||||
@@ -621,7 +625,7 @@
|
||||
return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b()));
|
||||
});
|
||||
SearchTreeReloadable<ItemStack> searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> {
|
||||
@@ -97,7 +95,7 @@
|
||||
});
|
||||
NonNullList<ItemStack> nonnulllist = NonNullList.func_191196_a();
|
||||
|
||||
@@ -691,13 +696,13 @@
|
||||
@@ -691,13 +695,13 @@
|
||||
Bootstrap.func_179870_a(p_71377_0_.func_71502_e());
|
||||
if (p_71377_0_.func_71497_f() != null) {
|
||||
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f());
|
||||
@@ -114,7 +112,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -706,6 +711,7 @@
|
||||
@@ -706,6 +710,7 @@
|
||||
return this.field_71474_y.field_211842_aO;
|
||||
}
|
||||
|
||||
@@ -122,7 +120,7 @@
|
||||
public CompletableFuture<Void> func_213237_g() {
|
||||
if (this.field_213276_aV != null) {
|
||||
return this.field_213276_aV;
|
||||
@@ -794,10 +800,6 @@
|
||||
@@ -794,10 +799,6 @@
|
||||
}
|
||||
|
||||
public void func_147108_a(@Nullable Screen p_147108_1_) {
|
||||
@@ -133,7 +131,7 @@
|
||||
if (p_147108_1_ == null && this.field_71441_e == null) {
|
||||
p_147108_1_ = new MainMenuScreen();
|
||||
} else if (p_147108_1_ == null && this.field_71439_g.func_233643_dh_()) {
|
||||
@@ -808,6 +810,14 @@
|
||||
@@ -808,6 +809,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +146,7 @@
|
||||
if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) {
|
||||
this.field_71474_y.field_74330_P = false;
|
||||
this.field_71456_v.func_146158_b().func_146231_a(true);
|
||||
@@ -939,11 +949,13 @@
|
||||
@@ -939,11 +948,13 @@
|
||||
RenderSystem.enableCull();
|
||||
this.field_71424_I.func_76319_b();
|
||||
if (!this.field_71454_w) {
|
||||
@@ -162,7 +160,7 @@
|
||||
}
|
||||
|
||||
if (this.field_238174_aV_ != null) {
|
||||
@@ -1042,6 +1054,7 @@
|
||||
@@ -1042,6 +1053,7 @@
|
||||
|
||||
Framebuffer framebuffer = this.func_147110_a();
|
||||
framebuffer.func_216491_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), field_142025_a);
|
||||
@@ -170,7 +168,7 @@
|
||||
this.field_71460_t.func_147704_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l());
|
||||
this.field_71417_B.func_198021_g();
|
||||
}
|
||||
@@ -1230,11 +1243,21 @@
|
||||
@@ -1230,11 +1242,21 @@
|
||||
if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) {
|
||||
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
|
||||
BlockPos blockpos = blockraytraceresult.func_216350_a();
|
||||
@@ -194,7 +192,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1253,6 +1276,8 @@
|
||||
@@ -1253,6 +1275,8 @@
|
||||
}
|
||||
|
||||
} else if (!this.field_71439_g.func_184838_M()) {
|
||||
@@ -203,7 +201,7 @@
|
||||
switch(this.field_71476_x.func_216346_c()) {
|
||||
case ENTITY:
|
||||
this.field_71442_b.func_78764_a(this.field_71439_g, ((EntityRayTraceResult)this.field_71476_x).func_216348_a());
|
||||
@@ -1260,7 +1285,7 @@
|
||||
@@ -1260,7 +1284,7 @@
|
||||
case BLOCK:
|
||||
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
|
||||
BlockPos blockpos = blockraytraceresult.func_216350_a();
|
||||
@@ -212,7 +210,7 @@
|
||||
this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b());
|
||||
break;
|
||||
}
|
||||
@@ -1270,8 +1295,10 @@
|
||||
@@ -1270,8 +1294,10 @@
|
||||
}
|
||||
|
||||
this.field_71439_g.func_184821_cY();
|
||||
@@ -223,7 +221,7 @@
|
||||
this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1286,6 +1313,11 @@
|
||||
@@ -1286,6 +1312,11 @@
|
||||
}
|
||||
|
||||
for(Hand hand : Hand.values()) {
|
||||
@@ -235,7 +233,7 @@
|
||||
ItemStack itemstack = this.field_71439_g.func_184586_b(hand);
|
||||
if (this.field_71476_x != null) {
|
||||
switch(this.field_71476_x.func_216346_c()) {
|
||||
@@ -1299,6 +1331,7 @@
|
||||
@@ -1299,6 +1330,7 @@
|
||||
|
||||
if (actionresulttype.func_226246_a_()) {
|
||||
if (actionresulttype.func_226247_b_()) {
|
||||
@@ -243,7 +241,7 @@
|
||||
this.field_71439_g.func_184609_a(hand);
|
||||
}
|
||||
|
||||
@@ -1311,6 +1344,7 @@
|
||||
@@ -1311,6 +1343,7 @@
|
||||
ActionResultType actionresulttype1 = this.field_71442_b.func_217292_a(this.field_71439_g, this.field_71441_e, hand, blockraytraceresult);
|
||||
if (actionresulttype1.func_226246_a_()) {
|
||||
if (actionresulttype1.func_226247_b_()) {
|
||||
@@ -251,7 +249,7 @@
|
||||
this.field_71439_g.func_184609_a(hand);
|
||||
if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.field_71442_b.func_78758_h())) {
|
||||
this.field_71460_t.field_78516_c.func_187460_a(hand);
|
||||
@@ -1326,6 +1360,9 @@
|
||||
@@ -1326,6 +1359,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +259,7 @@
|
||||
if (!itemstack.func_190926_b()) {
|
||||
ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand);
|
||||
if (actionresulttype2.func_226246_a_()) {
|
||||
@@ -1352,6 +1389,8 @@
|
||||
@@ -1352,6 +1388,8 @@
|
||||
--this.field_71467_ac;
|
||||
}
|
||||
|
||||
@@ -270,7 +268,7 @@
|
||||
this.field_71424_I.func_76320_a("gui");
|
||||
if (!this.field_71445_n) {
|
||||
this.field_71456_v.func_73831_a();
|
||||
@@ -1468,6 +1507,8 @@
|
||||
@@ -1468,6 +1506,8 @@
|
||||
this.field_71424_I.func_219895_b("keyboard");
|
||||
this.field_195559_v.func_204870_b();
|
||||
this.field_71424_I.func_76319_b();
|
||||
@@ -279,7 +277,7 @@
|
||||
}
|
||||
|
||||
private void func_184117_aA() {
|
||||
@@ -1697,7 +1738,12 @@
|
||||
@@ -1697,7 +1737,12 @@
|
||||
networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> {
|
||||
}));
|
||||
networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN));
|
||||
@@ -293,7 +291,7 @@
|
||||
this.field_71453_ak = networkmanager;
|
||||
} else {
|
||||
this.func_241559_a_(p_238195_6_, p_238195_1_, flag, () -> {
|
||||
@@ -1771,6 +1817,7 @@
|
||||
@@ -1771,6 +1816,7 @@
|
||||
}
|
||||
|
||||
public void func_71403_a(ClientWorld p_71403_1_) {
|
||||
@@ -301,7 +299,7 @@
|
||||
WorkingScreen workingscreen = new WorkingScreen();
|
||||
workingscreen.func_200210_a(new TranslationTextComponent("connect.joining"));
|
||||
this.func_213241_c(workingscreen);
|
||||
@@ -1802,10 +1849,12 @@
|
||||
@@ -1802,10 +1848,12 @@
|
||||
IntegratedServer integratedserver = this.field_71437_Z;
|
||||
this.field_71437_Z = null;
|
||||
this.field_71460_t.func_190564_k();
|
||||
@@ -314,7 +312,7 @@
|
||||
if (integratedserver != null) {
|
||||
this.field_71424_I.func_76320_a("waitForServer");
|
||||
|
||||
@@ -1820,6 +1869,7 @@
|
||||
@@ -1820,6 +1868,7 @@
|
||||
this.field_71456_v.func_181029_i();
|
||||
this.field_71422_O = null;
|
||||
this.field_71455_al = false;
|
||||
@@ -322,7 +320,7 @@
|
||||
this.field_213274_aO.func_216815_b();
|
||||
}
|
||||
|
||||
@@ -1850,6 +1900,7 @@
|
||||
@@ -1850,6 +1899,7 @@
|
||||
this.field_71452_i.func_78870_a(p_213257_1_);
|
||||
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_);
|
||||
this.func_230150_b_();
|
||||
@@ -330,7 +328,7 @@
|
||||
}
|
||||
|
||||
public boolean func_238216_r_() {
|
||||
@@ -1895,112 +1946,9 @@
|
||||
@@ -1895,112 +1945,9 @@
|
||||
|
||||
private void func_147112_ai() {
|
||||
if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) {
|
||||
@@ -446,7 +444,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2090,6 +2038,7 @@
|
||||
@@ -2090,6 +2037,7 @@
|
||||
return field_71432_P;
|
||||
}
|
||||
|
||||
@@ -454,7 +452,7 @@
|
||||
public CompletableFuture<Void> func_213245_w() {
|
||||
return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> {
|
||||
return p_229993_0_;
|
||||
@@ -2397,7 +2346,7 @@
|
||||
@@ -2397,7 +2345,7 @@
|
||||
supplier = func_228022_c_(supplier);
|
||||
}
|
||||
|
||||
@@ -463,7 +461,7 @@
|
||||
}
|
||||
|
||||
private static Supplier<IResourcePack> func_228021_b_(Supplier<IResourcePack> p_228021_0_) {
|
||||
@@ -2416,6 +2365,14 @@
|
||||
@@ -2416,6 +2364,14 @@
|
||||
this.field_175617_aL.func_229355_a_(p_228020_1_);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,10 @@
|
||||
func_238472_a_(p_230431_1_, fontrenderer, this.func_230458_i_(), this.field_230690_l_ + this.field_230688_j_ / 2, this.field_230691_m_ + (this.field_230689_k_ - 8) / 2, j | MathHelper.func_76123_f(this.field_230695_q_ * 255.0F) << 24);
|
||||
}
|
||||
|
||||
@@ -206,6 +206,14 @@
|
||||
@@ -206,6 +206,10 @@
|
||||
this.field_230688_j_ = p_230991_1_;
|
||||
}
|
||||
|
||||
+ public int getHeight() {
|
||||
+ return this.field_230689_k_;
|
||||
+ }
|
||||
+
|
||||
+ public void setHeight(int value) {
|
||||
+ this.field_230689_k_ = value;
|
||||
+ }
|
||||
@@ -24,7 +20,7 @@
|
||||
public void func_230986_a_(float p_230986_1_) {
|
||||
this.field_230695_q_ = p_230986_1_;
|
||||
}
|
||||
@@ -233,4 +241,17 @@
|
||||
@@ -233,4 +237,17 @@
|
||||
protected void func_230996_d_(boolean p_230996_1_) {
|
||||
this.field_230686_c_ = p_230996_1_;
|
||||
}
|
||||
|
||||
+17
-1
@@ -77,7 +77,23 @@
|
||||
if (effect != null) {
|
||||
EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h());
|
||||
effectinstance.func_100012_b(p_147260_1_.func_149429_c());
|
||||
@@ -1883,10 +1896,12 @@
|
||||
@@ -1388,11 +1401,14 @@
|
||||
public void func_199723_a(STagsListPacket p_199723_1_) {
|
||||
PacketThreadUtil.func_218797_a(p_199723_1_, this, this.field_147299_f);
|
||||
ITagCollectionSupplier itagcollectionsupplier = p_199723_1_.func_199858_a();
|
||||
- Multimap<ResourceLocation, ResourceLocation> multimap = TagRegistryManager.func_242198_b(itagcollectionsupplier);
|
||||
+ boolean vanillaConnection = net.minecraftforge.fml.network.NetworkHooks.isVanillaConnection(field_147302_e);
|
||||
+ Multimap<ResourceLocation, ResourceLocation> multimap = vanillaConnection ? TagRegistryManager.func_242198_b(net.minecraftforge.common.ForgeTagHandler.withNoCustom(itagcollectionsupplier)) : TagRegistryManager.validateVanillaTags(itagcollectionsupplier);//Forge: If we are connecting to vanilla validate all tags to properly validate custom tags the client may "require", and if we are connecting to forge only validate the vanilla tag types as the custom tag types get synced in a separate packet so may still arrive
|
||||
if (!multimap.isEmpty()) {
|
||||
field_147301_d.warn("Incomplete server tags, disconnecting. Missing: {}", (Object)multimap);
|
||||
this.field_147302_e.func_150718_a(new TranslationTextComponent("multiplayer.disconnect.missing_tags"));
|
||||
} else {
|
||||
+ net.minecraftforge.common.ForgeTagHandler.resetCachedTagCollections(true, vanillaConnection);
|
||||
+ itagcollectionsupplier = ITagCollectionSupplier.reinjectOptionalTags(itagcollectionsupplier);
|
||||
this.field_199725_m = itagcollectionsupplier;
|
||||
if (!this.field_147302_e.func_150731_c()) {
|
||||
itagcollectionsupplier.func_242212_e();
|
||||
@@ -1883,10 +1899,12 @@
|
||||
int l5 = packetbuffer.readInt();
|
||||
this.field_147299_f.field_184132_p.field_229018_q_.func_229022_a_(blockpos8, l3, s10, l5);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/client/particle/Particle.java
|
||||
+++ b/net/minecraft/client/particle/Particle.java
|
||||
@@ -208,4 +208,12 @@
|
||||
public void func_187108_a(AxisAlignedBB p_187108_1_) {
|
||||
this.field_187120_G = p_187108_1_;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Forge added method that controls if a particle should be culled to it's bounding box.
|
||||
+ * Default behaviour is culling enabled
|
||||
+ */
|
||||
+ public boolean shouldCull() {
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
@@ -34,9 +34,17 @@
|
||||
return iparticlefactory == null ? null : iparticlefactory.func_199234_a(p_199927_1_, this.field_78878_a, p_199927_2_, p_199927_4_, p_199927_6_, p_199927_8_, p_199927_10_, p_199927_12_);
|
||||
}
|
||||
|
||||
@@ -315,14 +315,21 @@
|
||||
@@ -313,16 +313,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ /**@deprecated Forge: use {@link #renderParticles(MatrixStack, IRenderTypeBuffer.Impl, LightTexture, ActiveRenderInfo, float, net.minecraft.client.renderer.culling.ClippingHelper)} with ClippingHelper as additional parameter*/
|
||||
+ @Deprecated
|
||||
public void func_228345_a_(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_) {
|
||||
+ renderParticles(p_228345_1_, p_228345_2_, p_228345_3_, p_228345_4_, p_228345_5_, null);
|
||||
+ }
|
||||
+
|
||||
+ public void renderParticles(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_, @Nullable net.minecraft.client.renderer.culling.ClippingHelper clippingHelper) {
|
||||
p_228345_3_.func_205109_c();
|
||||
+ Runnable enable = () -> {
|
||||
RenderSystem.enableAlphaTest();
|
||||
@@ -57,7 +65,15 @@
|
||||
Iterable<Particle> iterable = this.field_78876_b.get(iparticlerendertype);
|
||||
if (iterable != null) {
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -362,7 +369,7 @@
|
||||
@@ -331,6 +344,7 @@
|
||||
iparticlerendertype.func_217600_a(bufferbuilder, this.field_78877_c);
|
||||
|
||||
for(Particle particle : iterable) {
|
||||
+ if (clippingHelper != null && particle.shouldCull() && !clippingHelper.func_228957_a_(particle.func_187116_l())) continue;
|
||||
try {
|
||||
particle.func_225606_a_(bufferbuilder, p_228345_4_, p_228345_5_);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -362,7 +376,7 @@
|
||||
}
|
||||
|
||||
public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) {
|
||||
@@ -66,7 +82,7 @@
|
||||
VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_);
|
||||
double d0 = 0.25D;
|
||||
voxelshape.func_197755_b((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> {
|
||||
@@ -434,6 +441,12 @@
|
||||
@@ -434,6 +448,12 @@
|
||||
return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
--- a/net/minecraft/client/renderer/WorldRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/WorldRenderer.java
|
||||
@@ -830,7 +830,7 @@
|
||||
@@ -222,6 +222,11 @@
|
||||
}
|
||||
|
||||
private void func_228438_a_(LightTexture p_228438_1_, float p_228438_2_, double p_228438_3_, double p_228438_5_, double p_228438_7_) {
|
||||
+ net.minecraftforge.client.IWeatherRenderHandler renderHandler = field_72769_h.func_239132_a_().getWeatherRenderHandler();
|
||||
+ if (renderHandler != null) {
|
||||
+ renderHandler.render(field_72773_u, p_228438_2_, field_72769_h, field_72777_q, p_228438_1_, p_228438_3_, p_228438_5_, p_228438_7_);
|
||||
+ return;
|
||||
+ }
|
||||
float f = this.field_72777_q.field_71441_e.func_72867_j(p_228438_2_);
|
||||
if (!(f <= 0.0F)) {
|
||||
p_228438_1_.func_205109_c();
|
||||
@@ -830,7 +835,7 @@
|
||||
this.field_147595_R = true;
|
||||
BlockPos blockpos2 = chunkrenderdispatcher$chunkrender4.func_178568_j().func_177982_a(8, 8, 8);
|
||||
boolean flag1 = blockpos2.func_177951_i(blockpos) < 768.0D;
|
||||
@@ -9,7 +21,7 @@
|
||||
this.field_175009_l.add(chunkrenderdispatcher$chunkrender4);
|
||||
} else {
|
||||
this.field_72777_q.func_213239_aq().func_76320_a("build near");
|
||||
@@ -915,13 +915,13 @@
|
||||
@@ -915,13 +920,13 @@
|
||||
float f = p_228426_7_.func_205001_m();
|
||||
boolean flag1 = this.field_72777_q.field_71441_e.func_239132_a_().func_230493_a_(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d1)) || this.field_72777_q.field_71456_v.func_184046_j().func_184056_f();
|
||||
if (this.field_72777_q.field_71474_y.field_151451_c >= 4) {
|
||||
@@ -25,7 +37,7 @@
|
||||
iprofiler.func_219895_b("terrain_setup");
|
||||
this.func_228437_a_(p_228426_6_, clippinghelper, flag, this.field_228409_ai_++, this.field_72777_q.field_71439_g.func_175149_v());
|
||||
iprofiler.func_219895_b("updatechunks");
|
||||
@@ -942,7 +942,9 @@
|
||||
@@ -942,7 +947,9 @@
|
||||
this.func_174967_a(p_228426_3_ + l1);
|
||||
iprofiler.func_219895_b("terrain");
|
||||
this.func_228441_a_(RenderType.func_228639_c_(), p_228426_1_, d0, d1, d2);
|
||||
@@ -35,7 +47,7 @@
|
||||
this.func_228441_a_(RenderType.func_228643_e_(), p_228426_1_, d0, d1, d2);
|
||||
if (this.field_72769_h.func_239132_a_().func_239217_c_()) {
|
||||
RenderHelper.func_237533_a_(p_228426_1_.func_227866_c_().func_227870_a_());
|
||||
@@ -1010,6 +1012,7 @@
|
||||
@@ -1010,6 +1017,7 @@
|
||||
List<TileEntity> list = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b();
|
||||
if (!list.isEmpty()) {
|
||||
for(TileEntity tileentity1 : list) {
|
||||
@@ -43,7 +55,7 @@
|
||||
BlockPos blockpos3 = tileentity1.func_174877_v();
|
||||
IRenderTypeBuffer irendertypebuffer1 = irendertypebuffer$impl;
|
||||
p_228426_1_.func_227860_a_();
|
||||
@@ -1035,6 +1038,7 @@
|
||||
@@ -1035,6 +1043,7 @@
|
||||
|
||||
synchronized(this.field_181024_n) {
|
||||
for(TileEntity tileentity : this.field_181024_n) {
|
||||
@@ -51,17 +63,73 @@
|
||||
BlockPos blockpos2 = tileentity.func_174877_v();
|
||||
p_228426_1_.func_227860_a_();
|
||||
p_228426_1_.func_227861_a_((double)blockpos2.func_177958_n() - d0, (double)blockpos2.func_177956_o() - d1, (double)blockpos2.func_177952_p() - d2);
|
||||
@@ -1084,7 +1088,8 @@
|
||||
@@ -1084,10 +1093,13 @@
|
||||
iprofiler.func_219895_b("outline");
|
||||
BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).func_216350_a();
|
||||
BlockState blockstate = this.field_72769_h.func_180495_p(blockpos);
|
||||
- if (!blockstate.func_196958_f() && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) {
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(this, p_228426_6_, field_72777_q.field_71476_x, p_228426_2_, p_228426_1_, irendertypebuffer$impl))
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(this, p_228426_6_, raytraceresult, p_228426_2_, p_228426_1_, irendertypebuffer$impl))
|
||||
+ if (!blockstate.isAir(this.field_72769_h, blockpos) && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) {
|
||||
IVertexBuilder ivertexbuilder2 = irendertypebuffer$impl.getBuffer(RenderType.func_228659_m_());
|
||||
this.func_228429_a_(p_228426_1_, ivertexbuilder2, p_228426_6_.func_216773_g(), d0, d1, d2, blockpos, blockstate);
|
||||
}
|
||||
@@ -2076,7 +2081,12 @@
|
||||
+ } else if (raytraceresult != null && raytraceresult.func_216346_c() == RayTraceResult.Type.ENTITY) {
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(this, p_228426_6_, raytraceresult, p_228426_2_, p_228426_1_, irendertypebuffer$impl);
|
||||
}
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
@@ -1119,7 +1131,7 @@
|
||||
this.field_239224_H_.func_237506_a_(this.field_72777_q.func_147110_a());
|
||||
RenderState.field_239237_T_.func_228547_a_();
|
||||
iprofiler.func_219895_b("particles");
|
||||
- this.field_72777_q.field_71452_i.func_228345_a_(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_);
|
||||
+ this.field_72777_q.field_71452_i.renderParticles(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_, clippinghelper);
|
||||
RenderState.field_239237_T_.func_228549_b_();
|
||||
} else {
|
||||
iprofiler.func_219895_b("translucent");
|
||||
@@ -1129,7 +1141,7 @@
|
||||
iprofiler.func_219895_b("string");
|
||||
this.func_228441_a_(RenderType.func_241715_r_(), p_228426_1_, d0, d1, d2);
|
||||
iprofiler.func_219895_b("particles");
|
||||
- this.field_72777_q.field_71452_i.func_228345_a_(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_);
|
||||
+ this.field_72777_q.field_71452_i.renderParticles(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_, clippinghelper);
|
||||
}
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
@@ -1481,6 +1493,11 @@
|
||||
}
|
||||
|
||||
public void func_228424_a_(MatrixStack p_228424_1_, float p_228424_2_) {
|
||||
+ net.minecraftforge.client.ISkyRenderHandler renderHandler = field_72769_h.func_239132_a_().getSkyRenderHandler();
|
||||
+ if (renderHandler != null) {
|
||||
+ renderHandler.render(field_72773_u, p_228424_2_, p_228424_1_, field_72769_h, field_72777_q);
|
||||
+ return;
|
||||
+ }
|
||||
if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.END) {
|
||||
this.func_228444_b_(p_228424_1_);
|
||||
} else if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.NORMAL) {
|
||||
@@ -1609,6 +1626,11 @@
|
||||
}
|
||||
|
||||
public void func_228425_a_(MatrixStack p_228425_1_, float p_228425_2_, double p_228425_3_, double p_228425_5_, double p_228425_7_) {
|
||||
+ net.minecraftforge.client.ICloudRenderHandler renderHandler = field_72769_h.func_239132_a_().getCloudRenderHandler();
|
||||
+ if (renderHandler != null) {
|
||||
+ renderHandler.render(field_72773_u, p_228425_2_, p_228425_1_, field_72769_h, field_72777_q, p_228425_3_, p_228425_5_, p_228425_7_);
|
||||
+ return;
|
||||
+ }
|
||||
float f = this.field_72769_h.func_239132_a_().func_239213_a_();
|
||||
if (!Float.isNaN(f)) {
|
||||
RenderSystem.disableCull();
|
||||
@@ -1792,7 +1814,7 @@
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
ChunkRenderDispatcher.ChunkRender chunkrenderdispatcher$chunkrender = iterator.next();
|
||||
- if (chunkrenderdispatcher$chunkrender.func_188281_o()) {
|
||||
+ if (!net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() && chunkrenderdispatcher$chunkrender.func_188281_o()) {
|
||||
this.field_174995_M.func_228902_a_(chunkrenderdispatcher$chunkrender);
|
||||
} else {
|
||||
chunkrenderdispatcher$chunkrender.func_228929_a_(this.field_174995_M);
|
||||
@@ -2076,7 +2098,12 @@
|
||||
this.field_175008_n.func_217628_a(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_);
|
||||
}
|
||||
|
||||
@@ -74,7 +142,7 @@
|
||||
ISound isound = this.field_147593_P.get(p_184377_2_);
|
||||
if (isound != null) {
|
||||
this.field_72777_q.func_147118_V().func_147683_b(isound);
|
||||
@@ -2084,7 +2094,7 @@
|
||||
@@ -2084,7 +2111,7 @@
|
||||
}
|
||||
|
||||
if (p_184377_1_ != null) {
|
||||
@@ -83,7 +151,7 @@
|
||||
if (musicdiscitem != null) {
|
||||
this.field_72777_q.field_71456_v.func_238451_a_(musicdiscitem.func_234801_g_());
|
||||
}
|
||||
@@ -2232,7 +2242,7 @@
|
||||
@@ -2232,7 +2259,7 @@
|
||||
break;
|
||||
case 1010:
|
||||
if (Item.func_150899_d(p_180439_4_) instanceof MusicDiscItem) {
|
||||
@@ -92,7 +160,7 @@
|
||||
} else {
|
||||
this.func_184377_a((SoundEvent)null, p_180439_3_);
|
||||
}
|
||||
@@ -2382,8 +2392,8 @@
|
||||
@@ -2382,8 +2409,8 @@
|
||||
break;
|
||||
case 2001:
|
||||
BlockState blockstate = Block.func_196257_b(p_180439_4_);
|
||||
@@ -103,7 +171,7 @@
|
||||
this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false);
|
||||
}
|
||||
|
||||
@@ -2531,7 +2541,7 @@
|
||||
@@ -2531,7 +2558,7 @@
|
||||
} else {
|
||||
int i = p_228420_0_.func_226658_a_(LightType.SKY, p_228420_2_);
|
||||
int j = p_228420_0_.func_226658_a_(LightType.BLOCK, p_228420_2_);
|
||||
@@ -112,7 +180,7 @@
|
||||
if (j < k) {
|
||||
j = k;
|
||||
}
|
||||
@@ -2570,6 +2580,11 @@
|
||||
@@ -2570,6 +2597,11 @@
|
||||
return this.field_239226_J_;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) {
|
||||
- if (this.func_177070_b(p_225623_1_)) {
|
||||
- this.func_225629_a_(p_225623_1_, p_225623_1_.func_145748_c_(), p_225623_4_, p_225623_5_, p_225623_6_);
|
||||
+ net.minecraftforge.client.event.RenderNameplateEvent renderNameplateEvent = new net.minecraftforge.client.event.RenderNameplateEvent(p_225623_1_, p_225623_1_.func_145748_c_(), this, p_225623_4_, p_225623_5_, p_225623_6_);
|
||||
+ net.minecraftforge.client.event.RenderNameplateEvent renderNameplateEvent = new net.minecraftforge.client.event.RenderNameplateEvent(p_225623_1_, p_225623_1_.func_145748_c_(), this, p_225623_4_, p_225623_5_, p_225623_6_, p_225623_3_);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(renderNameplateEvent);
|
||||
+ if (renderNameplateEvent.getResult() != net.minecraftforge.eventbus.api.Event.Result.DENY && (renderNameplateEvent.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || this.func_177070_b(p_225623_1_))) {
|
||||
+ this.func_225629_a_(p_225623_1_, renderNameplateEvent.getContent(), p_225623_4_, p_225623_5_, p_225623_6_);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
private final ItemCameraTransforms field_177651_f;
|
||||
|
||||
+ public Builder(net.minecraftforge.client.model.IModelConfiguration model, ItemOverrideList overrides) {
|
||||
+ this(model.useSmoothLighting(), model.isShadedInGui(), model.isSideLit(), model.getCameraTransforms(), overrides);
|
||||
+ this(model.useSmoothLighting(), model.isSideLit(), model.isShadedInGui(), model.getCameraTransforms(), overrides);
|
||||
+ }
|
||||
+
|
||||
public Builder(BlockModel p_i230060_1_, ItemOverrideList p_i230060_2_, boolean p_i230060_3_) {
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
public boolean func_151470_d() {
|
||||
- return this.field_74513_e;
|
||||
+ return this.field_74513_e && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
|
||||
+ return this.field_74513_e && isConflictContextAndModifierActive();
|
||||
}
|
||||
|
||||
public String func_151466_e() {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/client/settings/ToggleableKeyBinding.java
|
||||
+++ b/net/minecraft/client/settings/ToggleableKeyBinding.java
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public void func_225593_a_(boolean p_225593_1_) {
|
||||
if (this.field_228053_a_.getAsBoolean()) {
|
||||
- if (p_225593_1_) {
|
||||
+ if (p_225593_1_ && isConflictContextAndModifierActive()) {
|
||||
super.func_225593_a_(!this.func_151470_d());
|
||||
}
|
||||
} else {
|
||||
@@ -24,4 +24,5 @@
|
||||
}
|
||||
|
||||
}
|
||||
+ @Override public boolean func_151470_d() { return this.field_74513_e; }
|
||||
}
|
||||
@@ -62,3 +62,11 @@
|
||||
if (p_217384_1_ == this.field_73037_M.field_71439_g) {
|
||||
this.field_73037_M.func_147118_V().func_147682_a(new EntityTickableSound(p_217384_3_, p_217384_4_, p_217384_2_));
|
||||
}
|
||||
@@ -876,6 +893,7 @@
|
||||
}
|
||||
|
||||
public void func_239156_a_(Difficulty p_239156_1_) {
|
||||
+ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_239156_1_, this.field_239153_j_);
|
||||
this.field_239153_j_ = p_239156_1_;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
--- a/net/minecraft/client/world/DimensionRenderInfo.java
|
||||
+++ b/net/minecraft/client/world/DimensionRenderInfo.java
|
||||
@@ -26,6 +26,9 @@
|
||||
private final DimensionRenderInfo.FogType field_241680_e_;
|
||||
private final boolean field_241681_f_;
|
||||
private final boolean field_239212_e_;
|
||||
+ private net.minecraftforge.client.IWeatherRenderHandler weatherRenderHandler = null;
|
||||
+ private net.minecraftforge.client.ISkyRenderHandler skyRenderHandler = null;
|
||||
+ private net.minecraftforge.client.ICloudRenderHandler cloudRenderHandler = null;
|
||||
|
||||
public DimensionRenderInfo(float p_i241259_1_, boolean p_i241259_2_, DimensionRenderInfo.FogType p_i241259_3_, boolean p_i241259_4_, boolean p_i241259_5_) {
|
||||
this.field_239210_c_ = p_i241259_1_;
|
||||
@@ -82,6 +85,28 @@
|
||||
return this.field_239212_e_;
|
||||
}
|
||||
|
||||
+ public void setWeatherRenderHandler(net.minecraftforge.client.IWeatherRenderHandler weatherRenderHandler) {
|
||||
+ this.weatherRenderHandler = weatherRenderHandler;
|
||||
+ }
|
||||
+ public void setSkyRenderHandler(net.minecraftforge.client.ISkyRenderHandler skyRenderHandler) {
|
||||
+ this.skyRenderHandler = skyRenderHandler;
|
||||
+ }
|
||||
+ public void setCloudRenderHandler(net.minecraftforge.client.ICloudRenderHandler cloudRenderHandler) {
|
||||
+ this.cloudRenderHandler = cloudRenderHandler;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public net.minecraftforge.client.ICloudRenderHandler getCloudRenderHandler() {
|
||||
+ return cloudRenderHandler;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public net.minecraftforge.client.IWeatherRenderHandler getWeatherRenderHandler() {
|
||||
+ return weatherRenderHandler;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public net.minecraftforge.client.ISkyRenderHandler getSkyRenderHandler() {
|
||||
+ return skyRenderHandler;
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class End extends DimensionRenderInfo {
|
||||
public End() {
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
this.field_197062_b.findAmbiguities((p_201302_1_, p_201302_2_, p_201302_3_, p_201302_4_) -> {
|
||||
field_197061_a.warn("Ambiguity between arguments {} and {} with inputs: {}", this.field_197062_b.getPath(p_201302_2_), this.field_197062_b.getPath(p_201302_3_), p_201302_4_);
|
||||
@@ -205,6 +206,14 @@
|
||||
@@ -205,7 +206,15 @@
|
||||
|
||||
try {
|
||||
try {
|
||||
- return this.field_197062_b.execute(stringreader, p_197059_1_);
|
||||
+ ParseResults<CommandSource> parse = this.field_197062_b.parse(stringreader, p_197059_1_);
|
||||
+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(parse);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) {
|
||||
@@ -20,6 +21,7 @@
|
||||
+ }
|
||||
+ return 1;
|
||||
+ }
|
||||
return this.field_197062_b.execute(stringreader, p_197059_1_);
|
||||
+ return this.field_197062_b.execute(event.getParseResults());
|
||||
} catch (CommandException commandexception) {
|
||||
p_197059_1_.func_197021_a(commandexception.func_197003_a());
|
||||
return 0;
|
||||
@@ -8,7 +8,24 @@
|
||||
}
|
||||
|
||||
public String func_71501_a() {
|
||||
@@ -121,23 +122,13 @@
|
||||
@@ -87,14 +88,8 @@
|
||||
if (this.field_85060_g != null && this.field_85060_g.length > 0) {
|
||||
p_71506_1_.append("-- Head --\n");
|
||||
p_71506_1_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
||||
- p_71506_1_.append("Stacktrace:\n");
|
||||
-
|
||||
- for(StackTraceElement stacktraceelement : this.field_85060_g) {
|
||||
- p_71506_1_.append("\t").append("at ").append((Object)stacktraceelement);
|
||||
- p_71506_1_.append("\n");
|
||||
- }
|
||||
-
|
||||
- p_71506_1_.append("\n");
|
||||
+ p_71506_1_.append("Stacktrace:");
|
||||
+ p_71506_1_.append(net.minecraftforge.fml.CrashReportExtender.generateEnhancedStackTrace(this.field_85060_g));
|
||||
}
|
||||
|
||||
for(CrashReportCategory crashreportcategory : this.field_71512_c) {
|
||||
@@ -121,23 +116,13 @@
|
||||
throwable.setStackTrace(this.field_71511_b.getStackTrace());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,3 +13,27 @@
|
||||
return this.field_85075_d.length;
|
||||
}
|
||||
}
|
||||
@@ -145,11 +147,7 @@
|
||||
|
||||
if (this.field_85075_d != null && this.field_85075_d.length > 0) {
|
||||
p_85072_1_.append("\nStacktrace:");
|
||||
-
|
||||
- for(StackTraceElement stacktraceelement : this.field_85075_d) {
|
||||
- p_85072_1_.append("\n\tat ");
|
||||
- p_85072_1_.append((Object)stacktraceelement);
|
||||
- }
|
||||
+ p_85072_1_.append(net.minecraftforge.fml.CrashReportExtender.generateEnhancedStackTrace(this.field_85075_d));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -158,6 +156,10 @@
|
||||
return this.field_85075_d;
|
||||
}
|
||||
|
||||
+ public void applyStackTrace(Throwable t) {
|
||||
+ this.field_85075_d = t.getStackTrace();
|
||||
+ }
|
||||
+
|
||||
public static void func_175750_a(CrashReportCategory p_175750_0_, BlockPos p_175750_1_, @Nullable BlockState p_175750_2_) {
|
||||
if (p_175750_2_ != null) {
|
||||
p_175750_0_.func_189529_a("Block", p_175750_2_::toString);
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/data/BlockTagsProvider.java
|
||||
+++ b/net/minecraft/data/BlockTagsProvider.java
|
||||
@@ -8,9 +8,13 @@
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class BlockTagsProvider extends TagsProvider<Block> {
|
||||
+ @Deprecated
|
||||
public BlockTagsProvider(DataGenerator p_i48256_1_) {
|
||||
super(p_i48256_1_, Registry.field_212618_g);
|
||||
}
|
||||
+ public BlockTagsProvider(DataGenerator p_i48256_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) {
|
||||
+ super(p_i48256_1_, Registry.field_212618_g, modId, existingFileHelper);
|
||||
+ }
|
||||
|
||||
protected void func_200432_c() {
|
||||
this.func_240522_a_(BlockTags.field_199897_a).func_240534_a_(Blocks.field_196556_aL, Blocks.field_196557_aM, Blocks.field_196558_aN, Blocks.field_196559_aO, Blocks.field_196560_aP, Blocks.field_196561_aQ, Blocks.field_196562_aR, Blocks.field_196563_aS, Blocks.field_196564_aT, Blocks.field_196565_aU, Blocks.field_196566_aV, Blocks.field_196567_aW, Blocks.field_196568_aX, Blocks.field_196569_aY, Blocks.field_196570_aZ, Blocks.field_196602_ba);
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/data/EntityTypeTagsProvider.java
|
||||
+++ b/net/minecraft/data/EntityTypeTagsProvider.java
|
||||
@@ -7,9 +7,13 @@
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class EntityTypeTagsProvider extends TagsProvider<EntityType<?>> {
|
||||
+ @Deprecated
|
||||
public EntityTypeTagsProvider(DataGenerator p_i50784_1_) {
|
||||
super(p_i50784_1_, Registry.field_212629_r);
|
||||
}
|
||||
+ public EntityTypeTagsProvider(DataGenerator p_i50784_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) {
|
||||
+ super(p_i50784_1_, Registry.field_212629_r, modId, existingFileHelper);
|
||||
+ }
|
||||
|
||||
protected void func_200432_c() {
|
||||
this.func_240522_a_(EntityTypeTags.field_219764_a).func_240534_a_(EntityType.field_200741_ag, EntityType.field_200750_ap, EntityType.field_200722_aA);
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/data/FluidTagsProvider.java
|
||||
+++ b/net/minecraft/data/FluidTagsProvider.java
|
||||
@@ -8,9 +8,13 @@
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class FluidTagsProvider extends TagsProvider<Fluid> {
|
||||
+ @Deprecated
|
||||
public FluidTagsProvider(DataGenerator p_i49156_1_) {
|
||||
super(p_i49156_1_, Registry.field_212619_h);
|
||||
}
|
||||
+ public FluidTagsProvider(DataGenerator p_i49156_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) {
|
||||
+ super(p_i49156_1_, Registry.field_212619_h, modId, existingFileHelper);
|
||||
+ }
|
||||
|
||||
protected void func_200432_c() {
|
||||
this.func_240522_a_(FluidTags.field_206959_a).func_240534_a_(Fluids.field_204546_a, Fluids.field_207212_b);
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/net/minecraft/data/ItemTagsProvider.java
|
||||
+++ b/net/minecraft/data/ItemTagsProvider.java
|
||||
@@ -14,10 +14,15 @@
|
||||
public class ItemTagsProvider extends TagsProvider<Item> {
|
||||
private final Function<ITag.INamedTag<Block>, ITag.Builder> field_240520_d_;
|
||||
|
||||
+ @Deprecated
|
||||
public ItemTagsProvider(DataGenerator p_i232552_1_, BlockTagsProvider p_i232552_2_) {
|
||||
super(p_i232552_1_, Registry.field_212630_s);
|
||||
this.field_240520_d_ = p_i232552_2_::func_240525_b_;
|
||||
}
|
||||
+ public ItemTagsProvider(DataGenerator p_i232552_1_, BlockTagsProvider p_i232552_2_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) {
|
||||
+ super(p_i232552_1_, Registry.field_212630_s, modId, existingFileHelper);
|
||||
+ this.field_240520_d_ = p_i232552_2_::func_240525_b_;
|
||||
+ }
|
||||
|
||||
protected void func_200432_c() {
|
||||
this.func_240521_a_(BlockTags.field_199897_a, ItemTags.field_199904_a);
|
||||
@@ -26,7 +26,7 @@
|
||||
+ Collection<Path> existingPacks = optionset.valuesOf(existing).stream().map(Paths::get).collect(Collectors.toList());
|
||||
+ java.util.Set<String> mods = new java.util.HashSet<>(optionset.valuesOf(mod));
|
||||
+ boolean isFlat = mods.isEmpty() || optionset.has(flat);
|
||||
+ net.minecraftforge.fml.ModLoader.get().runDataGenerator(mods, path, inputs, existingPacks, flag2, flag1, flag3, flag4, flag5, isFlat);
|
||||
+ net.minecraftforge.fml.DatagenModLoader.begin(mods, path, inputs, existingPacks, flag2, flag1, flag3, flag4, flag5, isFlat);
|
||||
+ if (mods.contains("minecraft") || mods.isEmpty())
|
||||
+ func_200264_a(isFlat ? path : path.resolve("minecraft"), inputs, flag1, flag2, flag3, flag4, flag5).func_200392_c();
|
||||
} else {
|
||||
|
||||
@@ -1,26 +1,33 @@
|
||||
--- a/net/minecraft/data/TagsProvider.java
|
||||
+++ b/net/minecraft/data/TagsProvider.java
|
||||
@@ -28,11 +28,17 @@
|
||||
@@ -28,10 +28,18 @@
|
||||
protected final DataGenerator field_200433_a;
|
||||
protected final Registry<T> field_200435_c;
|
||||
protected final Map<ResourceLocation, ITag.Builder> field_200434_b = Maps.newLinkedHashMap();
|
||||
+ protected String modId;
|
||||
+ protected final String modId;
|
||||
+ protected final net.minecraftforge.common.data.ExistingFileHelper existingFileHelper;
|
||||
|
||||
+ @Deprecated//Forge, Use ModID version.
|
||||
protected TagsProvider(DataGenerator p_i49827_1_, Registry<T> p_i49827_2_) {
|
||||
- this.field_200433_a = p_i49827_1_;
|
||||
- this.field_200435_c = p_i49827_2_;
|
||||
+ this(p_i49827_1_, p_i49827_2_, "vanilla");
|
||||
}
|
||||
+ protected TagsProvider(DataGenerator generatorIn, Registry<T> registryIn, String modId) {
|
||||
+ this.field_200433_a = generatorIn;
|
||||
+ this.field_200435_c = registryIn;
|
||||
+ this.modId = modId;
|
||||
+ this(p_i49827_1_, p_i49827_2_, "vanilla", null);
|
||||
+ }
|
||||
+ protected TagsProvider(DataGenerator p_i49827_1_, Registry<T> p_i49827_2_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) {
|
||||
this.field_200433_a = p_i49827_1_;
|
||||
this.field_200435_c = p_i49827_2_;
|
||||
+ this.modId = modId;
|
||||
+ this.existingFileHelper = existingFileHelper;
|
||||
}
|
||||
|
||||
protected abstract void func_200432_c();
|
||||
|
||||
@@ -53,6 +59,7 @@
|
||||
@@ -47,12 +55,14 @@
|
||||
return this.field_200435_c.func_241873_b(p_240527_1_).orElse((T)null);
|
||||
};
|
||||
this.field_200434_b.forEach((p_240524_4_, p_240524_5_) -> {
|
||||
- List<ITag.Proxy> list = p_240524_5_.func_232963_b_(function, function1).collect(Collectors.toList());
|
||||
+ // FORGE: Add validation via existing resources
|
||||
+ List<ITag.Proxy> list = p_240524_5_.func_232963_b_(function, function1).filter(this::missing).collect(Collectors.toList());
|
||||
if (!list.isEmpty()) {
|
||||
throw new IllegalArgumentException(String.format("Couldn't define tag %s as it is missing following references: %s", p_240524_4_, list.stream().map(Objects::toString).collect(Collectors.joining(","))));
|
||||
} else {
|
||||
JsonObject jsonobject = p_240524_5_.func_232965_c_();
|
||||
Path path = this.func_200431_a(p_240524_4_);
|
||||
@@ -28,7 +35,26 @@
|
||||
|
||||
try {
|
||||
String s = field_200437_e.toJson((JsonElement)jsonobject);
|
||||
@@ -78,7 +85,7 @@
|
||||
@@ -74,11 +84,26 @@
|
||||
});
|
||||
}
|
||||
|
||||
+ private boolean missing(ITag.Proxy reference) {
|
||||
+ ITag.ITagEntry entry = reference.func_232968_a_();
|
||||
+ // We only care about non-optional tag entries, this is the only type that can reference a resource and needs validation
|
||||
+ // Optional tags should not be validated
|
||||
+ if (entry instanceof ITag.TagEntry) {
|
||||
+ return existingFileHelper == null || !existingFileHelper.exists(((ITag.TagEntry)entry).getId(), net.minecraft.resources.ResourcePackType.SERVER_DATA, ".json", "tags/" + getTagFolder());
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
+ protected String getTagFolder() {
|
||||
+ return ((Registry)Registry.field_212617_f).func_177774_c(field_200435_c).func_110623_a() + "s";
|
||||
+ }
|
||||
+
|
||||
protected abstract Path func_200431_a(ResourceLocation p_200431_1_);
|
||||
|
||||
protected TagsProvider.Builder<T> func_240522_a_(ITag.INamedTag<T> p_240522_1_) {
|
||||
ITag.Builder itag$builder = this.func_240525_b_(p_240522_1_);
|
||||
@@ -37,7 +63,7 @@
|
||||
}
|
||||
|
||||
protected ITag.Builder func_240525_b_(ITag.INamedTag<T> p_240525_1_) {
|
||||
@@ -87,7 +94,7 @@
|
||||
@@ -87,7 +112,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,7 +72,7 @@
|
||||
private final ITag.Builder field_240528_a_;
|
||||
private final Registry<T> field_240529_b_;
|
||||
private final String field_240530_c_;
|
||||
@@ -115,5 +122,18 @@
|
||||
@@ -115,5 +140,18 @@
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
for(Enchantment enchantment : Registry.field_212628_q) {
|
||||
- if ((!enchantment.func_185261_e() || p_185291_2_) && enchantment.func_230310_i_() && (enchantment.field_77351_y.func_77557_a(item) || flag)) {
|
||||
+ if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag && enchantment.isAllowedOnBooks()))) {
|
||||
+ if ((!enchantment.func_185261_e() || p_185291_2_) && enchantment.func_230310_i_() && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag && enchantment.isAllowedOnBooks()))) {
|
||||
for(int i = enchantment.func_77325_b(); i > enchantment.func_77319_d() - 1; --i) {
|
||||
if (p_185291_0_ >= enchantment.func_77321_a(i) && p_185291_0_ <= enchantment.func_223551_b(i)) {
|
||||
list.add(new EnchantmentData(enchantment, i));
|
||||
@@ -31,18 +31,20 @@
|
||||
this.field_200606_g = p_i48580_1_;
|
||||
this.field_70170_p = p_i48580_2_;
|
||||
this.field_213325_aI = p_i48580_1_.func_220334_j();
|
||||
@@ -211,7 +214,9 @@
|
||||
@@ -211,7 +214,11 @@
|
||||
this.field_70180_af.func_187214_a(field_189655_aD, false);
|
||||
this.field_70180_af.func_187214_a(field_213330_X, Pose.STANDING);
|
||||
this.func_70088_a();
|
||||
- this.field_213326_aJ = this.func_213316_a(Pose.STANDING, this.field_213325_aI);
|
||||
+ this.field_213326_aJ = getEyeHeightForge(Pose.STANDING, this.field_213325_aI);
|
||||
+ net.minecraftforge.event.entity.EntityEvent.Size sizeEvent = net.minecraftforge.event.ForgeEventFactory.getEntitySizeForge(this, Pose.STANDING, this.field_213325_aI, this.func_213316_a(Pose.STANDING, this.field_213325_aI));
|
||||
+ this.field_213325_aI = sizeEvent.getNewSize();
|
||||
+ this.field_213326_aJ = sizeEvent.getNewEyeHeight();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this));
|
||||
+ this.gatherCapabilities();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -317,7 +322,13 @@
|
||||
@@ -317,7 +324,13 @@
|
||||
}
|
||||
|
||||
public void func_70106_y() {
|
||||
@@ -56,7 +58,7 @@
|
||||
}
|
||||
|
||||
public void func_213301_b(Pose p_213301_1_) {
|
||||
@@ -330,6 +341,7 @@
|
||||
@@ -330,6 +343,7 @@
|
||||
|
||||
public boolean func_233562_a_(Entity p_233562_1_, double p_233562_2_) {
|
||||
double d0 = p_233562_1_.field_233557_ao_.field_72450_a - this.field_233557_ao_.field_72450_a;
|
||||
@@ -64,7 +66,7 @@
|
||||
double d1 = p_233562_1_.field_233557_ao_.field_72448_b - this.field_233557_ao_.field_72448_b;
|
||||
double d2 = p_233562_1_.field_233557_ao_.field_72449_c - this.field_233557_ao_.field_72449_c;
|
||||
return d0 * d0 + d1 * d1 + d2 * d2 < p_233562_2_ * p_233562_2_;
|
||||
@@ -560,7 +572,7 @@
|
||||
@@ -560,7 +574,7 @@
|
||||
|
||||
this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(func_213296_b(vector3d)) * 0.6D);
|
||||
this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d0 * d0 + d1 * d1 + d2 * d2) * 0.6D);
|
||||
@@ -73,7 +75,7 @@
|
||||
this.field_70150_b = this.func_203009_ad();
|
||||
if (this.func_70090_H()) {
|
||||
Entity entity = this.func_184207_aI() && this.func_184179_bs() != null ? this.func_184179_bs() : this;
|
||||
@@ -575,7 +587,7 @@
|
||||
@@ -575,7 +589,7 @@
|
||||
} else {
|
||||
this.func_180429_a(blockpos, blockstate);
|
||||
}
|
||||
@@ -82,7 +84,7 @@
|
||||
this.field_191959_ay = this.func_191954_d(this.field_82151_R);
|
||||
}
|
||||
}
|
||||
@@ -591,8 +603,9 @@
|
||||
@@ -591,8 +605,9 @@
|
||||
|
||||
float f2 = this.func_225515_ai_();
|
||||
this.func_213317_d(this.func_213322_ci().func_216372_d((double)f2, 1.0D, (double)f2));
|
||||
@@ -94,7 +96,7 @@
|
||||
}) && this.field_190534_ay <= 0) {
|
||||
this.func_241209_g_(-this.func_190531_bD());
|
||||
}
|
||||
@@ -611,11 +624,10 @@
|
||||
@@ -611,11 +626,10 @@
|
||||
int j = MathHelper.func_76128_c(this.field_233557_ao_.field_72448_b - (double)0.2F);
|
||||
int k = MathHelper.func_76128_c(this.field_233557_ao_.field_72449_c);
|
||||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
@@ -108,7 +110,7 @@
|
||||
return blockpos1;
|
||||
}
|
||||
}
|
||||
@@ -801,6 +813,7 @@
|
||||
@@ -801,6 +815,7 @@
|
||||
public void func_174829_m() {
|
||||
AxisAlignedBB axisalignedbb = this.func_174813_aQ();
|
||||
this.func_226288_n_((axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D, axisalignedbb.field_72338_b, (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D);
|
||||
@@ -116,7 +118,7 @@
|
||||
}
|
||||
|
||||
protected SoundEvent func_184184_Z() {
|
||||
@@ -849,7 +862,7 @@
|
||||
@@ -849,7 +864,7 @@
|
||||
protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) {
|
||||
if (!p_180429_2_.func_185904_a().func_76224_d()) {
|
||||
BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a());
|
||||
@@ -125,7 +127,7 @@
|
||||
this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b());
|
||||
}
|
||||
}
|
||||
@@ -1056,9 +1069,10 @@
|
||||
@@ -1056,9 +1071,10 @@
|
||||
int k = MathHelper.func_76128_c(this.func_226281_cx_());
|
||||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
@@ -137,7 +139,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1377,6 +1391,7 @@
|
||||
@@ -1377,6 +1393,7 @@
|
||||
if (this.field_184238_ar) {
|
||||
p_189511_1_.func_74757_a("Glowing", this.field_184238_ar);
|
||||
}
|
||||
@@ -145,7 +147,7 @@
|
||||
|
||||
if (!this.field_184236_aF.isEmpty()) {
|
||||
ListNBT listnbt = new ListNBT();
|
||||
@@ -1388,6 +1403,10 @@
|
||||
@@ -1388,6 +1405,10 @@
|
||||
p_189511_1_.func_218657_a("Tags", listnbt);
|
||||
}
|
||||
|
||||
@@ -156,7 +158,7 @@
|
||||
this.func_213281_b(p_189511_1_);
|
||||
if (this.func_184207_aI()) {
|
||||
ListNBT listnbt1 = new ListNBT();
|
||||
@@ -1458,6 +1477,9 @@
|
||||
@@ -1458,6 +1479,9 @@
|
||||
this.func_174810_b(p_70020_1_.func_74767_n("Silent"));
|
||||
this.func_189654_d(p_70020_1_.func_74767_n("NoGravity"));
|
||||
this.func_184195_f(p_70020_1_.func_74767_n("Glowing"));
|
||||
@@ -166,7 +168,7 @@
|
||||
if (p_70020_1_.func_150297_b("Tags", 9)) {
|
||||
this.field_184236_aF.clear();
|
||||
ListNBT listnbt3 = p_70020_1_.func_150295_c("Tags", 8);
|
||||
@@ -1546,6 +1568,8 @@
|
||||
@@ -1546,6 +1570,8 @@
|
||||
} else {
|
||||
ItemEntity itementity = new ItemEntity(this.field_70170_p, this.func_226277_ct_(), this.func_226278_cu_() + (double)p_70099_2_, this.func_226281_cx_(), p_70099_1_);
|
||||
itementity.func_174869_p();
|
||||
@@ -175,7 +177,7 @@
|
||||
this.field_70170_p.func_217376_c(itementity);
|
||||
return itementity;
|
||||
}
|
||||
@@ -1582,6 +1606,7 @@
|
||||
@@ -1582,6 +1608,7 @@
|
||||
|
||||
public void func_70098_U() {
|
||||
this.func_213317_d(Vector3d.field_186680_a);
|
||||
@@ -183,7 +185,7 @@
|
||||
this.func_70071_h_();
|
||||
if (this.func_184218_aH()) {
|
||||
this.func_184187_bx().func_184232_k(this);
|
||||
@@ -1627,6 +1652,7 @@
|
||||
@@ -1627,6 +1654,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +193,7 @@
|
||||
if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) {
|
||||
if (this.func_184218_aH()) {
|
||||
this.func_184210_p();
|
||||
@@ -1659,6 +1685,7 @@
|
||||
@@ -1659,6 +1687,7 @@
|
||||
public void func_233575_bb_() {
|
||||
if (this.field_184239_as != null) {
|
||||
Entity entity = this.field_184239_as;
|
||||
@@ -199,7 +201,7 @@
|
||||
this.field_184239_as = null;
|
||||
entity.func_184225_p(this);
|
||||
}
|
||||
@@ -1816,6 +1843,7 @@
|
||||
@@ -1816,6 +1845,7 @@
|
||||
return !this.func_184188_bt().isEmpty();
|
||||
}
|
||||
|
||||
@@ -207,7 +209,7 @@
|
||||
public boolean func_205710_ba() {
|
||||
return true;
|
||||
}
|
||||
@@ -2032,7 +2060,7 @@
|
||||
@@ -2032,7 +2062,7 @@
|
||||
}
|
||||
|
||||
protected ITextComponent func_225513_by_() {
|
||||
@@ -216,7 +218,7 @@
|
||||
}
|
||||
|
||||
public boolean func_70028_i(Entity p_70028_1_) {
|
||||
@@ -2087,6 +2115,10 @@
|
||||
@@ -2087,14 +2117,19 @@
|
||||
|
||||
@Nullable
|
||||
public Entity func_241206_a_(ServerWorld p_241206_1_) {
|
||||
@@ -227,15 +229,18 @@
|
||||
if (this.field_70170_p instanceof ServerWorld && !this.field_70128_L) {
|
||||
this.field_70170_p.func_217381_Z().func_76320_a("changeDimension");
|
||||
this.func_213319_R();
|
||||
@@ -2095,6 +2127,7 @@
|
||||
if (portalinfo == null) {
|
||||
this.field_70170_p.func_217381_Z().func_76320_a("reposition");
|
||||
- PortalInfo portalinfo = this.func_241829_a(p_241206_1_);
|
||||
- if (portalinfo == null) {
|
||||
+ PortalInfo portalinfo = teleporter.isVanilla() ? this.func_241829_a(p_241206_1_) : null;
|
||||
+ if (portalinfo == null && teleporter.isVanilla()) {
|
||||
return null;
|
||||
} else {
|
||||
+ Entity transportedEntity = teleporter.placeEntity(this, (ServerWorld) this.field_70170_p, p_241206_1_, this.field_70177_z, spawnPortal -> { //Forge: Start vanilla logic
|
||||
this.field_70170_p.func_217381_Z().func_219895_b("reloading");
|
||||
Entity entity = this.func_200600_R().func_200721_a(p_241206_1_);
|
||||
if (entity != null) {
|
||||
@@ -2102,17 +2135,19 @@
|
||||
@@ -2102,17 +2137,19 @@
|
||||
entity.func_70012_b(portalinfo.field_222505_a.field_72450_a, portalinfo.field_222505_a.field_72448_b, portalinfo.field_222505_a.field_72449_c, portalinfo.field_242960_c, entity.field_70125_A);
|
||||
entity.func_213317_d(portalinfo.field_222506_b);
|
||||
p_241206_1_.func_217460_e(entity);
|
||||
@@ -257,16 +262,20 @@
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
@@ -2322,7 +2357,7 @@
|
||||
@@ -2320,9 +2357,10 @@
|
||||
public void func_213323_x_() {
|
||||
EntitySize entitysize = this.field_213325_aI;
|
||||
Pose pose = this.func_213283_Z();
|
||||
EntitySize entitysize1 = this.func_213305_a(pose);
|
||||
- EntitySize entitysize1 = this.func_213305_a(pose);
|
||||
+ net.minecraftforge.event.entity.EntityEvent.Size sizeEvent = net.minecraftforge.event.ForgeEventFactory.getEntitySizeForge(this, pose, this.func_213305_a(pose), this.func_213316_a(pose, entitysize));
|
||||
+ EntitySize entitysize1 = sizeEvent.getNewSize();
|
||||
this.field_213325_aI = entitysize1;
|
||||
- this.field_213326_aJ = this.func_213316_a(pose, entitysize1);
|
||||
+ this.field_213326_aJ = getEyeHeightForge(pose, entitysize1);
|
||||
+ this.field_213326_aJ = sizeEvent.getNewEyeHeight();
|
||||
if (entitysize1.field_220315_a < entitysize.field_220315_a) {
|
||||
double d0 = (double)entitysize1.field_220315_a / 2.0D;
|
||||
this.func_174826_a(new AxisAlignedBB(this.func_226277_ct_() - d0, this.func_226278_cu_(), this.func_226281_cx_() - d0, this.func_226277_ct_() + d0, this.func_226278_cu_() + (double)entitysize1.field_220316_b, this.func_226281_cx_() + d0));
|
||||
@@ -2796,6 +2831,7 @@
|
||||
@@ -2796,6 +2834,7 @@
|
||||
|
||||
this.field_233555_aA_ = true;
|
||||
}
|
||||
@@ -274,7 +283,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -2811,4 +2847,69 @@
|
||||
@@ -2811,4 +2850,63 @@
|
||||
public interface IMoveCallback {
|
||||
void accept(Entity p_accept_1_, double p_accept_2_, double p_accept_4_, double p_accept_6_);
|
||||
}
|
||||
@@ -336,11 +345,5 @@
|
||||
+ public void revive() {
|
||||
+ this.field_70128_L = false;
|
||||
+ this.reviveCaps();
|
||||
+ }
|
||||
+
|
||||
+ private float getEyeHeightForge(Pose pose, EntitySize size) {
|
||||
+ net.minecraftforge.event.entity.EntityEvent.EyeHeight evt = new net.minecraftforge.event.entity.EntityEvent.EyeHeight(this, pose, size, this.func_213316_a(pose, size));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(evt);
|
||||
+ return evt.getNewHeight();
|
||||
+ }
|
||||
}
|
||||
@@ -343,6 +343,15 @@
|
||||
float f4 = this.field_70122_E ? f3 * 0.91F : 0.91F;
|
||||
Vector3d vector3d5 = this.func_233633_a_(p_213352_1_, f3);
|
||||
double d2 = vector3d5.field_72448_b;
|
||||
@@ -2049,7 +2081,7 @@
|
||||
double d0 = MathHelper.func_151237_a(p_213362_1_.field_72450_a, (double)-0.15F, (double)0.15F);
|
||||
double d1 = MathHelper.func_151237_a(p_213362_1_.field_72449_c, (double)-0.15F, (double)0.15F);
|
||||
double d2 = Math.max(p_213362_1_.field_72448_b, (double)-0.15F);
|
||||
- if (d2 < 0.0D && !this.func_213339_cH().func_203425_a(Blocks.field_222420_lI) && this.func_230491_ea_() && this instanceof PlayerEntity) {
|
||||
+ if (d2 < 0.0D && !this.func_213339_cH().isScaffolding(this) && this.func_230491_ea_() && this instanceof PlayerEntity) {
|
||||
d2 = 0.0D;
|
||||
}
|
||||
|
||||
@@ -2077,6 +2109,7 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
if (entity != null) {
|
||||
double d0 = entity.func_70068_e(this);
|
||||
int i = this.func_200600_R().func_220339_d().func_233671_f_();
|
||||
@@ -878,6 +887,8 @@
|
||||
@@ -879,6 +888,8 @@
|
||||
}
|
||||
|
||||
public static EquipmentSlotType func_184640_d(ItemStack p_184640_0_) {
|
||||
@@ -41,7 +41,7 @@
|
||||
Item item = p_184640_0_.func_77973_b();
|
||||
if (item != Blocks.field_196625_cS.func_199767_j() && (!(item instanceof BlockItem) || !(((BlockItem)item).func_179223_d() instanceof AbstractSkullBlock))) {
|
||||
if (item instanceof ArmorItem) {
|
||||
@@ -885,7 +896,7 @@
|
||||
@@ -886,7 +897,7 @@
|
||||
} else if (item == Items.field_185160_cR) {
|
||||
return EquipmentSlotType.CHEST;
|
||||
} else {
|
||||
|
||||
+3
-3
@@ -207,9 +207,9 @@
|
||||
+ private boolean canUseRail = true;
|
||||
+ @Override public boolean canUseRail() { return canUseRail; }
|
||||
+ @Override public void setCanUseRail(boolean value) { this.canUseRail = value; }
|
||||
+ private float currentSpeedOnRail;
|
||||
+ @Override public float getCurrentCartSpeedCapOnRail() { return currentSpeedOnRail; }
|
||||
+ @Override public void setCurrentCartSpeedCapOnRail(float value) { currentSpeedOnRail = Math.min(value, getMaxCartSpeedOnRail()); }
|
||||
+ private float currentSpeedCapOnRail = getMaxCartSpeedOnRail();
|
||||
+ @Override public float getCurrentCartSpeedCapOnRail() { return currentSpeedCapOnRail; }
|
||||
+ @Override public void setCurrentCartSpeedCapOnRail(float value) { currentSpeedCapOnRail = Math.min(value, getMaxCartSpeedOnRail()); }
|
||||
+ private float maxSpeedAirLateral = DEFAULT_MAX_SPEED_AIR_LATERAL;
|
||||
+ @Override public float getMaxSpeedAirLateral() { return maxSpeedAirLateral; }
|
||||
+ @Override public void setMaxSpeedAirLateral(float value) { maxSpeedAirLateral = value; }
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/entity/monster/PhantomEntity.java
|
||||
+++ b/net/minecraft/entity/monster/PhantomEntity.java
|
||||
@@ -214,7 +214,7 @@
|
||||
this.field_203142_b = 60;
|
||||
List<PlayerEntity> list = PhantomEntity.this.field_70170_p.func_217373_a(this.field_220842_b, PhantomEntity.this, PhantomEntity.this.func_174813_aQ().func_72314_b(16.0D, 64.0D, 16.0D));
|
||||
if (!list.isEmpty()) {
|
||||
- list.sort(Comparator.comparing(Entity::func_226278_cu_).reversed());
|
||||
+ list.sort(Comparator.<Entity, Double>comparing(Entity::func_226278_cu_).reversed());
|
||||
|
||||
for(PlayerEntity playerentity : list) {
|
||||
if (PhantomEntity.this.func_213344_a(playerentity, EntityPredicate.field_221016_a)) {
|
||||
@@ -8,16 +8,17 @@
|
||||
public static final EntitySize field_213835_bs = EntitySize.func_220314_b(0.6F, 1.8F);
|
||||
private static final Map<Pose, EntitySize> field_213836_b = ImmutableMap.<Pose, EntitySize>builder().put(Pose.STANDING, field_213835_bs).put(Pose.SLEEPING, field_213377_as).put(Pose.FALL_FLYING, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SWIMMING, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SPIN_ATTACK, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.CROUCHING, EntitySize.func_220314_b(0.6F, 1.5F)).put(Pose.DYING, EntitySize.func_220311_c(0.2F, 0.2F)).build();
|
||||
private static final DataParameter<Float> field_184829_a = EntityDataManager.func_187226_a(PlayerEntity.class, DataSerializers.field_187193_c);
|
||||
@@ -150,6 +151,8 @@
|
||||
@@ -150,6 +151,9 @@
|
||||
private final CooldownTracker field_184832_bU = this.func_184815_l();
|
||||
@Nullable
|
||||
public FishingBobberEntity field_71104_cf;
|
||||
+ private final java.util.Collection<IFormattableTextComponent> prefixes = new java.util.LinkedList<>();
|
||||
+ private final java.util.Collection<IFormattableTextComponent> suffixes = new java.util.LinkedList<>();
|
||||
+ @Nullable private Pose forcedPose;
|
||||
|
||||
public PlayerEntity(World p_i241920_1_, BlockPos p_i241920_2_, float p_i241920_3_, GameProfile p_i241920_4_) {
|
||||
super(EntityType.field_200729_aH, p_i241920_1_);
|
||||
@@ -175,7 +178,7 @@
|
||||
@@ -175,7 +179,7 @@
|
||||
}
|
||||
|
||||
public static AttributeModifierMap.MutableAttribute func_234570_el_() {
|
||||
@@ -26,7 +27,7 @@
|
||||
}
|
||||
|
||||
protected void func_70088_a() {
|
||||
@@ -189,6 +192,7 @@
|
||||
@@ -189,6 +193,7 @@
|
||||
}
|
||||
|
||||
public void func_70071_h_() {
|
||||
@@ -34,7 +35,7 @@
|
||||
this.field_70145_X = this.func_175149_v();
|
||||
if (this.func_175149_v()) {
|
||||
this.field_70122_E = false;
|
||||
@@ -204,7 +208,7 @@
|
||||
@@ -204,7 +209,7 @@
|
||||
this.field_71076_b = 100;
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@
|
||||
this.func_225652_a_(false, true);
|
||||
}
|
||||
} else if (this.field_71076_b > 0) {
|
||||
@@ -258,6 +262,7 @@
|
||||
@@ -258,6 +263,7 @@
|
||||
this.func_203041_m();
|
||||
this.field_184832_bU.func_185144_a();
|
||||
this.func_213832_dB();
|
||||
@@ -51,7 +52,18 @@
|
||||
}
|
||||
|
||||
public boolean func_226563_dT_() {
|
||||
@@ -550,6 +555,7 @@
|
||||
@@ -333,6 +339,10 @@
|
||||
}
|
||||
|
||||
protected void func_213832_dB() {
|
||||
+ if(forcedPose != null) {
|
||||
+ this.func_213301_b(forcedPose);
|
||||
+ return;
|
||||
+ }
|
||||
if (this.func_213298_c(Pose.SWIMMING)) {
|
||||
Pose pose;
|
||||
if (this.func_184613_cA()) {
|
||||
@@ -550,6 +560,7 @@
|
||||
}
|
||||
|
||||
public void func_70645_a(DamageSource p_70645_1_) {
|
||||
@@ -59,7 +71,7 @@
|
||||
super.func_70645_a(p_70645_1_);
|
||||
this.func_226264_Z_();
|
||||
if (!this.func_175149_v()) {
|
||||
@@ -603,12 +609,14 @@
|
||||
@@ -603,12 +614,14 @@
|
||||
}
|
||||
|
||||
public boolean func_225609_n_(boolean p_225609_1_) {
|
||||
@@ -76,7 +88,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -646,7 +654,12 @@
|
||||
@@ -646,7 +659,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +101,7 @@
|
||||
float f = this.field_71071_by.func_184438_a(p_184813_1_);
|
||||
if (f > 1.0F) {
|
||||
int i = EnchantmentHelper.func_185293_e(this);
|
||||
@@ -688,11 +701,12 @@
|
||||
@@ -688,11 +706,12 @@
|
||||
f /= 5.0F;
|
||||
}
|
||||
|
||||
@@ -103,7 +115,7 @@
|
||||
}
|
||||
|
||||
public void func_70037_a(CompoundNBT p_70037_1_) {
|
||||
@@ -767,6 +781,7 @@
|
||||
@@ -767,6 +786,7 @@
|
||||
}
|
||||
|
||||
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
@@ -111,7 +123,7 @@
|
||||
if (this.func_180431_b(p_70097_1_)) {
|
||||
return false;
|
||||
} else if (this.field_71075_bZ.field_75102_a && !p_70097_1_.func_76357_e()) {
|
||||
@@ -798,7 +813,7 @@
|
||||
@@ -798,7 +818,7 @@
|
||||
|
||||
protected void func_190629_c(LivingEntity p_190629_1_) {
|
||||
super.func_190629_c(p_190629_1_);
|
||||
@@ -120,7 +132,7 @@
|
||||
this.func_190777_m(true);
|
||||
}
|
||||
|
||||
@@ -819,7 +834,7 @@
|
||||
@@ -819,7 +839,7 @@
|
||||
}
|
||||
|
||||
protected void func_184590_k(float p_184590_1_) {
|
||||
@@ -129,7 +141,7 @@
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
this.func_71029_a(Stats.field_75929_E.func_199076_b(this.field_184627_bm.func_77973_b()));
|
||||
}
|
||||
@@ -829,6 +844,7 @@
|
||||
@@ -829,6 +849,7 @@
|
||||
Hand hand = this.func_184600_cs();
|
||||
this.field_184627_bm.func_222118_a(i, this, (p_213833_1_) -> {
|
||||
p_213833_1_.func_213334_d(hand);
|
||||
@@ -137,7 +149,7 @@
|
||||
});
|
||||
if (this.field_184627_bm.func_190926_b()) {
|
||||
if (hand == Hand.MAIN_HAND) {
|
||||
@@ -847,10 +863,13 @@
|
||||
@@ -847,10 +868,13 @@
|
||||
|
||||
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
|
||||
if (!this.func_180431_b(p_70665_1_)) {
|
||||
@@ -151,7 +163,7 @@
|
||||
float f = p_70665_2_ - f2;
|
||||
if (f > 0.0F && f < 3.4028235E37F) {
|
||||
this.func_195067_a(Stats.field_212738_J, Math.round(f * 10.0F));
|
||||
@@ -909,6 +928,8 @@
|
||||
@@ -909,6 +933,8 @@
|
||||
|
||||
return ActionResultType.PASS;
|
||||
} else {
|
||||
@@ -160,7 +172,7 @@
|
||||
ItemStack itemstack = this.func_184586_b(p_190775_2_);
|
||||
ItemStack itemstack1 = itemstack.func_77946_l();
|
||||
ActionResultType actionresulttype = p_190775_1_.func_184230_a(this, p_190775_2_);
|
||||
@@ -917,6 +938,9 @@
|
||||
@@ -917,6 +943,9 @@
|
||||
itemstack.func_190920_e(itemstack1.func_190916_E());
|
||||
}
|
||||
|
||||
@@ -170,7 +182,7 @@
|
||||
return actionresulttype;
|
||||
} else {
|
||||
if (!itemstack.func_190926_b() && p_190775_1_ instanceof LivingEntity) {
|
||||
@@ -927,6 +951,7 @@
|
||||
@@ -927,6 +956,7 @@
|
||||
ActionResultType actionresulttype1 = itemstack.func_111282_a_(this, (LivingEntity)p_190775_1_, p_190775_2_);
|
||||
if (actionresulttype1.func_226246_a_()) {
|
||||
if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d) {
|
||||
@@ -178,7 +190,7 @@
|
||||
this.func_184611_a(p_190775_2_, ItemStack.field_190927_a);
|
||||
}
|
||||
|
||||
@@ -1011,6 +1036,7 @@
|
||||
@@ -1011,6 +1041,7 @@
|
||||
}
|
||||
|
||||
public void func_71059_n(Entity p_71059_1_) {
|
||||
@@ -186,7 +198,7 @@
|
||||
if (p_71059_1_.func_70075_an()) {
|
||||
if (!p_71059_1_.func_85031_j(this)) {
|
||||
float f = (float)this.func_233637_b_(Attributes.field_233823_f_);
|
||||
@@ -1038,8 +1064,10 @@
|
||||
@@ -1038,8 +1069,10 @@
|
||||
|
||||
boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(Effects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof LivingEntity;
|
||||
flag2 = flag2 && !this.func_70051_ag();
|
||||
@@ -198,7 +210,7 @@
|
||||
}
|
||||
|
||||
f = f + f1;
|
||||
@@ -1127,8 +1155,10 @@
|
||||
@@ -1127,8 +1160,10 @@
|
||||
}
|
||||
|
||||
if (!this.field_70170_p.field_72995_K && !itemstack1.func_190926_b() && entity instanceof LivingEntity) {
|
||||
@@ -209,7 +221,7 @@
|
||||
this.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a);
|
||||
}
|
||||
}
|
||||
@@ -1170,7 +1200,7 @@
|
||||
@@ -1170,7 +1205,7 @@
|
||||
}
|
||||
|
||||
if (this.field_70146_Z.nextFloat() < f) {
|
||||
@@ -218,7 +230,7 @@
|
||||
this.func_184602_cy();
|
||||
this.field_70170_p.func_72960_a(this, (byte)30);
|
||||
}
|
||||
@@ -1196,8 +1226,9 @@
|
||||
@@ -1196,8 +1231,9 @@
|
||||
public void func_71004_bE() {
|
||||
}
|
||||
|
||||
@@ -230,7 +242,7 @@
|
||||
this.field_71069_bz.func_75134_a(this);
|
||||
if (this.field_71070_bA != null) {
|
||||
this.field_71070_bA.func_75134_a(this);
|
||||
@@ -1220,6 +1251,7 @@
|
||||
@@ -1220,6 +1256,7 @@
|
||||
}
|
||||
|
||||
public void func_225652_a_(boolean p_225652_1_, boolean p_225652_2_) {
|
||||
@@ -238,7 +250,7 @@
|
||||
super.func_213366_dy();
|
||||
if (this.field_70170_p instanceof ServerWorld && p_225652_2_) {
|
||||
((ServerWorld)this.field_70170_p).func_72854_c();
|
||||
@@ -1242,8 +1274,8 @@
|
||||
@@ -1242,8 +1279,8 @@
|
||||
}
|
||||
|
||||
return optional;
|
||||
@@ -249,7 +261,7 @@
|
||||
} else if (!p_242374_3_) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -1425,6 +1457,7 @@
|
||||
@@ -1425,6 +1462,7 @@
|
||||
|
||||
public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) {
|
||||
if (this.field_71075_bZ.field_75101_c) {
|
||||
@@ -257,7 +269,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (p_225503_1_ >= 2.0F) {
|
||||
@@ -1438,7 +1471,7 @@
|
||||
@@ -1438,7 +1476,7 @@
|
||||
public boolean func_226566_ei_() {
|
||||
if (!this.field_70122_E && !this.func_184613_cA() && !this.func_70090_H() && !this.func_70644_a(Effects.field_188424_y)) {
|
||||
ItemStack itemstack = this.func_184582_a(EquipmentSlotType.CHEST);
|
||||
@@ -266,7 +278,7 @@
|
||||
this.func_226567_ej_();
|
||||
return true;
|
||||
}
|
||||
@@ -1479,6 +1512,10 @@
|
||||
@@ -1479,6 +1517,10 @@
|
||||
}
|
||||
|
||||
public void func_195068_e(int p_195068_1_) {
|
||||
@@ -277,7 +289,7 @@
|
||||
this.func_85039_t(p_195068_1_);
|
||||
this.field_71106_cc += (float)p_195068_1_ / (float)this.func_71050_bK();
|
||||
this.field_71067_cb = MathHelper.func_76125_a(this.field_71067_cb + p_195068_1_, 0, Integer.MAX_VALUE);
|
||||
@@ -1507,7 +1544,7 @@
|
||||
@@ -1507,7 +1549,7 @@
|
||||
}
|
||||
|
||||
public void func_192024_a(ItemStack p_192024_1_, int p_192024_2_) {
|
||||
@@ -286,7 +298,7 @@
|
||||
if (this.field_71068_ca < 0) {
|
||||
this.field_71068_ca = 0;
|
||||
this.field_71106_cc = 0.0F;
|
||||
@@ -1518,6 +1555,10 @@
|
||||
@@ -1518,6 +1560,10 @@
|
||||
}
|
||||
|
||||
public void func_82242_a(int p_82242_1_) {
|
||||
@@ -297,7 +309,7 @@
|
||||
this.field_71068_ca += p_82242_1_;
|
||||
if (this.field_71068_ca < 0) {
|
||||
this.field_71068_ca = 0;
|
||||
@@ -1708,7 +1749,11 @@
|
||||
@@ -1708,7 +1754,11 @@
|
||||
}
|
||||
|
||||
public ITextComponent func_145748_c_() {
|
||||
@@ -310,7 +322,7 @@
|
||||
return this.func_208016_c(iformattabletextcomponent);
|
||||
}
|
||||
|
||||
@@ -1987,4 +2032,45 @@
|
||||
@@ -1987,4 +2037,62 @@
|
||||
return this.field_221260_g;
|
||||
}
|
||||
}
|
||||
@@ -354,5 +366,22 @@
|
||||
+ else if (facing.func_176740_k().func_176722_c()) return playerEquipmentHandler.cast();
|
||||
+ }
|
||||
+ return super.getCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Force a pose for the player. If set, the vanilla pose determination and clearance check is skipped. Make sure the pose is clear yourself (e.g. in PlayerTick).
|
||||
+ * This has to be set just once, do not set it every tick.
|
||||
+ * Make sure to clear (null) the pose if not required anymore and only use if necessary.
|
||||
+ */
|
||||
+ public void setForcedPose(@Nullable Pose pose) {
|
||||
+ this.forcedPose = pose;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The forced pose if set, null otherwise
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Pose getForcedPose() {
|
||||
+ return this.forcedPose;
|
||||
+ }
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
ServerWorld serverworld = this.func_71121_q();
|
||||
RegistryKey<World> registrykey = serverworld.func_234923_W_();
|
||||
- if (registrykey == World.field_234920_i_ && p_241206_1_.func_234923_W_() == World.field_234918_g_) {
|
||||
+ if (registrykey == World.field_234920_i_ && p_241206_1_.func_234923_W_() == World.field_234918_g_ && teleporter instanceof net.minecraft.world.Teleporter) { //Forge: Fix non-vanilla teleporters triggering end credits
|
||||
+ if (registrykey == World.field_234920_i_ && p_241206_1_.func_234923_W_() == World.field_234918_g_ && teleporter.isVanilla()) { //Forge: Fix non-vanilla teleporters triggering end credits
|
||||
this.func_213319_R();
|
||||
- this.func_71121_q().func_217434_e(this);
|
||||
+ this.func_71121_q().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom
|
||||
@@ -32,10 +32,12 @@
|
||||
playerlist.func_187243_f(this);
|
||||
- serverworld.func_217434_e(this);
|
||||
- this.field_70128_L = false;
|
||||
- PortalInfo portalinfo = this.func_241829_a(p_241206_1_);
|
||||
- if (portalinfo != null) {
|
||||
+ serverworld.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 = this.func_241829_a(p_241206_1_);
|
||||
if (portalinfo != null) {
|
||||
+ PortalInfo portalinfo = teleporter.isVanilla() ? this.func_241829_a(p_241206_1_) : null;
|
||||
+ if (portalinfo != null || !teleporter.isVanilla()) {
|
||||
+ Entity e = teleporter.placeEntity(this, serverworld, p_241206_1_, this.field_70177_z, spawnPortal -> {//Forge: Start vanilla logic
|
||||
serverworld.func_217381_Z().func_76320_a("moving");
|
||||
if (registrykey == World.field_234918_g_ && p_241206_1_.func_234923_W_() == World.field_234919_h_) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/fluid/FlowingFluid.java
|
||||
+++ b/net/minecraft/fluid/FlowingFluid.java
|
||||
@@ -159,7 +159,7 @@
|
||||
BlockState blockstate = p_205576_1_.func_180495_p(blockpos);
|
||||
FluidState fluidstate = blockstate.func_204520_s();
|
||||
if (fluidstate.func_206886_c().func_207187_a(this) && this.func_212751_a(direction, p_205576_1_, p_205576_2_, p_205576_3_, blockpos, blockstate)) {
|
||||
- if (fluidstate.func_206889_d()) {
|
||||
+ if (fluidstate.func_206889_d() && net.minecraftforge.event.ForgeEventFactory.canCreateFluidSource(p_205576_1_, blockpos, blockstate, this.func_205579_d())) {
|
||||
++j;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (this.func_205579_d() && j >= 2) {
|
||||
+ if (j >= 2) {
|
||||
BlockState blockstate1 = p_205576_1_.func_180495_p(p_205576_2_.func_177977_b());
|
||||
FluidState fluidstate1 = blockstate1.func_204520_s();
|
||||
if (blockstate1.func_185904_a().func_76220_a() || this.func_211758_g(fluidstate1)) {
|
||||
@@ -35,7 +35,7 @@
|
||||
p_77659_2_.func_71029_a(Stats.field_75929_E.func_199076_b(this));
|
||||
- p_77659_2_.func_184185_a(fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M, 1.0F, 1.0F);
|
||||
+
|
||||
+ SoundEvent soundevent = this.field_77876_a.getAttributes().getEmptySound();
|
||||
+ SoundEvent soundevent = this.field_77876_a.getAttributes().getFillSound();
|
||||
+ if (soundevent == null) soundevent = fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M;
|
||||
+ p_77659_2_.func_184185_a(soundevent, 1.0F, 1.0F);
|
||||
ItemStack itemstack1 = DrinkHelper.func_242398_a(itemstack, p_77659_2_, new ItemStack(fluid.func_204524_b()));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
private final int field_196066_w;
|
||||
private final float[] field_193352_x;
|
||||
private final int field_196067_y;
|
||||
+ private final net.minecraft.tags.ITag.INamedTag<Item> tag;
|
||||
+ private final net.minecraftforge.common.Tags.IOptionalNamedTag<Item> tag;
|
||||
private final int field_218390_z;
|
||||
|
||||
private DyeColor(int p_i50049_3_, String p_i50049_4_, int p_i50049_5_, MaterialColor p_i50049_6_, int p_i50049_7_, int p_i50049_8_) {
|
||||
@@ -12,7 +12,7 @@
|
||||
int j = (p_i50049_5_ & '\uff00') >> 8;
|
||||
int k = (p_i50049_5_ & 255) >> 0;
|
||||
this.field_196066_w = k << 16 | j << 8 | i << 0;
|
||||
+ this.tag = net.minecraft.tags.ItemTags.func_199901_a("forge:dyes/" + p_i50049_4_);
|
||||
+ this.tag = net.minecraft.tags.ItemTags.createOptional(new net.minecraft.util.ResourceLocation("forge", "dyes/" + p_i50049_4_));
|
||||
this.field_193352_x = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F};
|
||||
this.field_196067_y = p_i50049_7_;
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
+ return field_193351_w;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraft.tags.ITag.INamedTag<Item> getTag() {
|
||||
+ public net.minecraftforge.common.Tags.IOptionalNamedTag<Item> getTag() {
|
||||
+ return tag;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
public boolean func_77616_k(ItemStack p_77616_1_) {
|
||||
- return this.func_77639_j() == 1 && this.func_77645_m();
|
||||
+ return this.getItemStackLimit(p_77616_1_) == 1 && this.func_77645_m();
|
||||
+ return this.getItemStackLimit(p_77616_1_) == 1 && this.isDamageable(p_77616_1_);
|
||||
}
|
||||
|
||||
protected static BlockRayTraceResult func_219968_a(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_) {
|
||||
@@ -93,7 +93,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isRepairable(ItemStack stack) {
|
||||
+ return canRepair && func_77645_m();
|
||||
+ return canRepair && isDamageable(stack);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
private static final Logger field_199558_c = LogManager.getLogger();
|
||||
public static final ItemStack field_190927_a = new ItemStack((Item)null);
|
||||
public static final DecimalFormat field_111284_a = Util.func_200696_a(new DecimalFormat("#.##"), (p_234699_0_) -> {
|
||||
@@ -109,7 +112,10 @@
|
||||
@@ -109,14 +112,18 @@
|
||||
p_i231596_3_.ifPresent(this::func_77982_d);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
+ this.capNBT = capNBT;
|
||||
this.field_151002_e = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j();
|
||||
this.field_77994_a = p_i48204_2_;
|
||||
if (this.field_151002_e != null && this.field_151002_e.func_77645_m()) {
|
||||
@@ -117,6 +123,7 @@
|
||||
- if (this.field_151002_e != null && this.field_151002_e.func_77645_m()) {
|
||||
+ if (this.field_151002_e != null && this.field_151002_e.isDamageable(this)) {
|
||||
this.func_196085_b(this.func_77952_i());
|
||||
}
|
||||
|
||||
this.func_190923_F();
|
||||
@@ -48,7 +49,13 @@
|
||||
this.field_151002_e = Registry.field_212630_s.func_82594_a(new ResourceLocation(p_i47263_1_.func_74779_i("id")));
|
||||
this.field_77994_a = p_i47263_1_.func_74771_c("Count");
|
||||
if (p_i47263_1_.func_150297_b("tag", 10)) {
|
||||
@@ -137,6 +146,7 @@
|
||||
@@ -132,11 +141,12 @@
|
||||
this.func_77973_b().func_179215_a(p_i47263_1_);
|
||||
}
|
||||
|
||||
- if (this.func_77973_b().func_77645_m()) {
|
||||
+ if (this.func_77973_b().isDamageable(this)) {
|
||||
this.func_196085_b(this.func_77952_i());
|
||||
}
|
||||
|
||||
this.func_190923_F();
|
||||
@@ -118,7 +125,7 @@
|
||||
|
||||
public boolean func_77984_f() {
|
||||
- if (!this.field_190928_g && this.func_77973_b().func_77612_l() > 0) {
|
||||
+ if (!this.field_190928_g && this.func_77973_b().getMaxDamage(this) > 0) {
|
||||
+ if (!this.field_190928_g && this.func_77973_b().isDamageable(this)) {
|
||||
CompoundNBT compoundnbt = this.func_77978_p();
|
||||
return compoundnbt == null || !compoundnbt.func_74767_n("Unbreakable");
|
||||
} else {
|
||||
@@ -190,6 +197,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,7 +502,7 @@
|
||||
|
||||
public void func_77982_d(@Nullable CompoundNBT p_77982_1_) {
|
||||
this.field_77990_d = p_77982_1_;
|
||||
- if (this.func_77973_b().func_77645_m()) {
|
||||
+ if (this.func_77973_b().isDamageable(this)) {
|
||||
this.func_196085_b(this.func_77952_i());
|
||||
}
|
||||
|
||||
@@ -673,6 +696,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/item/MerchantOffer.java
|
||||
+++ b/net/minecraft/item/MerchantOffer.java
|
||||
@@ -178,7 +178,7 @@
|
||||
return true;
|
||||
} else {
|
||||
ItemStack itemstack = p_222201_1_.func_77946_l();
|
||||
- if (itemstack.func_77973_b().func_77645_m()) {
|
||||
+ if (itemstack.func_77973_b().isDamageable(itemstack)) {
|
||||
itemstack.func_196085_b(itemstack.func_77952_i());
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
this.field_199807_b = p_i49381_1_.toArray((p_209360_0_) -> {
|
||||
return new Ingredient.IItemList[p_209360_0_];
|
||||
});
|
||||
+ this.isSimple = !net.minecraftforge.fml.ModLoader.isDataGenRunning() && !Arrays.stream(field_199807_b).anyMatch(list -> list.func_199799_a().stream().anyMatch(stack -> stack.func_77973_b().func_77645_m()));
|
||||
+ this.isSimple = !net.minecraftforge.fml.DatagenModLoader.isRunningDataGen() && !Arrays.stream(field_199807_b).anyMatch(list -> list.func_199799_a().stream().anyMatch(stack -> stack.func_77973_b().isDamageable(stack)));
|
||||
+ Ingredient.INSTANCES.add(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
if (p_150788_1_.func_190926_b()) {
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
@@ -301,7 +310,7 @@
|
||||
@@ -300,8 +309,8 @@
|
||||
this.func_150787_b(Item.func_150891_b(item));
|
||||
this.writeByte(p_150788_1_.func_190916_E());
|
||||
CompoundNBT compoundnbt = null;
|
||||
if (item.func_77645_m() || item.func_77651_p()) {
|
||||
- if (item.func_77645_m() || item.func_77651_p()) {
|
||||
- compoundnbt = p_150788_1_.func_77978_p();
|
||||
+ if (item.isDamageable(p_150788_1_) || item.func_77651_p()) {
|
||||
+ compoundnbt = limitedTag ? p_150788_1_.getShareTag() : p_150788_1_.func_77978_p();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,3 +8,11 @@
|
||||
}
|
||||
|
||||
public FunctionReloader func_240960_a_() {
|
||||
@@ -81,6 +82,7 @@
|
||||
|
||||
public void func_240971_i_() {
|
||||
this.field_240955_e_.func_242231_a().func_242212_e();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent.CustomTagTypes(field_240955_e_.func_242231_a()));
|
||||
}
|
||||
|
||||
public void close() {
|
||||
@@ -16,7 +16,15 @@
|
||||
GameRules gamerules = serverworld1.func_82736_K();
|
||||
boolean flag = gamerules.func_223586_b(GameRules.field_226683_z_);
|
||||
boolean flag1 = gamerules.func_223586_b(GameRules.field_223612_o);
|
||||
@@ -170,7 +172,7 @@
|
||||
@@ -156,6 +158,7 @@
|
||||
serverplaynethandler.func_147359_a(new SHeldItemChangePacket(p_72355_2_.field_71071_by.field_70461_c));
|
||||
serverplaynethandler.func_147359_a(new SUpdateRecipesPacket(this.field_72400_f.func_199529_aN().func_199510_b()));
|
||||
serverplaynethandler.func_147359_a(new STagsListPacket(this.field_72400_f.func_244266_aF()));
|
||||
+ net.minecraftforge.fml.network.NetworkHooks.syncCustomTagTypes(p_72355_2_, this.field_72400_f.func_244266_aF());
|
||||
this.func_187243_f(p_72355_2_);
|
||||
p_72355_2_.func_147099_x().func_150877_d();
|
||||
p_72355_2_.func_192037_E().func_192826_c(p_72355_2_);
|
||||
@@ -170,7 +173,7 @@
|
||||
|
||||
this.func_232641_a_(iformattabletextcomponent.func_240699_a_(TextFormatting.YELLOW), ChatType.SYSTEM, Util.field_240973_b_);
|
||||
serverplaynethandler.func_147364_a(p_72355_2_.func_226277_ct_(), p_72355_2_.func_226278_cu_(), p_72355_2_.func_226281_cx_(), p_72355_2_.field_70177_z, p_72355_2_.field_70125_A);
|
||||
@@ -25,7 +33,7 @@
|
||||
this.field_177454_f.put(p_72355_2_.func_110124_au(), p_72355_2_);
|
||||
this.func_148540_a(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_));
|
||||
|
||||
@@ -225,6 +227,7 @@
|
||||
@@ -225,6 +228,7 @@
|
||||
}
|
||||
|
||||
p_72355_2_.func_71116_b();
|
||||
@@ -33,7 +41,7 @@
|
||||
}
|
||||
|
||||
protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) {
|
||||
@@ -285,6 +288,7 @@
|
||||
@@ -285,6 +289,7 @@
|
||||
compoundnbt1 = compoundnbt;
|
||||
p_72380_1_.func_70020_e(compoundnbt);
|
||||
field_148546_d.debug("loading single player");
|
||||
@@ -41,7 +49,7 @@
|
||||
} else {
|
||||
compoundnbt1 = this.field_72412_k.func_237336_b_(p_72380_1_);
|
||||
}
|
||||
@@ -293,6 +297,7 @@
|
||||
@@ -293,6 +298,7 @@
|
||||
}
|
||||
|
||||
protected void func_72391_b(ServerPlayerEntity p_72391_1_) {
|
||||
@@ -49,7 +57,7 @@
|
||||
this.field_72412_k.func_237335_a_(p_72391_1_);
|
||||
ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au());
|
||||
if (serverstatisticsmanager != null) {
|
||||
@@ -307,6 +312,7 @@
|
||||
@@ -307,6 +313,7 @@
|
||||
}
|
||||
|
||||
public void func_72367_e(ServerPlayerEntity p_72367_1_) {
|
||||
@@ -57,7 +65,7 @@
|
||||
ServerWorld serverworld = p_72367_1_.func_71121_q();
|
||||
p_72367_1_.func_195066_a(Stats.field_75947_j);
|
||||
this.func_72391_b(p_72367_1_);
|
||||
@@ -330,7 +336,7 @@
|
||||
@@ -330,7 +337,7 @@
|
||||
p_72367_1_.func_213319_R();
|
||||
serverworld.func_217434_e(p_72367_1_);
|
||||
p_72367_1_.func_192039_O().func_192745_a();
|
||||
@@ -66,7 +74,7 @@
|
||||
this.field_72400_f.func_201300_aS().func_201382_b(p_72367_1_);
|
||||
UUID uuid = p_72367_1_.func_110124_au();
|
||||
ServerPlayerEntity serverplayerentity = this.field_177454_f.get(uuid);
|
||||
@@ -400,8 +406,8 @@
|
||||
@@ -400,8 +407,8 @@
|
||||
}
|
||||
|
||||
public ServerPlayerEntity func_232644_a_(ServerPlayerEntity p_232644_1_, boolean p_232644_2_) {
|
||||
@@ -77,7 +85,7 @@
|
||||
BlockPos blockpos = p_232644_1_.func_241140_K_();
|
||||
float f = p_232644_1_.func_242109_L();
|
||||
boolean flag = p_232644_1_.func_241142_M_();
|
||||
@@ -424,6 +430,7 @@
|
||||
@@ -424,6 +431,7 @@
|
||||
ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, serverworld1, p_232644_1_.func_146103_bH(), playerinteractionmanager);
|
||||
serverplayerentity.field_71135_a = p_232644_1_.field_71135_a;
|
||||
serverplayerentity.func_193104_a(p_232644_1_, p_232644_2_);
|
||||
@@ -85,7 +93,7 @@
|
||||
serverplayerentity.func_145769_d(p_232644_1_.func_145782_y());
|
||||
serverplayerentity.func_184819_a(p_232644_1_.func_184591_cq());
|
||||
|
||||
@@ -465,10 +472,11 @@
|
||||
@@ -465,10 +473,11 @@
|
||||
this.func_72354_b(serverplayerentity, serverworld1);
|
||||
this.func_187243_f(serverplayerentity);
|
||||
serverworld1.func_217433_d(serverplayerentity);
|
||||
@@ -98,7 +106,7 @@
|
||||
if (flag2) {
|
||||
serverplayerentity.field_71135_a.func_147359_a(new SPlaySoundEffectPacket(SoundEvents.field_232818_ms_, SoundCategory.BLOCKS, (double)blockpos.func_177958_n(), (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p(), 1.0F, 1.0F));
|
||||
}
|
||||
@@ -786,7 +794,7 @@
|
||||
@@ -786,7 +795,7 @@
|
||||
}
|
||||
|
||||
public List<ServerPlayerEntity> func_181057_v() {
|
||||
@@ -107,7 +115,15 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -816,4 +824,12 @@
|
||||
@@ -804,6 +813,7 @@
|
||||
}
|
||||
|
||||
this.func_148540_a(new STagsListPacket(this.field_72400_f.func_244266_aF()));
|
||||
+ net.minecraftforge.fml.network.NetworkHooks.syncCustomTagTypes(this.field_72400_f.func_244266_aF());
|
||||
SUpdateRecipesPacket supdaterecipespacket = new SUpdateRecipesPacket(this.field_72400_f.func_199529_aN().func_199510_b());
|
||||
|
||||
for(ServerPlayerEntity serverplayerentity : this.field_72404_b) {
|
||||
@@ -816,4 +826,12 @@
|
||||
public boolean func_206257_x() {
|
||||
return this.field_72407_n;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/tags/BlockTags.java
|
||||
+++ b/net/minecraft/tags/BlockTags.java
|
||||
@@ -97,6 +97,14 @@
|
||||
return field_199899_c.func_232937_a_(p_199894_0_);
|
||||
}
|
||||
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Block> createOptional(ResourceLocation name) {
|
||||
+ return createOptional(name, null);
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Block> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set<java.util.function.Supplier<Block>> defaults) {
|
||||
+ return field_199899_c.createOptional(name, defaults);
|
||||
+ }
|
||||
+
|
||||
public static ITagCollection<Block> func_199896_a() {
|
||||
return field_199899_c.func_232939_b_();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/tags/EntityTypeTags.java
|
||||
+++ b/net/minecraft/tags/EntityTypeTags.java
|
||||
@@ -16,6 +16,14 @@
|
||||
return field_219766_c.func_232937_a_(p_232896_0_);
|
||||
}
|
||||
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<EntityType<?>> createOptional(ResourceLocation name) {
|
||||
+ return createOptional(name, null);
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<EntityType<?>> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set<java.util.function.Supplier<EntityType<?>>> defaults) {
|
||||
+ return field_219766_c.createOptional(name, defaults);
|
||||
+ }
|
||||
+
|
||||
public static ITagCollection<EntityType<?>> func_219762_a() {
|
||||
return field_219766_c.func_232939_b_();
|
||||
}
|
||||
@@ -1,6 +1,17 @@
|
||||
--- a/net/minecraft/tags/FluidTags.java
|
||||
+++ b/net/minecraft/tags/FluidTags.java
|
||||
@@ -16,4 +16,9 @@
|
||||
@@ -13,7 +13,20 @@
|
||||
return field_206961_c.func_232937_a_(p_206956_0_);
|
||||
}
|
||||
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Fluid> createOptional(ResourceLocation name) {
|
||||
+ return createOptional(name, null);
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Fluid> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set<java.util.function.Supplier<Fluid>> defaults) {
|
||||
+ return field_206961_c.createOptional(name, defaults);
|
||||
+ }
|
||||
+
|
||||
public static List<? extends ITag.INamedTag<Fluid>> func_241280_c_() {
|
||||
return field_206961_c.func_241288_c_();
|
||||
}
|
||||
|
||||
@@ -32,29 +32,16 @@
|
||||
list.forEach((p_232958_2_) -> {
|
||||
this.field_232953_a_.add(new ITag.Proxy(p_232958_2_, p_232956_2_));
|
||||
});
|
||||
@@ -135,11 +146,20 @@
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
|
||||
for(ITag.Proxy itag$proxy : this.field_232953_a_) {
|
||||
+ if(!(itag$proxy.field_232966_a_ instanceof net.minecraftforge.common.data.IOptionalTagEntry))
|
||||
@@ -138,7 +149,7 @@
|
||||
itag$proxy.func_232968_a_().func_230237_a_(jsonarray);
|
||||
}
|
||||
|
||||
- jsonobject.addProperty("replace", false);
|
||||
+ JsonArray optopnals = new JsonArray();
|
||||
+ func_232962_b_()
|
||||
+ .map(e -> e.field_232966_a_)
|
||||
+ .filter(e -> e instanceof net.minecraftforge.common.data.IOptionalTagEntry)
|
||||
+ .forEach(e -> e.func_230237_a_(optopnals));
|
||||
+
|
||||
+ jsonobject.addProperty("replace", replace);
|
||||
jsonobject.add("values", jsonarray);
|
||||
+ if (optopnals.size() > 0)
|
||||
+ jsonobject.add("optional", optopnals);
|
||||
return jsonobject;
|
||||
}
|
||||
}
|
||||
@@ -178,6 +198,7 @@
|
||||
@@ -178,6 +189,7 @@
|
||||
public String toString() {
|
||||
return this.field_232969_a_.toString();
|
||||
}
|
||||
@@ -62,10 +49,11 @@
|
||||
}
|
||||
|
||||
public static class OptionalItemEntry implements ITag.ITagEntry {
|
||||
@@ -278,5 +299,6 @@
|
||||
@@ -278,5 +290,7 @@
|
||||
public String toString() {
|
||||
return "#" + this.field_200163_a;
|
||||
}
|
||||
+ @Override public boolean equals(Object o) { return o == this || (o instanceof ITag.TagEntry && java.util.Objects.equals(this.field_200163_a, ((ITag.TagEntry) o).field_200163_a)); }
|
||||
+ public ResourceLocation getId() { return field_200163_a; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,52 @@
|
||||
--- a/net/minecraft/tags/ITagCollectionSupplier.java
|
||||
+++ b/net/minecraft/tags/ITagCollectionSupplier.java
|
||||
@@ -8,7 +8,7 @@
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
-public interface ITagCollectionSupplier {
|
||||
+public interface ITagCollectionSupplier extends net.minecraftforge.common.extensions.IForgeTagCollectionSupplier {
|
||||
ITagCollectionSupplier field_242208_a = func_242209_a(ITagCollection.func_242205_c(), ITagCollection.func_242205_c(), ITagCollection.func_242205_c(), ITagCollection.func_242205_c());
|
||||
|
||||
ITagCollection<Block> func_241835_a();
|
||||
@@ -22,6 +22,7 @@
|
||||
default void func_242212_e() {
|
||||
TagRegistryManager.func_242193_a(this);
|
||||
Blocks.func_235419_a_();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent.VanillaTagTypes(this));
|
||||
}
|
||||
|
||||
default void func_242210_a(PacketBuffer p_242210_1_) {
|
||||
@@ -58,4 +59,32 @@
|
||||
}
|
||||
};
|
||||
}
|
||||
+
|
||||
+ static ITagCollectionSupplier reinjectOptionalTags(ITagCollectionSupplier tagCollectionSupplier) {
|
||||
+ ITagCollection<Block> blockTagCollection = BlockTags.field_199899_c.reinjectOptionalTags(tagCollectionSupplier.func_241835_a());
|
||||
+ ITagCollection<Item> itemTagCollection = ItemTags.field_199906_c.reinjectOptionalTags(tagCollectionSupplier.func_241836_b());
|
||||
+ ITagCollection<Fluid> fluidTagCollection = FluidTags.field_206961_c.reinjectOptionalTags(tagCollectionSupplier.func_241837_c());
|
||||
+ ITagCollection<EntityType<?>> entityTypeTagCollection = EntityTypeTags.field_219766_c.reinjectOptionalTags(tagCollectionSupplier.func_241838_d());
|
||||
+ return new ITagCollectionSupplier() {
|
||||
+ @Override
|
||||
+ public ITagCollection<Block> func_241835_a() {
|
||||
+ return blockTagCollection;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ITagCollection<Item> func_241836_b() {
|
||||
+ return itemTagCollection;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ITagCollection<Fluid> func_241837_c() {
|
||||
+ return fluidTagCollection;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ITagCollection<EntityType<?>> func_241838_d() {
|
||||
+ return entityTypeTagCollection;
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/tags/ItemTags.java
|
||||
+++ b/net/minecraft/tags/ItemTags.java
|
||||
@@ -65,6 +65,14 @@
|
||||
return field_199906_c.func_232937_a_(p_199901_0_);
|
||||
}
|
||||
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Item> createOptional(ResourceLocation name) {
|
||||
+ return createOptional(name, null);
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Item> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set<java.util.function.Supplier<Item>> defaults) {
|
||||
+ return field_199906_c.createOptional(name, defaults);
|
||||
+ }
|
||||
+
|
||||
public static ITagCollection<Item> func_199903_a() {
|
||||
return field_199906_c.func_232939_b_();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
--- a/net/minecraft/tags/NetworkTagManager.java
|
||||
+++ b/net/minecraft/tags/NetworkTagManager.java
|
||||
@@ -20,6 +20,7 @@
|
||||
protected TagCollectionReader<Item> field_199720_b = new TagCollectionReader<>(Registry.field_212630_s::func_241873_b, "tags/items", "item");
|
||||
protected TagCollectionReader<Fluid> field_205705_c = new TagCollectionReader<>(Registry.field_212619_h::func_241873_b, "tags/fluids", "fluid");
|
||||
protected TagCollectionReader<EntityType<?>> field_215299_d = new TagCollectionReader<>(Registry.field_212629_r::func_241873_b, "tags/entity_types", "entity_type");
|
||||
+ protected Map<ResourceLocation, TagCollectionReader<?>> customTagTypeReaders = net.minecraftforge.common.ForgeTagHandler.createCustomTagTypeReaders();
|
||||
private ITagCollectionSupplier field_242230_e = ITagCollectionSupplier.field_242208_a;
|
||||
|
||||
public ITagCollectionSupplier func_242231_a() {
|
||||
@@ -31,11 +32,13 @@
|
||||
CompletableFuture<Map<ResourceLocation, ITag.Builder>> completablefuture1 = this.field_199720_b.func_242224_a(p_215226_2_, p_215226_5_);
|
||||
CompletableFuture<Map<ResourceLocation, ITag.Builder>> completablefuture2 = this.field_205705_c.func_242224_a(p_215226_2_, p_215226_5_);
|
||||
CompletableFuture<Map<ResourceLocation, ITag.Builder>> completablefuture3 = this.field_215299_d.func_242224_a(p_215226_2_, p_215226_5_);
|
||||
- return CompletableFuture.allOf(completablefuture, completablefuture1, completablefuture2, completablefuture3).thenCompose(p_215226_1_::func_216872_a).thenAcceptAsync((p_232979_5_) -> {
|
||||
+ CompletableFuture<java.util.List<net.minecraftforge.common.ForgeTagHandler.TagCollectionReaderInfo>> customTagTypeResults = net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeReloadResults(p_215226_2_, p_215226_5_, customTagTypeReaders);
|
||||
+ return CompletableFuture.allOf(completablefuture, completablefuture1, completablefuture2, completablefuture3, customTagTypeResults).thenCompose(p_215226_1_::func_216872_a).thenAcceptAsync((p_232979_5_) -> {
|
||||
ITagCollection<Block> itagcollection = this.field_199719_a.func_242226_a(completablefuture.join());
|
||||
ITagCollection<Item> itagcollection1 = this.field_199720_b.func_242226_a(completablefuture1.join());
|
||||
ITagCollection<Fluid> itagcollection2 = this.field_205705_c.func_242226_a(completablefuture2.join());
|
||||
ITagCollection<EntityType<?>> itagcollection3 = this.field_215299_d.func_242226_a(completablefuture3.join());
|
||||
+ net.minecraftforge.common.ForgeTagHandler.updateCustomTagTypes(customTagTypeResults.join());
|
||||
ITagCollectionSupplier itagcollectionsupplier = ITagCollectionSupplier.func_242209_a(itagcollection, itagcollection1, itagcollection2, itagcollection3);
|
||||
Multimap<ResourceLocation, ResourceLocation> multimap = TagRegistryManager.func_242198_b(itagcollectionsupplier);
|
||||
if (!multimap.isEmpty()) {
|
||||
@@ -43,6 +46,8 @@
|
||||
return p_232978_0_.getKey() + ":" + p_232978_0_.getValue();
|
||||
}).sorted().collect(Collectors.joining(",")));
|
||||
} else {
|
||||
+ itagcollectionsupplier = ITagCollectionSupplier.reinjectOptionalTags(itagcollectionsupplier);
|
||||
+ net.minecraftforge.common.ForgeTagHandler.reinjectOptionalTagsCustomTypes();
|
||||
TagCollectionManager.func_242180_a(itagcollectionsupplier);
|
||||
this.field_242230_e = itagcollectionsupplier;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/tags/TagCollectionManager.java
|
||||
+++ b/net/minecraft/tags/TagCollectionManager.java
|
||||
@@ -3,13 +3,13 @@
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TagCollectionManager {
|
||||
- private static volatile ITagCollectionSupplier field_232918_a_ = ITagCollectionSupplier.func_242209_a(ITagCollection.func_242202_a(BlockTags.func_242174_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242183_0_) -> {
|
||||
+ private static volatile ITagCollectionSupplier field_232918_a_ = net.minecraftforge.common.ForgeTagHandler.populateTagCollectionManager(ITagCollection.func_242202_a(BlockTags.func_242174_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242183_0_) -> {
|
||||
return p_242183_0_;
|
||||
- }))), ITagCollection.func_242202_a(ItemTags.func_242177_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242182_0_) -> {
|
||||
+ }))), ITagCollection.func_242202_a(ItemTags.func_242177_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242182_0_) -> {
|
||||
return p_242182_0_;
|
||||
- }))), ITagCollection.func_242202_a(FluidTags.func_241280_c_().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242181_0_) -> {
|
||||
+ }))), ITagCollection.func_242202_a(FluidTags.func_241280_c_().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242181_0_) -> {
|
||||
return p_242181_0_;
|
||||
- }))), ITagCollection.func_242202_a(EntityTypeTags.func_242175_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242179_0_) -> {
|
||||
+ }))), ITagCollection.func_242202_a(EntityTypeTags.func_242175_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242179_0_) -> {
|
||||
return p_242179_0_;
|
||||
}))));
|
||||
|
||||
@@ -1,14 +1,89 @@
|
||||
--- a/net/minecraft/tags/TagRegistry.java
|
||||
+++ b/net/minecraft/tags/TagRegistry.java
|
||||
@@ -23,6 +23,7 @@
|
||||
@@ -16,13 +16,51 @@
|
||||
private ITagCollection<T> field_232930_b_ = ITagCollection.func_242205_c();
|
||||
private final List<TagRegistry.NamedTag<T>> field_232931_c_ = Lists.newArrayList();
|
||||
private final Function<ITagCollectionSupplier, ITagCollection<T>> field_242184_c;
|
||||
+ private static java.util.Map<ResourceLocation, List<TagRegistry.NamedTag<?>>> toAdd = com.google.common.collect.Maps.newHashMap();
|
||||
|
||||
public TagRegistry(Function<ITagCollectionSupplier, ITagCollection<T>> p_i241894_1_) {
|
||||
this.field_242184_c = p_i241894_1_;
|
||||
}
|
||||
|
||||
public ITag.INamedTag<T> func_232937_a_(String p_232937_1_) {
|
||||
TagRegistry.NamedTag<T> namedtag = new TagRegistry.NamedTag<>(new ResourceLocation(p_232937_1_));
|
||||
- TagRegistry.NamedTag<T> namedtag = new TagRegistry.NamedTag<>(new ResourceLocation(p_232937_1_));
|
||||
+ return add(new TagRegistry.NamedTag<>(new ResourceLocation(p_232937_1_)));
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraftforge.common.Tags.IOptionalNamedTag<T> createOptional(ResourceLocation key, @Nullable Set<java.util.function.Supplier<T>> defaults) {
|
||||
+ return add(new TagRegistry.OptionalNamedTag<>(key, defaults));
|
||||
+ }
|
||||
+
|
||||
+ /** Call via ForgeTagHandler#makeWrapperTag to avoid any exceptions due to calling this after it is safe to call {@link #func_232937_a_(String)} */
|
||||
+ public static <T> ITag.INamedTag<T> createDelayedTag(ResourceLocation tagRegistry, ResourceLocation name) {
|
||||
+ return delayedAdd(tagRegistry, new TagRegistry.NamedTag<>(name));
|
||||
+ }
|
||||
+
|
||||
+ /** Call via ForgeTagHandler#createOptionalTag to avoid any exceptions due to calling this after it is safe to call {@link #createOptional(ResourceLocation, Set)} */
|
||||
+ public static <T> net.minecraftforge.common.Tags.IOptionalNamedTag<T> createDelayedOptional(ResourceLocation tagRegistry, ResourceLocation key, @Nullable Set<java.util.function.Supplier<T>> defaults) {
|
||||
+ return delayedAdd(tagRegistry, new TagRegistry.OptionalNamedTag<>(key, defaults));
|
||||
+ }
|
||||
+
|
||||
+ private static synchronized <T, R extends TagRegistry.NamedTag<T>> R delayedAdd(ResourceLocation tagRegistry, R tag) {
|
||||
+ if (toAdd == null) throw new RuntimeException("Creating delayed tags or optional tags, is only supported before custom tag types have been added.");
|
||||
+ toAdd.computeIfAbsent(tagRegistry, registry -> Lists.newArrayList()).add(tag);
|
||||
+ return tag;
|
||||
+ }
|
||||
+
|
||||
+ public static void performDelayedAdd() {
|
||||
+ if (toAdd != null) {
|
||||
+ for (java.util.Map.Entry<ResourceLocation, List<TagRegistry.NamedTag<?>>> entry : toAdd.entrySet()) {
|
||||
+ TagRegistry<?> tagRegistry = TagRegistryManager.get(entry.getKey());
|
||||
+ if (tagRegistry == null) throw new RuntimeException("A mod attempted to add a delayed tag for a registry that doesn't have custom tag support.");
|
||||
+ for (TagRegistry.NamedTag<?> tag : entry.getValue()) {
|
||||
+ tagRegistry.add((TagRegistry.NamedTag) tag);
|
||||
+ }
|
||||
+ }
|
||||
+ toAdd = null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private <R extends TagRegistry.NamedTag<T>> R add(R namedtag) {
|
||||
+ namedtag.func_232943_a_(field_232930_b_::func_199910_a);
|
||||
this.field_232931_c_.add(namedtag);
|
||||
return namedtag;
|
||||
}
|
||||
@@ -93,5 +94,10 @@
|
||||
@@ -46,6 +84,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
+ public ITagCollection<T> reinjectOptionalTags(ITagCollection<T> tagCollection) {
|
||||
+ java.util.Map<ResourceLocation, ITag<T>> currentTags = tagCollection.func_241833_a();
|
||||
+ java.util.Map<ResourceLocation, ITag<T>> missingOptionals = this.field_232931_c_.stream().filter(e -> e instanceof OptionalNamedTag && !currentTags.containsKey(e.func_230234_a_())).collect(Collectors.toMap(NamedTag::func_230234_a_, namedTag -> {
|
||||
+ OptionalNamedTag<T> optionalNamedTag = (OptionalNamedTag<T>) namedTag;
|
||||
+ optionalNamedTag.defaulted = true;
|
||||
+ return optionalNamedTag.resolveDefaulted();
|
||||
+ }));
|
||||
+ if (!missingOptionals.isEmpty()) {
|
||||
+ missingOptionals.putAll(currentTags);
|
||||
+ return ITagCollection.func_242202_a(missingOptionals);
|
||||
+ }
|
||||
+ return tagCollection;
|
||||
+ }
|
||||
+
|
||||
public ITagCollection<T> func_232939_b_() {
|
||||
return this.field_232930_b_;
|
||||
}
|
||||
@@ -56,7 +108,7 @@
|
||||
|
||||
public Set<ResourceLocation> func_242189_b(ITagCollectionSupplier p_242189_1_) {
|
||||
ITagCollection<T> itagcollection = this.field_242184_c.apply(p_242189_1_);
|
||||
- Set<ResourceLocation> set = this.field_232931_c_.stream().map(TagRegistry.NamedTag::func_230234_a_).collect(Collectors.toSet());
|
||||
+ Set<ResourceLocation> set = this.field_232931_c_.stream().filter(e -> !(e instanceof OptionalNamedTag)).map(TagRegistry.NamedTag::func_230234_a_).collect(Collectors.toSet());
|
||||
ImmutableSet<ResourceLocation> immutableset = ImmutableSet.copyOf(itagcollection.func_199908_a());
|
||||
return Sets.difference(set, immutableset);
|
||||
}
|
||||
@@ -93,5 +145,40 @@
|
||||
public List<T> func_230236_b_() {
|
||||
return this.func_232944_c_().func_230236_b_();
|
||||
}
|
||||
@@ -17,5 +92,35 @@
|
||||
+ public String toString() {
|
||||
+ return "NamedTag[" + func_230234_a_().toString() + ']';
|
||||
+ }
|
||||
+ @Override public boolean equals(Object o) { return (o == this) || (o instanceof ITag.INamedTag && java.util.Objects.equals(this.func_230234_a_(), ((ITag.INamedTag<T>)o).func_230234_a_())); }
|
||||
+ @Override public int hashCode() { return func_230234_a_().hashCode(); }
|
||||
}
|
||||
+
|
||||
+ private static class OptionalNamedTag<T> extends NamedTag<T> implements net.minecraftforge.common.Tags.IOptionalNamedTag<T> {
|
||||
+ @Nullable
|
||||
+ private final Set<java.util.function.Supplier<T>> defaults;
|
||||
+ private boolean defaulted = false;
|
||||
+
|
||||
+ private OptionalNamedTag(ResourceLocation name, @Nullable Set<java.util.function.Supplier<T>> defaults) {
|
||||
+ super(name);
|
||||
+ this.defaults = defaults;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isDefaulted() {
|
||||
+ return defaulted;
|
||||
+ }
|
||||
+
|
||||
+ Tag<T> resolveDefaulted() {
|
||||
+ if (defaults == null || defaults.isEmpty()) {
|
||||
+ return Tag.func_241284_a_();
|
||||
+ }
|
||||
+ return Tag.func_241286_a_(ImmutableSet.copyOf(defaults.stream().map(java.util.function.Supplier::get).collect(Collectors.toSet())));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "OptionalNamedTag[" + func_230234_a_().toString() + ']';
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
--- a/net/minecraft/tags/TagRegistryManager.java
|
||||
+++ b/net/minecraft/tags/TagRegistryManager.java
|
||||
@@ -51,4 +51,23 @@
|
||||
throw new IllegalStateException("Missing helper registrations");
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @javax.annotation.Nullable
|
||||
+ public static TagRegistry<?> get(ResourceLocation rl) {
|
||||
+ return field_242190_a.get(rl);
|
||||
+ }
|
||||
+
|
||||
+ public static Multimap<ResourceLocation, ResourceLocation> validateVanillaTags(ITagCollectionSupplier tagCollectionSupplier) {
|
||||
+ Multimap<ResourceLocation, ResourceLocation> missingTags = HashMultimap.create();
|
||||
+ for (java.util.Map.Entry<ResourceLocation, TagRegistry<?>> entry : field_242190_a.entrySet()) {
|
||||
+ if (!net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeNames().contains(entry.getKey())) {
|
||||
+ missingTags.putAll(entry.getKey(), entry.getValue().func_242189_b(tagCollectionSupplier));
|
||||
+ }
|
||||
+ }
|
||||
+ return missingTags;
|
||||
+ }
|
||||
+
|
||||
+ public static void fetchCustomTagTypes(ITagCollectionSupplier tagCollectionSupplier) {
|
||||
+ net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeNames().forEach(tagRegistry -> field_242190_a.get(tagRegistry).func_242188_a(tagCollectionSupplier));
|
||||
+ }
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
if (itemstack.func_190926_b()) {
|
||||
return false;
|
||||
} else if (!PotionBrewing.func_185205_a(itemstack)) {
|
||||
@@ -163,16 +164,16 @@
|
||||
@@ -163,22 +164,22 @@
|
||||
}
|
||||
|
||||
private void func_145940_l() {
|
||||
@@ -18,18 +18,26 @@
|
||||
- for(int i = 0; i < 3; ++i) {
|
||||
- this.field_145945_j.set(i, PotionBrewing.func_185212_d(itemstack, this.field_145945_j.get(i)));
|
||||
- }
|
||||
-
|
||||
- itemstack.func_190918_g(1);
|
||||
+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, itemstack, field_145947_i);
|
||||
|
||||
itemstack.func_190918_g(1);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j);
|
||||
BlockPos blockpos = this.func_174877_v();
|
||||
- if (itemstack.func_77973_b().func_77634_r()) {
|
||||
- ItemStack itemstack1 = new ItemStack(itemstack.func_77973_b().func_77668_q());
|
||||
+ if (itemstack.hasContainerItem()) {
|
||||
+ ItemStack itemstack1 = itemstack.getContainerItem();
|
||||
+ itemstack.func_190918_g(1);
|
||||
if (itemstack.func_190926_b()) {
|
||||
itemstack = itemstack1;
|
||||
} else if (!this.field_145850_b.field_72995_K) {
|
||||
InventoryHelper.func_180173_a(this.field_145850_b, (double)blockpos.func_177958_n(), (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p(), itemstack1);
|
||||
}
|
||||
}
|
||||
+ else itemstack.func_190918_g(1);
|
||||
|
||||
this.field_145945_j.set(3, itemstack);
|
||||
this.field_145850_b.func_217379_c(1035, blockpos, 0);
|
||||
@@ -229,13 +230,13 @@
|
||||
|
||||
public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) {
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
--- a/net/minecraft/tileentity/ConduitTileEntity.java
|
||||
+++ b/net/minecraft/tileentity/ConduitTileEntity.java
|
||||
@@ -131,7 +131,7 @@
|
||||
@@ -130,10 +130,8 @@
|
||||
BlockPos blockpos1 = this.field_174879_c.func_177982_a(j1, k1, l1);
|
||||
BlockState blockstate = this.field_145850_b.func_180495_p(blockpos1);
|
||||
|
||||
for(Block block : field_205042_e) {
|
||||
- for(Block block : field_205042_e) {
|
||||
- if (blockstate.func_203425_a(block)) {
|
||||
+ if (blockstate.isConduitFrame(this.field_145850_b, blockpos1, func_174877_v())) {
|
||||
this.field_205046_i.add(blockpos1);
|
||||
}
|
||||
- this.field_205046_i.add(blockpos1);
|
||||
- }
|
||||
+ if (blockstate.isConduitFrame(this.field_145850_b, blockpos1, func_174877_v())) {
|
||||
+ this.field_205046_i.add(blockpos1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/util/registry/Bootstrap.java
|
||||
+++ b/net/minecraft/util/registry/Bootstrap.java
|
||||
@@ -46,6 +46,7 @@
|
||||
PotionBrewing.func_185207_a();
|
||||
EntityOptions.func_197445_a();
|
||||
@@ -48,6 +48,7 @@
|
||||
IDispenseItemBehavior.func_218401_c();
|
||||
+ if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context
|
||||
ArgumentTypes.func_197483_a();
|
||||
TagRegistryManager.func_242197_b();
|
||||
+ if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context
|
||||
func_179868_d();
|
||||
}
|
||||
}
|
||||
@@ -103,7 +104,6 @@
|
||||
Commands.func_242986_b();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/net/minecraft/util/registry/WorldGenRegistries.java
|
||||
+++ b/net/minecraft/util/registry/WorldGenRegistries.java
|
||||
@@ -45,7 +45,7 @@
|
||||
return ProcessorLists.field_244102_b;
|
||||
});
|
||||
public static final Registry<JigsawPattern> field_243656_h = func_243667_a(Registry.field_243555_ax, JigsawPatternRegistry::func_244093_a);
|
||||
- public static final Registry<Biome> field_243657_i = func_243667_a(Registry.field_239720_u_, () -> {
|
||||
+ @Deprecated public static final Registry<Biome> field_243657_i = forge(Registry.field_239720_u_, () -> {
|
||||
return BiomeRegistry.field_244200_a;
|
||||
});
|
||||
public static final Registry<DimensionSettings> field_243658_j = func_243667_a(Registry.field_243549_ar, DimensionSettings::func_242746_i);
|
||||
@@ -54,6 +54,10 @@
|
||||
return func_243665_a(p_243667_0_, Lifecycle.stable(), p_243667_1_);
|
||||
}
|
||||
|
||||
+ private static <T extends net.minecraftforge.registries.IForgeRegistryEntry<T>> Registry<T> forge(RegistryKey<? extends Registry<T>> key, Supplier<T> def) {
|
||||
+ return func_243666_a(key, net.minecraftforge.registries.GameData.getWrapper(key, Lifecycle.stable()), def, Lifecycle.stable());
|
||||
+ }
|
||||
+
|
||||
private static <T> Registry<T> func_243665_a(RegistryKey<? extends Registry<T>> p_243665_0_, Lifecycle p_243665_1_, Supplier<T> p_243665_2_) {
|
||||
return func_243666_a(p_243665_0_, new SimpleRegistry<>(p_243665_0_, p_243665_1_), p_243665_2_, p_243665_1_);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/net/minecraft/util/registry/WorldSettingsImport.java
|
||||
+++ b/net/minecraft/util/registry/WorldSettingsImport.java
|
||||
@@ -190,6 +190,7 @@
|
||||
) {
|
||||
JsonParser jsonparser = new JsonParser();
|
||||
JsonElement jsonelement = jsonparser.parse(reader);
|
||||
+ if (jsonelement!= null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_241879_3_.func_240901_a_().toString());
|
||||
return p_241879_4_.parse(p_241879_1_, jsonelement).map((p_244347_0_) -> {
|
||||
return Pair.of(p_244347_0_, OptionalInt.empty());
|
||||
});
|
||||
@@ -231,6 +232,7 @@
|
||||
|
||||
public <E> DataResult<Pair<E, OptionalInt>> func_241879_a(DynamicOps<JsonElement> p_241879_1_, RegistryKey<? extends Registry<E>> p_241879_2_, RegistryKey<E> p_241879_3_, Decoder<E> p_241879_4_) {
|
||||
JsonElement jsonelement = this.field_244349_a.get(p_241879_3_);
|
||||
+ if (jsonelement!= null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_241879_3_.func_240901_a_().toString());
|
||||
return jsonelement == null ? DataResult.error("Unknown element: " + p_241879_3_) : p_241879_4_.parse(p_241879_1_, jsonelement).setLifecycle(this.field_244351_c.get(p_241879_3_)).map((p_244353_2_) -> {
|
||||
return Pair.of(p_244353_2_, OptionalInt.of(this.field_244350_b.getInt(p_241879_3_)));
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/WorldSettings.java
|
||||
+++ b/net/minecraft/world/WorldSettings.java
|
||||
@@ -62,6 +62,7 @@
|
||||
}
|
||||
|
||||
public WorldSettings func_234948_a_(Difficulty p_234948_1_) {
|
||||
+ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_234948_1_, this.field_234944_d_);
|
||||
return new WorldSettings(this.field_234943_a_, this.field_77172_b, this.field_77170_d, p_234948_1_, this.field_77168_f, this.field_234945_f_, this.field_234946_g_);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
--- a/net/minecraft/world/biome/Biome.java
|
||||
+++ b/net/minecraft/world/biome/Biome.java
|
||||
@@ -200,7 +200,7 @@
|
||||
@@ -53,7 +53,7 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
-public final class Biome {
|
||||
+public final class Biome extends net.minecraftforge.registries.ForgeRegistryEntry<Biome> {
|
||||
public static final Logger field_150586_aC = LogManager.getLogger();
|
||||
public static final Codec<Biome> field_242418_b = RecordCodecBuilder.create((p_235064_0_) -> {
|
||||
return p_235064_0_.group(Biome.Climate.field_242459_a.forGetter((p_242446_0_) -> {
|
||||
@@ -70,7 +70,9 @@
|
||||
return p_242443_0_.field_242424_k;
|
||||
}), MobSpawnInfo.field_242552_c.forGetter((p_242442_0_) -> {
|
||||
return p_242442_0_.field_242425_l;
|
||||
- })).apply(p_235064_0_, Biome::new);
|
||||
+ }), ResourceLocation.field_240908_a_.fieldOf("forge:registry_name").forGetter(Biome::getRegistryName))
|
||||
+ .apply(p_235064_0_, (climate, category, depth, scale, effects, gen, spawns, name) ->
|
||||
+ net.minecraftforge.common.ForgeHooks.enhanceBiome(name, climate, category, depth, scale, effects, gen, spawns, p_235064_0_, Biome::new));
|
||||
});
|
||||
public static final Codec<Biome> field_242419_c = RecordCodecBuilder.create((p_242432_0_) -> {
|
||||
return p_242432_0_.group(Biome.Climate.field_242459_a.forGetter((p_242441_0_) -> {
|
||||
@@ -200,7 +202,7 @@
|
||||
} else {
|
||||
if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_226658_a_(LightType.BLOCK, p_201850_2_) < 10) {
|
||||
BlockState blockstate = p_201850_1_.func_180495_p(p_201850_2_);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
--- a/net/minecraft/world/biome/BiomeGenerationSettings.java
|
||||
+++ b/net/minecraft/world/biome/BiomeGenerationSettings.java
|
||||
@@ -47,6 +47,7 @@
|
||||
});
|
||||
private final Supplier<ConfiguredSurfaceBuilder<?>> field_242482_d;
|
||||
private final Map<GenerationStage.Carving, List<Supplier<ConfiguredCarver<?>>>> field_242483_e;
|
||||
+ private final java.util.Set<GenerationStage.Carving> carversView;
|
||||
private final List<List<Supplier<ConfiguredFeature<?, ?>>>> field_242484_f;
|
||||
private final List<Supplier<StructureFeature<?, ?>>> field_242485_g;
|
||||
private final List<ConfiguredFeature<?, ?>> field_242486_h;
|
||||
@@ -59,12 +60,17 @@
|
||||
this.field_242486_h = p_i241935_3_.stream().flatMap(Collection::stream).map(Supplier::get).flatMap(ConfiguredFeature::func_242768_d).filter((p_242490_0_) -> {
|
||||
return p_242490_0_.field_222737_a == Feature.field_227247_y_;
|
||||
}).collect(ImmutableList.toImmutableList());
|
||||
+ this.carversView = java.util.Collections.unmodifiableSet(field_242483_e.keySet());
|
||||
}
|
||||
|
||||
public List<Supplier<ConfiguredCarver<?>>> func_242489_a(GenerationStage.Carving p_242489_1_) {
|
||||
return this.field_242483_e.getOrDefault(p_242489_1_, ImmutableList.of());
|
||||
}
|
||||
|
||||
+ public java.util.Set<GenerationStage.Carving> getCarvingStages() {
|
||||
+ return this.carversView;
|
||||
+ }
|
||||
+
|
||||
public boolean func_242493_a(Structure<?> p_242493_1_) {
|
||||
return this.field_242485_g.stream().anyMatch((p_242494_1_) -> {
|
||||
return (p_242494_1_.get()).field_236268_b_ == p_242493_1_;
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/biome/BiomeRegistry.java
|
||||
+++ b/net/minecraft/world/biome/BiomeRegistry.java
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
public static RegistryKey<Biome> func_244203_a(int p_244203_0_) {
|
||||
- return field_244202_c.get(p_244203_0_);
|
||||
+ return ((net.minecraftforge.registries.ForgeRegistry<Biome>)net.minecraftforge.registries.ForgeRegistries.BIOMES).getKey(p_244203_0_);
|
||||
}
|
||||
|
||||
static {
|
||||
@@ -0,0 +1,38 @@
|
||||
--- a/net/minecraft/world/biome/MobSpawnInfo.java
|
||||
+++ b/net/minecraft/world/biome/MobSpawnInfo.java
|
||||
@@ -42,23 +42,35 @@
|
||||
private final Map<EntityClassification, List<MobSpawnInfo.Spawners>> field_242554_e;
|
||||
private final Map<EntityType<?>, MobSpawnInfo.SpawnCosts> field_242555_f;
|
||||
private final boolean field_242556_g;
|
||||
+ private final java.util.Set<EntityClassification> typesView;
|
||||
+ private final java.util.Set<EntityType<?>> costView;
|
||||
|
||||
private MobSpawnInfo(float p_i241946_1_, Map<EntityClassification, List<MobSpawnInfo.Spawners>> p_i241946_2_, Map<EntityType<?>, MobSpawnInfo.SpawnCosts> p_i241946_3_, boolean p_i241946_4_) {
|
||||
this.field_242553_d = p_i241946_1_;
|
||||
this.field_242554_e = p_i241946_2_;
|
||||
this.field_242555_f = p_i241946_3_;
|
||||
this.field_242556_g = p_i241946_4_;
|
||||
+ this.typesView = java.util.Collections.unmodifiableSet(this.field_242554_e.keySet());
|
||||
+ this.costView = java.util.Collections.unmodifiableSet(this.field_242555_f.keySet());
|
||||
}
|
||||
|
||||
public List<MobSpawnInfo.Spawners> func_242559_a(EntityClassification p_242559_1_) {
|
||||
return this.field_242554_e.getOrDefault(p_242559_1_, ImmutableList.of());
|
||||
}
|
||||
|
||||
+ public java.util.Set<EntityClassification> getSpawnerTypes() {
|
||||
+ return this.typesView;
|
||||
+ }
|
||||
+
|
||||
@Nullable
|
||||
public MobSpawnInfo.SpawnCosts func_242558_a(EntityType<?> p_242558_1_) {
|
||||
return this.field_242555_f.get(p_242558_1_);
|
||||
}
|
||||
|
||||
+ public java.util.Set<EntityType<?>> getEntityTypes() {
|
||||
+ return this.costView;
|
||||
+ }
|
||||
+
|
||||
public float func_242557_a() {
|
||||
return this.field_242553_d;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
--- a/net/minecraft/world/gen/layer/BiomeLayer.java
|
||||
+++ b/net/minecraft/world/gen/layer/BiomeLayer.java
|
||||
@@ -10,12 +10,13 @@
|
||||
private static final int[] field_202746_t = new int[]{4, 3, 5, 1};
|
||||
private static final int[] field_202747_u = new int[]{12, 12, 12, 30};
|
||||
private int[] field_151623_c = field_202744_r;
|
||||
+ private final boolean legacyDesert;
|
||||
+ private java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry>[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length];
|
||||
|
||||
public BiomeLayer(boolean p_i232147_1_) {
|
||||
- if (p_i232147_1_) {
|
||||
- this.field_151623_c = field_202743_q;
|
||||
- }
|
||||
-
|
||||
+ this.legacyDesert = p_i232147_1_;
|
||||
+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values())
|
||||
+ biomes[type.ordinal()] = new java.util.ArrayList<>(net.minecraftforge.common.BiomeManager.getBiomes(type));
|
||||
}
|
||||
|
||||
public int func_202726_a(INoiseRandom p_202726_1_, int p_202726_2_) {
|
||||
@@ -28,21 +29,21 @@
|
||||
return p_202726_1_.func_202696_a(3) == 0 ? 39 : 38;
|
||||
}
|
||||
|
||||
- return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)];
|
||||
+ return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_);
|
||||
case 2:
|
||||
if (i > 0) {
|
||||
return 21;
|
||||
}
|
||||
|
||||
- return field_202745_s[p_202726_1_.func_202696_a(field_202745_s.length)];
|
||||
+ return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_);
|
||||
case 3:
|
||||
if (i > 0) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
- return field_202746_t[p_202726_1_.func_202696_a(field_202746_t.length)];
|
||||
+ return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_);
|
||||
case 4:
|
||||
- return field_202747_u[p_202726_1_.func_202696_a(field_202747_u.length)];
|
||||
+ return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_);
|
||||
default:
|
||||
return 14;
|
||||
}
|
||||
@@ -50,4 +51,17 @@
|
||||
return p_202726_2_;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ private int getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) {
|
||||
+ return net.minecraft.util.registry.WorldGenRegistries.field_243657_i.func_148757_b(
|
||||
+ net.minecraft.util.registry.WorldGenRegistries.field_243657_i.func_230516_a_(getBiome(type, context)));
|
||||
+ }
|
||||
+ protected net.minecraft.util.RegistryKey<net.minecraft.world.biome.Biome> getBiome(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) {
|
||||
+ if (type == net.minecraftforge.common.BiomeManager.BiomeType.DESERT && this.legacyDesert)
|
||||
+ type = net.minecraftforge.common.BiomeManager.BiomeType.DESERT_LEGACY;
|
||||
+ java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry> biomeList = biomes[type.ordinal()];
|
||||
+ int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList);
|
||||
+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type) ? context.func_202696_a(totalWeight) : context.func_202696_a(totalWeight / 10) * 10;
|
||||
+ return net.minecraft.util.WeightedRandom.func_180166_a(biomeList, weight).getKey();
|
||||
+ }
|
||||
}
|
||||
@@ -25,6 +25,8 @@ import org.apache.logging.log4j.util.StringBuilderFormattable;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class AdvancedLogMessageAdapter implements Message, StringBuilderFormattable {
|
||||
private static final long serialVersionUID = -8291754833965087436L;
|
||||
|
||||
private static final Object[] EMPTY = new Object[0];
|
||||
|
||||
private final Consumer<StringBuilder> logMessageBuilder;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -29,10 +31,17 @@ public class EarlyLoadingException extends RuntimeException {
|
||||
public static class ExceptionData {
|
||||
|
||||
|
||||
private final IModInfo modInfo;
|
||||
private final String i18message;
|
||||
private final Object[] args;
|
||||
|
||||
public ExceptionData(final String message, Object... args) {
|
||||
this(message, null, args);
|
||||
}
|
||||
|
||||
public ExceptionData(final String message, final IModInfo modInfo, Object... args) {
|
||||
this.i18message = message;
|
||||
this.modInfo = modInfo;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
@@ -43,6 +52,10 @@ public class EarlyLoadingException extends RuntimeException {
|
||||
public Object[] getArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
public IModInfo getModInfo() {
|
||||
return modInfo;
|
||||
}
|
||||
}
|
||||
private final List<ExceptionData> errorMessages;
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ public abstract class FMLCommonLaunchHandler
|
||||
Arrays.stream(FMLLoader.getMCPaths()).forEach(builder::addTransformationPath);
|
||||
additionalLibraries.forEach(builder::addTransformationPath);
|
||||
FMLLoader.getLanguageLoadingProvider().getLibraries().forEach(builder::addTransformationPath);
|
||||
builder.setClassBytesLocator(getClassLoaderLocatorFunction());
|
||||
builder.setManifestLocator(getClassLoaderManifestLocatorFunction());
|
||||
builder.setResourceEnumeratorLocator(getClassLoaderResourceEnumerationFunction());
|
||||
}
|
||||
|
||||
public void setup(final IEnvironment environment, final Map<String, ?> arguments)
|
||||
@@ -128,16 +128,17 @@ public abstract class FMLCommonLaunchHandler
|
||||
}
|
||||
|
||||
|
||||
protected Function<String, Optional<URL>> getClassLoaderLocatorFunction() {
|
||||
return input->Optional.ofNullable(FMLLoader.getLoadingModList().findURLForResource(input));
|
||||
protected Function<String, Enumeration<URL>> getClassLoaderResourceEnumerationFunction() {
|
||||
return input->FMLLoader.getLoadingModList().findAllURLsForResource(input);
|
||||
}
|
||||
|
||||
protected Function<URLConnection, Optional<Manifest>> getClassLoaderManifestLocatorFunction() {
|
||||
return input -> {
|
||||
if (input instanceof ModJarURLHandler.ModJarURLConnection) {
|
||||
return ((ModJarURLHandler.ModJarURLConnection) input).getManifest();
|
||||
return urlConnection -> {
|
||||
if (urlConnection instanceof ModJarURLHandler.ModJarURLConnection) {
|
||||
return ((ModJarURLHandler.ModJarURLConnection) urlConnection).getManifest();
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.empty();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.fml.loading;
|
||||
|
||||
import com.electronwill.nightconfig.core.ConfigSpec;
|
||||
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
import com.electronwill.nightconfig.core.io.ParsingException;
|
||||
import com.electronwill.nightconfig.core.io.WritingMode;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -54,7 +55,14 @@ public class FMLConfig
|
||||
autosave().autoreload().
|
||||
writingMode(WritingMode.REPLACE).
|
||||
build();
|
||||
configData.load();
|
||||
try
|
||||
{
|
||||
configData.load();
|
||||
}
|
||||
catch (ParsingException e)
|
||||
{
|
||||
throw new RuntimeException("Failed to load FML config from " + configFile.toString(), e);
|
||||
}
|
||||
if (!configSpec.isCorrect(configData)) {
|
||||
LOGGER.warn(CORE, "Configuration file {} is not correct. Correcting", configFile);
|
||||
configSpec.correct(configData, (action, path, incorrectValue, correctedValue) ->
|
||||
|
||||
@@ -19,20 +19,16 @@
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import com.google.common.collect.Streams;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -45,6 +41,7 @@ public class LoadingModList
|
||||
private final List<ModFileInfo> modFiles;
|
||||
private final List<ModInfo> sortedList;
|
||||
private final Map<String, ModFileInfo> fileById;
|
||||
@SuppressWarnings("unused")
|
||||
private BackgroundScanHandler scanner;
|
||||
private final List<EarlyLoadingException> preLoadErrors;
|
||||
private List<ModFile> brokenFiles;
|
||||
@@ -118,21 +115,46 @@ public class LoadingModList
|
||||
return null;
|
||||
}
|
||||
|
||||
public URL findURLForResource(String resourceName) {
|
||||
for (ModFileInfo mf : modFiles) {
|
||||
// strip a leading slash
|
||||
if (resourceName.startsWith("/")) resourceName = resourceName.substring(1);
|
||||
|
||||
final Path resource = mf.getFile().findResource(resourceName);
|
||||
if (Files.exists(resource)) {
|
||||
try {
|
||||
return new URL("modjar://"+mf.getMods().get(0).getModId()+"/"+resourceName);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
public Enumeration<URL> findAllURLsForResource(final String resName) {
|
||||
final String resourceName;
|
||||
// strip a leading slash
|
||||
if (resName.startsWith("/")) {
|
||||
resourceName = resName.substring(1);
|
||||
} else {
|
||||
resourceName = resName;
|
||||
}
|
||||
return null;
|
||||
return new Enumeration<URL>() {
|
||||
private final Iterator<ModFileInfo> modFileIterator = modFiles.iterator();
|
||||
private URL next;
|
||||
@Override
|
||||
public boolean hasMoreElements() {
|
||||
if (next!=null) return true;
|
||||
next = findNextURL();
|
||||
return next != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL nextElement() {
|
||||
if (next == null) {
|
||||
next = findNextURL();
|
||||
if (next == null) throw new NoSuchElementException();
|
||||
}
|
||||
URL result = next;
|
||||
next = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private URL findNextURL() {
|
||||
while (modFileIterator.hasNext()) {
|
||||
final ModFileInfo next = modFileIterator.next();
|
||||
final Path resource = next.getFile().findResource(resourceName);
|
||||
if (Files.exists(resource)) {
|
||||
return LamdbaExceptionUtils.uncheck(()->new URL("modjar://" + next.getMods().get(0).getModId() + "/" + resourceName));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public ModFileInfo getModFileById(String modid)
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import com.google.common.collect.Streams;
|
||||
import com.google.common.graph.GraphBuilder;
|
||||
import com.google.common.graph.MutableGraph;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
@@ -43,6 +42,7 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
@@ -192,7 +192,7 @@ public class ModSorter
|
||||
if (!dupedMods.isEmpty()) {
|
||||
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods
|
||||
.stream()
|
||||
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm.getValue().get(0)))
|
||||
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm.getValue().get(0), Objects.toString(dm.getValue().get(0))))
|
||||
.collect(Collectors.toList());
|
||||
throw new EarlyLoadingException("Duplicate mods found", null, duplicateModErrors);
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class ModSorter
|
||||
if (!missingVersions.isEmpty()) {
|
||||
final List<EarlyLoadingException.ExceptionData> exceptionData = missingVersions
|
||||
.stream()
|
||||
.map(mv -> new EarlyLoadingException.ExceptionData("fml.modloading.missingdependency",
|
||||
.map(mv -> new EarlyLoadingException.ExceptionData("fml.modloading.missingdependency", mv.getOwner(),
|
||||
mv.getModId(), mv.getOwner().getModId(), mv.getVersionRange(),
|
||||
modVersions.getOrDefault(mv.getModId(), new DefaultArtifactVersion("null"))))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
+1
-2
@@ -29,7 +29,6 @@ import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -63,7 +62,7 @@ public abstract class AbstractJarFileLocator implements IModLocator {
|
||||
if (path.length < 1) {
|
||||
throw new IllegalArgumentException("Missing path");
|
||||
}
|
||||
return modJars.get(modFile).getPath(path[0], Arrays.copyOfRange(path, 1, path.length));
|
||||
return modJars.get(modFile).getPath("",path);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -79,7 +79,7 @@ public class ExplodedDirectoryLocator implements IModLocator {
|
||||
if (Files.exists(found)) return found;
|
||||
// then try left path (classes)
|
||||
return mods.get(modFile).getRight().stream().map(p->p.resolve(target)).filter(Files::exists).
|
||||
findFirst().orElse(found.resolve(target));
|
||||
findFirst().orElse(found);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,6 +92,7 @@ public class ExplodedDirectoryLocator implements IModLocator {
|
||||
}
|
||||
|
||||
private void scanIndividualPath(final Path path, Consumer<Path> pathConsumer) {
|
||||
if (!Files.exists(path)) return;
|
||||
LOGGER.debug(SCAN, "Scanning exploded target {}", path.toString());
|
||||
try (Stream<Path> files = Files.find(path, Integer.MAX_VALUE, (p, a) -> p.getNameCount() > 0 && p.getFileName().toString().endsWith(".class"))) {
|
||||
files.forEach(pathConsumer);
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class InvalidModFileException extends RuntimeException
|
||||
|
||||
public InvalidModFileException(String message, IModFileInfo modFileInfo)
|
||||
{
|
||||
super(message);
|
||||
super(String.format("%s (%s)", message, ((ModFileInfo)modFileInfo).getFile().getFileName()));
|
||||
this.modFileInfo = modFileInfo;
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
import net.minecraftforge.forgespi.Environment;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
@@ -79,7 +78,7 @@ public class ModFile implements IModFile {
|
||||
this.locator = locator;
|
||||
this.filePath = file;
|
||||
this.parser = parser;
|
||||
manifest = locator.findManifest(file).orElse(DEFAULTMANIFEST);
|
||||
manifest = Optional.ofNullable(locator).flatMap(l->l.findManifest(file)).orElse(DEFAULTMANIFEST);
|
||||
if (manifest != DEFAULTMANIFEST) LOGGER.debug(SCAN,"Mod file {} has a manifest", file);
|
||||
else LOGGER.debug(SCAN,"Mod file {} is missing a manifest", file);
|
||||
final Optional<String> value = Optional.ofNullable(manifest.getMainAttributes().getValue(TYPE));
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
|
||||
import net.minecraftforge.fml.loading.StringSubstitutor;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
@@ -54,6 +52,9 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
private final List<IModInfo> mods;
|
||||
private final Map<String,Object> properties;
|
||||
private final String license;
|
||||
// Caches the manifest of the mod jar as parsing the manifest can be expensive for
|
||||
// signed jars.
|
||||
private final Optional<Manifest> manifest;
|
||||
|
||||
ModFileInfo(final ModFile modFile, final IConfigurable config)
|
||||
{
|
||||
@@ -65,14 +66,14 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
.map(MavenVersionAdapter::createFromVersionSpec)
|
||||
.orElseThrow(()->new InvalidModFileException("Missing ModLoader version in file", this));
|
||||
this.license = config.<String>getConfigElement("license")
|
||||
.orElseThrow(()->new InvalidModFileException("Missing License, please supply a license.", this));
|
||||
.orElse("");
|
||||
this.showAsResourcePack = config.<Boolean>getConfigElement("showAsResourcePack").orElse(false);
|
||||
this.properties = config.<UnmodifiableConfig>getConfigElement("properties").
|
||||
map(UnmodifiableConfig::valueMap).orElse(Collections.emptyMap());
|
||||
this.properties = config.<Map<String, Object>>getConfigElement("properties").orElse(Collections.emptyMap());
|
||||
this.modFile.setFileProperties(this.properties);
|
||||
this.issueURL = config.<String>getConfigElement("issueTrackerURL").map(StringUtils::toURL).orElse(null);
|
||||
final List<? extends IConfigurable> modConfigs = config.getConfigList("mods");
|
||||
if (modConfigs.isEmpty()) {
|
||||
if (modConfigs.isEmpty())
|
||||
{
|
||||
throw new InvalidModFileException("Missing mods list", this);
|
||||
}
|
||||
this.mods = modConfigs.stream()
|
||||
@@ -82,6 +83,7 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
this.modFile::getFileName,
|
||||
() -> this.mods.stream().map(IModInfo::getModId).collect(Collectors.joining(",", "{", "}")),
|
||||
() -> this.mods.stream().map(IModInfo::getVersion).map(Objects::toString).collect(Collectors.joining(",", "{", "}")));
|
||||
this.manifest = modFile.getLocator().findManifest(modFile.getFilePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,31 +110,47 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getFileProperties() {
|
||||
public Map<String, Object> getFileProperties()
|
||||
{
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
public Optional<Manifest> getManifest() {
|
||||
return modFile.getLocator().findManifest(modFile.getFilePath());
|
||||
public Optional<Manifest> getManifest()
|
||||
{
|
||||
return manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showAsResourcePack() {
|
||||
public boolean showAsResourcePack()
|
||||
{
|
||||
return this.showAsResourcePack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<T> getConfigElement(final String... key) {
|
||||
public <T> Optional<T> getConfigElement(final String... key)
|
||||
{
|
||||
return this.config.getConfigElement(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends IConfigurable> getConfigList(final String... key) {
|
||||
public List<? extends IConfigurable> getConfigList(final String... key)
|
||||
{
|
||||
return this.config.getConfigList(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLicense() {
|
||||
public String getLicense()
|
||||
{
|
||||
return license;
|
||||
}
|
||||
|
||||
public URL getIssueURL()
|
||||
{
|
||||
return issueURL;
|
||||
}
|
||||
|
||||
public boolean missingLicense()
|
||||
{
|
||||
return Strings.isNullOrEmpty(license);
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -45,8 +45,14 @@ public class NightConfigWrapper implements IConfigurable {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Optional<T> getConfigElement(final String... key) {
|
||||
return this.config.getOptional(asList(key));
|
||||
return this.config.getOptional(asList(key)).map(value -> {
|
||||
if (value instanceof UnmodifiableConfig) {
|
||||
return (T) ((UnmodifiableConfig) value).valueMap();
|
||||
}
|
||||
return (T) value;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
"minecraft:birch_fence_gate",
|
||||
"minecraft:jungle_fence_gate",
|
||||
"minecraft:acacia_fence_gate",
|
||||
"minecraft:dark_oak_fence_gate"
|
||||
"minecraft:dark_oak_fence_gate",
|
||||
"minecraft:crimson_fence_gate",
|
||||
"minecraft:warped_fence_gate"
|
||||
]
|
||||
}
|
||||
@@ -6,6 +6,8 @@
|
||||
"minecraft:birch_fence",
|
||||
"minecraft:jungle_fence",
|
||||
"minecraft:acacia_fence",
|
||||
"minecraft:dark_oak_fence"
|
||||
"minecraft:dark_oak_fence",
|
||||
"minecraft:crimson_fence",
|
||||
"minecraft:warped_fence"
|
||||
]
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
"#forge:ores/iron",
|
||||
"#forge:ores/lapis",
|
||||
"#forge:ores/redstone",
|
||||
"#forge:ores/quartz"
|
||||
"#forge:ores/quartz",
|
||||
"#forge:ores/netherite_scrap"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:gold_ore"
|
||||
"#minecraft:gold_ores"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:ancient_debris"
|
||||
]
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
"#forge:storage_blocks/iron",
|
||||
"#forge:storage_blocks/lapis",
|
||||
"#forge:storage_blocks/quartz",
|
||||
"#forge:storage_blocks/redstone"
|
||||
"#forge:storage_blocks/redstone",
|
||||
"#forge:storage_blocks/netherite"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:netherite_block"
|
||||
]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:arrow",
|
||||
"minecraft:tipped_arrow",
|
||||
"minecraft:spectral_arrow"
|
||||
]
|
||||
}
|
||||
@@ -6,6 +6,8 @@
|
||||
"minecraft:birch_fence_gate",
|
||||
"minecraft:jungle_fence_gate",
|
||||
"minecraft:acacia_fence_gate",
|
||||
"minecraft:dark_oak_fence_gate"
|
||||
"minecraft:dark_oak_fence_gate",
|
||||
"minecraft:crimson_fence_gate",
|
||||
"minecraft:warped_fence_gate"
|
||||
]
|
||||
}
|
||||
@@ -6,6 +6,8 @@
|
||||
"minecraft:birch_fence",
|
||||
"minecraft:jungle_fence",
|
||||
"minecraft:acacia_fence",
|
||||
"minecraft:dark_oak_fence"
|
||||
"minecraft:dark_oak_fence",
|
||||
"minecraft:crimson_fence",
|
||||
"minecraft:warped_fence"
|
||||
]
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
"#forge:ingots/iron",
|
||||
"#forge:ingots/gold",
|
||||
"#forge:ingots/brick",
|
||||
"#forge:ingots/nether_brick"
|
||||
"#forge:ingots/nether_brick",
|
||||
"#forge:ingots/netherite"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:netherite_ingot"
|
||||
]
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:music_disc_13",
|
||||
"minecraft:music_disc_cat",
|
||||
"minecraft:music_disc_blocks",
|
||||
"minecraft:music_disc_chirp",
|
||||
"minecraft:music_disc_far",
|
||||
"minecraft:music_disc_mall",
|
||||
"minecraft:music_disc_mellohi",
|
||||
"minecraft:music_disc_stal",
|
||||
"minecraft:music_disc_strad",
|
||||
"minecraft:music_disc_ward",
|
||||
"minecraft:music_disc_11",
|
||||
"minecraft:music_disc_wait"
|
||||
]
|
||||
}
|
||||
Loaded 100 of 294 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user