Zeroth pass on 1.13

This commit is contained in:
cpw 2018-08-27 13:10:07 -04:00 committed by LexManos
parent 6e99f84e91
commit 77c3310711
176 changed files with 603 additions and 16145 deletions

View file

@ -1,477 +1,116 @@
buildscript {
repositories {
mavenLocal()
maven { url = 'http://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
}
}
plugins {
id 'net.minecrell.licenser' version '0.4'
}
apply plugin: "maven"
def patcher_plugin = plugins.apply('net.minecraftforge.gradle.patcher')
apply plugin: "net.minecraftforge.gradle.launch4j"
minecraft.version = "1.12.2"
minecraft {
mappings = 'snapshot_nodoc_20171003'
workspaceDir = "projects"
versionJson = "jsons/${minecraft.version}-dev.json"
buildUserdev = true
buildInstaller = true
installerVersion = "1.5"
def common = {
patchPrefixOriginal "../src-base/minecraft"
patchPrefixChanged "../src-work/minecraft"
mainClassClient "net.minecraft.launchwrapper.Launch"
tweakClassClient "net.minecraftforge.fml.common.launcher.FMLTweaker"
mainClassServer "net.minecraft.launchwrapper.Launch"
tweakClassServer "net.minecraftforge.fml.common.launcher.FMLServerTweaker"
}
projects {
forge {
rootDir "."
patchDir "patches/minecraft"
patchAfter "clean"
genPatchesFrom "clean"
genMcpPatches = false
applyMcpPatches = false
s2sKeepImports = true
with common
}
}
}
apply plugin: 'eclipse'
group = 'net.minecraftforge'
version = getVersionFromJava(file("src/main/java/net/minecraftforge/common/ForgeVersion.java"))
version = '1.0.0'
extractForgeSources { exclude "**/SideOnly.java", "**/Side.java" }
extractForgeResources { exclude "**/log4j2.xml" }
genGradleProjects {
addTestCompileDep "junit:junit:4.12" // TODO update unit tests to junit 5 and remove this
addTestCompileDep "org.junit.jupiter:junit-jupiter-api:5.0.0"
addTestCompileDep "org.opentest4j:opentest4j:1.0.0" // needed for junit 5
addTestCompileDep "org.hamcrest:hamcrest-core:1.3"
filter { dep -> !dep.contains("scala") }
project(':mcp') {
apply plugin: 'net.minecraftforge.gradle.forgedev.mcp'
mcp {
config = 'de.oceanlabs.mcp:mcp_config:1.13@zip'
pipeline = 'joined'
}
}
processJson {
releaseJson = "jsons/${minecraft.version}-rel.json"
addReplacements([
"@minecraft_version@": project.minecraft.version,
"@version@": project.version,
"@project@": "forge",
"@artifact@": "net.minecraftforge:forge:${project.version}",
"@universal_jar@": { outputJar.archiveName },
"@timestamp@": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
project(':clean') {
evaluationDependsOn(':mcp')
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
repositories {
mavenCentral()
}
patcher {
parent = project(':mcp')
patchedSrc = file('src/main/java')
mappings channel: 'snapshot', version: '20180813-1.12'
mcVersion = '1.13'
}
}
license {
header = project.file('LICENSE-header.txt')
include 'net/minecraftforge/'
exclude 'net/minecraftforge/fml/repackage/'
exclude 'net/minecraftforge/server/terminalconsole/'
exclude 'net/minecraftforge/fml/common/versioning/ComparableVersion.java'
exclude 'net/minecraftforge/fml/common/versioning/InvalidVersionSpecificationException.java'
exclude 'net/minecraftforge/fml/common/versioning/Restriction.java'
exclude 'net/minecraftforge/fml/common/versioning/VersionRange.java'
tasks {
project(':forge') {
evaluationDependsOn(':clean')
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
sourceSets {
main {
files = project.files('src/main/java')
}
test {
files = project.files('src/test/java')
}
}
}
task changelog(type: JenkinsChangelog) {
// skip if there is no forge jenkins pass
onlyIf {
project.hasProperty('forgeJenkinsPass')
}
outputs.upToDateWhen { false } // never up to date
serverRoot = "http://ci.jenkins.minecraftforge.net/"
jobName = "minecraftforge"
targetBuild = System.env['BUILD_NUMBER'] ?: project.ext.properties.buildNumber ?:0;
authName = "console_script"
authPassword = project.hasProperty('forgeJenkinsPass') ? project.getProperty('forgeJenkinsPass') : "";
output = "build/distributions/${project.name}-${project.version}-changelog.txt"
}
task crowdin(type: CrowdinDownload) {
output = "build/crowdin.zip"
projectId = 'minecraft-forge'
extract = false // we wanna keep it as a zip. not extract it to a folder named "crowdin.zip"
// task auomatically skips if this is null
if (project.hasProperty('crowdinKey'))
apiKey = project.crowdinKey
}
def extraTxts = [
"CREDITS.txt",
"LICENSE.txt",
"LICENSE-Paulscode SoundSystem CodecIBXM.txt",
"LICENSE-Paulscode IBXM Library.txt"
]
if (project.hasProperty('forgeJenkinsPass'))
extraTxts += changelog
import groovy.json.JsonSlurper;
import groovy.json.JsonBuilder;
task extractAnnotationsVanilla(type: net.minecraftforge.gradle.tasks.TaskExtractAnnotationsText, dependsOn: deobfuscateJar) {
jar = deobfuscateJar.outJar
output = 'build/vanilla_annotations_raw.json'
doLast { //Re-dump it so it's in groovy's sorted order. Because I like being able to do diffs against things.
def json = new JsonSlurper().parseText(file(output).text)
file(output).write(new JsonBuilder(json).toPrettyString())
}
}
task reobfToSRG(type: net.minecraftforge.gradle.patcher.TaskReobfuscate, dependsOn: reobfuscate) {
srg = patcher_plugin.delayedFile('{CACHE_DIR}/de/oceanlabs/mcp/mcp_{MAPPING_CHANNEL}/{MAPPING_VERSION}/{MC_VERSION}/srgs/mcp-srg.srg')
exc = reobfuscate.exc
preFFJar = reobfuscate.preFFJar
methodsCsv = reobfuscate.methodsCsv
fieldsCsv = reobfuscate.fieldsCsv
addLibs reobfuscate.libs
inJar = patcher_plugin.delayedFile('{BUILD_DIR}/localCache/Forge/recompiled.jar')
outJar = 'build/forge_srg.jar'
}
task extractAnnotationsForgeSRG(type: net.minecraftforge.gradle.tasks.TaskExtractAnnotationsText, dependsOn: reobfToSRG) {
jar = reobfToSRG.outJar
output = 'build/forge_annotations.json'
doLast { //Re-dump it so it's in groovy's sorted order. Because I like being able to do diffs against things.
def json = new JsonSlurper().parseText(file(output).text)
json.entrySet().removeIf{e -> (!e.key.startsWith('net/minecraft/') && !e.key.startsWith('net/minecraftforge/')) || e.key.endsWith('/package-info')}
file(output).write(new JsonBuilder(json).toPrettyString())
}
}
task fixAnnotationsJson(dependsOn: [extractAnnotationsVanilla, extractAnnotationsForgeSRG, genPatches]) {
inputs.file(extractAnnotationsVanilla.output)
inputs.file(extractAnnotationsForgeSRG.output)
outputs.file('build/vanilla_annotations.json')
doLast {
def json_vanilla = new JsonSlurper().parseText(file(extractAnnotationsVanilla.output).text) as TreeMap
def json_forge = new JsonSlurper().parseText(file(extractAnnotationsForgeSRG.output).text) as TreeMap
def start = minecraft.projects.forge.patchDir.absolutePath.length()
file(minecraft.projects.forge.patchDir).traverse(type: groovy.io.FileType.FILES, nameFilter: {nf -> nf.endsWith('.java.patch')}) { f ->
def cls = f.absolutePath.substring(start+1).replace('\\', '/').replace('.java.patch', '')
json_vanilla.entrySet().removeIf{e -> e.key == cls || e.key.startsWith(cls + '$')}
json_forge.entrySet().stream().filter{e -> e.key == cls || e.key.startsWith(cls + '$')}.forEach{e -> json_vanilla.put(e.key, e.value)}
}
json_forge.entrySet().stream().filter{e -> e.key.startsWith('net/minecraftforge/')}.forEach{e -> json_vanilla.put(e.key, e.value)}
outputs.files.singleFile.write(new JsonBuilder(json_vanilla).toPrettyString())
}
}
outputJar {
classifier = 'universal'
from extraTxts
from(fixAnnotationsJson){
into 'META-INF'
}
dependsOn fixAnnotationsJson
// add crowdin locales
from { crowdin.getDidWork() ? zipTree(crowdin.output) : null}
dependsOn 'crowdin'
manifest.attributes([
"Main-Class": "net.minecraftforge.fml.relauncher.ServerLaunchWrapper",
"TweakClass": "net.minecraftforge.fml.common.launcher.FMLTweaker",
"Class-Path": getServerClasspath(file("jsons/${minecraft.version}-rel.json"))
])
}
installer {
classifier = 'installer'
from extraTxts
from "src/main/resources/forge_logo.png"
from "src/main/resources/url.png"
rename "forge_logo\\.png", "big_logo.png"
}
task signUniversal(type: SignJar, dependsOn: 'outputJar') {
onlyIf {
project.hasProperty('jarsigner')
}
def jarsigner = [:];
if (project.hasProperty('jarsigner'))
jarsigner = project.jarsigner;
alias = 'forge'
exclude "paulscode/**"
storePass = jarsigner.storepass
keyPass = jarsigner.keypass
keyStore = jarsigner.keystore
inputFile = outputJar.archivePath
outputFile = outputJar.archivePath
}
uploadArchives.dependsOn signUniversal
build.dependsOn signUniversal
installer.dependsOn signUniversal
// MDK package
import org.apache.tools.ant.filters.ReplaceTokens
task makeMdk(type: Zip) {
baseName = project.name
classifier = "mdk"
version = project.version
destinationDir = file('build/distributions')
from 'gradlew'
from 'gradlew.bat'
from extraTxts
into ('gradle') {
from 'gradle'
}
into ('eclipse') {
from 'mdk/eclipse'
}
from ('mdk') {
filter(ReplaceTokens, tokens: [
VERSION: project.version,
MAPPINGS: minecraft.mappings.replace('nodoc_', '')
])
exclude 'eclipse'
rename 'gitignore\\.txt', '.gitignore'
}
}
tasks.build.dependsOn makeMdk
// launch4j
launch4j {
jar = installer.archivePath.canonicalPath
outfile = file("build/distributions/${project.name}-${project.version}-installer-win.exe").canonicalPath
icon = file('icon.ico').canonicalPath
manifest = file('l4jManifest.xml').canonicalPath
jreMinVersion = '1.8.0'
initialHeapPercent = 5;
maxHeapPercent = 100;
}
tasks.generateXmlConfig.dependsOn installer
tasks.build.dependsOn 'launch4j'
// MAVEN
artifacts {
if (project.hasProperty('forgeJenkinsPass'))
archives changelog.output
archives file("build/distributions/${project.name}-${project.version}-installer-win.exe")
archives makeMdk
}
task ciWriteBuildNumber << {
def file = file("src/main/java/net/minecraftforge/common/ForgeVersion.java");
def bn = System.getenv("BUILD_NUMBER")?:project.ext.properties.buildNumber?:0;
def outfile = "";
def ln = "\n"; //Linux line endings because we're on git!
file.eachLine{ String s ->
if (s.matches("^ public static final int buildVersion = [\\d]+;\$"))
s = " public static final int buildVersion = ${bn};";
if (s.matches('^ public static final String mcVersion = "[^\\"]+";'))
s = " public static final String mcVersion = \"${minecraft.version}\";";
outfile += (s+ln);
}
file.write(outfile);
}
uploadArchives {
repositories.mavenDeployer {
dependsOn 'build'
if (project.hasProperty('forgeMavenPass'))
{
repository(url: "http://files.minecraftforge.net/maven/manage/upload") {
authentication(userName: "forge", password: project.getProperty('forgeMavenPass')) // the elvis operator. look it up.
java {
srcDir "$rootDir/src/main/java"
}
}
else
{
// local repo folder. Might wanna juset use gradle install if you wanans end it to maven-local
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Minecraft Forge API'
url 'https://github.com/MinecraftForge/MinecraftForge'
scm {
url 'https://github.com/MinecraftForge/MinecraftForge'
connection 'scm:git:git://github.com/MinecraftForge/MinecraftForge.git'
developerConnection 'scm:git:git@github.com:MinecraftForge/MinecraftForge.git'
}
issueManagement {
system 'github'
url 'https://github.com/MinecraftForge/MinecraftForge/issues'
}
licenses {
license {
name 'Forge Public License'
url 'https://raw.github.com/MinecraftForge/MinecraftForge/master/MinecraftForge-License.txt'
distribution 'repo'
}
}
developers {
developer {
id 'cpw'
name 'cpw'
roles { role 'developer' }
}
developer {
id 'LexManos'
name 'Lex Manos'
roles { role 'developer' }
}
developer {
id 'AbrarSyed'
name 'Abrar Syed'
roles { role 'contributor' }
}
}
resources {
srcDir "$rootDir/src/main/resources"
}
}
}
}
repositories {
mavenCentral()
}
patcher {
parent = project(':clean')
patches = file("$rootDir/patches/minecraft")
patchedSrc = file('src/main/java')
accessTransformer = file("$rootDir/src/main/resources/forge_at.cfg")
srgPatches = false
}
applyPatches {
canonicalizeAccess true
canonicalizeWhitespace true
maxFuzz 3
}
dependencies {
implementation project(':clean')
implementation 'cpw.mods:modlauncher:0.1+'
implementation 'net.minecraftforge:accesstransformers:0.10+:shadowed'
implementation 'net.minecraftforge:eventbus:0.1+:service'
implementation 'net.minecraftforge:forgespi:0.1+'
implementation 'net.minecraftforge:coremods:0.1+'
implementation 'com.electronwill.night-config:core:3.4.0'
implementation 'com.electronwill.night-config:toml:3.4.0'
}
// HELPER METHODS
configurations {
ecj
}
dependencies {
ecj 'org.eclipse.jdt.core.compiler:ecj:4.6.1'
}
String getServerClasspath(File file)
{
def node = new JsonSlurper().parse(file);
def out = new StringBuilder()
node.versionInfo.libraries.each { lib ->
if (lib.serverreq)
{
// group : artifact : version
def split = lib.name.split(':')
def group = split[0].replace('.', '/')
def artifact = split[1]
def version = split[2]
out += "libraries/$group/$artifact/$version/$artifact-${version}.jar "
compileJava {
options.fork = true
options.failOnError = false
options.forkOptions.with {
executable = 'java'
jvmArgs = ['-classpath', project.configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', '-nowarn']
}
}
out += "minecraft_server.${minecraft.version}.jar"
return out.toString();
}
String getVersionFromJava(File file)
{
String major = "0";
String minor = "0";
String revision = "0";
String build = "0";
String prefix = "public static final int";
file.eachLine{ String s ->
s = s.trim();
if (s.startsWith(prefix))
{
s = s.substring(prefix.length(), s.length() - 1);
s = s.replace('=', ' ').replace("Version", "").replaceAll(" +", " ").trim();
String[] pts = s.split(" ");
if (pts[0].equals("major")) major = pts[pts.length - 1];
else if (pts[0] == "minor") minor = pts[pts.length - 1];
else if (pts[0] == "revision") revision = pts[pts.length - 1];
}
task runclient(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main 'net.minecraftforge.fml.LaunchTesting'
systemProperties target:'fmldevclient'
}
build = System.getenv("BUILD_NUMBER") ?: project.ext.properties.buildNumber ?: 0
String branch = null;
if (!System.getenv().containsKey("GIT_BRANCH"))
{
// TODO: use grgit - Tried to switch 07/07/16 - jgit broken on windows?
branch = "git rev-parse --abbrev-ref HEAD".execute().text.trim()
task runserver(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main 'net.minecraftforge.fml.LaunchTesting'
systemProperties target:'fmldevserver'
}
else
{
branch = System.getenv("GIT_BRANCH");
branch = branch.substring(branch.lastIndexOf('/') + 1);
}
def out = "${minecraft.version.replace('-', '_')}-$major.$minor.$revision.$build"
if (branch && branch != 'master' && branch != 'HEAD' && branch != minecraft.version && branch != minecraft.version + '.0')
{
if (!(branch.endsWith('.x') && minecraft.version.startsWith(branch.substring(0, branch.length() -2))))
out += "-$branch"
}
return out;
}
reobfuscate {
extraSrg = [
'MD: net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry/getKeys ()Ljava/util/Set; net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry/getKeys ()Ljava/util/Set;'
]
//evaluationDependsOnChildren()
task setup() {
dependsOn ':clean:extractMapped'
dependsOn ':forge:extractMapped' //These must be strings so that we can do lazy resolution. Else we need evaluationDependsOnChildren above
}
task resetBuildNumber << {
project.ext.properties.buildNumber = 0;
ciWriteBuildNumber.execute()
}
// re-add old tasks for jenkins compat
// should be removed, and the jenkins fixed when no longer building with FG 1.2
task setupForge { dependsOn 'setup', 'ciWriteBuildNumber' }
task buildPackages { dependsOn 'build' }
//Temporary hack to fix compile errors caused by mappings shading in Bootstrap
/*
task fixParams << {
logger.lifecycle('Fixing param names!')
def params = new File(extractMcpMappings.destinationDir, 'params.csv')
def text = params.text
text = text.replaceAll('p_180276_1_,biome,', 'p_180276_1_,biomeIn,')
params.write(text)
}
fixParams.dependsOn('extractMcpMappings')
extractMcpMappings.finalizedBy('fixParams')
*/

Binary file not shown.

View file

@ -1,6 +1,5 @@
#Sat Mar 10 11:15:39 EST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip

26
gradlew vendored
View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
warn () {
echo "$*"
}
die ( ) {
die () {
echo
echo "$*"
echo
@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

6
gradlew.bat vendored
View file

@ -49,7 +49,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line

View file

@ -1 +1,9 @@
rootProject.name = 'forge'
rootProject.name = 'Forge'
include ':mcp'
include ':clean'
include ':forge'
project(":mcp").projectDir = file("projects/mcp")
project(":clean").projectDir = file("projects/clean")
project(":forge").projectDir = file("projects/forge")

View file

@ -1,50 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.advancements.critereon;
import com.google.gson.JsonObject;
import net.minecraft.util.JsonUtils;
import org.apache.commons.lang3.ArrayUtils;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/**
* An {@link ItemPredicate} that matches oredicts.
*/
public class OredictItemPredicate extends ItemPredicate
{
private final String ore;
public OredictItemPredicate(String ore)
{
this.ore = ore;
}
public OredictItemPredicate(JsonObject jsonObject) { this(JsonUtils.getString(jsonObject, "ore")); }
@Override
public boolean test(ItemStack stack)
{
return !stack.isEmpty() && ArrayUtils.contains(OreDictionary.getOreIDs(stack), OreDictionary.getOreID(ore));
}
}

View file

@ -1,30 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.classloading;
import java.io.File;
import java.util.Map;
import javax.annotation.Nullable;
public class FMLForgePlugin
{
public static boolean RUNTIME_DEOBF = false;
}

View file

@ -46,7 +46,7 @@ import static net.minecraft.util.text.TextFormatting.*;
* client, the client takes precedence!
*
*/
public class ClientCommandHandler extends CommandHandler
public class ClientCommandHandler {} /*extends CommandHandler
{
public static final ClientCommandHandler instance = new ClientCommandHandler();
@ -55,7 +55,7 @@ public class ClientCommandHandler extends CommandHandler
/**
* @return 1 if successfully executed, -1 if no permission or wrong usage,
* 0 if it doesn't exist or it was canceled (it's sent to the server)
*/
* /
@Override
public int executeCommand(ICommandSender sender, String message)
{
@ -165,3 +165,4 @@ public class ClientCommandHandler extends CommandHandler
return Minecraft.getMinecraft().getIntegratedServer();
}
}
*/

View file

@ -26,11 +26,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.InventoryEffectRenderer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
@ -178,6 +176,7 @@ public class GuiScreenEvent extends Event
* This event fires at the end of {@link GuiScreen#drawDefaultBackground()} and before the rest of the Gui draws.
* This allows drawing next to Guis, above the background but below any tooltips.
*/
/*
public static class BackgroundDrawnEvent extends GuiScreenEvent
{
private final int mouseX;
@ -193,22 +192,27 @@ public class GuiScreenEvent extends Event
this.mouseY = scaledHeight - Mouse.getY() * scaledHeight / gui.mc.displayHeight - 1;
}
/**
*/
/**
* The x coordinate of the mouse pointer on the screen.
*/
*//*
public int getMouseX()
{
return mouseX;
}
/**
*/
/**
* The y coordinate of the mouse pointer on the screen.
*/
*//*
public int getMouseY()
{
return mouseY;
}
}
*/
/**
* This event fires in {@link InventoryEffectRenderer#updateActivePotionEffects()}

View file

@ -1,63 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.event;
import org.lwjgl.input.Mouse;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
/**
* Author: MachineMuse (Claire Semple)
* Created: 2:46 PM, 9/4/13
*/
@net.minecraftforge.eventbus.api.Cancelable
public class MouseEvent extends net.minecraftforge.eventbus.api.Event
{
private final int x;
private final int y;
private final int dx;
private final int dy;
private final int dwheel;
private final int button;
private final boolean buttonstate;
private final long nanoseconds;
public MouseEvent()
{
this.x = Mouse.getEventX();
this.y = Mouse.getEventY();
this.dx = Mouse.getEventDX();
this.dy = Mouse.getEventDY();
this.dwheel = Mouse.getEventDWheel();
this.button = Mouse.getEventButton();
this.buttonstate = Mouse.getEventButtonState();
this.nanoseconds = Mouse.getEventNanoseconds();
}
public int getX() { return x; }
public int getY() { return y; }
public int getDx() { return dx; }
public int getDy() { return dy; }
public int getDwheel() { return dwheel; }
public int getButton() { return button; }
public boolean isButtonstate() { return buttonstate; }
public long getNanoseconds() { return nanoseconds; }
}

View file

@ -24,9 +24,8 @@ import java.util.ArrayList;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.client.gui.BossInfoClient;
import net.minecraft.client.gui.ScaledResolution;
@net.minecraftforge.eventbus.api.Cancelable
@Cancelable
public class RenderGameOverlayEvent extends Event
{
public float getPartialTicks()
@ -34,11 +33,6 @@ public class RenderGameOverlayEvent extends Event
return partialTicks;
}
public ScaledResolution getResolution()
{
return resolution;
}
public ElementType getType()
{
return type;
@ -71,20 +65,17 @@ public class RenderGameOverlayEvent extends Event
}
private final float partialTicks;
private final ScaledResolution resolution;
private final ElementType type;
public RenderGameOverlayEvent(float partialTicks, ScaledResolution resolution)
public RenderGameOverlayEvent(float partialTicks, Void resolution)
{
this.partialTicks = partialTicks;
this.resolution = resolution;
this.type = null;
}
private RenderGameOverlayEvent(RenderGameOverlayEvent parent, ElementType type)
{
this.partialTicks = parent.getPartialTicks();
this.resolution = parent.getResolution();
this.type = type;
}

View file

@ -38,7 +38,7 @@ public class PlaySoundEvent extends SoundEvent
{
super(manager);
this.sound = sound;
this.name = sound.getSoundLocation().getResourcePath();
this.name = sound.getSoundLocation().getPath();
this.setResultSound(sound);
}

View file

@ -45,7 +45,7 @@ public class SoundEvent extends net.minecraftforge.eventbus.api.Event
public SoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
super(manager);
this.name = sound.getSoundLocation().getResourcePath();
this.name = sound.getSoundLocation().getPath();
this.sound = sound;
this.uuid = uuid;
}

View file

@ -223,12 +223,14 @@ public class ForgeGuiFactory implements IModGuiFactory
Property global = ForgeMod.getConfig().get(VERSION_CHECK_CAT, "Global", true);
List<Property> props = new ArrayList<Property>();
// TODO
/*
for (ModContainer mod : ForgeVersion.gatherMods().keySet())
{
values.remove(mod.getModId());
props.add(ForgeMod.getConfig().get(VERSION_CHECK_CAT, mod.getModId(), true)); //Get or make the value in the config
}
*/
props.addAll(values.values()); // Add any left overs from the config
props.sort(Comparator.comparing(Property::getName));
@ -378,12 +380,15 @@ public class ForgeGuiFactory implements IModGuiFactory
private static Map<Object, String> getSelectableValues()
{
Map<Object, String> selectableValues = new TreeMap<Object, String>();
// TODO
/*
for (ModContainer mod : Loader.instance().getActiveModList())
// only add mods to the list that have a non-immutable ModContainer
if (!mod.isImmutable() && mod.getMod() != null)
selectableValues.put(mod.getModId(), mod.getName());
*/
return selectableValues;
}

View file

@ -28,7 +28,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.common.ForgeVersion.Status;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.client.ClientModLoader;
import net.minecraftforge.api.distmarker.Dist;
@ -85,7 +84,7 @@ public class NotificationModUpdateScreen extends GuiScreen
public static NotificationModUpdateScreen init(GuiMainMenu guiMainMenu, GuiButton modButton)
{
NotificationModUpdateScreen notificationModUpdateScreen = new NotificationModUpdateScreen(modButton);
notificationModUpdateScreen.setGuiSize(guiMainMenu.width, guiMainMenu.height);
notificationModUpdateScreen.setWorldAndResolution(guiMainMenu.mc, guiMainMenu.width, guiMainMenu.height);
notificationModUpdateScreen.initGui();
return notificationModUpdateScreen;
}

View file

@ -108,15 +108,17 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static net.minecraftforge.fml.Logging.MODELLOADING;
import static net.minecraftforge.fml.Logging.fmlLog;
public final class ModelLoader extends ModelBakery
{
private static final Logger LOGGER = LogManager.getLogger();
private final Map<ModelResourceLocation, IModel> stateModels = Maps.newHashMap();
private final Map<ModelResourceLocation, ModelBlockDefinition> multipartDefinitions = Maps.newHashMap();
private final Map<ModelBlockDefinition, IModel> multipartModels = Maps.newHashMap();
@ -939,7 +941,7 @@ public final class ModelLoader extends ModelBakery
// ignoring pure ResourceLocation arguments, all things we care about pass ModelResourceLocation
if(entry.getKey() instanceof ModelResourceLocation)
{
fmlLog.debug(MODELLOADING, ()-> new ModelLoaderErrorMessage((ModelResourceLocation)entry.getKey(), entry.getValue(), modelRegistry, this.blockModelShapes, this::getVariantNames));
LOGGER.debug(MODELLOADING, ()-> new ModelLoaderErrorMessage((ModelResourceLocation)entry.getKey(), entry.getValue(), modelRegistry, this.blockModelShapes, this::getVariantNames));
final ModelResourceLocation location = (ModelResourceLocation)entry.getKey();
final IBakedModel model = modelRegistry.getObject(location);
if(model == null)
@ -953,7 +955,7 @@ public final class ModelLoader extends ModelBakery
IBakedModel model = modelRegistry.getObject(missing);
if(model == null || model == missingModel)
{
fmlLog.debug(MODELLOADING, ()-> new ModelLoaderErrorMessage(missing, null, modelRegistry, this.blockModelShapes, this::getVariantNames));
LOGGER.debug(MODELLOADING, ()-> new ModelLoaderErrorMessage(missing, null, modelRegistry, this.blockModelShapes, this::getVariantNames));
}
if(model == null)
{

View file

@ -66,7 +66,7 @@ import javax.annotation.Nullable;
public class DimensionManager
{
private static final Logger LOGGER = LogManager.getLogger("FML");
private static final Logger LOGGER = LogManager.getLogger();
private static final Marker DIMMGR = MarkerManager.getMarker("DIMS");
private static class Dimension
{

View file

@ -49,7 +49,7 @@ import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.ServerLifecycleHooks;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;

View file

@ -170,7 +170,7 @@ import org.apache.logging.log4j.MarkerManager;
public class ForgeHooks
{
private static final Logger LOGGER = LogManager.getLogger("FML");
private static final Logger LOGGER = LogManager.getLogger();
private static final Marker FORGEHOOKS = MarkerManager.getMarker("FORGEHOOKS");
//TODO: Loot tables?
static class SeedEntry extends WeightedRandom.Item

View file

@ -25,22 +25,21 @@ import net.minecraft.world.biome.Biome;
import static net.minecraftforge.common.config.Configuration.CATEGORY_CLIENT;
import static net.minecraftforge.common.config.Configuration.CATEGORY_GENERAL;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.SidedExecutor;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.WorldPersistenceHooks;
import net.minecraftforge.fml.javafmlmod.ModLoadingContext;
import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.INBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.StatList;
import net.minecraft.world.storage.SaveHandler;
@ -66,9 +65,7 @@ import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
import net.minecraftforge.fml.common.event.FMLModIdMappingEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.MarkerManager;
@ -76,7 +73,7 @@ import org.apache.logging.log4j.MarkerManager;
public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
{
public static final String VERSION_CHECK_CAT = "version_checking";
private static final Logger LOGGER = LogManager.getLogger("FML");
private static final Logger LOGGER = LogManager.getLogger();
private static final Marker FORGEMOD = MarkerManager.getMarker("FORGEMOD");
public static int clumpingThreshold = 64;
public static boolean removeErroringEntities = false;
@ -113,9 +110,9 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
public ForgeMod()
{
INSTANCE = this;
ModLoadingContext.get().getModEventBus().addListener(this::preInit);
ModLoadingContext.get().getModEventBus().addListener(this::postInit);
ModLoadingContext.get().getModEventBus().addListener(this::onAvailable);
FMLModLoadingContext.get().getModEventBus().addListener(this::preInit);
FMLModLoadingContext.get().getModEventBus().addListener(this::postInit);
FMLModLoadingContext.get().getModEventBus().addListener(this::onAvailable);
MinecraftForge.EVENT_BUS.addListener(this::serverStarting);
MinecraftForge.EVENT_BUS.addListener(this::playerLogin);
MinecraftForge.EVENT_BUS.addListener(this::serverStopping);
@ -336,10 +333,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
if (event.isWorldRunning() && tmpStairs != disableStairSlabCulling)
{
SidedExecutor.runOn(Dist.CLIENT,()->{
Minecraft.getMinecraft().renderGlobal.loadRenderers();
return null;
});
DistExecutor.runWhenOn(Dist.CLIENT,()->()-> Minecraft.getMinecraft().renderGlobal.loadRenderers());
}
}
@ -438,7 +432,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
}
@Override
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
public void readData(SaveHandler handler, WorldInfo info, Map<String, INBTBase> propertyMap, NBTTagCompound tag)
{
DimensionManager.loadDimensionDataMap(tag.hasKey("DimensionData") ? tag.getCompoundTag("DimensionData") : null);
FluidRegistry.loadFluidDefaults(tag);
@ -449,10 +443,9 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
OreDictionary.rebakeMap();
StatList.reinit();
Ingredient.invalidateAll();
SidedExecutor.runOn(Dist.CLIENT, ()-> {
DistExecutor.runWhenOn(Dist.CLIENT, ()-> () -> {
Minecraft.getMinecraft().populateSearchTreeManager();
Minecraft.getMinecraft().getSearchTreeManager().onResourceManagerReload(Minecraft.getMinecraft().getResourceManager());
return null;
});
}

View file

@ -58,7 +58,7 @@ public class MinecraftForge
public static final IEventBus ORE_GEN_BUS = IEventBus.create();
static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler();
private static final Logger LOGGER = LogManager.getLogger("FML");
private static final Logger LOGGER = LogManager.getLogger();
private static final Marker FORGE = MarkerManager.getMarker("FORGE");
/**

View file

@ -22,7 +22,7 @@ package net.minecraftforge.common.brewing;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionHelper;
import net.minecraft.potion.PotionBrewing;
import javax.annotation.Nonnull;
@ -49,7 +49,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
@Override
public boolean isIngredient(@Nonnull ItemStack stack)
{
return PotionHelper.isReagent(stack);
return PotionBrewing.isReagent(stack);
}
/**
@ -63,7 +63,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
{
if (!input.isEmpty() && !ingredient.isEmpty() && isIngredient(ingredient))
{
ItemStack result = PotionHelper.doReaction(ingredient, input);
ItemStack result = PotionBrewing.doReaction(ingredient, input);
if (result != input)
{
return result;

View file

@ -23,7 +23,7 @@ import java.util.concurrent.Callable;
import com.google.common.base.Throwables;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.INBTBase;
import net.minecraft.util.EnumFacing;
import javax.annotation.Nullable;
@ -58,7 +58,7 @@ public class Capability<T>
* @return a NBT holding the data. Null if no data needs to be stored.
*/
@Nullable
NBTBase writeNBT(Capability<T> capability, T instance, EnumFacing side);
INBTBase writeNBT(Capability<T> capability, T instance, EnumFacing side);
/**
* Read the capability instance from a NBT tag.
@ -79,7 +79,7 @@ public class Capability<T>
* @param side The side of the object the instance is associated with.
* @param nbt A NBT holding the data. Must not be null, as doesn't make sense to call this function with nothing to read...
*/
void readNBT(Capability<T> capability, T instance, EnumFacing side, NBTBase nbt);