mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 09:05:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b852e30285 | ||
|
|
7ea571f593 | ||
|
|
7a4ceebf5e | ||
|
|
31efcfc3b2 | ||
|
|
49cb893d12 | ||
|
|
009d4dee23 | ||
|
|
3e278acb71 | ||
|
|
d0d31d9575 | ||
|
|
ef492407ef | ||
|
|
cd417c6786 | ||
|
|
89e4e483c2 | ||
|
|
fd36f50d82 | ||
|
|
1d71c017f4 | ||
|
|
99c681ad87 | ||
|
|
57f7f1d7ab | ||
|
|
b2550b8a69 | ||
|
|
a30f173627 | ||
|
|
2aaaeba15e | ||
|
|
9c96a0a10a | ||
|
|
f5c38e2359 | ||
|
|
e544adba5c | ||
|
|
58f7487cfa | ||
|
|
9f928963f2 | ||
|
|
38cec7a11f | ||
|
|
7ab3c3a37c | ||
|
|
53127eec30 | ||
|
|
30d532f4fc | ||
|
|
01fb451b69 | ||
|
|
3714426e19 | ||
|
|
c2b919d339 | ||
|
|
c4b8a393f9 | ||
|
|
30894f7afa | ||
|
|
e9a7660cb8 | ||
|
|
4d46abf761 | ||
|
|
23baf3a8ce | ||
|
|
c6a21d0d62 | ||
|
|
da72640c7e | ||
|
|
b7f34629c3 | ||
|
|
5500d69b77 | ||
|
|
6af42bc656 | ||
|
|
e19fcb8844 | ||
|
|
0a62333890 | ||
|
|
e7512f13e4 | ||
|
|
4708d77c98 | ||
|
|
9b1d2bdd13 | ||
|
|
a6dc03aa7e | ||
|
|
6cd8349542 | ||
|
|
976c589c78 | ||
|
|
24ec338a51 | ||
|
|
4f634855ac | ||
|
|
9f01e3407e | ||
|
|
adeaeb74aa | ||
|
|
e13c3966e0 | ||
|
|
02c3b4e74b | ||
|
|
89a07d3668 | ||
|
|
b52eb6d699 | ||
|
|
3281faf2be | ||
|
|
3d25b4e793 | ||
|
|
f4532410ec | ||
|
|
8f87021b0f | ||
|
|
bc57ff9e83 | ||
|
|
de8ab934d8 | ||
|
|
81fe1c9682 | ||
|
|
58a299aabc | ||
|
|
243a21a353 | ||
|
|
f0dc530b28 | ||
|
|
dac7f590ea | ||
|
|
bf54d4d667 | ||
|
|
da4337efbf | ||
|
|
f92962bbbb | ||
|
|
2714da1022 | ||
|
|
96be82343c | ||
|
|
58577775d2 | ||
|
|
fc3e7647d2 | ||
|
|
a381874bb9 | ||
|
|
55525f6d2e | ||
|
|
bc64ceabef | ||
|
|
63ba3aa009 | ||
|
|
5265e34a35 | ||
|
|
35ab9f52b0 | ||
|
|
9b55f1f48f | ||
|
|
e356f4d713 | ||
|
|
bfc25bc5da | ||
|
|
9f0f9e7288 | ||
|
|
ce6404fd5b | ||
|
|
8f18a3de9a | ||
|
|
9815d8c379 | ||
|
|
1d902df581 | ||
|
|
8e26c99de3 | ||
|
|
fc8c3bef03 | ||
|
|
a4de22c1ad | ||
|
|
70cffe6982 | ||
|
|
39620f1e41 | ||
|
|
0e80fcb8f7 | ||
|
|
4a94c2c71b | ||
|
|
79c39f8b7c | ||
|
|
f6190e8752 | ||
|
|
0950b9fc84 |
No files matched your search
@@ -1,9 +1,13 @@
|
||||
* text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.patch text eol=lf
|
||||
*.java text eol=lf
|
||||
*.gradle text eol=crlf
|
||||
*.png binary
|
||||
*.exe binary
|
||||
*.dll binary
|
||||
*.jar binary
|
||||
*.lzma binary
|
||||
*.zip binary
|
||||
*.pyd binary
|
||||
*.cfg text eol=lf
|
||||
|
||||
+20
-19
@@ -1,20 +1,21 @@
|
||||
#eclipse
|
||||
/bin
|
||||
/minecraft_server
|
||||
/mods
|
||||
/fmlbuild.properties
|
||||
/fmlversion.properties
|
||||
/difflist.txt
|
||||
/target
|
||||
fmlbranding.properties
|
||||
/fernflower.zip
|
||||
/commands.py.bck
|
||||
/mcp*.zip
|
||||
/mcp
|
||||
/eclipse
|
||||
/deobfuscation_data*.zip
|
||||
/binpatch
|
||||
/mcp_data/
|
||||
/map_client.txt
|
||||
/*.lzma
|
||||
**/*.lzma
|
||||
/installer_base.jar
|
||||
/.settings
|
||||
/.classpath
|
||||
|
||||
#idea
|
||||
/.idea
|
||||
*.iml
|
||||
|
||||
#gradle
|
||||
/build
|
||||
/buildSrc
|
||||
/.gradle
|
||||
|
||||
#occupational hazards
|
||||
/eclipse/
|
||||
/repo/
|
||||
|
||||
|
||||
#Patch reject
|
||||
*.rej
|
||||
File renamed without changes.
-69
@@ -1,69 +0,0 @@
|
||||
{
|
||||
"id": "FML152",
|
||||
"time": "2013-03-20T12:00:00-04:00",
|
||||
"releaseTime": "2013-03-20T12:00:00-04:00",
|
||||
"type": "release",
|
||||
"minecraftArguments": "${auth_player_name} ${auth_session} --gameDir ${game_directory} --assetsDir ${game_assets} --tweakClass cpw.mods.fml.common.launcher.FMLTweaker",
|
||||
"libraries": [
|
||||
{
|
||||
"name": "cpw.mods:fml:5.2"
|
||||
},
|
||||
{
|
||||
"name": "net.minecraft:launchwrapper:1.3"
|
||||
},
|
||||
{
|
||||
"name": "net.sf.jopt-simple:jopt-simple:4.5"
|
||||
},
|
||||
{
|
||||
"name": "argo:argo:2.25_fixed"
|
||||
},
|
||||
{
|
||||
"name": "org.ow2.asm:asm-all:4.1"
|
||||
},
|
||||
{
|
||||
"name": "org.lwjgl.lwjgl:lwjgl:2.9.0"
|
||||
},
|
||||
{
|
||||
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.0"
|
||||
},
|
||||
{
|
||||
"name": "net.java.jinput:jinput:2.0.5"
|
||||
},
|
||||
{
|
||||
"name": "org.bouncycastle:bcprov-jdk15on:1.47"
|
||||
},
|
||||
{
|
||||
"name": "com.google.guava:guava:14.0"
|
||||
},
|
||||
{
|
||||
"name": "net.java.jutils:jutils:1.0.0"
|
||||
},
|
||||
{
|
||||
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.0",
|
||||
"natives": {
|
||||
"linux": "natives-linux",
|
||||
"windows": "natives-windows",
|
||||
"osx": "natives-osx"
|
||||
},
|
||||
"extract": {
|
||||
"exclude": [
|
||||
"META-INF/"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "net.java.jinput:jinput-platform:2.0.5",
|
||||
"natives": {
|
||||
"linux": "natives-linux",
|
||||
"windows": "natives-windows",
|
||||
"osx": "natives-osx"
|
||||
},
|
||||
"extract": {
|
||||
"exclude": [
|
||||
"META-INF/"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"mainClass": "net.minecraft.launchwrapper.Launch"
|
||||
}
|
||||
Executable → Regular
File renamed without changes.
@@ -1,14 +0,0 @@
|
||||
import os, sys
|
||||
|
||||
def main():
|
||||
fml_dir = os.path.abspath(sys.argv[1])
|
||||
work_dir = os.path.normpath(sys.argv[2])
|
||||
mcp_dir = os.path.normpath(sys.argv[3])
|
||||
|
||||
sys.path.append(os.path.join(fml_dir, 'install'))
|
||||
from fml import apply_fml_patches
|
||||
|
||||
apply_fml_patches(fml_dir, mcp_dir, work_dir, False)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
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:1.1-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
import static net.minecraftforge.gradle.dev.FmlDevPlugin.*
|
||||
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'fmldev'
|
||||
|
||||
repositories {
|
||||
flatDir {
|
||||
name "fileRepo"
|
||||
dirs "repo"
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = '1.7.2'
|
||||
mcpVersion = '9.01-pre'
|
||||
fmlDir = projectDir.getAbsolutePath();
|
||||
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
|
||||
installerVersion = "1.4"
|
||||
}
|
||||
|
||||
group = 'cpw.mods'
|
||||
version = getVersionFromGit(getProject())
|
||||
|
||||
jenkins {
|
||||
job = 'fml'
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
if (project.hasProperty("filesmaven")) {
|
||||
logger.info('Publishing to files server')
|
||||
|
||||
mavenDeployer {
|
||||
configuration = configurations.deployerJars
|
||||
|
||||
repository(url: project.filesmaven.url) {
|
||||
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
|
||||
}
|
||||
|
||||
pom {
|
||||
groupId = project.group
|
||||
version = project.version
|
||||
artifactId = project.archivesBaseName
|
||||
project {
|
||||
name project.archivesBaseName
|
||||
packaging 'jar'
|
||||
description 'ForgeModLoader'
|
||||
url 'https://github.com/MinecraftForge/FML'
|
||||
|
||||
scm {
|
||||
url 'https://github.com/MinecraftForge/FML'
|
||||
connection 'scm:git:git://github.com/MinecraftForge/FML.git'
|
||||
developerConnection 'scm:git:[email protected]:MinecraftForge/FML.git'
|
||||
}
|
||||
|
||||
issueManagement {
|
||||
system 'github'
|
||||
url 'https://github.com/MinecraftForge/FML/issues'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'GNU Lesser Public License (LGPL), Version 2.1'
|
||||
url 'http://www.gnu.org/licenses/lgpl-2.1.txt'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'cpw'
|
||||
name 'cpw'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
developer {
|
||||
id 'LexManos'
|
||||
name 'Lex Manos'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.info('Publishing to repo folder')
|
||||
|
||||
mavenDeployer {
|
||||
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,473 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- ======================================================================
|
||||
30 Mar 2012 13:35:40
|
||||
|
||||
FML
|
||||
The Forge Mod Loader
|
||||
|
||||
cpw
|
||||
====================================================================== -->
|
||||
<project name="FML" default="jenkinsbuild">
|
||||
<description>The Forge Mod Loader</description>
|
||||
<target name="writeversion" depends="buildenvsetup">
|
||||
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
|
||||
<arg value="${basedir}/getversion.py" />
|
||||
<arg value="${mcp.home}" />
|
||||
</exec>
|
||||
<propertyfile file="fmlversion.properties">
|
||||
<entry key="fmlbuild.build.number" type="int" value="${version.build}" />
|
||||
<entry key="fmlbuild.deobfuscation.hash" type="string" value="${deobf.checksum}" />
|
||||
</propertyfile>
|
||||
</target>
|
||||
|
||||
<target name="buildenvsetup">
|
||||
<tstamp>
|
||||
<format pattern="yyMMddHHmmss" property="timestamp" />
|
||||
</tstamp>
|
||||
<property environment="env" />
|
||||
<property name="modname" value="fml" />
|
||||
<condition property="mcp.home" value="${env.WORKSPACE}/mcp" else="${basedir}/mcp">
|
||||
<isset property="env.WORKSPACE" />
|
||||
</condition>
|
||||
<property name="fml.python.dir" location="${basedir}/python" />
|
||||
<property name="fml.lzma.dir" location="${basedir}/lzmabin" />
|
||||
<condition property="python.exe" value="${fml.python.dir}/python_fml" else="python">
|
||||
<os family="Windows" />
|
||||
</condition>
|
||||
<condition property="lzma.exe" value="${fml.lzma.dir}/xz.exe" else="xz">
|
||||
<os family="Windows" />
|
||||
</condition>
|
||||
<condition property="mcp.exists">
|
||||
<available file="${mcp.home}/runtime/commands.py" />
|
||||
</condition>
|
||||
<condition property="signature.exists">
|
||||
<available file="${env.JENKINS_HOME}/fmlsigned.properties" />
|
||||
</condition>
|
||||
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
|
||||
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
|
||||
<property name="mcp.srcdir" location="${mcp.home}/src" />
|
||||
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
|
||||
<property name="clean.mcp.srcdir" location="${mcp.home}/src-base" />
|
||||
<property name="patch.mcp.srcdir" location="${mcp.home}/src-work" />
|
||||
<property name="tmp.mcp.srcdir" location="${mcp.home}/src-tmp" />
|
||||
<property name="renamed.mcp.srcdir" location="${mcp.home}/src-renamed" />
|
||||
<property name="common.src.dir" location="${basedir}/common" />
|
||||
<property name="client.src.dir" location="${basedir}/client" />
|
||||
<property name="patch.src.dir" location="${basedir}/patches" />
|
||||
<property name="fml.conf.dir" location="${basedir}/conf" />
|
||||
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
|
||||
<isset property="env.BUILD_NUMBER" />
|
||||
</condition>
|
||||
<available file="eclipse" property="eclipse.exists" />
|
||||
</target>
|
||||
|
||||
<target name="makeversion" depends="buildenvsetup">
|
||||
<antcall target="writeversion" />
|
||||
<property file="fmlversion.properties" />
|
||||
<property name="build.number" value="${fmlbuild.major.number}.${fmlbuild.minor.number}.${fmlbuild.revision.number}" />
|
||||
<property name="version.major" value="${fmlbuild.major.number}" />
|
||||
<property name="version.minor" value="${fmlbuild.minor.number}" />
|
||||
<property name="version.rev" value="${fmlbuild.revision.number}" />
|
||||
<property name="version.minecraft" value="${fmlbuild.mcversion}" />
|
||||
<property name="version.branch" value="${fmlbuild.branch}" />
|
||||
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
|
||||
</target>
|
||||
|
||||
<target name="makeclean" depends="buildenvsetup" if="mcp.exists">
|
||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
||||
<arg value="${mcp.home}/runtime/cleanup.py" />
|
||||
<arg value="-f" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="buildenvsetup,makeclean" if="mcp.exists">
|
||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
||||
<arg value="${basedir}/decompile.py" />
|
||||
<arg value="--mcp-dir" />
|
||||
<arg value="${mcp.home}" />
|
||||
<arg value="--fml-dir" />
|
||||
<arg value="${basedir}" />
|
||||
<arg value="--gen-conf" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="reobfuscate" depends="buildenvsetup,recompile">
|
||||
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
||||
<arg value="${mcp.home}/runtime/reobfuscate.py" />
|
||||
</exec>
|
||||
<fail message="Reobfuscation failed">
|
||||
<condition>
|
||||
<not>
|
||||
<and>
|
||||
<available file="${mcp.home}/temp/client.md5" />
|
||||
<available file="${mcp.home}/temp/client_reobf.md5" />
|
||||
</and>
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
||||
<arg value="${basedir}/generatechangedfilelist.py" />
|
||||
<arg value="${mcp.home}" />
|
||||
<arg value="${basedir}/difflist.txt" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="recompile" depends="buildenvsetup">
|
||||
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
||||
<arg value="${mcp.home}/runtime/recompile.py" />
|
||||
</exec>
|
||||
<fail message="Compilation failed">
|
||||
<condition>
|
||||
<not>
|
||||
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class" />
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
</target>
|
||||
|
||||
<target name="merge-client" depends="buildenvsetup">
|
||||
<copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
|
||||
<fileset dir="${client.src.dir}" includes="**/*.java" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="merge-common" depends="buildenvsetup,build-deobf-data">
|
||||
<copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
|
||||
<fileset dir="${common.src.dir}" includes="**/*.java" />
|
||||
<fileset dir="${basedir}" includes="deobfuscation_data-${version.minecraft}.lzma"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="merge-source" depends="buildenvsetup,merge-client,merge-common" />
|
||||
|
||||
<target name="build-universal" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion,makebinpatches">
|
||||
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
|
||||
<equals arg1="${version.branch}" arg2="master" />
|
||||
</condition>
|
||||
|
||||
<mkdir dir="${basedir}/target" />
|
||||
<path id="server.classpath">
|
||||
<pathelement path="${mcp.home}/jars/libraries/net/minecraft/launchwrapper/1.3/launchwrapper-1.3.jar"/>
|
||||
<pathelement path="${mcp.home}/jars/libraries/org/ow2/asm/asm-all/4.1/asm-all-4.1.jar"/>
|
||||
<pathelement path="${mcp.home}/jars/libraries/lzma/lzma/0.0.1/lzma-0.0.1.jar"/>
|
||||
<pathelement path="${mcp.home}/jars/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar"/>
|
||||
<pathelement path="${mcp.home}/jars/libraries/org/scala-lang/scala-library/2.10.2/scala-library-2.10.2.jar"/>
|
||||
<pathelement path="${mcp.home}/jars/libraries/org/scala-lang/scala-compiler/2.10.2/scala-compiler-2.10.2.jar"/>
|
||||
<pathelement path="${mcp.home}/jars/minecraft_server.${version.minecraft}.jar"/>
|
||||
</path>
|
||||
<manifestclasspath property="server.jar.classpath" jarfile="${mcp.home}/jars/minecraft_server.jar">
|
||||
<classpath refid="server.classpath" />
|
||||
</manifestclasspath>
|
||||
<jar destfile="${basedir}/target/${universal.jarname}.jar" duplicate="preserve">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="cpw.mods.fml.relauncher.ServerLaunchWrapper" />
|
||||
<attribute name="Class-Path" value="${server.jar.classpath}" />
|
||||
</manifest>
|
||||
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" excludes="*.class,net/minecraft/**/*.class" />
|
||||
</jar>
|
||||
<antcall target="signjar" />
|
||||
<zip update="true" destfile="${basedir}/target/${universal.jarname}.jar">
|
||||
<fileset dir="${basedir}" includes="binpatches.pack.lzma,deobfuscation_data-${version.minecraft}.lzma"/>
|
||||
<fileset dir="${client.mcp.obfoutput}" includes="*.class" />
|
||||
<zipfileset dir="${basedir}" includes="fmlversion.properties" />
|
||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
|
||||
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" />
|
||||
<zipfileset dir="${client.src.dir}" includes="mcplogo.png" />
|
||||
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt" />
|
||||
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
|
||||
<mappedresources>
|
||||
<concat>
|
||||
<fileset dir="${basedir}/install" includes="README.txt" />
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="MAJOR" value="${version.major}" />
|
||||
<token key="MINOR" value="${version.minor}" />
|
||||
<token key="REV" value="${version.rev}" />
|
||||
<token key="BUILD" value="${version.build}" />
|
||||
<token key="MCVERSION" value="${version.minecraft}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</concat>
|
||||
<mergemapper to="README-fml.txt" />
|
||||
</mappedresources>
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="build-installer" depends="build-universal">
|
||||
<condition property="version.fullname" value="${version.minecraft}-${version}" else="${version.minecraft}-${version}-${version.branch}">
|
||||
<equals arg1="${version.branch}" arg2="master" />
|
||||
</condition>
|
||||
<tstamp>
|
||||
<format property="current.time" pattern="yyyy-MM-dd'T'HH:mm:ssZ" />
|
||||
</tstamp>
|
||||
|
||||
<delete file="${basedir}/installer_base.jar" />
|
||||
<delete file="${basedir}/install_profile.json" />
|
||||
<get src="http://files.minecraftforge.net/installer/forge-installer-1.3-shrunk.jar" dest="${basedir}/installer_base.jar" />
|
||||
<copy file="${basedir}/jsons/${version.minecraft}-rel.json" tofile="${basedir}/install_profile.json" />
|
||||
<copy file="${basedir}/installer_base.jar" tofile="${basedir}/target/${modname}-installer-${version.fullname}.jar" />
|
||||
<replace file="${basedir}/install_profile.json">
|
||||
<replaceFilter token="@version@" value="${version}" />
|
||||
<replaceFilter token="@minecraft_version@" value="${version.minecraft}" />
|
||||
<replaceFilter token="@timestamp@" value="${current.time}" />
|
||||
<replaceFilter token="@universal_jar@" value="${modname}-universal-${version.fullname}.jar" />
|
||||
</replace>
|
||||
<jar destfile="${basedir}/target/${modname}-installer-${version.fullname}.jar" update="true">
|
||||
<zipfileset dir="${basedir}" includes="install_profile.json" />
|
||||
<zipfileset dir="${basedir}/jsons" includes="big_logo.png" />
|
||||
<zipfileset dir="${basedir}/target" includes="${modname}-universal-${version.fullname}.jar" />
|
||||
</jar>
|
||||
<delete file="${basedir}/install_profile.json" />
|
||||
</target>
|
||||
|
||||
<target name="build-source-pack" depends="makeversion">
|
||||
<property name="srcpack.jarname" value="${modname}-src-${version.minecraft}-${version}-${version.branch}" />
|
||||
<zip destfile="${basedir}/target/${srcpack.jarname}.zip">
|
||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt,commands.patch,mcp_merge.cfg,mc_versions.cfg" prefix="fml" />
|
||||
<zipfileset dir="${basedir}/jsons" includes="${version.minecraft}-dev.json" fullpath="fml/fml.json"/>
|
||||
<zipfileset dir="${basedir}" includes="deobfuscation_data-${version.minecraft}.lzma" prefix="fml/common" />
|
||||
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/common" />
|
||||
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/client" />
|
||||
<zipfileset dir="${client.src.dir}" includes="mcp.png" prefix="fml/client" />
|
||||
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/common" />
|
||||
<zipfileset dir="${common.src.dir}" includes="*.cfg" prefix="fml/common" />
|
||||
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" prefix="fml/common" />
|
||||
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
|
||||
<zipfileset dir="${fml.conf.dir}" prefix="fml/conf" />
|
||||
<zipfileset dir="${fml.python.dir}" prefix="fml/python" />
|
||||
<mappedresources>
|
||||
<concat>
|
||||
<fileset dir="${basedir}/install" includes="README.txt" />
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="MAJOR" value="${version.major}" />
|
||||
<token key="MINOR" value="${version.minor}" />
|
||||
<token key="REV" value="${version.rev}" />
|
||||
<token key="BUILD" value="${version.build}" />
|
||||
<token key="MCVERSION" value="${version.minecraft}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</concat>
|
||||
<mergemapper to="fml/README-fml.txt" />
|
||||
</mappedresources>
|
||||
<zipfileset dir="${basedir}/install" excludes="README.txt,fml.pyc" prefix="fml" />
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="build-deobf-data" depends="makeversion">
|
||||
<mkdir dir="build-tmp-deobf" />
|
||||
<copy todir="build-tmp-deobf">
|
||||
<mappedresources>
|
||||
<fileset dir="${mcp.home}/conf" includes="packaged.srg" />
|
||||
<globmapper from="packaged.srg" to="deobfuscation_data-${version.minecraft}" />
|
||||
</mappedresources>
|
||||
</copy>
|
||||
<exec executable="${lzma.exe}">
|
||||
<arg line="--format=lzma"/>
|
||||
<arg line="build-tmp-deobf/deobfuscation_data-${version.minecraft}"/>
|
||||
<arg line="-v"/>
|
||||
</exec>
|
||||
<copy todir="${basedir}">
|
||||
<fileset dir="build-tmp-deobf" includes="*.lzma" />
|
||||
</copy>
|
||||
<antcall target="writeversion" />
|
||||
<delete dir="build-tmp-deobf" />
|
||||
</target>
|
||||
|
||||
<target name="build" depends="buildenvsetup,build-deobf-data,merge-client,merge-common,build-universal,build-installer,build-source-pack" />
|
||||
|
||||
<target name="jenkinsbuild" depends="buildenvsetup,jenkinsfmldecompile,patch,build" />
|
||||
|
||||
<target name="patch" depends="buildenvsetup">
|
||||
<exec executable="${python.exe}" dir="${basedir}">
|
||||
<arg value="${basedir}/applypatches.py" />
|
||||
<arg value="${basedir}" />
|
||||
<arg value="${mcp.srcdir}" />
|
||||
<arg value="${mcp.home}" />
|
||||
</exec>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="setupenvironment" depends="buildenvsetup">
|
||||
<input message="This will clean the mcp environment at ${mcp.home} and backup any src-work folder there (src-base will be erased). Continue?" validargs="y,n" addproperty="do.continue" />
|
||||
<condition property="do.not.continue">
|
||||
<equals arg1="n" arg2="${do.continue}" />
|
||||
</condition>
|
||||
<fail if="do.not.continue">You have decided not to continue. This script will stop now.</fail>
|
||||
<echo>Preparing the MCP environment at ${mcp.home}</echo>
|
||||
<antcall target="fmldecompile" />
|
||||
<echo>Moving old patched sources at ${patch.mcp.srcdir} out of the way</echo>
|
||||
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
|
||||
<fileset dir="${patch.mcp.srcdir}" />
|
||||
</move>
|
||||
<echo>Deleting old patch references at ${clean.mcp.srcdir}</echo>
|
||||
<delete dir="${clean.mcp.srcdir}" failonerror="false" />
|
||||
<echo>Creating new patch references at ${clean.mcp.srcdir}</echo>
|
||||
<copy todir="${clean.mcp.srcdir}">
|
||||
<fileset dir="${mcp.srcdir}" />
|
||||
</copy>
|
||||
<antcall target="cleanargo" />
|
||||
<antcall target="patch" />
|
||||
<echo>Creating clean patched references at ${patch.mcp.srcdir}</echo>
|
||||
<copy todir="${patch.mcp.srcdir}">
|
||||
<fileset dir="${mcp.srcdir}" />
|
||||
</copy>
|
||||
<antcall target="writeversion" />
|
||||
<delete>
|
||||
<fileset dir="${basedir}" includes="deobfuscation_data-*.lzma" />
|
||||
</delete>
|
||||
<antcall target="build-deobf-data" />
|
||||
<copy todir="${common.src.dir}">
|
||||
<fileset dir="${basedir}" includes="deobfuscation_data-*.lzma" />
|
||||
</copy>
|
||||
<antcall target="makeeclipse" />
|
||||
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML project</echo>
|
||||
</target>
|
||||
|
||||
<target name="fmldecompile" depends="buildenvsetup,makeclean">
|
||||
<exec executable="${python.exe}" dir="${basedir}">
|
||||
<arg value="${basedir}/decompile.py" />
|
||||
<arg value="--mcp-dir" />
|
||||
<arg value="${mcp.home}" />
|
||||
<arg value="--fml-dir" />
|
||||
<arg value="${basedir}" />
|
||||
<arg value="--gen-conf" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="jenkinsfmldecompile" depends="buildenvsetup,makeclean">
|
||||
<exec executable="${python.exe}" dir="${basedir}">
|
||||
<arg value="${basedir}/decompile.py" />
|
||||
<arg value="--mcp-dir" />
|
||||
<arg value="${mcp.home}" />
|
||||
<arg value="--fml-dir" />
|
||||
<arg value="${basedir}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="repatch" depends="buildenvsetup,checkpatches">
|
||||
<echo>Moving old patched sources at ${mcp.home}/src-work out of the way</echo>
|
||||
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
|
||||
<fileset dir="${patch.mcp.srcdir}" />
|
||||
</move>
|
||||
<delete dir="${mcp.srcdir}" />
|
||||
<copy todir="${mcp.srcdir}">
|
||||
<fileset dir="${clean.mcp.srcdir}" />
|
||||
</copy>
|
||||
|
||||
<antcall target="cleanargo" />
|
||||
|
||||
<antcall target="patch" />
|
||||
<copy todir="${patch.mcp.srcdir}">
|
||||
<fileset dir="${mcp.srcdir}" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="repatchclean" depends="buildenvsetup">
|
||||
<delete dir="${mcp.srcdir}" />
|
||||
<copy todir="${mcp.srcdir}">
|
||||
<fileset dir="${clean.mcp.srcdir}" />
|
||||
</copy>
|
||||
|
||||
<antcall target="cleanargo" />
|
||||
|
||||
<antcall target="patch" />
|
||||
</target>
|
||||
|
||||
<target name="cleanargo" depends="buildenvsetup">
|
||||
<delete dir="${client.mcp.srcdir}/argo" />
|
||||
<delete dir="${client.mcp.srcdir}/org" />
|
||||
</target>
|
||||
|
||||
<target name="checkpatches" depends="buildenvsetup">
|
||||
<uptodate property="checkUptodate.uptodate">
|
||||
<srcfiles dir="${patch.mcp.srcdir}" includes="**/*.java">
|
||||
<present targetdir="${patch.src.dir}">
|
||||
<globmapper from="*.java" to="*.java.patch" />
|
||||
</present>
|
||||
</srcfiles>
|
||||
<globmapper from="*.java" to="${patch.src.dir}/*.java.patch" />
|
||||
</uptodate>
|
||||
<fail unless="checkUptodate.uptodate">
|
||||
A patch is out of date. Update your patches!
|
||||
</fail>
|
||||
</target>
|
||||
|
||||
<target name="updatepatches" depends="buildenvsetup">
|
||||
<exec executable="${python.exe}" dir="${basedir}">
|
||||
<arg value="${basedir}/update_patches.py" />
|
||||
<arg value="${mcp.home}" />
|
||||
<arg value="${basedir}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="makeeclipse" depends="buildenvsetup" unless="eclipse.exists">
|
||||
<echo>
|
||||
Extracting fresh eclipse workspace to ${basedir}/eclipse
|
||||
</echo>
|
||||
<unzip src="${basedir}/eclipse-workspace-dev.zip" dest="${basedir}" />
|
||||
</target>
|
||||
|
||||
<target name="makerenamedsource" depends="buildenvsetup,repatch,merge-client,merge-common,reobfuscate">
|
||||
<copy todir="${tmp.mcp.srcdir}">
|
||||
<fileset dir="${mcp.srcdir}" />
|
||||
</copy>
|
||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
||||
<arg value="${mcp.home}/runtime/updatenames.py" />
|
||||
<arg value="-f" />
|
||||
</exec>
|
||||
<copy todir="${renamed.mcp.srcdir}">
|
||||
<fileset dir="${mcp.srcdir}" />
|
||||
</copy>
|
||||
<move todir="${mcp.srcdir}">
|
||||
<fileset dir="${tmp.mcp.srcdir}" />
|
||||
</move>
|
||||
</target>
|
||||
<target name="signjar" depends="buildenvsetup,makeversion" if="signature.exists">
|
||||
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
|
||||
<equals arg1="${version.branch}" arg2="master" />
|
||||
</condition>
|
||||
<property file="${env.JENKINS_HOME}/fmlsigned.properties" prefix="sign" />
|
||||
<echo>${env.JENKINS_HOME} ${universal.jarname} ${sign.KEYPASS}</echo>
|
||||
<signjar alias="FML" jar="${basedir}/target/${universal.jarname}.zip" keypass="${sign.KEYPASS}" keystore="${env.JENKINS_HOME}/${sign.KEYSTORE}" storepass="${sign.STOREPASS}" verbose="true" />
|
||||
</target>
|
||||
<target name="makebinpatches" depends="buildenvsetup,makeversion">
|
||||
<path id="diffset.libs">
|
||||
<pathelement path="${mcp.home}/jars/libraries/com/google/guava/guava/14.0/guava-14.0.jar"/>
|
||||
<pathelement path="${mcp.home}/jars/libraries/org/ow2/asm/asm-debug-all/4.1/asm-debug-all-4.1.jar"/>
|
||||
<pathelement path="${mcp.home}/jars/libraries/lzma/lzma/0.0.1/lzma-0.0.1.jar"/>
|
||||
<pathelement path="${mcp.obfoutput}/minecraft"/>
|
||||
</path>
|
||||
<delete dir="${basedir}/binpatch" verbose="true"/>
|
||||
<java classname="cpw.mods.fml.common.patcher.GenDiffSet" classpathref="diffset.libs">
|
||||
<arg path="${mcp.home}/jars/versions/${version.minecraft}/${version.minecraft}.jar.backup"/>
|
||||
<arg path="${mcp.obfoutput}/minecraft"/>
|
||||
<arg path="${basedir}/deobfuscation_data-${version.minecraft}.lzma"/>
|
||||
<arg path="${basedir}/binpatch/client"/>
|
||||
<arg value="false"/>
|
||||
</java>
|
||||
<java classname="cpw.mods.fml.common.patcher.GenDiffSet" classpathref="diffset.libs">
|
||||
<arg path="${mcp.home}/jars/minecraft_server.${version.minecraft}.jar.backup"/>
|
||||
<arg path="${mcp.obfoutput}/minecraft"/>
|
||||
<arg path="${basedir}/deobfuscation_data-${version.minecraft}.lzma"/>
|
||||
<arg path="${basedir}/binpatch/server"/>
|
||||
<arg value="true"/>
|
||||
</java>
|
||||
<mkdir dir="binpatch-tmp"/>
|
||||
<zip destfile="binpatch-tmp/binpatches.jar" basedir="${basedir}">
|
||||
<include name="binpatch/**/*.binpatch"/>
|
||||
</zip>
|
||||
<apply executable="pack200">
|
||||
<arg line="--no-gzip"/>
|
||||
<arg line="binpatch-tmp/binpatches.pack"/>
|
||||
<fileset dir="binpatch-tmp" includes="binpatches.jar"/>
|
||||
</apply>
|
||||
<apply executable="${lzma.exe}">
|
||||
<arg line="--format=lzma"/>
|
||||
<arg line="-v"/>
|
||||
<fileset dir="binpatch-tmp" includes="binpatches.pack"/>
|
||||
</apply>
|
||||
<move file="binpatch-tmp/binpatches.pack.lzma" todir="${basedir}"/>
|
||||
<delete dir="binpatch-tmp" failonerror="false"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,637 +0,0 @@
|
||||
/*
|
||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
||||
*
|
||||
* 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; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* 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 cpw.mods.fml.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.Item;
|
||||
import net.minecraft.server.LocaleLanguage;
|
||||
import net.minecraft.server.MLProp;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.BaseMod;
|
||||
import net.minecraft.server.BiomeBase;
|
||||
import net.minecraft.server.EntityItem;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
import net.minecraft.server.IChunkProvider;
|
||||
import net.minecraft.server.ICommandListener;
|
||||
import net.minecraft.server.IInventory;
|
||||
import net.minecraft.server.ItemStack;
|
||||
import net.minecraft.server.NetworkManager;
|
||||
import net.minecraft.server.Packet1Login;
|
||||
import net.minecraft.server.Packet250CustomPayload;
|
||||
import net.minecraft.server.Packet3Chat;
|
||||
import net.minecraft.server.BukkitRegistry;
|
||||
import net.minecraft.server.SidedProxy;
|
||||
import net.minecraft.server.World;
|
||||
import net.minecraft.server.WorldType;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.IFMLSidedHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.ProxyInjector;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
import cpw.mods.fml.common.modloader.ModProperty;
|
||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
||||
|
||||
/**
|
||||
* Handles primary communication from hooked code into the system
|
||||
*
|
||||
* The FML entry point is {@link #onPreLoad(MinecraftServer)} called from {@link MinecraftServer}
|
||||
*
|
||||
* Obfuscated code should focus on this class and other members of the "server" (or "client") code
|
||||
*
|
||||
* The actual mod loading is handled at arms length by {@link Loader}
|
||||
*
|
||||
* It is expected that a similar class will exist for each target environment: Bukkit and Client side.
|
||||
*
|
||||
* It should not be directly modified.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class FMLBukkitHandler implements IFMLSidedHandler
|
||||
{
|
||||
/**
|
||||
* The singleton
|
||||
*/
|
||||
private static final FMLBukkitHandler INSTANCE = new FMLBukkitHandler();
|
||||
|
||||
/**
|
||||
* A reference to the server itself
|
||||
*/
|
||||
private MinecraftServer server;
|
||||
|
||||
/**
|
||||
* A handy list of the default overworld biomes
|
||||
*/
|
||||
private BiomeBase[] defaultOverworldBiomes;
|
||||
|
||||
FMLBukkitProfiler profiler;
|
||||
|
||||
/**
|
||||
* Called to start the whole game off from {@link MinecraftServer#startServer}
|
||||
* @param minecraftServer
|
||||
*/
|
||||
public void onPreLoad(MinecraftServer minecraftServer)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class.forName("BaseModMp", false, getClass().getClassLoader());
|
||||
MinecraftServer.log.severe(""
|
||||
+ "Forge Mod Loader has detected that this server has an ModLoaderMP installed alongside Forge Mod Loader.\n"
|
||||
+ "This will cause a serious problem with compatibility. To protect your worlds, this minecraft server will now shutdown.\n"
|
||||
+ "You should follow the installation instructions of either Minecraft Forge of Forge Mod Loader and NOT install ModLoaderMP \n"
|
||||
+ "into the minecraft_server.jar file "
|
||||
+ "before this server will be allowed to start up.\n\nFailure to do so will simply result in more startup failures.\n\n"
|
||||
+ "The authors of Minecraft Forge and Forge Mod Loader strongly suggest you talk to your mod's authors and get them to\nupdate their "
|
||||
+ "requirements. ModLoaderMP is not compatible with Minecraft Forge on the server and they will need to update their mod\n"
|
||||
+ "for Minecraft Forge and other server compatibility, unless they are Minecraft Forge mods, in which case they already\n"
|
||||
+ "don't need ModLoaderMP and the mod author simply has failed to update his requirements and should be informed appropriately.\n\n"
|
||||
+ "The authors of Forge Mod Loader would like to be compatible with ModLoaderMP but it is closed source and owned by SDK.\n"
|
||||
+ "SDK, the author of ModLoaderMP, has a standing invitation to submit compatibility patches \n"
|
||||
+ "to the open source community project that is Forge Mod Loader so that this incompatibility doesn't last. \n"
|
||||
+ "Users who wish to enjoy mods of both types are "
|
||||
+ "encouraged to request of SDK that he submit a\ncompatibility patch to the Forge Mod Loader project at \n"
|
||||
+ "http://github.com/cpw/FML.\nPosting on the minecraft forums at\nhttp://www.minecraftforum.net/topic/86765- (the MLMP thread)\n"
|
||||
+ "may encourage him in this effort. However, I ask that your requests be polite.\n"
|
||||
+ "Now, the server has to shutdown so you can reinstall your minecraft_server.jar\nproperly, until such time as we can work together.");
|
||||
throw new RuntimeException(
|
||||
"This FML based server has detected an installation of ModLoaderMP alongside. This will cause serious compatibility issues, so the server will now shut down.");
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
// We're safe. continue
|
||||
}
|
||||
server = minecraftServer;
|
||||
FMLCommonHandler.instance().beginLoading(this);
|
||||
FMLRegistry.registerRegistry(new BukkitRegistry());
|
||||
Loader.instance().loadMods();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called a bit later on during server initialization to finish loading mods
|
||||
*/
|
||||
public void onLoadComplete()
|
||||
{
|
||||
Loader.instance().initializeMods();
|
||||
for (Item i : Item.byId) {
|
||||
if (i!=null && Material.getMaterial(i.id).name().startsWith("X")) {
|
||||
Material.setMaterialName(i.id, i.l());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onWorldLoadTick()
|
||||
{
|
||||
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.WORLDLOAD));
|
||||
}
|
||||
|
||||
/**
|
||||
* Every tick just before world and other ticks occur
|
||||
*/
|
||||
public void onPreWorldTick(World world)
|
||||
{
|
||||
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.WORLD),world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Every tick just after world and other ticks occur
|
||||
*/
|
||||
public void onPostWorldTick(World world)
|
||||
{
|
||||
FMLCommonHandler.instance().tickEnd(EnumSet.of(TickType.WORLD), world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the server instance
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MinecraftServer getServer()
|
||||
{
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a handle to the server's logger instance
|
||||
*/
|
||||
public Logger getMinecraftLogger()
|
||||
{
|
||||
return MinecraftServer.log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from ChunkProviderServer when a chunk needs to be populated
|
||||
*
|
||||
* To avoid polluting the worldgen seed, we generate a new random from the world seed and
|
||||
* generate a seed from that
|
||||
*
|
||||
* @param chunkProvider
|
||||
* @param chunkX
|
||||
* @param chunkZ
|
||||
* @param world
|
||||
* @param generator
|
||||
*/
|
||||
public void onChunkPopulate(IChunkProvider chunkProvider, int chunkX, int chunkZ, World world, IChunkProvider generator)
|
||||
{
|
||||
FMLCommonHandler.instance().handleWorldGeneration(chunkX, chunkZ, world.getSeed(), world, generator, chunkProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from the furnace to lookup fuel values
|
||||
*
|
||||
* @param itemId
|
||||
* @param itemDamage
|
||||
* @return
|
||||
*/
|
||||
public int fuelLookup(int itemId, int itemDamage)
|
||||
{
|
||||
int fv = 0;
|
||||
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
fv = Math.max(fv, mod.lookupFuelValue(itemId, itemDamage));
|
||||
}
|
||||
|
||||
return fv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the offered class and instance of BaseMod and therefore a ModLoader mod?
|
||||
*/
|
||||
public boolean isModLoaderMod(Class<?> clazz)
|
||||
{
|
||||
return BaseMod.class.isAssignableFrom(clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the supplied mod class into a mod container
|
||||
*/
|
||||
public ModContainer loadBaseModMod(Class<?> clazz, File canonicalFile)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
Class <? extends BaseMod > bmClazz = (Class <? extends BaseMod >) clazz;
|
||||
return new ModLoaderModContainer(bmClazz, canonicalFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to notify that an item was picked up from the world
|
||||
*
|
||||
* @param entityItem
|
||||
* @param entityPlayer
|
||||
*/
|
||||
public void notifyItemPickup(EntityItem entityItem, EntityHuman entityPlayer)
|
||||
{
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
if (mod.wantsPickupNotification())
|
||||
{
|
||||
mod.getPickupNotifier().notifyPickup(entityItem, entityPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise an exception
|
||||
*
|
||||
* @param exception
|
||||
* @param message
|
||||
* @param stopGame
|
||||
*/
|
||||
public void raiseException(Throwable exception, String message, boolean stopGame)
|
||||
{
|
||||
FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception);
|
||||
throw new RuntimeException(exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to dispense the item as an entity other than just as a the item itself
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param xVelocity
|
||||
* @param zVelocity
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
public boolean tryDispensingEntity(World world, double x, double y, double z, byte xVelocity, byte zVelocity, ItemStack item)
|
||||
{
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
if (mod.wantsToDispense() && mod.getDispenseHandler().dispense(x, y, z, xVelocity, zVelocity, world, item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the instance
|
||||
*/
|
||||
public static FMLBukkitHandler instance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of default overworld biomes
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BiomeBase[] getDefaultOverworldBiomes()
|
||||
{
|
||||
if (defaultOverworldBiomes == null)
|
||||
{
|
||||
ArrayList<BiomeBase> biomes = new ArrayList<BiomeBase>(20);
|
||||
|
||||
for (int i = 0; i < 23; i++)
|
||||
{
|
||||
if ("Sky".equals(BiomeBase.biomes[i].y) || "Hell".equals(BiomeBase.biomes[i].y))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
biomes.add(BiomeBase.biomes[i]);
|
||||
}
|
||||
|
||||
defaultOverworldBiomes = new BiomeBase[biomes.size()];
|
||||
biomes.toArray(defaultOverworldBiomes);
|
||||
}
|
||||
|
||||
return defaultOverworldBiomes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an item is crafted
|
||||
*
|
||||
* @param player
|
||||
* @param craftedItem
|
||||
* @param craftingGrid
|
||||
*/
|
||||
public void onItemCrafted(EntityHuman player, ItemStack craftedItem, IInventory craftingGrid)
|
||||
{
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
if (mod.wantsCraftingNotification())
|
||||
{
|
||||
mod.getCraftingHandler().onCrafting(player, craftedItem, craftingGrid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an item is smelted
|
||||
*
|
||||
* @param player
|
||||
* @param smeltedItem
|
||||
*/
|
||||
public void onItemSmelted(EntityHuman player, ItemStack smeltedItem)
|
||||
{
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
if (mod.wantsCraftingNotification())
|
||||
{
|
||||
mod.getCraftingHandler().onSmelting(player, smeltedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a chat packet is received
|
||||
*
|
||||
* @param chat
|
||||
* @param player
|
||||
* @return true if you want the packet to stop processing and not echo to the rest of the world
|
||||
*/
|
||||
public boolean handleChatPacket(Packet3Chat chat, EntityHuman player)
|
||||
{
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
if (mod.wantsNetworkPackets() && mod.getNetworkHandler().onChat(chat, player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a packet 250 packet is received from the player
|
||||
*
|
||||
* @param packet
|
||||
* @param player
|
||||
*/
|
||||
public void handlePacket250(Packet250CustomPayload packet, EntityHuman player)
|
||||
{
|
||||
if ("REGISTER".equals(packet.tag) || "UNREGISTER".equals(packet.tag))
|
||||
{
|
||||
handleClientRegistration(packet, player);
|
||||
return;
|
||||
}
|
||||
|
||||
ModContainer mod = FMLCommonHandler.instance().getModForChannel(packet.tag);
|
||||
|
||||
if (mod != null)
|
||||
{
|
||||
mod.getNetworkHandler().onPacket250Packet(packet, player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle register requests for packet 250 channels
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
private void handleClientRegistration(Packet250CustomPayload packet, EntityHuman player)
|
||||
{
|
||||
if (packet.data==null) {
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
for (String channel : new String(packet.data, "UTF8").split("\0"))
|
||||
{
|
||||
// Skip it if we don't know it
|
||||
if (FMLCommonHandler.instance().getModForChannel(channel) == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ("REGISTER".equals(packet.tag))
|
||||
{
|
||||
FMLCommonHandler.instance().activateChannel(player, channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLCommonHandler.instance().deactivateChannel(player, channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
getMinecraftLogger().warning("Received invalid registration packet");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a login
|
||||
*
|
||||
* @param loginPacket
|
||||
* @param networkManager
|
||||
*/
|
||||
public void handleLogin(Packet1Login loginPacket, NetworkManager networkManager)
|
||||
{
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.tag = "REGISTER";
|
||||
packet.data = FMLCommonHandler.instance().getPacketRegistry();
|
||||
packet.length = packet.data.length;
|
||||
if (packet.length>0) {
|
||||
networkManager.queue(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public void announceLogin(EntityHuman player) {
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
if (mod.wantsPlayerTracking())
|
||||
{
|
||||
mod.getPlayerTracker().onPlayerLogin(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getMinecraftRootDirectory()
|
||||
{
|
||||
try {
|
||||
return server.a(".").getCanonicalFile();
|
||||
} catch (IOException ioe) {
|
||||
return new File(".");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param var2
|
||||
* @return
|
||||
*/
|
||||
public boolean handleServerCommand(String command, String player, ICommandListener listener)
|
||||
{
|
||||
for (ModContainer mod : Loader.getModList()) {
|
||||
if (mod.wantsConsoleCommands() && mod.getConsoleHandler().handleCommand(command, player, listener)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
*/
|
||||
public void announceLogout(EntityHuman player)
|
||||
{
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
if (mod.wantsPlayerTracking())
|
||||
{
|
||||
mod.getPlayerTracker().onPlayerLogout(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param p_28168_1_
|
||||
*/
|
||||
public void announceDimensionChange(EntityHuman player)
|
||||
{
|
||||
for (ModContainer mod : Loader.getModList())
|
||||
{
|
||||
if (mod.wantsPlayerTracking())
|
||||
{
|
||||
mod.getPlayerTracker().onPlayerChangedDimension(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param biome
|
||||
*/
|
||||
public void addBiomeToDefaultWorldGenerator(BiomeBase biome)
|
||||
{
|
||||
WorldType.NORMAL.addNewBiome(biome);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param biome
|
||||
*/
|
||||
public void removeBiomeFromDefaultWorldGenerator(BiomeBase biome)
|
||||
{
|
||||
WorldType.NORMAL.removeBiome(biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMinecraftInstance() {
|
||||
return server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentLanguage()
|
||||
{
|
||||
return LocaleLanguage.a().getCurrentLanguage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Properties getCurrentLanguageTable()
|
||||
{
|
||||
return LocaleLanguage.a().getCurrentLanguageTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object instance)
|
||||
{
|
||||
String objectName;
|
||||
if (instance instanceof Item) {
|
||||
objectName=((Item)instance).getName();
|
||||
} else if (instance instanceof Block) {
|
||||
objectName=((Block)instance).getName();
|
||||
} else if (instance instanceof ItemStack) {
|
||||
objectName=Item.byId[((ItemStack)instance).id].a((ItemStack)instance);
|
||||
} else {
|
||||
throw new IllegalArgumentException(String.format("Illegal object for naming %s",instance));
|
||||
}
|
||||
objectName+=".name";
|
||||
return objectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModMetadata readMetadataFrom(InputStream input, ModContainer mod) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void profileStart(String profileLabel) {
|
||||
if (profiler!=null)
|
||||
{
|
||||
profiler.start(profileLabel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void profileEnd() {
|
||||
if (profiler!=null)
|
||||
{
|
||||
profiler.end();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModProperty getModLoaderPropertyFor(Field f) {
|
||||
if (f.isAnnotationPresent(MLProp.class)) {
|
||||
MLProp prop = f.getAnnotation(MLProp.class);
|
||||
return new ModProperty(prop.info(), prop.min(), prop.max(), prop.name());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAdditionalBrandingInformation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Side getSide() {
|
||||
return Side.BUKKIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProxyInjector findSidedProxyOn(cpw.mods.fml.common.modloader.BaseMod mod) {
|
||||
for (Field f : mod.getClass().getDeclaredFields())
|
||||
{
|
||||
if (f.isAnnotationPresent(SidedProxy.class))
|
||||
{
|
||||
SidedProxy sp = f.getAnnotation(SidedProxy.class);
|
||||
return new ProxyInjector(sp.clientSide(), sp.serverSide(), sp.bukkitSide(), f);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onServerPostTick() {
|
||||
FMLCommonHandler.instance().tickEnd(EnumSet.of(TickType.GAME));
|
||||
}
|
||||
|
||||
public void onServerPreTick() {
|
||||
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.GAME));
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
package cpw.mods.fml.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableMultiset;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Multiset;
|
||||
import com.google.common.collect.Multiset.Entry;
|
||||
import com.google.common.collect.Multisets;
|
||||
import com.google.common.collect.TreeMultiset;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
public class FMLBukkitProfiler {
|
||||
private static FMLBukkitProfiler lastInstance;
|
||||
private static long endTime;
|
||||
private LinkedList<String> profiles = new LinkedList<String>();
|
||||
private TreeMultiset<String> hitCounter = TreeMultiset.create();
|
||||
private TreeMultiset<String> timings = TreeMultiset.create();
|
||||
private long timestamp;
|
||||
|
||||
public static long beginProfiling(int seconds)
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
if (lastInstance == null)
|
||||
{
|
||||
lastInstance = new FMLBukkitProfiler();
|
||||
FMLBukkitHandler.instance().profiler = lastInstance;
|
||||
endTime = now + seconds * 1000;
|
||||
}
|
||||
if (endTime > now)
|
||||
{
|
||||
return (endTime - now) / 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static long endProfiling()
|
||||
{
|
||||
FMLBukkitHandler.instance().profiler = null;
|
||||
return endTime - System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static void resetProfiling()
|
||||
{
|
||||
endProfiling();
|
||||
lastInstance = null;
|
||||
}
|
||||
|
||||
public void start(String profileLabel)
|
||||
{
|
||||
profiles.push(profileLabel);
|
||||
timestamp = System.nanoTime();
|
||||
}
|
||||
|
||||
public void end()
|
||||
{
|
||||
int timing = (int)((System.nanoTime() - timestamp)/1000L);
|
||||
String label = Joiner.on('.').join(profiles);
|
||||
profiles.pop();
|
||||
hitCounter.add(label);
|
||||
timings.add(label,timing);
|
||||
if (System.currentTimeMillis()>endTime)
|
||||
{
|
||||
endProfiling();
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] dumpProfileData(int count)
|
||||
{
|
||||
if (lastInstance == null)
|
||||
{
|
||||
return new String[] { "No profile data available" };
|
||||
}
|
||||
|
||||
if (endTime > System.currentTimeMillis())
|
||||
{
|
||||
return new String[] { String.format("Timing is being gathered for another %d seconds", endTime - System.currentTimeMillis()) };
|
||||
}
|
||||
return lastInstance.profileData(count);
|
||||
}
|
||||
|
||||
private String[] profileData(int count) {
|
||||
List<Entry<String>> sortedTiming = getEntriesSortedByFrequency(timings, false);
|
||||
ArrayList<String> timeLine = new ArrayList<String>();
|
||||
|
||||
double totalTime = timings.size();
|
||||
|
||||
for (Entry<String> hit : sortedTiming)
|
||||
{
|
||||
if (--count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
timeLine.add(String.format("%s : %d microseconds, %d invocations. %.2f %% of overall time",hit.getElement(), hit.getCount(), hitCounter.count(hit.getElement()), 100.0 * hit.getCount()/totalTime));
|
||||
}
|
||||
return timeLine.toArray(new String[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Code from http://stackoverflow.com/questions/4345633/simplest-way-to-iterate-through-a-multiset-in-the-order-of-element-frequency
|
||||
*/
|
||||
private enum EntryComp implements Comparator<Multiset.Entry<?>>{
|
||||
DESCENDING{
|
||||
@Override
|
||||
public int compare(final Entry<?> a, final Entry<?> b){
|
||||
return Ints.compare(b.getCount(), a.getCount());
|
||||
}
|
||||
},
|
||||
ASCENDING{
|
||||
@Override
|
||||
public int compare(final Entry<?> a, final Entry<?> b){
|
||||
return Ints.compare(a.getCount(), b.getCount());
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
private static <E> List<Entry<E>> getEntriesSortedByFrequency(final Multiset<E> ms, final boolean ascending) {
|
||||
final List<Entry<E>> entryList = Lists.newArrayList(ms.entrySet());
|
||||
Collections.sort(entryList, ascending ? EntryComp.ASCENDING : EntryComp.DESCENDING);
|
||||
return entryList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,409 +0,0 @@
|
||||
/*
|
||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
||||
*
|
||||
* 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; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* 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.minecraft.server;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.craftbukkit.generator.NetherChunkGenerator;
|
||||
import org.bukkit.craftbukkit.generator.NormalChunkGenerator;
|
||||
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
||||
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
|
||||
{
|
||||
// CALLBACK MECHANISMS
|
||||
|
||||
/**
|
||||
* @param minecraftInstance
|
||||
* @return
|
||||
*/
|
||||
public final boolean doTickInGame(TickType tick, boolean tickEnd, Object minecraftInstance, Object... data)
|
||||
{
|
||||
if (tick==TickType.GAME && tickEnd) {
|
||||
return onTickInGame((MinecraftServer)minecraftInstance);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onCrafting(Object... craftingParameters)
|
||||
{
|
||||
takenFromCrafting((EntityHuman)craftingParameters[0], (ItemStack)craftingParameters[1], (IInventory)craftingParameters[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onSmelting(Object... smeltingParameters)
|
||||
{
|
||||
takenFromFurnace((EntityHuman)smeltingParameters[0], (ItemStack)smeltingParameters[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean dispense(double x, double y, double z, byte xVelocity, byte zVelocity, Object... data)
|
||||
{
|
||||
return dispenseEntity((World)data[0], x, y, z, xVelocity, zVelocity, (ItemStack)data[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean onChat(Object... data)
|
||||
{
|
||||
return onChatMessageReceived((EntityHuman)data[1], (Packet3Chat)data[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onServerLogin(Object handler) {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public final void onServerLogout() {
|
||||
// NOOP
|
||||
}
|
||||
@Override
|
||||
public final void onPlayerLogin(Object player)
|
||||
{
|
||||
onClientLogin((EntityHuman) player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPlayerLogout(Object player)
|
||||
{
|
||||
onClientLogout((EntityHuman)player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPlayerChangedDimension(Object player)
|
||||
{
|
||||
onClientDimensionChanged((EntityHuman)player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPacket250Packet(Object... data)
|
||||
{
|
||||
onPacket250Received((EntityHuman)data[1], (Packet250CustomPayload)data[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void notifyPickup(Object... pickupData)
|
||||
{
|
||||
EntityItem item = (EntityItem) pickupData[0];
|
||||
EntityHuman player = (EntityHuman) pickupData[1];
|
||||
onItemPickup(player, item.itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void generate(Random random, int chunkX, int chunkZ, Object... additionalData)
|
||||
{
|
||||
World w = (World) additionalData[0];
|
||||
IChunkProvider cp = (IChunkProvider) additionalData[1];
|
||||
|
||||
if (cp instanceof ChunkProviderHell || cp instanceof NetherChunkGenerator)
|
||||
{
|
||||
generateNether(w, random, chunkX << 4, chunkZ << 4);
|
||||
}
|
||||
else if (cp instanceof ChunkProviderGenerate || cp instanceof NormalChunkGenerator)
|
||||
{
|
||||
generateSurface(w, random, chunkX << 4, chunkZ << 4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* NO-OP on client side
|
||||
*/
|
||||
@Override
|
||||
public final boolean handleCommand(String command, Object... data)
|
||||
{
|
||||
return onServerCommand(command, (String)data[0], (ICommandListener)data[1]);
|
||||
}
|
||||
@Override
|
||||
public void onRegisterAnimations() {
|
||||
// NOOP on servers
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderHarvest(@SuppressWarnings("rawtypes") Map renderers) {
|
||||
// NOOP on servers
|
||||
}
|
||||
|
||||
// BASEMOD API
|
||||
/**
|
||||
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
|
||||
*
|
||||
* @param id
|
||||
* @param metadata
|
||||
* @return
|
||||
*/
|
||||
public int addFuel(int id, int metadata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addRenderer(Map<Class<? extends Entity>, Object> renderers)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Override if you wish to perform some action other than just dispensing the item from the dispenser
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param xVel
|
||||
* @param zVel
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
public boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override if you wish to generate Nether (Hell biome) blocks
|
||||
*
|
||||
* @param world
|
||||
* @param random
|
||||
* @param chunkX
|
||||
* @param chunkZ
|
||||
*/
|
||||
public void generateNether(World world, Random random, int chunkX, int chunkZ)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Override if you wish to generate Overworld (not hell or the end) blocks
|
||||
*
|
||||
* @param world
|
||||
* @param random
|
||||
* @param chunkX
|
||||
* @param chunkZ
|
||||
*/
|
||||
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of your mod. Defaults to the class name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get your mod priorities
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPriorities()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the version of your mod
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getVersion();
|
||||
|
||||
public void keyboardEvent(Object event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load your mod
|
||||
*/
|
||||
public abstract void load();
|
||||
|
||||
/**
|
||||
* Finish loading your mod
|
||||
*/
|
||||
public void modsLoaded()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle item pickup
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
public void onItemPickup(EntityHuman player, ItemStack item)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)}
|
||||
*
|
||||
* @param minecraftServer the server
|
||||
* @return true to continue receiving ticks
|
||||
*/
|
||||
public boolean onTickInGame(MinecraftServer minecraftServer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onTickInGUI(float tick, Object game, Object gui)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only implemented on the client side
|
||||
* {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)}
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
public void receiveChatPacket(String text)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Only called on the client side
|
||||
* {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)}
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
public void receiveCustomPacket(Packet250CustomPayload packet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void registerAnimation(Object game)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void renderInvBlock(Object renderer, Block block, int metadata, int modelID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean renderWorldBlock(Object renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when someone crafts an item from a crafting table
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
* @param matrix
|
||||
*/
|
||||
public void takenFromCrafting(EntityHuman player, ItemStack item, IInventory matrix)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when someone takes a smelted item from a furnace
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
public void takenFromFurnace(EntityHuman player, ItemStack item)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The identifier string for the mod- used in client<->server negotiation
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getName() + " " + getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a 250 packet is received on a channel registered to this mod
|
||||
*
|
||||
* @param source
|
||||
* @param payload
|
||||
*/
|
||||
public void onPacket250Received(EntityHuman source, Packet250CustomPayload payload)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a chat message is received. Return true to stop further processing
|
||||
*
|
||||
* @param source
|
||||
* @param chat
|
||||
* @return true if you want to consume the message so it is not available for further processing
|
||||
*/
|
||||
public boolean onChatMessageReceived(EntityHuman source, Packet3Chat chat)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Called when a server command is received
|
||||
* @param command
|
||||
* @return true if you want to consume the message so it is not available for further processing
|
||||
*/
|
||||
public boolean onServerCommand(String command, String sender, ICommandListener listener)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a new client logs in.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void onClientLogin(EntityHuman player)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a client logs out of the server.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void onClientLogout(EntityHuman player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Called when a client changes dimensions on the server.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void onClientDimensionChanged(EntityHuman player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Spare client junk
|
||||
// -------
|
||||
// void addRenderer(Map<Class<? extends Entity>, Render> renderers);
|
||||
// void registerAnimation(Minecraft game);
|
||||
// void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID);
|
||||
// boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID);
|
||||
// boolean onTickInGUI(float tick, Minecraft game, GuiScreen gui);
|
||||
// void keyboardEvent(KeyBinding event);
|
||||
|
||||
@Override
|
||||
public void keyBindingEvent(Object keybinding) {
|
||||
// NOOP on server
|
||||
}
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.src.BiomeGenBase;
|
||||
|
||||
import cpw.mods.fml.common.registry.IMinecraftRegistry;
|
||||
import cpw.mods.fml.server.FMLBukkitHandler;
|
||||
|
||||
public class BukkitRegistry implements IMinecraftRegistry
|
||||
{
|
||||
|
||||
@Override
|
||||
public void addRecipe(net.minecraft.src.ItemStack output, Object... params)
|
||||
{
|
||||
CraftingManager.getInstance().registerShapedRecipe((ItemStack) output, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addShapelessRecipe(net.minecraft.src.ItemStack output, Object... params)
|
||||
{
|
||||
CraftingManager.getInstance().registerShapelessRecipe((ItemStack) output, params);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void addRecipe(net.minecraft.src.IRecipe recipe)
|
||||
{
|
||||
CraftingManager.getInstance().getRecipies().add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSmelting(int input, net.minecraft.src.ItemStack output)
|
||||
{
|
||||
FurnaceRecipes.getInstance().registerRecipe(input, (ItemStack) output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlock(net.minecraft.src.Block block)
|
||||
{
|
||||
registerBlock(block, ItemBlock.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlock(net.minecraft.src.Block block, Class <? extends net.minecraft.src.ItemBlock > itemclass)
|
||||
{
|
||||
try
|
||||
{
|
||||
assert block != null : "registerBlock: block cannot be null";
|
||||
assert itemclass != null : "registerBlock: itemclass cannot be null";
|
||||
int blockItemId = ((Block)block).id - 256;
|
||||
itemclass.getConstructor(int.class).newInstance(blockItemId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//HMMM
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void registerEntityID(Class <? extends net.minecraft.src.Entity > entityClass, String entityName, int id)
|
||||
{
|
||||
EntityTypes.addNewEntityListMapping((Class<? extends Entity>) entityClass, entityName, id);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void registerEntityID(Class <? extends net.minecraft.src.Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
|
||||
{
|
||||
EntityTypes.addNewEntityListMapping((Class<? extends Entity>) entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void registerTileEntity(Class <? extends net.minecraft.src.TileEntity > tileEntityClass, String id)
|
||||
{
|
||||
TileEntity.addNewTileEntityMapping((Class<? extends TileEntity>) tileEntityClass, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBiome(BiomeGenBase biome)
|
||||
{
|
||||
FMLBukkitHandler.instance().addBiomeToDefaultWorldGenerator((BiomeBase) biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSpawn(Class <? extends net.minecraft.src.EntityLiving > entityClass, int weightedProb, int min, int max, net.minecraft.src.EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
||||
{
|
||||
BiomeBase[] realBiomes=(BiomeBase[]) biomes;
|
||||
for (BiomeBase biome : realBiomes)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BiomeMeta> spawns = ((BiomeBase)biome).getMobs((EnumCreatureType)typeOfCreature);
|
||||
|
||||
for (BiomeMeta entry : spawns)
|
||||
{
|
||||
//Adjusting an existing spawn entry
|
||||
if (entry.a == entityClass)
|
||||
{
|
||||
entry.d = weightedProb;
|
||||
entry.b = min;
|
||||
entry.c = max;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spawns.add(new BiomeMeta(entityClass, weightedProb, min, max));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addSpawn(String entityName, int weightedProb, int min, int max, net.minecraft.src.EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
Class <? extends Entity > entityClazz = EntityTypes.getEntityToClassMapping().get(entityName);
|
||||
|
||||
if (EntityLiving.class.isAssignableFrom(entityClazz))
|
||||
{
|
||||
addSpawn((Class <? extends net.minecraft.src.EntityLiving >) entityClazz, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBiome(BiomeGenBase biome)
|
||||
{
|
||||
FMLBukkitHandler.instance().removeBiomeFromDefaultWorldGenerator((BiomeBase)biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSpawn(Class <? extends net.minecraft.src.EntityLiving > entityClass, net.minecraft.src.EnumCreatureType typeOfCreature, BiomeGenBase... biomesO)
|
||||
{
|
||||
BiomeBase[] biomes=(BiomeBase[]) biomesO;
|
||||
for (BiomeBase biome : biomes)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BiomeMeta> spawns = ((BiomeBase)biome).getMobs((EnumCreatureType) typeOfCreature);
|
||||
|
||||
Iterator<BiomeMeta> entries = spawns.iterator();
|
||||
while (entries.hasNext())
|
||||
{
|
||||
BiomeMeta entry = entries.next();
|
||||
if (entry.a == entityClass)
|
||||
{
|
||||
entries.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void removeSpawn(String entityName, net.minecraft.src.EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
Class <? extends Entity > entityClazz = EntityTypes.getEntityToClassMapping().get(entityName);
|
||||
|
||||
if (EntityLiving.class.isAssignableFrom(entityClazz))
|
||||
{
|
||||
removeSpawn((Class <? extends net.minecraft.src.EntityLiving >) entityClazz, spawnList, biomes);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
||||
*
|
||||
* 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; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* 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.minecraft.server;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@Retention(value = RUNTIME)
|
||||
@Target(value = FIELD)
|
||||
public @interface MLProp
|
||||
{
|
||||
/**
|
||||
* Adds additional help to top of configuration file.
|
||||
*/
|
||||
String info() default "";
|
||||
|
||||
/**
|
||||
* Maximum value allowed if field is a number.
|
||||
*/
|
||||
double max() default Double.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* Minimum value allowed if field is a number.
|
||||
*/
|
||||
double min() default Double.MIN_VALUE;
|
||||
|
||||
/**
|
||||
* Overrides the field name for property key.
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
}
|
||||
@@ -1,780 +0,0 @@
|
||||
/*
|
||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
||||
*
|
||||
* 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; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* 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.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ReflectionHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
||||
import cpw.mods.fml.server.FMLBukkitHandler;
|
||||
|
||||
public class ModLoader
|
||||
{
|
||||
/**
|
||||
* Not used on the server.
|
||||
*
|
||||
* @param achievement
|
||||
* @param name
|
||||
* @param description
|
||||
*/
|
||||
public static void addAchievementDesc(Achievement achievement, String name, String description)
|
||||
{
|
||||
String achName=achievement.getName();
|
||||
addLocalization(achName, name);
|
||||
addLocalization(achName+".desc", description);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
*
|
||||
* {@link FMLCommonHandler#fuelLookup(int, int)}
|
||||
*
|
||||
* @param id
|
||||
* @param metadata
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static int addAllFuel(int id, int metadata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void addAllRenderers(Map<Class<? extends Entity>, Object> renderers)
|
||||
{
|
||||
}
|
||||
|
||||
public static void addAnimation(Object anim)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is unimplemented in server versions to date.
|
||||
*
|
||||
* @param armor
|
||||
* @return
|
||||
*/
|
||||
public static int addArmor(String armor)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds the supplied biome to the set of candidate biomes for the default world generator type.
|
||||
*
|
||||
* @param biome
|
||||
*/
|
||||
public static void addBiome(BiomeBase biome)
|
||||
{
|
||||
FMLRegistry.addBiome(biome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add localization for the specified string
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public static void addLocalization(String key, String value)
|
||||
{
|
||||
addLocalization(key, "en_US", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add localization for the specified string
|
||||
*
|
||||
* @param key
|
||||
* @param lang
|
||||
* @param value
|
||||
*/
|
||||
public static void addLocalization(String key, String lang, String value)
|
||||
{
|
||||
FMLCommonHandler.instance().addStringLocalization(key, lang, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Name the specified minecraft object with the supplied name
|
||||
*
|
||||
* @param instance
|
||||
* @param name
|
||||
*/
|
||||
public static void addName(Object instance, String name)
|
||||
{
|
||||
addName(instance,"en_US",name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not generate names
|
||||
*
|
||||
* @param instance
|
||||
* @param lang
|
||||
* @param name
|
||||
*/
|
||||
public static void addName(Object instance, String lang, String name)
|
||||
{
|
||||
FMLCommonHandler.instance().addNameForObject(instance, lang, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not render textures
|
||||
*
|
||||
* @param fileToOverride
|
||||
* @param fileToAdd
|
||||
* @return
|
||||
*/
|
||||
public static int addOverride(String fileToOverride, String fileToAdd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not render textures
|
||||
*
|
||||
* @param path
|
||||
* @param overlayPath
|
||||
* @param index
|
||||
*/
|
||||
public static void addOverride(String path, String overlayPath, int index)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Shaped Recipe
|
||||
*
|
||||
* @param output
|
||||
* @param params
|
||||
*/
|
||||
public static void addRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
FMLRegistry.addRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a shapeless recipe
|
||||
*
|
||||
* @param output
|
||||
* @param params
|
||||
*/
|
||||
public static void addShapelessRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
FMLRegistry.addShapelessRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new product to be smelted
|
||||
*
|
||||
* @param input
|
||||
* @param output
|
||||
*/
|
||||
public static void addSmelting(int input, ItemStack output)
|
||||
{
|
||||
FMLRegistry.addSmelting(input, output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
*
|
||||
* @param entityClass
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
||||
{
|
||||
FMLRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLBukkitHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
* @param entityClass
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeBase... biomes)
|
||||
{
|
||||
FMLRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
*
|
||||
* @param entityName
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
||||
{
|
||||
FMLRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLBukkitHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
* @param entityName
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeBase... biomes)
|
||||
{
|
||||
FMLRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* {@link FMLBukkitHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param xVel
|
||||
* @param zVel
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a container and drop all the items in it on the ground around
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public static void genericContainerRemoval(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(te instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inv = (IInventory)te;
|
||||
|
||||
for (int l = 0; l < inv.getSize(); l++)
|
||||
{
|
||||
ItemStack itemstack = inv.getItem(l);
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float f = world.random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = world.random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = world.random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.count > 0)
|
||||
{
|
||||
int i1 = world.random.nextInt(21) + 10;
|
||||
|
||||
if (i1 > itemstack.count)
|
||||
{
|
||||
i1 = itemstack.count ;
|
||||
}
|
||||
|
||||
itemstack.count -= i1;
|
||||
EntityItem entityitem = new EntityItem(world, (float)te.x + f, (float)te.y + f1, (float)te.z + f2, new ItemStack(itemstack.id, i1, itemstack.getData()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motX = (float)world.random.nextGaussian() * f3;
|
||||
entityitem.motY = (float)world.random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motZ = (float)world.random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTag())
|
||||
{
|
||||
entityitem.itemStack.setTag((NBTTagCompound)itemstack.getTag().clone());
|
||||
}
|
||||
|
||||
world.addEntity(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all BaseMod loaded into the system
|
||||
* {@link ModLoaderModContainer#findAll}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<BaseMod> getLoadedMods()
|
||||
{
|
||||
return ModLoaderModContainer.findAll(BaseMod.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Logger getLogger()
|
||||
{
|
||||
return FMLCommonHandler.instance().getFMLLogger();
|
||||
}
|
||||
|
||||
public static Object getMinecraftInstance()
|
||||
{
|
||||
return getMinecraftServerInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minecraft server instance
|
||||
* {@link FMLServerHandler#getServer()}
|
||||
* @return
|
||||
*/
|
||||
public static MinecraftServer getMinecraftServerInstance()
|
||||
{
|
||||
return FMLBukkitHandler.instance().getServer();
|
||||
}
|
||||
/**
|
||||
* Get a value from a field using reflection
|
||||
* {@link ReflectionHelper#getPrivateValue(Class, Object, int)}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param fieldindex
|
||||
* @return
|
||||
*/
|
||||
public static <T, E> T getPrivateValue(Class <? super E > instanceclass, E instance, int fieldindex)
|
||||
{
|
||||
return ReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a field using reflection
|
||||
* {@link ReflectionHelper#getPrivateValue(Class, Object, String)}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param field
|
||||
* @return
|
||||
*/
|
||||
public static <T, E> T getPrivateValue(Class <? super E > instanceclass, E instance, String field)
|
||||
{
|
||||
return ReflectionHelper.getPrivateValue(instanceclass, instance, field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stubbed method on the server to return a unique model id
|
||||
*
|
||||
*/
|
||||
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new unique entity id
|
||||
* {@link Entity#getNextId()}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getUniqueEntityId()
|
||||
{
|
||||
return FMLCommonHandler.instance().nextUniqueEntityListId();
|
||||
}
|
||||
|
||||
public static int getUniqueSpriteIndex(String path)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* To properly implement packet 250 protocol you should always check your
|
||||
* channel is active prior to sending the packet
|
||||
*
|
||||
* @param player
|
||||
* @param channel
|
||||
* @return
|
||||
*/
|
||||
public static boolean isChannelActive(EntityPlayer player, String channel)
|
||||
{
|
||||
return FMLCommonHandler.instance().isChannelActive(channel, player);
|
||||
}
|
||||
|
||||
public static boolean isGUIOpen(Class<?> gui)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the named mod loaded?
|
||||
* {@link Loader#isModLoaded(String)}
|
||||
*
|
||||
* @param modname
|
||||
* @return
|
||||
*/
|
||||
public static boolean isModLoaded(String modname)
|
||||
{
|
||||
return Loader.isModLoaded(modname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented elsewhere
|
||||
*/
|
||||
@Deprecated
|
||||
public static void loadConfig()
|
||||
{
|
||||
}
|
||||
|
||||
public static Object loadImage(Object renderEngine, String path) throws Exception
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call in from elsewhere. Unimplemented here.
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
@Deprecated
|
||||
public static void onItemPickup(EntityPlayer player, ItemStack item)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Call in from elsewhere. Unimplemented here.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void onTick(float tick, Object game)
|
||||
{
|
||||
}
|
||||
|
||||
public static void openGUI(EntityPlayer player, Object gui)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void populateChunk(IChunkProvider generator, int chunkX, int chunkZ, World world)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* {@link FMLBukkitHandler#handlePacket250(Packet250CustomPayload, EntityHuman)}
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
@Deprecated
|
||||
public static void receivePacket(Packet250CustomPayload packet)
|
||||
{
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Object[] registerAllKeys(Object[] keys)
|
||||
{
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void registerAllTextureOverrides(Object cache)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new block
|
||||
*
|
||||
* @param block
|
||||
*/
|
||||
public static void registerBlock(Block block)
|
||||
{
|
||||
FMLRegistry.registerBlock(block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new block
|
||||
*
|
||||
* @param block
|
||||
* @param itemclass
|
||||
*/
|
||||
public static void registerBlock(Block block, Class <? extends ItemBlock > itemclass)
|
||||
{
|
||||
FMLRegistry.registerBlock(block, itemclass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new entity ID
|
||||
*
|
||||
* @param entityClass
|
||||
* @param entityName
|
||||
* @param id
|
||||
*/
|
||||
public static void registerEntityID(Class <? extends Entity > entityClass, String entityName, int id)
|
||||
{
|
||||
FMLRegistry.registerEntityID(entityClass, entityName, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new entity ID
|
||||
*
|
||||
* @param entityClass
|
||||
* @param entityName
|
||||
* @param id
|
||||
* @param background
|
||||
* @param foreground
|
||||
*/
|
||||
public static void registerEntityID(Class <? extends Entity > entityClass, String entityName, int id, int background, int foreground)
|
||||
{
|
||||
FMLRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
|
||||
}
|
||||
|
||||
public static void registerKey(BaseMod mod, Object keyHandler, boolean allowRepeat)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the mod for packets on this channel. This only registers the
|
||||
* channel with Forge Mod Loader, not with clients connecting- use
|
||||
* BaseMod.onClientLogin to tell them about your custom channel
|
||||
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
|
||||
*
|
||||
* @param mod
|
||||
* @param channel
|
||||
*/
|
||||
public static void registerPacketChannel(BaseMod mod, String channel)
|
||||
{
|
||||
FMLCommonHandler.instance().registerChannel(ModLoaderModContainer.findContainerFor(mod), channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new tile entity class
|
||||
*
|
||||
* @param tileEntityClass
|
||||
* @param id
|
||||
*/
|
||||
public static void registerTileEntity(Class <? extends TileEntity > tileEntityClass, String id)
|
||||
{
|
||||
FMLRegistry.registerTileEntity(tileEntityClass, id);
|
||||
}
|
||||
|
||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, Object renderer)
|
||||
{
|
||||
FMLRegistry.instance().registerTileEntity(tileEntityClass, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a biome from the list of generated biomes
|
||||
*
|
||||
* @param biome
|
||||
*/
|
||||
public static void removeBiome(BiomeBase biome)
|
||||
{
|
||||
FMLRegistry.removeBiome(biome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
*
|
||||
* @param entityClass
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType spawnList)
|
||||
{
|
||||
FMLRegistry.removeSpawn(entityClass, spawnList, FMLBukkitHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
*
|
||||
* @param entityClass
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType spawnList, BiomeBase... biomes)
|
||||
{
|
||||
FMLRegistry.removeSpawn(entityClass, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
*
|
||||
* @param entityName
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList)
|
||||
{
|
||||
FMLRegistry.removeSpawn(entityName, spawnList, FMLBukkitHandler.instance().getDefaultOverworldBiomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
*
|
||||
* @param entityName
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeBase... biomes)
|
||||
{
|
||||
FMLRegistry.removeSpawn(entityName, spawnList, biomes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean renderBlockIsItemFull3D(int modelID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void renderInvBlock(Object renderer, Block block, int metadata, int modelID)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean renderWorldBlock(Object renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration is handled elsewhere
|
||||
* {@link ModLoaderModContainer}
|
||||
*/
|
||||
@Deprecated
|
||||
public static void saveConfig()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a chat message to the server
|
||||
* {@link FMLServerHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
@Deprecated
|
||||
public static void serverChat(String text)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void serverLogin(Object handler, Packet1Login loginPacket)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that you want to receive ticks
|
||||
*
|
||||
* @param mod receiving the events
|
||||
* @param enable indicates whether you want to recieve them or not
|
||||
* @param useClock Not used in server side: all ticks are sent on the server side (no render subticks)
|
||||
*/
|
||||
public static void setInGameHook(BaseMod mod, boolean enable, boolean useClock)
|
||||
{
|
||||
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
||||
}
|
||||
|
||||
|
||||
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
||||
{
|
||||
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a private field to a value using reflection
|
||||
* {@link ReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param fieldindex
|
||||
* @param value
|
||||
*/
|
||||
public static <T, E> void setPrivateValue(Class <? super T > instanceclass, T instance, int fieldindex, E value)
|
||||
{
|
||||
ReflectionHelper.setPrivateValue(instanceclass, instance, fieldindex, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a private field to a value using reflection
|
||||
* {@link ReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param field
|
||||
* @param value
|
||||
*/
|
||||
public static <T, E> void setPrivateValue(Class <? super T > instanceclass, T instance, String field, E value)
|
||||
{
|
||||
ReflectionHelper.setPrivateValue(instanceclass, instance, field, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* {@link FMLBukkitHandler#onItemCrafted(EntityHuman, ItemStack, IInventory)}
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
* @param matrix
|
||||
*/
|
||||
@Deprecated
|
||||
public static void takenFromCrafting(EntityHuman player, ItemStack item, IInventory matrix)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* {@link FMLBukkitHandler#onItemSmelted(EntityHuman, ItemStack)}
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
@Deprecated
|
||||
public static void takenFromFurnace(EntityHuman player, ItemStack item)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw the offered exception. Likely will stop the game.
|
||||
* {@link FMLBukkitHandler#raiseException(Throwable, String, boolean)}
|
||||
* @param message
|
||||
* @param e
|
||||
*/
|
||||
public static void throwException(String message, Throwable e)
|
||||
{
|
||||
FMLBukkitHandler.instance().raiseException(e, message, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* To properly implement packet 250 protocol you should always check your channel
|
||||
* is active prior to sending the packet
|
||||
*
|
||||
* @param player
|
||||
* @param channel
|
||||
* @return
|
||||
*/
|
||||
public static boolean isChannelActive(EntityHuman player, String channel)
|
||||
{
|
||||
return FMLCommonHandler.instance().isChannelActive(channel, player);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* The FML Forge Mod Loader suite.
|
||||
* Copyright (C) 2012 cpw
|
||||
*
|
||||
* 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; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* 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.minecraft.server;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface SidedProxy
|
||||
{
|
||||
/**
|
||||
* The name of the client side class to load and populate
|
||||
* @return
|
||||
*/
|
||||
String clientSide() default "";
|
||||
|
||||
/**
|
||||
* The name of the server side class to load and populate
|
||||
* @return
|
||||
*/
|
||||
String serverSide() default "";
|
||||
|
||||
/**
|
||||
* The name of the a special bukkit plugin class to load and populate
|
||||
*/
|
||||
String bukkitSide() default "";
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface BiomeGenBase {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface Block {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface Entity {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface EntityLiving {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface EnumCreatureType {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface IRecipe {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface ItemBlock {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface ItemStack {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
public interface TileEntity {
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
import sys
|
||||
import os, os.path, shutil
|
||||
import fnmatch
|
||||
import re
|
||||
|
||||
def main():
|
||||
sys.stdout.flush()
|
||||
for x in range(1, len(sys.argv)):
|
||||
cleanup_source(sys.argv[x])
|
||||
|
||||
count = 0
|
||||
def cleanup_source(path):
|
||||
path = os.path.normpath(path)
|
||||
regex_cases_before = re.compile(r'((case|default).+\r?\n)\r?\n', re.MULTILINE) #Fixes newline after case before case body
|
||||
regex_cases_after = re.compile(r'\r?\n(\r?\n[ \t]+(case|default))', re.MULTILINE) #Fixes newline after case body before new case
|
||||
|
||||
def updatefile(src_file):
|
||||
global count
|
||||
tmp_file = src_file + '.tmp'
|
||||
count = 0
|
||||
with open(src_file, 'r') as fh:
|
||||
buf = fh.read()
|
||||
|
||||
def fix_cases(match):
|
||||
global count
|
||||
count += 1
|
||||
return match.group(1)
|
||||
|
||||
buf = regex_cases_before.sub(fix_cases, buf)
|
||||
buf = regex_cases_after.sub(fix_cases, buf)
|
||||
if count > 0:
|
||||
with open(tmp_file, 'w') as fh:
|
||||
fh.write(buf)
|
||||
shutil.move(tmp_file, src_file)
|
||||
|
||||
for path, _, filelist in os.walk(path, followlinks=True):
|
||||
sub_dir = os.path.relpath(path, path)
|
||||
for cur_file in fnmatch.filter(filelist, '*.java'):
|
||||
src_file = os.path.normpath(os.path.join(path, cur_file))
|
||||
updatefile(src_file)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.StringTranslate;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
|
||||
import cpw.mods.fml.common.registry.ItemData;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
|
||||
public class GuiIdMismatchScreen extends GuiYesNo {
|
||||
private List<String> missingIds = Lists.newArrayList();
|
||||
private List<String> mismatchedIds = Lists.newArrayList();
|
||||
private boolean allowContinue;
|
||||
|
||||
public GuiIdMismatchScreen(MapDifference<Integer, ItemData> idDifferences, boolean allowContinue)
|
||||
{
|
||||
super(null,"ID mismatch", "Should I continue?", 1);
|
||||
field_73942_a = this;
|
||||
for (Entry<Integer, ItemData> entry : idDifferences.entriesOnlyOnLeft().entrySet())
|
||||
{
|
||||
missingIds.add(String.format("ID %d from Mod %s is missing", entry.getValue().getItemId(), entry.getValue().getModId(), entry.getValue().getItemType()));
|
||||
}
|
||||
for (Entry<Integer, ValueDifference<ItemData>> entry : idDifferences.entriesDiffering().entrySet())
|
||||
{
|
||||
ItemData world = entry.getValue().leftValue();
|
||||
ItemData game = entry.getValue().rightValue();
|
||||
mismatchedIds.add(String.format("ID %d is mismatched between world and game", world.getItemId()));
|
||||
}
|
||||
this.allowContinue = allowContinue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_73878_a(boolean choice, int p_73878_2_)
|
||||
{
|
||||
FMLClientHandler.instance().callbackIdDifferenceResponse(choice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73873_v_();
|
||||
if (!allowContinue && field_73887_h.size() == 2)
|
||||
{
|
||||
field_73887_h.remove(0);
|
||||
}
|
||||
int offset = Math.max(85 - (missingIds.size() + mismatchedIds.size()) * 10, 30);
|
||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found ID mismatches", this.field_73880_f / 2, 10, 0xFFFFFF);
|
||||
this.func_73732_a(this.field_73886_k, "Complete details are in the log file", this.field_73880_f / 2, 20, 0xFFFFFF);
|
||||
int maxLines = 20;
|
||||
for (String s: missingIds) {
|
||||
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||
offset += 10;
|
||||
maxLines --;
|
||||
if (maxLines < 0) break;
|
||||
if (offset >= this.field_73881_g - 30) break;
|
||||
}
|
||||
if (maxLines > 0 && offset < this.field_73881_g - 30)
|
||||
{
|
||||
for (String s: mismatchedIds) {
|
||||
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||
offset += 10;
|
||||
maxLines --;
|
||||
if (maxLines < 0) break;
|
||||
if (offset >= this.field_73881_g - 30) break;
|
||||
}
|
||||
}
|
||||
if (allowContinue)
|
||||
{
|
||||
this.func_73732_a(this.field_73886_k, "Do you wish to continue loading?", this.field_73880_f / 2, this.field_73881_g - 30, 0xFFFFFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.func_73732_a(this.field_73886_k, "You cannot connect to this server", this.field_73880_f / 2, this.field_73881_g - 30, 0xFFFFFF);
|
||||
}
|
||||
// super.super. Grrr
|
||||
for (int var4 = 0; var4 < this.field_73887_h.size(); ++var4)
|
||||
{
|
||||
GuiButton var5 = (GuiButton)this.field_73887_h.get(var4);
|
||||
var5.field_73743_d = this.field_73881_g - 20;
|
||||
if (!allowContinue)
|
||||
{
|
||||
var5.field_73746_c = this.field_73880_f / 2 - 75;
|
||||
var5.field_73744_e = I18n.func_135053_a("gui.done");
|
||||
}
|
||||
var5.func_73737_a(this.field_73882_e, p_73863_1_, p_73863_2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiSmallButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.StringTranslate;
|
||||
import cpw.mods.fml.common.network.ModMissingPacket;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
|
||||
public class GuiModsMissingForServer extends GuiScreen
|
||||
{
|
||||
private ModMissingPacket modsMissing;
|
||||
|
||||
public GuiModsMissingForServer(ModMissingPacket modsMissing)
|
||||
{
|
||||
this.modsMissing = modsMissing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_73866_w_()
|
||||
{
|
||||
this.field_73887_h.add(new GuiSmallButton(1, this.field_73880_f / 2 - 75, this.field_73881_g - 38, I18n.func_135053_a("gui.done")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void func_73875_a(GuiButton p_73875_1_)
|
||||
{
|
||||
if (p_73875_1_.field_73742_g && p_73875_1_.field_73741_f == 1)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().func_71373_a(null);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73873_v_();
|
||||
int offset = Math.max(85 - modsMissing.getModList().size() * 10, 10);
|
||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader could not connect to this server", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset += 10;
|
||||
this.func_73732_a(this.field_73886_k, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset += 10;
|
||||
this.func_73732_a(this.field_73886_k, "They are required to play on this server", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset += 5;
|
||||
for (ArtifactVersion v : modsMissing.getModList())
|
||||
{
|
||||
offset += 10;
|
||||
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||
}
|
||||
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.toposort.ModSortingException;
|
||||
import cpw.mods.fml.common.toposort.ModSortingException.SortingExceptionData;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class GuiSortingProblem extends GuiScreen {
|
||||
private ModSortingException modSorting;
|
||||
private SortingExceptionData<ModContainer> failedList;
|
||||
|
||||
public GuiSortingProblem(ModSortingException modSorting)
|
||||
{
|
||||
this.modSorting = modSorting;
|
||||
this.failedList = modSorting.getExceptionData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_73866_w_()
|
||||
{
|
||||
super.func_73866_w_();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73873_v_();
|
||||
int offset = Math.max(85 - (failedList.getVisitedNodes().size() + 3) * 10, 10);
|
||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, "A mod sorting cycle was detected and loading cannot continue", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, String.format("The first mod in the cycle is %s", failedList.getFirstBadNode()), this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, "The remainder of the cycle involves these mods", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=5;
|
||||
for (ModContainer mc : failedList.getVisitedNodes())
|
||||
{
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, String.format("%s : before: %s, after: %s", mc.toString(), mc.getDependants(), mc.getDependencies()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||
}
|
||||
offset+=20;
|
||||
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.lwjgl.opengl.ContextCapabilities;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class TextureFXManager
|
||||
{
|
||||
private static final TextureFXManager INSTANCE = new TextureFXManager();
|
||||
|
||||
private Minecraft client;
|
||||
|
||||
private Map<Integer,TextureHolder> texturesById = Maps.newHashMap();
|
||||
private Map<String, TextureHolder> texturesByName = Maps.newHashMap();
|
||||
|
||||
// private TextureHelper helper;
|
||||
|
||||
void setClient(Minecraft client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
// public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
|
||||
// {
|
||||
// InputStream image=client.field_71418_C.func_77292_e().func_77532_a(path);
|
||||
// if (image==null) {
|
||||
// throw new RuntimeException(String.format("The requested image path %s is not found",path));
|
||||
// }
|
||||
// BufferedImage result=ImageIO.read(image);
|
||||
// if (result==null)
|
||||
// {
|
||||
// throw new RuntimeException(String.format("The requested image path %s appears to be corrupted",path));
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
public static TextureFXManager instance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void fixTransparency(BufferedImage loadedImage, String textureName)
|
||||
{
|
||||
if (textureName.matches("^/mob/.*_eyes.*.png$"))
|
||||
{
|
||||
for (int x = 0; x < loadedImage.getWidth(); x++) {
|
||||
for (int y = 0; y < loadedImage.getHeight(); y++) {
|
||||
int argb = loadedImage.getRGB(x, y);
|
||||
if ((argb & 0xff000000) == 0 && argb != 0) {
|
||||
loadedImage.setRGB(x, y, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void bindTextureToName(String name, int index)
|
||||
{
|
||||
TextureHolder holder = new TextureHolder();
|
||||
holder.textureId = index;
|
||||
holder.textureName = name;
|
||||
texturesById.put(index,holder);
|
||||
texturesByName.put(name,holder);
|
||||
}
|
||||
|
||||
public void setTextureDimensions(int index, int j, int k)
|
||||
{
|
||||
TextureHolder holder = texturesById.get(index);
|
||||
if (holder == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
holder.x = j;
|
||||
holder.y = k;
|
||||
}
|
||||
|
||||
private class TextureHolder {
|
||||
private int textureId;
|
||||
private String textureName;
|
||||
private int x;
|
||||
private int y;
|
||||
}
|
||||
|
||||
public Dimension getTextureDimensions(String texture)
|
||||
{
|
||||
return texturesByName.containsKey(texture) ? new Dimension(texturesByName.get(texture).x, texturesByName.get(texture).y) : new Dimension(1,1);
|
||||
}
|
||||
|
||||
|
||||
// public TextureHelper getHelper()
|
||||
// {
|
||||
// if (helper == null)
|
||||
// {
|
||||
// ContextCapabilities capabilities = GLContext.getCapabilities();
|
||||
// boolean has43 = false;
|
||||
// try
|
||||
// {
|
||||
// has43 = capabilities.getClass().getField("GL_ARB_copy_image").getBoolean(capabilities);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// //e.printStackTrace();
|
||||
// // NOOP - LWJGL needs updating
|
||||
// FMLLog.info("Forge Mod Loader has detected an older LWJGL version, new advanced texture animation features are disabled");
|
||||
// }
|
||||
//// if (has43 && Boolean.parseBoolean(System.getProperty("fml.useGL43","true")))
|
||||
//// {
|
||||
//// FMLLog.info("Using the new OpenGL 4.3 advanced capability for animations");
|
||||
//// helper = new OpenGL43TextureHelper();
|
||||
//// }
|
||||
//// else
|
||||
// {
|
||||
// FMLLog.info("Not using advanced OpenGL 4.3 advanced capability for animations : OpenGL 4.3 is %s", has43 ? "available" : "not available");
|
||||
//// helper = new CopySubimageTextureHelper();
|
||||
// }
|
||||
// }
|
||||
// return helper;
|
||||
// }
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.client.modloader;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.src.BaseMod;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class ModLoaderBlockRendererHandler implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
private int renderId;
|
||||
private boolean render3dInInventory;
|
||||
private BaseMod mod;
|
||||
|
||||
/**
|
||||
* @param mod
|
||||
*
|
||||
*/
|
||||
public ModLoaderBlockRendererHandler(int renderId, boolean render3dInInventory, BaseMod mod)
|
||||
{
|
||||
this.renderId=renderId;
|
||||
this.render3dInInventory=render3dInInventory;
|
||||
this.mod=mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory()
|
||||
{
|
||||
return render3dInInventory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param block
|
||||
* @param modelId
|
||||
* @param renderer
|
||||
*/
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
return mod.renderWorldBlock(renderer, world, x, y, z, block, modelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param block
|
||||
* @param metadata
|
||||
* @param modelID
|
||||
* @param renderer
|
||||
*/
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
mod.renderInvBlock(renderer, block, metadata, modelID);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.client.modloader;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.src.BaseMod;
|
||||
import net.minecraft.client.*;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.multiplayer.NetClientHandler;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import com.google.common.base.Equivalence;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.modloader.BaseModProxy;
|
||||
import cpw.mods.fml.common.modloader.IModLoaderSidedHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
|
||||
public class ModLoaderClientHelper implements IModLoaderSidedHelper
|
||||
{
|
||||
public static int obtainBlockModelIdFor(BaseMod mod, boolean inventoryRenderer)
|
||||
{
|
||||
int renderId=RenderingRegistry.getNextAvailableRenderId();
|
||||
ModLoaderBlockRendererHandler bri=new ModLoaderBlockRendererHandler(renderId, inventoryRenderer, mod);
|
||||
RenderingRegistry.registerBlockHandler(bri);
|
||||
return renderId;
|
||||
}
|
||||
|
||||
|
||||
public static void handleFinishLoadingFor(ModLoaderModContainer mc, Minecraft game)
|
||||
{
|
||||
FMLLog.log(mc.getModId(), Level.FINE, "Handling post startup activities for ModLoader mod %s", mc.getModId());
|
||||
BaseMod mod = (BaseMod) mc.getMod();
|
||||
|
||||
Map<Class<? extends Entity>, Render> renderers = Maps.newHashMap(RenderManager.field_78727_a.field_78729_o);
|
||||
|
||||
try
|
||||
{
|
||||
FMLLog.log(mc.getModId(), Level.FINEST, "Requesting renderers from basemod %s", mc.getModId());
|
||||
mod.addRenderer(renderers);
|
||||
FMLLog.log(mc.getModId(), Level.FINEST, "Received %d renderers from basemod %s", renderers.size(), mc.getModId());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(mc.getModId(), Level.SEVERE, e, "A severe problem was detected with the mod %s during the addRenderer call. Continuing, but expect odd results", mc.getModId());
|
||||
}
|
||||
|
||||
MapDifference<Class<? extends Entity>, Render> difference = Maps.difference(RenderManager.field_78727_a.field_78729_o, renderers, Equivalence.identity());
|
||||
|
||||
for ( Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnLeft().entrySet())
|
||||
{
|
||||
FMLLog.log(mc.getModId(), Level.WARNING, "The mod %s attempted to remove an entity renderer %s from the entity map. This will be ignored.", mc.getModId(), e.getKey().getName());
|
||||
}
|
||||
|
||||
for (Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnRight().entrySet())
|
||||
{
|
||||
FMLLog.log(mc.getModId(), Level.FINEST, "Registering ModLoader entity renderer %s as instance of %s", e.getKey().getName(), e.getValue().getClass().getName());
|
||||
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
for (Entry<Class<? extends Entity>, ValueDifference<Render>> e : difference.entriesDiffering().entrySet())
|
||||
{
|
||||
FMLLog.log(mc.getModId(), Level.FINEST, "Registering ModLoader entity rendering override for %s as instance of %s", e.getKey().getName(), e.getValue().rightValue().getClass().getName());
|
||||
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue().rightValue());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
mod.registerAnimation(game);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(mc.getModId(), Level.SEVERE, e, "A severe problem was detected with the mod %s during the registerAnimation call. Continuing, but expect odd results", mc.getModId());
|
||||
}
|
||||
}
|
||||
|
||||
public ModLoaderClientHelper(Minecraft client)
|
||||
{
|
||||
this.client = client;
|
||||
ModLoaderHelper.sidedHelper = this;
|
||||
keyBindingContainers = Multimaps.newMultimap(Maps.<ModLoaderModContainer, Collection<ModLoaderKeyBindingHandler>>newHashMap(), new Supplier<Collection<ModLoaderKeyBindingHandler>>()
|
||||
{
|
||||
@Override
|
||||
public Collection<ModLoaderKeyBindingHandler> get()
|
||||
{
|
||||
return Collections.singleton(new ModLoaderKeyBindingHandler());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Minecraft client;
|
||||
private static Multimap<ModLoaderModContainer, ModLoaderKeyBindingHandler> keyBindingContainers;
|
||||
|
||||
@Override
|
||||
public void finishModLoading(ModLoaderModContainer mc)
|
||||
{
|
||||
handleFinishLoadingFor(mc, client);
|
||||
}
|
||||
|
||||
|
||||
public static void registerKeyBinding(BaseModProxy mod, KeyBinding keyHandler, boolean allowRepeat)
|
||||
{
|
||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
||||
ModLoaderKeyBindingHandler handler = Iterables.getOnlyElement(keyBindingContainers.get(mlmc));
|
||||
handler.setModContainer(mlmc);
|
||||
handler.addKeyBinding(keyHandler, allowRepeat);
|
||||
KeyBindingRegistry.registerKeyBinding(handler);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getClientGui(BaseModProxy mod, EntityPlayer player, int ID, int x, int y, int z)
|
||||
{
|
||||
return ((net.minecraft.src.BaseMod)mod).getContainerGUI((EntityClientPlayerMP) player, ID, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Entity spawnEntity(BaseModProxy mod, EntitySpawnPacket input, EntityRegistration er)
|
||||
{
|
||||
return ((net.minecraft.src.BaseMod)mod).spawnEntity(er.getModEntityId(), client.field_71441_e, input.scaledX, input.scaledY, input.scaledZ);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet)
|
||||
{
|
||||
((net.minecraft.src.BaseMod)mod).clientCustomPayload(client.field_71439_g.field_71174_a, packet);
|
||||
}
|
||||
|
||||
private Map<INetworkManager,NetHandler> managerLookups = new MapMaker().weakKeys().weakValues().makeMap();
|
||||
@Override
|
||||
public void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod)
|
||||
{
|
||||
managerLookups.put(manager, netClientHandler);
|
||||
((BaseMod)mod).clientConnect((NetClientHandler)netClientHandler);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod)
|
||||
{
|
||||
if (managerLookups.containsKey(manager))
|
||||
{
|
||||
((BaseMod)mod).clientDisconnect((NetClientHandler) managerLookups.get(manager));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.client.modloader;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import com.google.common.primitives.Booleans;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class ModLoaderKeyBindingHandler extends KeyBindingRegistry.KeyHandler
|
||||
{
|
||||
private ModLoaderModContainer modContainer;
|
||||
private List<KeyBinding> helper;
|
||||
private boolean[] active = new boolean[0];
|
||||
private boolean[] mlRepeats = new boolean[0];
|
||||
private boolean[] armed = new boolean[0];
|
||||
|
||||
public ModLoaderKeyBindingHandler()
|
||||
{
|
||||
super(new KeyBinding[0], new boolean[0]);
|
||||
}
|
||||
|
||||
void setModContainer(ModLoaderModContainer modContainer)
|
||||
{
|
||||
this.modContainer = modContainer;
|
||||
}
|
||||
|
||||
public void fireKeyEvent(KeyBinding kb)
|
||||
{
|
||||
((net.minecraft.src.BaseMod)modContainer.getMod()).keyboardEvent(kb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyDown(EnumSet<TickType> type, KeyBinding kb, boolean end, boolean repeats)
|
||||
{
|
||||
if (!end)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int idx = helper.indexOf(kb);
|
||||
if (type.contains(TickType.CLIENT))
|
||||
{
|
||||
armed[idx] = true;
|
||||
}
|
||||
if (armed[idx] && type.contains(TickType.RENDER) && (!active[idx] || mlRepeats[idx]))
|
||||
{
|
||||
fireKeyEvent(kb);
|
||||
active[idx] = true;
|
||||
armed[idx] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyUp(EnumSet<TickType> type, KeyBinding kb, boolean end)
|
||||
{
|
||||
if (!end)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int idx = helper.indexOf(kb);
|
||||
active[idx] = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks()
|
||||
{
|
||||
return EnumSet.of(TickType.CLIENT, TickType.RENDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel()
|
||||
{
|
||||
return modContainer.getModId() +" KB "+keyBindings[0].field_74512_d;
|
||||
}
|
||||
|
||||
void addKeyBinding(KeyBinding binding, boolean repeats)
|
||||
{
|
||||
this.keyBindings = ObjectArrays.concat(this.keyBindings, binding);
|
||||
this.repeatings = new boolean[this.keyBindings.length];
|
||||
Arrays.fill(this.repeatings, true);
|
||||
this.active = new boolean[this.keyBindings.length];
|
||||
this.armed = new boolean[this.keyBindings.length];
|
||||
this.mlRepeats = Booleans.concat(this.mlRepeats, new boolean[] { repeats });
|
||||
this.keyDown = new boolean[this.keyBindings.length];
|
||||
this.helper = Arrays.asList(this.keyBindings);
|
||||
}
|
||||
}
|
||||
@@ -1,457 +0,0 @@
|
||||
/*
|
||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
||||
*
|
||||
* 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; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* 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.minecraft.src;
|
||||
|
||||
import static cpw.mods.fml.relauncher.Side.CLIENT;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.*;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.multiplayer.NetClientHandler;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetServerHandler;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModProxy
|
||||
{
|
||||
// CALLBACK MECHANISMS
|
||||
|
||||
public final boolean doTickInGame(TickType tick, boolean tickEnd, Object... data)
|
||||
{
|
||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
boolean hasWorld = mc.field_71441_e != null;
|
||||
// World and render ticks
|
||||
if (tickEnd && ( tick==TickType.RENDER || tick==TickType.CLIENT ) && hasWorld) {
|
||||
return onTickInGame((Float) data[0], mc);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean doTickInGUI(TickType tick, boolean tickEnd, Object... data)
|
||||
{
|
||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
boolean hasWorld = mc.field_71441_e != null;
|
||||
|
||||
if (tickEnd && ( tick==TickType.RENDER || ( tick==TickType.CLIENT && hasWorld))) {
|
||||
return onTickInGUI((Float) data[0], mc, mc.field_71462_r);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
public final void onRenderHarvest(Map renderers)
|
||||
{
|
||||
addRenderer((Map<Class<? extends Entity>,Render>)renderers);
|
||||
}
|
||||
|
||||
public final void onRegisterAnimations()
|
||||
{
|
||||
registerAnimation(FMLClientHandler.instance().getClient());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onCrafting(Object... craftingParameters)
|
||||
{
|
||||
takenFromCrafting((EntityPlayer)craftingParameters[0], (ItemStack)craftingParameters[1], (IInventory)craftingParameters[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onSmelting(Object... smeltingParameters)
|
||||
{
|
||||
takenFromFurnace((EntityPlayer)smeltingParameters[0], (ItemStack)smeltingParameters[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean dispense(double x, double y, double z, int xVelocity, int zVelocity, Object... data)
|
||||
{
|
||||
return dispenseEntity((World)data[0], x, y, z, xVelocity, zVelocity, (ItemStack)data[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean onChat(Object... data)
|
||||
{
|
||||
receiveChatPacket(((Packet3Chat)data[0]).field_73476_b);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void onServerLogin(Object handler) {
|
||||
serverConnect((NetClientHandler) handler);
|
||||
}
|
||||
|
||||
public final void onServerLogout() {
|
||||
serverDisconnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPlayerLogin(Object player)
|
||||
{
|
||||
onClientLogin((EntityPlayer) player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPlayerLogout(Object player)
|
||||
{
|
||||
onClientLogout((EntityPlayer)player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPlayerChangedDimension(Object player)
|
||||
{
|
||||
onClientDimensionChanged((EntityPlayer)player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPacket250Packet(Object... data)
|
||||
{
|
||||
receiveCustomPacket((Packet250CustomPayload)data[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void notifyPickup(Object... pickupData)
|
||||
{
|
||||
EntityItem item = (EntityItem) pickupData[0];
|
||||
EntityPlayer player = (EntityPlayer) pickupData[1];
|
||||
onItemPickup(player, item.field_70294_a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void generate(Random random, int chunkX, int chunkZ, Object... additionalData)
|
||||
{
|
||||
World w = (World) additionalData[0];
|
||||
IChunkProvider cp = (IChunkProvider) additionalData[1];
|
||||
|
||||
if (cp instanceof ChunkProviderGenerate)
|
||||
{
|
||||
generateSurface(w, random, chunkX << 4, chunkZ << 4);
|
||||
}
|
||||
else if (cp instanceof ChunkProviderHell)
|
||||
{
|
||||
generateNether(w, random, chunkX << 4, chunkZ << 4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean handleCommand(String command, Object... data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*/
|
||||
// BASEMOD API
|
||||
/**
|
||||
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
|
||||
*
|
||||
* @param id
|
||||
* @param metadata
|
||||
*/
|
||||
public int addFuel(int id, int metadata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public void addRenderer(Map<Class<? extends Entity>, Render> renderers)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Override if you wish to generate Nether (Hell biome) blocks
|
||||
*
|
||||
* @param world
|
||||
* @param random
|
||||
* @param chunkX
|
||||
* @param chunkZ
|
||||
*/
|
||||
public void generateNether(World world, Random random, int chunkX, int chunkZ)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Override if you wish to generate Overworld (not hell or the end) blocks
|
||||
*
|
||||
* @param world
|
||||
* @param random
|
||||
* @param chunkX
|
||||
* @param chunkZ
|
||||
*/
|
||||
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to return a gui screen to display
|
||||
* @param player
|
||||
* @param containerID
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public GuiContainer getContainerGUI(EntityClientPlayerMP player, int containerID, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of your mod. Defaults to the class name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get your mod priorities
|
||||
*/
|
||||
public String getPriorities()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the version of your mod
|
||||
*/
|
||||
public abstract String getVersion();
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public void keyboardEvent(KeyBinding event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load your mod
|
||||
*/
|
||||
public abstract void load();
|
||||
|
||||
/**
|
||||
* Finish loading your mod
|
||||
*/
|
||||
public void modsLoaded()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle item pickup
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
public void onItemPickup(EntityPlayer player, ItemStack item)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)}
|
||||
*
|
||||
* @param time the rendering subtick time (0.0-1.0)
|
||||
* @param minecraftInstance the client
|
||||
* @return true to continue receiving ticks
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public boolean onTickInGame(float time, Minecraft minecraftInstance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onTickInGame(MinecraftServer minecraftServer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public boolean onTickInGUI(float tick, Minecraft game, GuiScreen gui)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only implemented on the client side
|
||||
* {@link #serverChat(NetServerHandler, String)}
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
@Override
|
||||
public void clientChat(String text)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a client connects
|
||||
* @param handler
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public void clientConnect(NetClientHandler handler)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the client disconnects
|
||||
* @param handler
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public void clientDisconnect(NetClientHandler handler)
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* Called client side to receive a custom payload for this mod
|
||||
*
|
||||
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
@Override
|
||||
public void receiveCustomPacket(Packet250CustomPayload packet)
|
||||
{
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public void registerAnimation(Minecraft game)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
/*
|
||||
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||
*/
|
||||
@Override
|
||||
public void serverConnect(NetHandler handler) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||
*/
|
||||
@Override
|
||||
public void serverDisconnect() {
|
||||
|
||||
}
|
||||
/**
|
||||
* Called when someone crafts an item from a crafting table
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
* @param matrix
|
||||
*/
|
||||
public void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory matrix)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when someone takes a smelted item from a furnace
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
public void takenFromFurnace(EntityPlayer player, ItemStack item)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The identifier string for the mod- used in client<->server negotiation
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getName() + " " + getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a chat message is received. Return true to stop further processing
|
||||
*/
|
||||
@Override
|
||||
public void serverChat(NetServerHandler source, String message)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Called when a new client logs in.
|
||||
*
|
||||
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
@Override
|
||||
public void onClientLogin(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a client logs out of the server.
|
||||
*
|
||||
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||
*/
|
||||
@Override
|
||||
public void onClientLogout(INetworkManager mgr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn the entity of the supplied type, if it is your mod's
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public Entity spawnEntity(int entityId, World world, double scaledX, double scaledY, double scaledZ)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public void clientCustomPayload(NetClientHandler handler, Packet250CustomPayload packet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
|
||||
public class EntityRendererProxy extends EntityRenderer
|
||||
{
|
||||
public static final String fmlMarker = "This is an FML marker";
|
||||
private Minecraft game;
|
||||
|
||||
public EntityRendererProxy(Minecraft minecraft)
|
||||
{
|
||||
super(minecraft);
|
||||
game = minecraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_78480_b(float tick)
|
||||
{
|
||||
super.func_78480_b(tick);
|
||||
//This is where ModLoader does all of it's ticking
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
||||
*
|
||||
* 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; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* 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.minecraft.src;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@Retention(value = RUNTIME)
|
||||
@Target(value = FIELD)
|
||||
public @interface MLProp
|
||||
{
|
||||
/**
|
||||
* Adds additional help to top of configuration file.
|
||||
*/
|
||||
String info() default "";
|
||||
|
||||
/**
|
||||
* Maximum value allowed if field is a number.
|
||||
*/
|
||||
double max() default Double.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* Minimum value allowed if field is a number.
|
||||
*/
|
||||
double min() default Double.MIN_VALUE;
|
||||
|
||||
/**
|
||||
* Overrides the field name for property key.
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
}
|
||||
@@ -1,918 +0,0 @@
|
||||
/*
|
||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
||||
*
|
||||
* 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; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* 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.minecraft.src;
|
||||
|
||||
import static cpw.mods.fml.relauncher.Side.CLIENT;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.client.*;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.multiplayer.NetClientHandler;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.dispenser.IBehaviorDispenseItem;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.NetServerHandler;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet1Login;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.*;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.TextureFXManager;
|
||||
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
||||
import cpw.mods.fml.client.modloader.ModLoaderKeyBindingHandler;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cpw.mods.fml.server.FMLServerHandler;
|
||||
|
||||
public class ModLoader
|
||||
{
|
||||
public static final String fmlMarker = "This is an FML marker";
|
||||
// TODO dirty workaround for millinaire
|
||||
@Deprecated
|
||||
public static final Map<String,Map<String,String>> localizedStrings=Collections.emptyMap();
|
||||
|
||||
/**
|
||||
* Adds localization info for an achievement, Not used on the server.
|
||||
*
|
||||
* @param achievement The achievement to name
|
||||
* @param name The name
|
||||
* @param description The description
|
||||
*/
|
||||
public static void addAchievementDesc(Achievement achievement, String name, String description)
|
||||
{
|
||||
String achName=achievement.func_75970_i();
|
||||
addLocalization(achName, name);
|
||||
addLocalization(achName+".desc", description);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
*
|
||||
* {@link GameRegistry#getFuelValue(ItemStack)}
|
||||
*
|
||||
* @param id The Item ID
|
||||
* @param metadata The Item Metadata
|
||||
* @return The fuel strength, in ticks, 0 if unhandled
|
||||
*/
|
||||
@Deprecated
|
||||
public static int addAllFuel(int id, int metadata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static void addAllRenderers(Map<Class<? extends Entity>, Render> renderers)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new prefix to the armor texture list
|
||||
*
|
||||
* {@link RenderingRegistry#addNewArmourRendererPrefix(String)}
|
||||
*
|
||||
* @param armor The new armor prefix
|
||||
* @return The new armor index
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public static int addArmor(String armor)
|
||||
{
|
||||
return RenderingRegistry.addNewArmourRendererPrefix(armor);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds the supplied biome to the set of candidate biomes for the default world generator type.
|
||||
*
|
||||
* @param biome The biome to add
|
||||
*/
|
||||
public static void addBiome(BiomeGenBase biome)
|
||||
{
|
||||
GameRegistry.addBiome(biome);
|
||||
}
|
||||
|
||||
public static void addEntityTracker(BaseMod mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval, boolean sendVelocityInfo)
|
||||
{
|
||||
ModLoaderHelper.buildEntityTracker(mod, entityClass, entityTypeId, updateRange, updateInterval, sendVelocityInfo);
|
||||
}
|
||||
|
||||
public static void addCommand(ICommand command)
|
||||
{
|
||||
ModLoaderHelper.addCommand(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a behaviour to the dispenser
|
||||
*
|
||||
* @param item
|
||||
* @param behavior
|
||||
*/
|
||||
public static void addDispenserBehavior(Item item, IBehaviorDispenseItem behavior)
|
||||
{
|
||||
BlockDispenser.field_82527_a.func_82595_a(item, behavior);
|
||||
}
|
||||
/**
|
||||
* Add localization for the specified string
|
||||
*
|
||||
* @param key Key
|
||||
* @param value Value
|
||||
*/
|
||||
public static void addLocalization(String key, String value)
|
||||
{
|
||||
addLocalization(key, "en_US", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add localization for the specified string
|
||||
*
|
||||
* @param key Key
|
||||
* @param lang Language identifier
|
||||
* @param value Value
|
||||
*/
|
||||
public static void addLocalization(String key, String lang, String value)
|
||||
{
|
||||
LanguageRegistry.instance().addStringLocalization(key, lang, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Name the specified minecraft object with the supplied name
|
||||
*
|
||||
* @param instance Item to name
|
||||
* @param name The name to give it
|
||||
*/
|
||||
public static void addName(Object instance, String name)
|
||||
{
|
||||
addName(instance,"en_US",name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unimplemented on the server as it does not generate names
|
||||
*
|
||||
* @param instance Item to name
|
||||
* @param lang Languge identifier
|
||||
* @param name Name to give it
|
||||
*/
|
||||
public static void addName(Object instance, String lang, String name)
|
||||
{
|
||||
LanguageRegistry.instance().addNameForObject(instance, lang, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to register a small image to be applied to a larger texture image,
|
||||
* typically how old ModLoader mods add custom Item/Block textures.
|
||||
*
|
||||
* Forge mods should use setTextureFile in Item/Block
|
||||
*
|
||||
* Will return the icon index it was applied to.
|
||||
*
|
||||
* Unimplemented on the server as it does not render textures
|
||||
*
|
||||
* @param fileToOverride The texture to apply the new image to
|
||||
* @param fileToAdd The new image
|
||||
* @return The 'icon index' in the main image that the new image will be applied to
|
||||
*/
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static int addOverride(String fileToOverride, String fileToAdd)
|
||||
{
|
||||
return RenderingRegistry.addTextureOverride(fileToOverride, fileToAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to register a small image to be applied to a larger texture image,
|
||||
* typically how old ModLoader mods add custom Item/Block textures.
|
||||
*
|
||||
* Forge mods should use setTextureFile in Item/Block
|
||||
*
|
||||
* Unimplemented on the server as it does not render textures
|
||||
*
|
||||
* @param path The texture to apply the new image to
|
||||
* @param overlayPath The new image
|
||||
* @param index Where on the texture to apply it
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public static void addOverride(String path, String overlayPath, int index)
|
||||
{
|
||||
RenderingRegistry.addTextureOverride(path, overlayPath, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Shaped Recipe
|
||||
*
|
||||
* @param output The result
|
||||
* @param params The input
|
||||
*/
|
||||
public static void addRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
GameRegistry.addRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a shapeless recipe
|
||||
*
|
||||
* @param output The result
|
||||
* @param params The input
|
||||
*/
|
||||
public static void addShapelessRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
GameRegistry.addShapelessRecipe(output, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new product to be smelted
|
||||
*
|
||||
* @param input
|
||||
* @param output
|
||||
*/
|
||||
public static void addSmelting(int input, ItemStack output)
|
||||
{
|
||||
GameRegistry.addSmelting(input, output, 1.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new product to be smelted
|
||||
*
|
||||
* @param input
|
||||
* @param output
|
||||
*/
|
||||
public static void addSmelting(int input, ItemStack output, float experience)
|
||||
{
|
||||
GameRegistry.addSmelting(input, output, experience);
|
||||
}
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
*
|
||||
* @param entityClass
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
||||
{
|
||||
EntityRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, WorldType.base12Biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
*
|
||||
* @param entityClass
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
EntityRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
*
|
||||
* @param entityName
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
||||
{
|
||||
EntityRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, WorldType.base12Biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a mob to the spawn list
|
||||
*
|
||||
* @param entityName
|
||||
* @param weightedProb
|
||||
* @param min
|
||||
* @param max
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
EntityRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
||||
}
|
||||
|
||||
public static void addTrade(int profession, TradeEntry entry)
|
||||
{
|
||||
ModLoaderHelper.registerTrade(profession, entry);
|
||||
}
|
||||
/**
|
||||
* Send a packet from the client
|
||||
* @param packet
|
||||
*/
|
||||
public static void clientSendPacket(Packet packet)
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer(packet);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param xVel
|
||||
* @param zVel
|
||||
* @param item
|
||||
* @return Always false, not implemented here
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a container and drop all the items in it on the ground around
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public static void genericContainerRemoval(World world, int x, int y, int z)
|
||||
{
|
||||
/* TileEntity te = world.func_603_b(x, y, z);
|
||||
|
||||
if (!(te instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inv = (IInventory)te;
|
||||
|
||||
for (int l = 0; l < inv.func_469_c(); l++)
|
||||
{
|
||||
ItemStack itemstack = inv.func_468_c(l);
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float f = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.field_1615_a > 0)
|
||||
{
|
||||
int i1 = world.field_1037_n.nextInt(21) + 10;
|
||||
|
||||
if (i1 > itemstack.field_1615_a)
|
||||
{
|
||||
i1 = itemstack.field_1615_a;
|
||||
}
|
||||
|
||||
itemstack.field_1615_a -= i1;
|
||||
EntityItem entityitem = new EntityItem(world, (float)te.field_823_f + f, (float)te.field_822_g + f1, (float)te.field_821_h + f2, new ItemStack(itemstack.field_1617_c, i1, itemstack.func_21181_i()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.field_608_an = (float) world.field_1037_n.nextGaussian() * f3;
|
||||
entityitem.field_607_ao = (float) world.field_1037_n.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.field_606_ap = (float) world.field_1037_n.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.func_40710_n())
|
||||
{
|
||||
entityitem.field_801_a.func_40706_d((NBTTagCompound) itemstack.func_40709_o().func_40195_b());
|
||||
}
|
||||
|
||||
world.func_674_a(entityitem);
|
||||
}
|
||||
}
|
||||
*/ }
|
||||
|
||||
/**
|
||||
* Get a list of all BaseMod loaded into the system
|
||||
* {@link ModLoaderModContainer#findAll}
|
||||
*
|
||||
* @return A list containing all loaded ModLoader mods
|
||||
*/
|
||||
public static List<BaseMod> getLoadedMods()
|
||||
{
|
||||
return ModLoaderModContainer.findAll(BaseMod.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
|
||||
*
|
||||
* @return The current logger
|
||||
*/
|
||||
public static Logger getLogger()
|
||||
{
|
||||
return FMLLog.getLogger();
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public static Minecraft getMinecraftInstance()
|
||||
{
|
||||
return FMLClientHandler.instance().getClient();
|
||||
}
|
||||
|
||||
public static MinecraftServer getMinecraftServerInstance()
|
||||
{
|
||||
return FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a field using reflection
|
||||
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, int)}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param fieldindex
|
||||
* @return The value in the specified field.
|
||||
*/
|
||||
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, int fieldindex)
|
||||
{
|
||||
return ObfuscationReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a field using reflection
|
||||
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, String[])}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param field
|
||||
* @return The value in the specified field.
|
||||
*/
|
||||
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, String field)
|
||||
{
|
||||
return ObfuscationReflectionHelper.getPrivateValue(instanceclass, instance, field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stubbed method on the server to return a unique model id
|
||||
*
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
||||
{
|
||||
return ModLoaderClientHelper.obtainBlockModelIdFor(mod, inventoryRenderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new unique entity id
|
||||
* {@link EntityRegistry#findGlobalUniqueEntityId()}
|
||||
*
|
||||
* @return A unique entity ID
|
||||
*/
|
||||
public static int getUniqueEntityId()
|
||||
{
|
||||
return EntityRegistry.findGlobalUniqueEntityId();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static int getUniqueSpriteIndex(String path)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* To properly implement packet 250 protocol you should always check your
|
||||
* channel is active prior to sending the packet
|
||||
*
|
||||
* @param player
|
||||
* @param channel
|
||||
* @return If the channel is registered to the current connection.
|
||||
*/
|
||||
public static boolean isChannelActive(EntityPlayer player, String channel)
|
||||
{
|
||||
return NetworkRegistry.instance().isChannelActive(channel, (Player)player);
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public static boolean isGUIOpen(Class<? extends GuiScreen> gui)
|
||||
{
|
||||
return FMLClientHandler.instance().isGUIOpen(gui);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the named mod loaded?
|
||||
* {@link Loader#isModLoaded(String)}
|
||||
*
|
||||
* @param modname
|
||||
* @return If the specified mod is loaded
|
||||
*/
|
||||
public static boolean isModLoaded(String modname)
|
||||
{
|
||||
return Loader.isModLoaded(modname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented elsewhere
|
||||
*/
|
||||
@Deprecated
|
||||
public static void loadConfig()
|
||||
{
|
||||
}
|
||||
|
||||
// @SideOnly(CLIENT)
|
||||
// public static BufferedImage loadImage(RenderEngine renderEngine, String path) throws Exception
|
||||
// {
|
||||
// return TextureFXManager.instance().loadImageFromTexturePack(renderEngine, path);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Call in from elsewhere. Unimplemented here.
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
@Deprecated
|
||||
public static void onItemPickup(EntityPlayer player, ItemStack item)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Call in from elsewhere. Unimplemented here.
|
||||
*/
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static void onTick(float tick, Minecraft game)
|
||||
{
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public static void openGUI(EntityPlayer player, GuiScreen gui)
|
||||
{
|
||||
FMLClientHandler.instance().displayGuiScreen(player, gui);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void populateChunk(IChunkProvider generator, int chunkX, int chunkZ, World world)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
@Deprecated
|
||||
public static void receivePacket(Packet250CustomPayload packet)
|
||||
{
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static KeyBinding[] registerAllKeys(KeyBinding[] keys)
|
||||
{
|
||||
return keys;
|
||||
}
|
||||
|
||||
// @Deprecated
|
||||
// @SideOnly(CLIENT)
|
||||
// public static void registerAllTextureOverrides(RenderEngine cache)
|
||||
// {
|
||||
// }
|
||||
|
||||
/**
|
||||
* Register a new block
|
||||
*
|
||||
* @param block
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void registerBlock(Block block)
|
||||
{
|
||||
GameRegistry.registerBlock(block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new block
|
||||
*
|
||||
* @param block
|
||||
* @param itemclass
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass)
|
||||
{
|
||||
GameRegistry.registerBlock(block, itemclass);
|
||||
}
|
||||
|
||||
public static void registerContainerID(BaseMod mod, int id)
|
||||
{
|
||||
ModLoaderHelper.buildGuiHelper(mod, id);
|
||||
}
|
||||
/**
|
||||
* Register a new entity ID
|
||||
*
|
||||
* @param entityClass
|
||||
* @param entityName
|
||||
* @param id
|
||||
*/
|
||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id)
|
||||
{
|
||||
EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new entity ID
|
||||
*
|
||||
* @param entityClass
|
||||
* @param entityName
|
||||
* @param id
|
||||
* @param background
|
||||
* @param foreground
|
||||
*/
|
||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground)
|
||||
{
|
||||
EntityRegistry.registerGlobalEntityID(entityClass, entityName, id, background, foreground);
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public static void registerKey(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat)
|
||||
{
|
||||
ModLoaderClientHelper.registerKeyBinding(mod, keyHandler, allowRepeat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the mod for packets on this channel.
|
||||
* {@link NetworkRegistry#registerChannel(IPacketHandler, String)}
|
||||
*
|
||||
* @param mod
|
||||
* @param channel
|
||||
*/
|
||||
public static void registerPacketChannel(BaseMod mod, String channel)
|
||||
{
|
||||
NetworkRegistry.instance().registerChannel(ModLoaderHelper.buildPacketHandlerFor(mod), channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new tile entity class
|
||||
*
|
||||
* @param tileEntityClass
|
||||
* @param id
|
||||
*/
|
||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
|
||||
{
|
||||
GameRegistry.registerTileEntity(tileEntityClass, id);
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, TileEntitySpecialRenderer renderer)
|
||||
{
|
||||
ClientRegistry.registerTileEntity(tileEntityClass, id, renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a biome from the list of generated biomes
|
||||
*
|
||||
* @param biome
|
||||
*/
|
||||
public static void removeBiome(BiomeGenBase biome)
|
||||
{
|
||||
GameRegistry.removeBiome(biome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
*
|
||||
* @param entityClass
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList)
|
||||
{
|
||||
EntityRegistry.removeSpawn(entityClass, spawnList, WorldType.base12Biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
*
|
||||
* @param entityClass
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
EntityRegistry.removeSpawn(entityClass, spawnList, biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
*
|
||||
* @param entityName
|
||||
* @param spawnList
|
||||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList)
|
||||
{
|
||||
EntityRegistry.removeSpawn(entityName, spawnList, WorldType.base12Biomes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a spawn
|
||||
*
|
||||
* @param entityName
|
||||
* @param spawnList
|
||||
* @param biomes
|
||||
*/
|
||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
||||
{
|
||||
EntityRegistry.removeSpawn(entityName, spawnList, biomes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static boolean renderBlockIsItemFull3D(int modelID)
|
||||
{
|
||||
return RenderingRegistry.instance().renderItemAsFull3DBlock(modelID);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
|
||||
{
|
||||
RenderingRegistry.instance().renderInventoryBlock(renderer, block, metadata, modelID);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
||||
{
|
||||
return RenderingRegistry.instance().renderWorldBlock(renderer, world, x, y, z, block, modelID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration is handled elsewhere
|
||||
* {@link ModLoaderModContainer}
|
||||
*/
|
||||
@Deprecated
|
||||
public static void saveConfig()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a packet from client to server
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
public static void sendPacket(Packet packet) {
|
||||
PacketDispatcher.sendPacketToServer(packet);
|
||||
}
|
||||
/**
|
||||
* Send a chat message to the server
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
@Deprecated
|
||||
public static void serverChat(String text)
|
||||
{
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SideOnly(CLIENT)
|
||||
public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket)
|
||||
{
|
||||
}
|
||||
|
||||
public static void serverSendPacket(NetServerHandler handler, Packet packet)
|
||||
{
|
||||
if (handler != null)
|
||||
{
|
||||
PacketDispatcher.sendPacketToPlayer(packet, (Player)handler.getPlayer());
|
||||
}
|
||||
}
|
||||
public static void serverOpenWindow(EntityPlayerMP player, Container container, int ID, int x, int y, int z)
|
||||
{
|
||||
ModLoaderHelper.openGui(ID, player, container, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that you want to receive ticks
|
||||
*
|
||||
* @param mod receiving the events
|
||||
* @param enable indicates whether you want to recieve them or not
|
||||
* @param useClock don't receive render subticks, just world ticks
|
||||
*/
|
||||
public static void setInGameHook(BaseMod mod, boolean enable, boolean useClock)
|
||||
{
|
||||
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
||||
}
|
||||
|
||||
|
||||
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
||||
{
|
||||
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a private field to a value using reflection
|
||||
* {@link ObfuscationReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param fieldindex
|
||||
* @param value
|
||||
*/
|
||||
public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, int fieldindex, E value)
|
||||
{
|
||||
ObfuscationReflectionHelper.setPrivateValue(instanceclass, instance, value, fieldindex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a private field to a value using reflection
|
||||
* {@link ObfuscationReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param field
|
||||
* @param value
|
||||
*/
|
||||
public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, String field, E value)
|
||||
{
|
||||
ObfuscationReflectionHelper.setPrivateValue(instanceclass, instance, value, field);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
* @param matrix
|
||||
*/
|
||||
@Deprecated
|
||||
public static void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory matrix)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
*
|
||||
* @param player
|
||||
* @param item
|
||||
*/
|
||||
@Deprecated
|
||||
public static void takenFromFurnace(EntityPlayer player, ItemStack item)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw the offered exception. Likely will stop the game.
|
||||
*
|
||||
* @param message
|
||||
* @param e
|
||||
*/
|
||||
public static void throwException(String message, Throwable e)
|
||||
{
|
||||
FMLCommonHandler.instance().raiseException(e, message, true);
|
||||
}
|
||||
|
||||
public static void throwException(Throwable e)
|
||||
{
|
||||
throwException("Exception in ModLoader", e);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
/**
|
||||
* Compatibility class for ModLoader -- do not use
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class TradeEntry
|
||||
{
|
||||
public final int id;
|
||||
public float chance;
|
||||
public boolean buying;
|
||||
public int min = 0;
|
||||
public int max = 0;
|
||||
|
||||
public TradeEntry(int id, float chance, boolean buying, int min, int max)
|
||||
{
|
||||
this.id = id;
|
||||
this.chance = chance;
|
||||
this.buying = buying;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public TradeEntry(int id, float chance, boolean buying)
|
||||
{
|
||||
this(id, chance, buying, 0, 0);
|
||||
}
|
||||
}
|
||||
-125
@@ -1,125 +0,0 @@
|
||||
--- commands.py
|
||||
+++ commands.py
|
||||
@@ -141,6 +141,8 @@
|
||||
fieldnames = csvreader.fieldnames
|
||||
return set(fieldnames)
|
||||
|
||||
+def commands_sanity_check():
|
||||
+ print ' Commands patch applied successfully'
|
||||
|
||||
class Commands(object):
|
||||
"""Contains the commands and initialisation for a full mcp run"""
|
||||
@@ -952,6 +954,8 @@
|
||||
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
|
||||
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
|
||||
|
||||
+ if side == SERVER and not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
|
||||
+ return self.checkbins(CLIENT)
|
||||
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
|
||||
return False
|
||||
return True
|
||||
@@ -1283,23 +1287,34 @@
|
||||
pathbinlk = {CLIENT: self.binclient, SERVER: self.binserver}
|
||||
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
||||
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
|
||||
+
|
||||
+ if side == SERVER: #Warn about server because FML recombines it into client
|
||||
+ self.logger.info('Server side recompiling might be skipped, this is normal, do not complain to FML/Forge team about server side.')
|
||||
|
||||
if not os.path.exists(pathbinlk[side]):
|
||||
os.makedirs(pathbinlk[side])
|
||||
|
||||
# HINT: We create the list of source directories based on the list of packages
|
||||
# on windows we just pass wildcards, otherwise we pass the full file list
|
||||
- if self.osname == 'win':
|
||||
+ if self.osname == 'win' and False == True: #FML: Disable for windows we write to file now
|
||||
all_files = False
|
||||
append_pattern = True
|
||||
else:
|
||||
all_files = True
|
||||
append_pattern = False
|
||||
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
|
||||
+ from tempfile import NamedTemporaryFile
|
||||
if self.cmdrecompscala: # Compile scala before java as scala scans java files, but not vice-versa
|
||||
pkglistscala = pkglist[:]
|
||||
pkglistscala.extend(filterdirs(pathsrclk[side], '*.scala', append_pattern=append_pattern, all_files=all_files))
|
||||
- dirs = ' '.join(pkglistscala)
|
||||
+ f = NamedTemporaryFile(mode='wb', suffix='.txt', prefix ='scala_src_path_', delete=False) #FML: We write to a temporary file just in case the command is to long
|
||||
+ for line in pkglistscala:
|
||||
+ if os.sep == '\\':
|
||||
+ f.write('"%s"\n' % os.path.abspath(line).replace(os.sep, os.sep + os.sep))
|
||||
+ else:
|
||||
+ f.write('"%s"\n' % os.path.abspath(line))
|
||||
+ f.close()
|
||||
+ dirs = '@"%s"' % f.name
|
||||
classpath = os.pathsep.join(cplk[side])
|
||||
forkcmd = self.cmdrecompscala.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side], pkgs=dirs)
|
||||
try:
|
||||
@@ -1319,7 +1334,15 @@
|
||||
self.logger.error('================================')
|
||||
self.logger.error('')
|
||||
raise
|
||||
- dirs = ' '.join(pkglist)
|
||||
+ os.unlink(f.name)
|
||||
+ f = NamedTemporaryFile(mode='wb', suffix='.txt', prefix ='java_src_path_', delete=False) #FML: We write to a temporary file just in case the command is to long
|
||||
+ for line in pkglist:
|
||||
+ if os.sep == '\\':
|
||||
+ f.write('"%s"\n' % os.path.abspath(line).replace('\\', '\\\\'))
|
||||
+ else:
|
||||
+ f.write('"%s"\n' % os.path.abspath(line))
|
||||
+ f.close()
|
||||
+ dirs = '@"%s"' % f.name
|
||||
classpath = os.pathsep.join(cplk[side])
|
||||
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
|
||||
pkgs=dirs)
|
||||
@@ -1338,9 +1361,10 @@
|
||||
self.logger.error('==================')
|
||||
self.logger.error('')
|
||||
raise
|
||||
+ os.unlink(f.name)
|
||||
|
||||
def startserver(self, mainclass, extraargs):
|
||||
- classpath = [self.binserver] + self.cpathserver
|
||||
+ classpath = [self.binclient, self.srcclient] + self.cpathserver + self.cpathclient
|
||||
classpath = [os.path.join('..', p) for p in classpath]
|
||||
classpath = os.pathsep.join(classpath)
|
||||
os.chdir(self.dirjars)
|
||||
@@ -1705,7 +1729,7 @@
|
||||
self.runcmd(forkcmd)
|
||||
return True
|
||||
|
||||
- def gathermd5s(self, side, reobf=False):
|
||||
+ def gathermd5s(self, side, reobf=False, skip_fml=False):
|
||||
if not reobf:
|
||||
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
|
||||
else:
|
||||
@@ -1720,6 +1744,9 @@
|
||||
class_path = ''
|
||||
else:
|
||||
class_path += '/'
|
||||
+ if skip_fml:
|
||||
+ if class_path.startswith('cpw/'):
|
||||
+ continue
|
||||
for class_file in fnmatch.filter(filelist, '*.class'):
|
||||
class_name = class_path + os.path.splitext(class_file)[0]
|
||||
bin_file = os.path.normpath(os.path.join(path, class_file))
|
||||
@@ -1892,6 +1919,9 @@
|
||||
sys.exit(1)
|
||||
|
||||
for entry in newfiles:
|
||||
+ if 'commands.py' in entry[0]: #FML, Disable updating of Commands.py
|
||||
+ print 'Update to runtime/commands.py found, but disbled due to using fml'
|
||||
+ continue
|
||||
if entry[3] == 'U':
|
||||
self.logger.info('Retrieving file from server : %s', entry[0])
|
||||
cur_file = os.path.normpath(entry[0])
|
||||
@@ -1912,6 +1942,9 @@
|
||||
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
|
||||
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
|
||||
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
||||
+
|
||||
+ if side == SERVER: #Noop out server side stuff
|
||||
+ return
|
||||
|
||||
# HINT: We need a table for the old md5 and the new ones
|
||||
md5table = {}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.MapDifference;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet131MapData;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||
import cpw.mods.fml.common.network.ModMissingPacket;
|
||||
import cpw.mods.fml.common.registry.ItemData;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public interface IFMLSidedHandler
|
||||
{
|
||||
List<String> getAdditionalBrandingInformation();
|
||||
|
||||
Side getSide();
|
||||
|
||||
void haltGame(String message, Throwable exception);
|
||||
|
||||
void showGuiScreen(Object clientGuiElement);
|
||||
|
||||
Entity spawnEntityIntoClientWorld(EntityRegistration registration, EntitySpawnPacket packet);
|
||||
|
||||
void adjustEntityLocationOnClient(EntitySpawnAdjustmentPacket entitySpawnAdjustmentPacket);
|
||||
|
||||
void beginServerLoading(MinecraftServer server);
|
||||
|
||||
void finishServerLoading();
|
||||
|
||||
MinecraftServer getServer();
|
||||
|
||||
void sendPacket(Packet packet);
|
||||
|
||||
void displayMissingMods(ModMissingPacket modMissingPacket);
|
||||
|
||||
void handleTinyPacket(NetHandler handler, Packet131MapData mapData);
|
||||
|
||||
void setClientCompatibilityLevel(byte compatibilityLevel);
|
||||
|
||||
byte getClientCompatibilityLevel();
|
||||
|
||||
boolean shouldServerShouldBeKilledQuietly();
|
||||
|
||||
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);
|
||||
|
||||
void addModAsResource(ModContainer container);
|
||||
|
||||
void updateResourcePackList();
|
||||
|
||||
String getCurrentLanguage();
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import static argo.jdom.JsonNodeBuilders.aStringBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import argo.jdom.JsonNode;
|
||||
import argo.jdom.JsonStringNode;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.common.functions.ModNameFunction;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionParser;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class ModMetadata
|
||||
{
|
||||
private static final class JsonStringConverter implements Function<JsonNode, Object>
|
||||
{
|
||||
public Object apply(JsonNode arg0)
|
||||
{
|
||||
if (arg0.hasElements())
|
||||
{
|
||||
return Lists.transform(arg0.getElements(), new JsonArrayConverter());
|
||||
}
|
||||
else
|
||||
{
|
||||
return arg0.getText();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final class JsonArrayConverter implements Function<JsonNode, String>
|
||||
{
|
||||
public String apply(JsonNode arg0)
|
||||
{
|
||||
return arg0.getText();
|
||||
}
|
||||
}
|
||||
|
||||
public String modId;
|
||||
public String name;
|
||||
public String description;
|
||||
|
||||
public String url = "";
|
||||
public String updateUrl = "";
|
||||
|
||||
public String logoFile = "";
|
||||
public String version = "";
|
||||
public List<String> authorList = Lists.newArrayList();
|
||||
public String credits = "";
|
||||
public String parent = "";
|
||||
public String[] screenshots;
|
||||
|
||||
public ModContainer parentMod;
|
||||
public List<ModContainer> childMods = Lists.newArrayList();
|
||||
|
||||
public boolean useDependencyInformation;
|
||||
public Set<ArtifactVersion> requiredMods;
|
||||
public List<ArtifactVersion> dependencies;
|
||||
public List<ArtifactVersion> dependants;
|
||||
public boolean autogenerated;
|
||||
|
||||
public ModMetadata(JsonNode node)
|
||||
{
|
||||
Map<JsonStringNode, Object> processedFields = Maps.transformValues(node.getFields(), new JsonStringConverter());
|
||||
modId = (String)processedFields.get(aStringBuilder("modid"));
|
||||
if (Strings.isNullOrEmpty(modId))
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, "Found an invalid mod metadata file - missing modid");
|
||||
throw new LoaderException();
|
||||
}
|
||||
name = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("name")));
|
||||
description = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("description")));
|
||||
url = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("url")));
|
||||
updateUrl = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("updateUrl")));
|
||||
logoFile = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("logoFile")));
|
||||
version = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("version")));
|
||||
credits = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("credits")));
|
||||
parent = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("parent")));
|
||||
authorList = Objects.firstNonNull(((List<String>)processedFields.get(aStringBuilder("authors"))),Objects.firstNonNull(((List<String>)processedFields.get(aStringBuilder("authorList"))), authorList));
|
||||
requiredMods = processReferences(processedFields.get(aStringBuilder("requiredMods")), HashSet.class);
|
||||
dependencies = processReferences(processedFields.get(aStringBuilder("dependencies")), ArrayList.class);
|
||||
dependants = processReferences(processedFields.get(aStringBuilder("dependants")), ArrayList.class);
|
||||
useDependencyInformation = Boolean.parseBoolean(Strings.nullToEmpty((String)processedFields.get(aStringBuilder("useDependencyInformation"))));
|
||||
}
|
||||
|
||||
public ModMetadata()
|
||||
{
|
||||
}
|
||||
|
||||
private <T extends Collection<ArtifactVersion>> T processReferences(Object refs, Class<? extends T> retType)
|
||||
{
|
||||
T res = null;
|
||||
try
|
||||
{
|
||||
res = retType.newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// unpossible
|
||||
}
|
||||
|
||||
if (refs == null)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
for (String ref : ((List<String>)refs))
|
||||
{
|
||||
res.add(VersionParser.parseVersionReference(ref));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getChildModCountString()
|
||||
{
|
||||
return String.format("%d child mod%s", childMods.size(), childMods.size() != 1 ? "s" : "");
|
||||
}
|
||||
|
||||
public String getAuthorList()
|
||||
{
|
||||
return Joiner.on(", ").join(authorList);
|
||||
}
|
||||
|
||||
public String getChildModList()
|
||||
{
|
||||
return Joiner.on(", ").join(Lists.transform(childMods, new ModNameFunction()));
|
||||
}
|
||||
|
||||
public String printableSortingRules()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.asm;
|
||||
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import cpw.mods.fml.common.registry.BlockProxy;
|
||||
|
||||
public class ASMTransformer implements IClassTransformer
|
||||
{
|
||||
@Override
|
||||
public byte[] transform(String name,String transformedName, byte[] bytes)
|
||||
{
|
||||
if ("net.minecraft.src.Block".equals(name))
|
||||
{
|
||||
ClassReader cr = new ClassReader(bytes);
|
||||
ClassNode cn = new ClassNode(Opcodes.ASM4);
|
||||
cr.accept(cn, ClassReader.EXPAND_FRAMES);
|
||||
cn.interfaces.add(Type.getInternalName(BlockProxy.class));
|
||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
cn.accept(cw);
|
||||
return cw.toByteArray();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,659 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.asm.transformers;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.AnnotationNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class MCPMerger
|
||||
{
|
||||
private static Hashtable<String, ClassInfo> clients = new Hashtable<String, ClassInfo>();
|
||||
private static Hashtable<String, ClassInfo> shared = new Hashtable<String, ClassInfo>();
|
||||
private static Hashtable<String, ClassInfo> servers = new Hashtable<String, ClassInfo>();
|
||||
private static HashSet<String> copyToServer = new HashSet<String>();
|
||||
private static HashSet<String> copyToClient = new HashSet<String>();
|
||||
private static HashSet<String> dontAnnotate = new HashSet<String>();
|
||||
private static HashSet<String> dontProcess = new HashSet<String>();
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
if (args.length != 3)
|
||||
{
|
||||
System.out.println("Usage: MCPMerger <MapFile> <minecraft.jar> <minecraft_server.jar>");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
File map_file = new File(args[0]);
|
||||
File client_jar = new File(args[1]);
|
||||
File server_jar = new File(args[2]);
|
||||
File client_jar_tmp = new File(args[1] + ".backup_merge");
|
||||
File server_jar_tmp = new File(args[2] + ".backup_merge");
|
||||
|
||||
if (client_jar_tmp.exists() && !client_jar_tmp.delete())
|
||||
{
|
||||
System.out.println("Could not delete temp file: " + client_jar_tmp);
|
||||
}
|
||||
|
||||
if (server_jar_tmp.exists() && !server_jar_tmp.delete())
|
||||
{
|
||||
System.out.println("Could not delete temp file: " + server_jar_tmp);
|
||||
}
|
||||
|
||||
if (!client_jar.exists())
|
||||
{
|
||||
System.out.println("Could not find minecraft.jar: " + client_jar);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
if (!server_jar.exists())
|
||||
{
|
||||
System.out.println("Could not find minecraft_server.jar: " + server_jar);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
if (!client_jar.renameTo(client_jar_tmp))
|
||||
{
|
||||
System.out.println("Could not rename file: " + client_jar + " -> " + client_jar_tmp);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
if (!server_jar.renameTo(server_jar_tmp))
|
||||
{
|
||||
System.out.println("Could not rename file: " + server_jar + " -> " + server_jar_tmp);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
if (!readMapFile(map_file))
|
||||
{
|
||||
System.out.println("Could not read map file: " + map_file);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
processJar(client_jar_tmp, server_jar_tmp, client_jar, server_jar);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
if (!client_jar_tmp.delete())
|
||||
{
|
||||
System.out.println("Could not delete temp file: " + client_jar_tmp);
|
||||
}
|
||||
|
||||
if (!server_jar_tmp.delete())
|
||||
{
|
||||
System.out.println("Could not delete temp file: " + server_jar_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean readMapFile(File mapFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileInputStream fstream = new FileInputStream(mapFile);
|
||||
DataInputStream in = new DataInputStream(fstream);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
|
||||
String line;
|
||||
while ((line = br.readLine()) != null)
|
||||
{
|
||||
line = line.split("#")[0];
|
||||
char cmd = line.charAt(0);
|
||||
line = line.substring(1).trim();
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case '!': dontAnnotate.add(line); break;
|
||||
case '<': copyToClient.add(line); break;
|
||||
case '>': copyToServer.add(line); break;
|
||||
case '^': dontProcess.add(line); break;
|
||||
}
|
||||
}
|
||||
|
||||
in.close();
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Error: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void processJar(File clientInFile, File serverInFile, File clientOutFile, File serverOutFile) throws IOException
|
||||
{
|
||||
ZipFile cInJar = null;
|
||||
ZipFile sInJar = null;
|
||||
ZipOutputStream cOutJar = null;
|
||||
ZipOutputStream sOutJar = null;
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
cInJar = new ZipFile(clientInFile);
|
||||
sInJar = new ZipFile(serverInFile);
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
throw new FileNotFoundException("Could not open input file: " + e.getMessage());
|
||||
}
|
||||
try
|
||||
{
|
||||
cOutJar = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(clientOutFile)));
|
||||
sOutJar = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(serverOutFile)));
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
throw new FileNotFoundException("Could not open output file: " + e.getMessage());
|
||||
}
|
||||
Hashtable<String, ZipEntry> cClasses = getClassEntries(cInJar, cOutJar);
|
||||
Hashtable<String, ZipEntry> sClasses = getClassEntries(sInJar, sOutJar);
|
||||
HashSet<String> cAdded = new HashSet<String>();
|
||||
HashSet<String> sAdded = new HashSet<String>();
|
||||
|
||||
for (Entry<String, ZipEntry> entry : cClasses.entrySet())
|
||||
{
|
||||
String name = entry.getKey();
|
||||
ZipEntry cEntry = entry.getValue();
|
||||
ZipEntry sEntry = sClasses.get(name);
|
||||
|
||||
if (sEntry == null)
|
||||
{
|
||||
if (!copyToServer.contains(name))
|
||||
{
|
||||
copyClass(cInJar, cEntry, cOutJar, null, true);
|
||||
cAdded.add(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Copy class c->s : " + name);
|
||||
}
|
||||
copyClass(cInJar, cEntry, cOutJar, sOutJar, true);
|
||||
cAdded.add(name);
|
||||
sAdded.add(name);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
sClasses.remove(name);
|
||||
ClassInfo info = new ClassInfo(name);
|
||||
shared.put(name, info);
|
||||
|
||||
byte[] cData = readEntry(cInJar, entry.getValue());
|
||||
byte[] sData = readEntry(sInJar, sEntry);
|
||||
byte[] data = processClass(cData, sData, info);
|
||||
|
||||
ZipEntry newEntry = new ZipEntry(cEntry.getName());
|
||||
cOutJar.putNextEntry(newEntry);
|
||||
cOutJar.write(data);
|
||||
sOutJar.putNextEntry(newEntry);
|
||||
sOutJar.write(data);
|
||||
cAdded.add(name);
|
||||
sAdded.add(name);
|
||||
}
|
||||
|
||||
for (Entry<String, ZipEntry> entry : sClasses.entrySet())
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Copy class s->c : " + entry.getKey());
|
||||
}
|
||||
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
|
||||
}
|
||||
|
||||
for (String name : new String[]{SideOnly.class.getName(), Side.class.getName()})
|
||||
{
|
||||
String eName = name.replace(".", "/");
|
||||
byte[] data = getClassBytes(name);
|
||||
ZipEntry newEntry = new ZipEntry(name.replace(".", "/").concat(".class"));
|
||||
if (!cAdded.contains(eName))
|
||||
{
|
||||
cOutJar.putNextEntry(newEntry);
|
||||
cOutJar.write(data);
|
||||
}
|
||||
if (!sAdded.contains(eName))
|
||||
{
|
||||
sOutJar.putNextEntry(newEntry);
|
||||
sOutJar.write(data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (cInJar != null)
|
||||
{
|
||||
try { cInJar.close(); } catch (IOException e){}
|
||||
}
|
||||
|
||||
if (sInJar != null)
|
||||
{
|
||||
try { sInJar.close(); } catch (IOException e) {}
|
||||
}
|
||||
if (cOutJar != null)
|
||||
{
|
||||
try { cOutJar.close(); } catch (IOException e){}
|
||||
}
|
||||
|
||||
if (sOutJar != null)
|
||||
{
|
||||
try { sOutJar.close(); } catch (IOException e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyClass(ZipFile inJar, ZipEntry entry, ZipOutputStream outJar, ZipOutputStream outJar2, boolean isClientOnly) throws IOException
|
||||
{
|
||||
ClassReader reader = new ClassReader(readEntry(inJar, entry));
|
||||
ClassNode classNode = new ClassNode();
|
||||
|
||||
reader.accept(classNode, 0);
|
||||
|
||||
if (!dontAnnotate.contains(classNode.name))
|
||||
{
|
||||
if (classNode.visibleAnnotations == null) classNode.visibleAnnotations = new ArrayList<AnnotationNode>();
|
||||
classNode.visibleAnnotations.add(getSideAnn(isClientOnly));
|
||||
}
|
||||
|
||||
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
classNode.accept(writer);
|
||||
byte[] data = writer.toByteArray();
|
||||
|
||||
ZipEntry newEntry = new ZipEntry(entry.getName());
|
||||
if (outJar != null)
|
||||
{
|
||||
outJar.putNextEntry(newEntry);
|
||||
outJar.write(data);
|
||||
}
|
||||
if (outJar2 != null)
|
||||
{
|
||||
outJar2.putNextEntry(newEntry);
|
||||
outJar2.write(data);
|
||||
}
|
||||
}
|
||||
|
||||
private static AnnotationNode getSideAnn(boolean isClientOnly)
|
||||
{
|
||||
AnnotationNode ann = new AnnotationNode(Type.getDescriptor(SideOnly.class));
|
||||
ann.values = new ArrayList<Object>();
|
||||
ann.values.add("value");
|
||||
ann.values.add(new String[]{ Type.getDescriptor(Side.class), (isClientOnly ? "CLIENT" : "SERVER")});
|
||||
return ann;
|
||||
}
|
||||
|
||||
private static Hashtable<String, ZipEntry> getClassEntries(ZipFile inFile, ZipOutputStream outFile) throws IOException
|
||||
{
|
||||
Hashtable<String, ZipEntry> ret = new Hashtable<String, ZipEntry>();
|
||||
for (ZipEntry entry : Collections.list(inFile.entries()))
|
||||
{
|
||||
if (entry.isDirectory())
|
||||
{
|
||||
outFile.putNextEntry(entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
String entryName = entry.getName();
|
||||
|
||||
boolean filtered = false;
|
||||
for (String filter : dontProcess)
|
||||
{
|
||||
if (entryName.startsWith(filter))
|
||||
{
|
||||
filtered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (filtered || !entryName.endsWith(".class") || entryName.startsWith("."))
|
||||
{
|
||||
ZipEntry newEntry = new ZipEntry(entry.getName());
|
||||
outFile.putNextEntry(newEntry);
|
||||
outFile.write(readEntry(inFile, entry));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.put(entryName.replace(".class", ""), entry);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
private static byte[] readEntry(ZipFile inFile, ZipEntry entry) throws IOException
|
||||
{
|
||||
return readFully(inFile.getInputStream(entry));
|
||||
}
|
||||
private static byte[] readFully(InputStream stream) throws IOException
|
||||
{
|
||||
byte[] data = new byte[4096];
|
||||
ByteArrayOutputStream entryBuffer = new ByteArrayOutputStream();
|
||||
int len;
|
||||
do
|
||||
{
|
||||
len = stream.read(data);
|
||||
if (len > 0)
|
||||
{
|
||||
entryBuffer.write(data, 0, len);
|
||||
}
|
||||
} while (len != -1);
|
||||
|
||||
return entryBuffer.toByteArray();
|
||||
}
|
||||
private static class ClassInfo
|
||||
{
|
||||
public String name;
|
||||
public ArrayList<FieldNode> cField = new ArrayList<FieldNode>();
|
||||
public ArrayList<FieldNode> sField = new ArrayList<FieldNode>();
|
||||
public ArrayList<MethodNode> cMethods = new ArrayList<MethodNode>();
|
||||
public ArrayList<MethodNode> sMethods = new ArrayList<MethodNode>();
|
||||
public ClassInfo(String name){ this.name = name; }
|
||||
public boolean isSame() { return (cField.size() == 0 && sField.size() == 0 && cMethods.size() == 0 && sMethods.size() == 0); }
|
||||
}
|
||||
|
||||
public static byte[] processClass(byte[] cIn, byte[] sIn, ClassInfo info)
|
||||
{
|
||||
ClassNode cClassNode = getClassNode(cIn);
|
||||
ClassNode sClassNode = getClassNode(sIn);
|
||||
|
||||
processFields(cClassNode, sClassNode, info);
|
||||
processMethods(cClassNode, sClassNode, info);
|
||||
|
||||
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
cClassNode.accept(writer);
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
private static ClassNode getClassNode(byte[] data)
|
||||
{
|
||||
ClassReader reader = new ClassReader(data);
|
||||
ClassNode classNode = new ClassNode();
|
||||
reader.accept(classNode, 0);
|
||||
return classNode;
|
||||
}
|
||||
|
||||
private static void processFields(ClassNode cClass, ClassNode sClass, ClassInfo info)
|
||||
{
|
||||
List<FieldNode> cFields = cClass.fields;
|
||||
List<FieldNode> sFields = sClass.fields;
|
||||
|
||||
int sI = 0;
|
||||
for (int x = 0; x < cFields.size(); x++)
|
||||
{
|
||||
FieldNode cF = cFields.get(x);
|
||||
if (sI < sFields.size())
|
||||
{
|
||||
if (!cF.name.equals(sFields.get(sI).name))
|
||||
{
|
||||
boolean serverHas = false;
|
||||
for (int y = sI + 1; y < sFields.size(); y++)
|
||||
{
|
||||
if (cF.name.equals(sFields.get(y).name))
|
||||
{
|
||||
serverHas = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (serverHas)
|
||||
{
|
||||
boolean clientHas = false;
|
||||
FieldNode sF = sFields.get(sI);
|
||||
for (int y = x + 1; y < cFields.size(); y++)
|
||||
{
|
||||
if (sF.name.equals(cFields.get(y).name))
|
||||
{
|
||||
clientHas = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!clientHas)
|
||||
{
|
||||
if (sF.visibleAnnotations == null) sF.visibleAnnotations = new ArrayList<AnnotationNode>();
|
||||
sF.visibleAnnotations.add(getSideAnn(false));
|
||||
cFields.add(x++, sF);
|
||||
info.sField.add(sF);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cF.visibleAnnotations == null) cF.visibleAnnotations = new ArrayList<AnnotationNode>();
|
||||
cF.visibleAnnotations.add(getSideAnn(true));
|
||||
sFields.add(sI, cF);
|
||||
info.cField.add(cF);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cF.visibleAnnotations == null) cF.visibleAnnotations = new ArrayList<AnnotationNode>();
|
||||
cF.visibleAnnotations.add(getSideAnn(true));
|
||||
sFields.add(sI, cF);
|
||||
info.cField.add(cF);
|
||||
}
|
||||
sI++;
|
||||
}
|
||||
if (sFields.size() != cFields.size())
|
||||
{
|
||||
for (int x = cFields.size(); x < sFields.size(); x++)
|
||||
{
|
||||
FieldNode sF = sFields.get(x);
|
||||
if (sF.visibleAnnotations == null) sF.visibleAnnotations = new ArrayList<AnnotationNode>();
|
||||
sF.visibleAnnotations.add(getSideAnn(true));
|
||||
cFields.add(x++, sF);
|
||||
info.sField.add(sF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class MethodWrapper
|
||||
{
|
||||
private MethodNode node;
|
||||
public boolean client;
|
||||
public boolean server;
|
||||
public MethodWrapper(MethodNode node)
|
||||
{
|
||||
this.node = node;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj == null || !(obj instanceof MethodWrapper)) return false;
|
||||
MethodWrapper mw = (MethodWrapper) obj;
|
||||
boolean eq = Objects.equal(node.name, mw.node.name) && Objects.equal(node.desc, mw.node.desc);
|
||||
if (eq)
|
||||
{
|
||||
mw.client = this.client | mw.client;
|
||||
mw.server = this.server | mw.server;
|
||||
this.client = this.client | mw.client;
|
||||
this.server = this.server | mw.server;
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.printf(" eq: %s %s\n", this, mw);
|
||||
}
|
||||
}
|
||||
return eq;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hashCode(node.name, node.desc);
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return Objects.toStringHelper(this).add("name", node.name).add("desc",node.desc).add("server",server).add("client",client).toString();
|
||||
}
|
||||
}
|
||||
private static void processMethods(ClassNode cClass, ClassNode sClass, ClassInfo info)
|
||||
{
|
||||
List<MethodNode> cMethods = (List<MethodNode>)cClass.methods;
|
||||
List<MethodNode> sMethods = (List<MethodNode>)sClass.methods;
|
||||
LinkedHashSet<MethodWrapper> allMethods = Sets.newLinkedHashSet();
|
||||
|
||||
int cPos = 0;
|
||||
int sPos = 0;
|
||||
int cLen = cMethods.size();
|
||||
int sLen = sMethods.size();
|
||||
String clientName = "";
|
||||
String lastName = clientName;
|
||||
String serverName = "";
|
||||
while (cPos < cLen || sPos < sLen)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (sPos>=sLen)
|
||||
{
|
||||
break;
|
||||
}
|
||||
MethodNode sM = sMethods.get(sPos);
|
||||
serverName = sM.name;
|
||||
if (!serverName.equals(lastName) && cPos != cLen)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.printf("Server -skip : %s %s %d (%s %d) %d [%s]\n", sClass.name, clientName, cLen - cPos, serverName, sLen - sPos, allMethods.size(), lastName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
MethodWrapper mw = new MethodWrapper(sM);
|
||||
mw.server = true;
|
||||
allMethods.add(mw);
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.printf("Server *add* : %s %s %d (%s %d) %d [%s]\n", sClass.name, clientName, cLen - cPos, serverName, sLen - sPos, allMethods.size(), lastName);
|
||||
}
|
||||
sPos++;
|
||||
}
|
||||
while (sPos < sLen);
|
||||
do
|
||||
{
|
||||
if (cPos>=cLen)
|
||||
{
|
||||
break;
|
||||
}
|
||||
MethodNode cM = cMethods.get(cPos);
|
||||
lastName = clientName;
|
||||
clientName = cM.name;
|
||||
if (!clientName.equals(lastName) && sPos != sLen)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.printf("Client -skip : %s %s %d (%s %d) %d [%s]\n", cClass.name, clientName, cLen - cPos, serverName, sLen - sPos, allMethods.size(), lastName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
MethodWrapper mw = new MethodWrapper(cM);
|
||||
mw.client = true;
|
||||
allMethods.add(mw);
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.printf("Client *add* : %s %s %d (%s %d) %d [%s]\n", cClass.name, clientName, cLen - cPos, serverName, sLen - sPos, allMethods.size(), lastName);
|
||||
}
|
||||
cPos++;
|
||||
}
|
||||
while (cPos < cLen);
|
||||
}
|
||||
|
||||
cMethods.clear();
|
||||
sMethods.clear();
|
||||
|
||||
for (MethodWrapper mw : allMethods)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println(mw);
|
||||
}
|
||||
cMethods.add(mw.node);
|
||||
sMethods.add(mw.node);
|
||||
if (mw.server && mw.client)
|
||||
{
|
||||
// no op
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mw.node.visibleAnnotations == null) mw.node.visibleAnnotations = Lists.newArrayListWithExpectedSize(1);
|
||||
mw.node.visibleAnnotations.add(getSideAnn(mw.client));
|
||||
if (mw.client)
|
||||
{
|
||||
info.sMethods.add(mw.node);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.cMethods.add(mw.node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] getClassBytes(String name) throws IOException
|
||||
{
|
||||
InputStream classStream = null;
|
||||
try
|
||||
{
|
||||
classStream = MCPMerger.class.getResourceAsStream("/" + name.replace('.', '/').concat(".class"));
|
||||
return readFully(classStream);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (classStream != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
classStream.close();
|
||||
}
|
||||
catch (IOException e){}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.discovery.asm;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class ModMethodVisitor extends MethodVisitor
|
||||
{
|
||||
|
||||
private ASMModParser discoverer;
|
||||
private boolean inCode;
|
||||
private LinkedList<Label> labels = Lists.newLinkedList();
|
||||
private String foundProperties;
|
||||
private boolean validProperties;
|
||||
|
||||
public ModMethodVisitor(String name, ASMModParser discoverer)
|
||||
{
|
||||
super(Opcodes.ASM4);
|
||||
this.discoverer = discoverer;
|
||||
}
|
||||
@Override
|
||||
public void visitCode()
|
||||
{
|
||||
labels.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLdcInsn(Object cst)
|
||||
{
|
||||
if (cst instanceof String && labels.size() == 1)
|
||||
{
|
||||
foundProperties = (String) cst;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void visitInsn(int opcode)
|
||||
{
|
||||
if (Opcodes.ARETURN == opcode && labels.size() == 1 && foundProperties != null)
|
||||
{
|
||||
validProperties = true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void visitLabel(Label label)
|
||||
{
|
||||
labels.push(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnd()
|
||||
{
|
||||
if (validProperties)
|
||||
{
|
||||
discoverer.setBaseModProperties(foundProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetServerHandler;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
*
|
||||
* Marker interface for BaseMod
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public interface BaseModProxy
|
||||
{
|
||||
void modsLoaded();
|
||||
|
||||
void load();
|
||||
|
||||
String getName();
|
||||
|
||||
String getPriorities();
|
||||
|
||||
String getVersion();
|
||||
|
||||
boolean doTickInGUI(TickType type, boolean end, Object... tickData);
|
||||
boolean doTickInGame(TickType type, boolean end, Object... tickData);
|
||||
void generateSurface(World w, Random random, int i, int j);
|
||||
void generateNether(World w, Random random, int i, int j);
|
||||
int addFuel(int itemId, int damage);
|
||||
void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix);
|
||||
void takenFromFurnace(EntityPlayer player, ItemStack item);
|
||||
|
||||
public abstract void onClientLogout(INetworkManager manager);
|
||||
|
||||
public abstract void onClientLogin(EntityPlayer player);
|
||||
|
||||
public abstract void serverDisconnect();
|
||||
|
||||
public abstract void serverConnect(NetHandler handler);
|
||||
|
||||
public abstract void receiveCustomPacket(Packet250CustomPayload packet);
|
||||
|
||||
public abstract void clientChat(String text);
|
||||
|
||||
public abstract void onItemPickup(EntityPlayer player, ItemStack item);
|
||||
|
||||
public abstract void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet);
|
||||
|
||||
public abstract void serverChat(NetServerHandler source, String message);
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class BaseModTicker implements ITickHandler
|
||||
{
|
||||
|
||||
private BaseModProxy mod;
|
||||
private EnumSet<TickType> ticks;
|
||||
private boolean clockTickTrigger;
|
||||
private boolean sendGuiTicks;
|
||||
|
||||
|
||||
BaseModTicker(BaseModProxy mod, boolean guiTicker)
|
||||
{
|
||||
this.mod = mod;
|
||||
this.ticks = EnumSet.of(TickType.WORLDLOAD);
|
||||
this.sendGuiTicks = guiTicker;
|
||||
}
|
||||
|
||||
BaseModTicker(EnumSet<TickType> ticks, boolean guiTicker)
|
||||
{
|
||||
this.ticks = ticks;
|
||||
this.sendGuiTicks = guiTicker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickStart(EnumSet<TickType> types, Object... tickData)
|
||||
{
|
||||
tickBaseMod(types, false, tickData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(EnumSet<TickType> types, Object... tickData)
|
||||
{
|
||||
tickBaseMod(types, true, tickData);
|
||||
}
|
||||
|
||||
private void tickBaseMod(EnumSet<TickType> types, boolean end, Object... tickData)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getSide().isClient() && ( ticks.contains(TickType.CLIENT) || ticks.contains(TickType.WORLDLOAD)))
|
||||
{
|
||||
EnumSet cTypes=EnumSet.copyOf(types);
|
||||
if ( ( end && types.contains(TickType.CLIENT)) || types.contains(TickType.WORLDLOAD))
|
||||
{
|
||||
clockTickTrigger = true;
|
||||
cTypes.remove(TickType.CLIENT);
|
||||
cTypes.remove(TickType.WORLDLOAD);
|
||||
}
|
||||
|
||||
if (end && clockTickTrigger && types.contains(TickType.RENDER))
|
||||
{
|
||||
clockTickTrigger = false;
|
||||
cTypes.remove(TickType.RENDER);
|
||||
cTypes.add(TickType.CLIENT);
|
||||
}
|
||||
|
||||
sendTick(cTypes, end, tickData);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendTick(types, end, tickData);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTick(EnumSet<TickType> types, boolean end, Object... tickData)
|
||||
{
|
||||
for (TickType type : types)
|
||||
{
|
||||
if (!ticks.contains(type))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean keepTicking=true;
|
||||
if (sendGuiTicks)
|
||||
{
|
||||
keepTicking = mod.doTickInGUI(type, end, tickData);
|
||||
}
|
||||
else
|
||||
{
|
||||
keepTicking = mod.doTickInGame(type, end, tickData);
|
||||
}
|
||||
if (!keepTicking) {
|
||||
ticks.remove(type);
|
||||
ticks.removeAll(type.partnerTicks());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks()
|
||||
{
|
||||
return (clockTickTrigger ? EnumSet.of(TickType.RENDER) : ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel()
|
||||
{
|
||||
return mod.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
public void setMod(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
|
||||
public interface IModLoaderSidedHelper
|
||||
{
|
||||
|
||||
void finishModLoading(ModLoaderModContainer mc);
|
||||
|
||||
Object getClientGui(BaseModProxy mod, EntityPlayer player, int iD, int x, int y, int z);
|
||||
|
||||
Entity spawnEntity(BaseModProxy mod, EntitySpawnPacket input, EntityRegistration registration);
|
||||
|
||||
void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet);
|
||||
|
||||
void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod);
|
||||
|
||||
boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod);
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import net.minecraft.network.NetServerHandler;
|
||||
import net.minecraft.network.packet.*;
|
||||
import cpw.mods.fml.common.network.IChatListener;
|
||||
|
||||
public class ModLoaderChatListener implements IChatListener
|
||||
{
|
||||
|
||||
private BaseModProxy mod;
|
||||
|
||||
public ModLoaderChatListener(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet3Chat serverChat(NetHandler handler, Packet3Chat message)
|
||||
{
|
||||
mod.serverChat((NetServerHandler)handler, message.field_73476_b);
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet3Chat clientChat(NetHandler handler, Packet3Chat message)
|
||||
{
|
||||
mod.clientChat(message.field_73476_b);
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetLoginHandler;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet1Login;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class ModLoaderConnectionHandler implements IConnectionHandler
|
||||
{
|
||||
private BaseModProxy mod;
|
||||
|
||||
public ModLoaderConnectionHandler(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
mod.onClientLogin((EntityPlayer)player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
||||
{
|
||||
ModLoaderHelper.sidedHelper.clientConnectionOpened(netClientHandler, manager, mod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionClosed(INetworkManager manager)
|
||||
{
|
||||
if (ModLoaderHelper.sidedHelper==null || !ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod))
|
||||
{
|
||||
mod.serverDisconnect();
|
||||
mod.onClientLogout(manager);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientLoggedIn(NetHandler nh, INetworkManager manager, Packet1Login login)
|
||||
{
|
||||
mod.serverConnect(nh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
||||
{
|
||||
ModLoaderHelper.sidedHelper.clientConnectionOpened(netClientHandler, manager, mod);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.ICraftingHandler;
|
||||
|
||||
public class ModLoaderCraftingHelper implements ICraftingHandler
|
||||
{
|
||||
|
||||
private BaseModProxy mod;
|
||||
|
||||
public ModLoaderCraftingHelper(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
|
||||
{
|
||||
mod.takenFromCrafting(player, item, craftMatrix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSmelting(EntityPlayer player, ItemStack item)
|
||||
{
|
||||
mod.takenFromFurnace(player, item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
|
||||
public class ModLoaderEntitySpawnCallback implements Function<EntitySpawnPacket, Entity>
|
||||
{
|
||||
|
||||
private BaseModProxy mod;
|
||||
private EntityRegistration registration;
|
||||
private boolean isAnimal;
|
||||
|
||||
public ModLoaderEntitySpawnCallback(BaseModProxy mod, EntityRegistration er)
|
||||
{
|
||||
this.mod = mod;
|
||||
this.registration = er;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity apply(EntitySpawnPacket input)
|
||||
{
|
||||
return ModLoaderHelper.sidedHelper.spawnEntity(mod, input, registration);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
|
||||
public class ModLoaderFuelHelper implements IFuelHandler
|
||||
{
|
||||
|
||||
private BaseModProxy mod;
|
||||
|
||||
public ModLoaderFuelHelper(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel)
|
||||
{
|
||||
return mod.addFuel(fuel.field_77993_c, fuel.func_77960_j());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class ModLoaderGuiHelper implements IGuiHandler
|
||||
{
|
||||
|
||||
private BaseModProxy mod;
|
||||
private Set<Integer> ids;
|
||||
private Container container;
|
||||
private int currentID;
|
||||
|
||||
ModLoaderGuiHelper(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
this.ids = Sets.newHashSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
return container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
return ModLoaderHelper.getClientSideGui(mod, player, ID, x, y, z);
|
||||
}
|
||||
|
||||
public void injectContainerAndID(Container container, int ID)
|
||||
{
|
||||
this.container = container;
|
||||
this.currentID = ID;
|
||||
}
|
||||
|
||||
public Object getMod()
|
||||
{
|
||||
return mod;
|
||||
}
|
||||
|
||||
public void associateId(int additionalID)
|
||||
{
|
||||
this.ids.add(additionalID);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.src.BaseMod;
|
||||
import net.minecraft.src.TradeEntry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.ICraftingHandler;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.IPickupNotifier;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.network.IChatListener;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ModLoaderHelper
|
||||
{
|
||||
public static IModLoaderSidedHelper sidedHelper;
|
||||
|
||||
private static Map<BaseModProxy, ModLoaderGuiHelper> guiHelpers = Maps.newHashMap();
|
||||
private static Map<Integer, ModLoaderGuiHelper> guiIDs = Maps.newHashMap();
|
||||
|
||||
public static void updateStandardTicks(BaseModProxy mod, boolean enable, boolean useClock)
|
||||
{
|
||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().getReversedModObjectList().get(mod);
|
||||
if (mlmc==null)
|
||||
{
|
||||
mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
||||
}
|
||||
if (mlmc == null)
|
||||
{
|
||||
FMLLog.severe("Attempted to register ModLoader ticking for invalid BaseMod %s",mod);
|
||||
return;
|
||||
}
|
||||
BaseModTicker ticker = mlmc.getGameTickHandler();
|
||||
EnumSet<TickType> ticks = ticker.ticks();
|
||||
// If we're enabled we get render ticks
|
||||
if (enable && !useClock) {
|
||||
ticks.add(TickType.RENDER);
|
||||
} else {
|
||||
ticks.remove(TickType.RENDER);
|
||||
}
|
||||
// If we're enabled but we want clock ticks, or we're server side we get game ticks
|
||||
if (enable && (useClock || FMLCommonHandler.instance().getSide().isServer())) {
|
||||
ticks.add(TickType.CLIENT);
|
||||
ticks.add(TickType.WORLDLOAD);
|
||||
} else {
|
||||
ticks.remove(TickType.CLIENT);
|
||||
ticks.remove(TickType.WORLDLOAD);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateGUITicks(BaseModProxy mod, boolean enable, boolean useClock)
|
||||
{
|
||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().getReversedModObjectList().get(mod);
|
||||
if (mlmc==null)
|
||||
{
|
||||
mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
||||
}
|
||||
if (mlmc == null)
|
||||
{
|
||||
FMLLog.severe("Attempted to register ModLoader ticking for invalid BaseMod %s",mod);
|
||||
return;
|
||||
}
|
||||
EnumSet<TickType> ticks = mlmc.getGUITickHandler().ticks();
|
||||
// If we're enabled and we don't want clock ticks we get render ticks
|
||||
if (enable && !useClock) {
|
||||
ticks.add(TickType.RENDER);
|
||||
} else {
|
||||
ticks.remove(TickType.RENDER);
|
||||
}
|
||||
// If we're enabled but we want clock ticks, or we're server side we get world ticks
|
||||
if (enable && useClock) {
|
||||
ticks.add(TickType.CLIENT);
|
||||
ticks.add(TickType.WORLDLOAD);
|
||||
} else {
|
||||
ticks.remove(TickType.CLIENT);
|
||||
ticks.remove(TickType.WORLDLOAD);
|
||||
}
|
||||
}
|
||||
|
||||
public static IPacketHandler buildPacketHandlerFor(BaseModProxy mod)
|
||||
{
|
||||
return new ModLoaderPacketHandler(mod);
|
||||
}
|
||||
|
||||
public static IWorldGenerator buildWorldGenHelper(BaseModProxy mod)
|
||||
{
|
||||
return new ModLoaderWorldGenerator(mod);
|
||||
}
|
||||
|
||||
public static IFuelHandler buildFuelHelper(BaseModProxy mod)
|
||||
{
|
||||
return new ModLoaderFuelHelper(mod);
|
||||
}
|
||||
|
||||
public static ICraftingHandler buildCraftingHelper(BaseModProxy mod)
|
||||
{
|
||||
return new ModLoaderCraftingHelper(mod);
|
||||
}
|
||||
|
||||
public static void finishModLoading(ModLoaderModContainer mc)
|
||||
{
|
||||
if (sidedHelper != null)
|
||||
{
|
||||
sidedHelper.finishModLoading(mc);
|
||||
}
|
||||
}
|
||||
|
||||
public static IConnectionHandler buildConnectionHelper(BaseModProxy mod)
|
||||
{
|
||||
return new ModLoaderConnectionHandler(mod);
|
||||
}
|
||||
|
||||
public static IPickupNotifier buildPickupHelper(BaseModProxy mod)
|
||||
{
|
||||
return new ModLoaderPickupNotifier(mod);
|
||||
}
|
||||
|
||||
public static void buildGuiHelper(BaseModProxy mod, int id)
|
||||
{
|
||||
ModLoaderGuiHelper handler = guiHelpers.get(mod);
|
||||
if (handler == null)
|
||||
{
|
||||
handler = new ModLoaderGuiHelper(mod);
|
||||
guiHelpers.put(mod,handler);
|
||||
NetworkRegistry.instance().registerGuiHandler(mod, handler);
|
||||
}
|
||||
handler.associateId(id);
|
||||
guiIDs.put(id, handler);
|
||||
}
|
||||
|
||||
public static void openGui(int id, EntityPlayer player, Container container, int x, int y, int z)
|
||||
{
|
||||
ModLoaderGuiHelper helper = guiIDs.get(id);
|
||||
helper.injectContainerAndID(container, id);
|
||||
player.openGui(helper.getMod(), id, player.field_70170_p, x, y, z);
|
||||
}
|
||||
|
||||
public static Object getClientSideGui(BaseModProxy mod, EntityPlayer player, int ID, int x, int y, int z)
|
||||
{
|
||||
if (sidedHelper != null)
|
||||
{
|
||||
return sidedHelper.getClientGui(mod, player, ID, x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void buildEntityTracker(BaseModProxy mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval,
|
||||
boolean sendVelocityInfo)
|
||||
{
|
||||
EntityRegistration er = EntityRegistry.registerModLoaderEntity(mod, entityClass, entityTypeId, updateRange, updateInterval, sendVelocityInfo);
|
||||
er.setCustomSpawning(new ModLoaderEntitySpawnCallback(mod, er), EntityDragon.class.isAssignableFrom(entityClass) || IAnimals.class.isAssignableFrom(entityClass));
|
||||
}
|
||||
|
||||
private static ModLoaderVillageTradeHandler[] tradeHelpers = new ModLoaderVillageTradeHandler[6];
|
||||
|
||||
public static void registerTrade(int profession, TradeEntry entry)
|
||||
{
|
||||
assert profession < tradeHelpers.length : "The profession is out of bounds";
|
||||
if (tradeHelpers[profession] == null)
|
||||
{
|
||||
tradeHelpers[profession] = new ModLoaderVillageTradeHandler();
|
||||
VillagerRegistry.instance().registerVillageTradeHandler(profession, tradeHelpers[profession]);
|
||||
}
|
||||
|
||||
tradeHelpers[profession].addTrade(entry);
|
||||
}
|
||||
|
||||
public static void addCommand(ICommand command)
|
||||
{
|
||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
||||
if (mlmc!=null)
|
||||
{
|
||||
mlmc.addServerCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
public static IChatListener buildChatListener(BaseModProxy mod)
|
||||
{
|
||||
return new ModLoaderChatListener(mod);
|
||||
}
|
||||
}
|
||||
@@ -1,630 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.security.cert.Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.ILanguageAdapter;
|
||||
import cpw.mods.fml.common.LoadController;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.LoaderException;
|
||||
import cpw.mods.fml.common.MetadataCollection;
|
||||
import cpw.mods.fml.common.ModClassLoader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.ProxyInjector;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
||||
import cpw.mods.fml.common.discovery.ContainerType;
|
||||
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class ModLoaderModContainer implements ModContainer
|
||||
{
|
||||
public BaseModProxy mod;
|
||||
private File modSource;
|
||||
public Set<ArtifactVersion> requirements = Sets.newHashSet();
|
||||
public ArrayList<ArtifactVersion> dependencies = Lists.newArrayList();
|
||||
public ArrayList<ArtifactVersion> dependants = Lists.newArrayList();
|
||||
private ContainerType sourceType;
|
||||
private ModMetadata metadata;
|
||||
private ProxyInjector sidedProxy;
|
||||
private BaseModTicker gameTickHandler;
|
||||
private BaseModTicker guiTickHandler;
|
||||
private String modClazzName;
|
||||
private String modId;
|
||||
private EventBus bus;
|
||||
private LoadController controller;
|
||||
private boolean enabled = true;
|
||||
private String sortingProperties;
|
||||
private ArtifactVersion processedVersion;
|
||||
private boolean isNetworkMod;
|
||||
private List<ICommand> serverCommands = Lists.newArrayList();
|
||||
|
||||
public ModLoaderModContainer(String className, File modSource, String sortingProperties)
|
||||
{
|
||||
this.modClazzName = className;
|
||||
this.modSource = modSource;
|
||||
this.modId = className.contains(".") ? className.substring(className.lastIndexOf('.')+1) : className;
|
||||
this.sortingProperties = Strings.isNullOrEmpty(sortingProperties) ? "" : sortingProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* We only instantiate this for "not mod mods"
|
||||
* @param instance
|
||||
*/
|
||||
ModLoaderModContainer(BaseModProxy instance) {
|
||||
this.mod=instance;
|
||||
this.gameTickHandler = new BaseModTicker(instance, false);
|
||||
this.guiTickHandler = new BaseModTicker(instance, true);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void configureMod(Class<? extends BaseModProxy> modClazz, ASMDataTable asmData)
|
||||
{
|
||||
File configDir = Loader.instance().getConfigDir();
|
||||
File modConfig = new File(configDir, String.format("%s.cfg", getModId()));
|
||||
Properties props = new Properties();
|
||||
|
||||
boolean existingConfigFound = false;
|
||||
boolean mlPropFound = false;
|
||||
|
||||
if (modConfig.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
FMLLog.fine("Reading existing configuration file for %s : %s", getModId(), modConfig.getName());
|
||||
FileReader configReader = new FileReader(modConfig);
|
||||
props.load(configReader);
|
||||
configReader.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Error occured reading mod configuration file %s", modConfig.getName());
|
||||
throw new LoaderException(e);
|
||||
}
|
||||
existingConfigFound = true;
|
||||
}
|
||||
|
||||
StringBuffer comments = new StringBuffer();
|
||||
comments.append("MLProperties: name (type:default) min:max -- information\n");
|
||||
|
||||
|
||||
List<ModProperty> mlPropFields = Lists.newArrayList();
|
||||
try
|
||||
{
|
||||
for (ASMData dat : Sets.union(asmData.getAnnotationsFor(this).get("net.minecraft.src.MLProp"), asmData.getAnnotationsFor(this).get("MLProp")))
|
||||
{
|
||||
if (dat.getClassName().equals(modClazzName))
|
||||
{
|
||||
try
|
||||
{
|
||||
mlPropFields.add(new ModProperty(modClazz.getDeclaredField(dat.getObjectName()), dat.getAnnotationInfo()));
|
||||
FMLLog.finest("Found an MLProp field %s in %s", dat.getObjectName(), getModId());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.WARNING, e, "An error occured trying to access field %s in mod %s", dat.getObjectName(), getModId());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ModProperty property : mlPropFields)
|
||||
{
|
||||
if (!Modifier.isStatic(property.field().getModifiers()))
|
||||
{
|
||||
FMLLog.info("The MLProp field %s in mod %s appears not to be static", property.field().getName(), getModId());
|
||||
continue;
|
||||
}
|
||||
FMLLog.finest("Considering MLProp field %s", property.field().getName());
|
||||
Field f = property.field();
|
||||
String propertyName = !Strings.nullToEmpty(property.name()).isEmpty() ? property.name() : f.getName();
|
||||
String propertyValue = null;
|
||||
Object defaultValue = null;
|
||||
|
||||
try
|
||||
{
|
||||
defaultValue = f.get(null);
|
||||
propertyValue = props.getProperty(propertyName, extractValue(defaultValue));
|
||||
Object currentValue = parseValue(propertyValue, property, f.getType(), propertyName);
|
||||
FMLLog.finest("Configuration for %s.%s found values default: %s, configured: %s, interpreted: %s", modClazzName, propertyName, defaultValue, propertyValue, currentValue);
|
||||
|
||||
if (currentValue != null && !currentValue.equals(defaultValue))
|
||||
{
|
||||
FMLLog.finest("Configuration for %s.%s value set to: %s", modClazzName, propertyName, currentValue);
|
||||
f.set(null, currentValue);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Invalid configuration found for %s in %s", propertyName, modConfig.getName());
|
||||
throw new LoaderException(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
comments.append(String.format("MLProp : %s (%s:%s", propertyName, f.getType().getName(), defaultValue));
|
||||
|
||||
if (property.min() != Double.MIN_VALUE)
|
||||
{
|
||||
comments.append(",>=").append(String.format("%.1f", property.min()));
|
||||
}
|
||||
|
||||
if (property.max() != Double.MAX_VALUE)
|
||||
{
|
||||
comments.append(",<=").append(String.format("%.1f", property.max()));
|
||||
}
|
||||
|
||||
comments.append(")");
|
||||
|
||||
if (!Strings.nullToEmpty(property.info()).isEmpty())
|
||||
{
|
||||
comments.append(" -- ").append(property.info());
|
||||
}
|
||||
|
||||
if (propertyValue != null)
|
||||
{
|
||||
props.setProperty(propertyName, extractValue(propertyValue));
|
||||
}
|
||||
comments.append("\n");
|
||||
}
|
||||
mlPropFound = true;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!mlPropFound && !existingConfigFound)
|
||||
{
|
||||
FMLLog.fine("No MLProp configuration for %s found or required. No file written", getModId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mlPropFound && existingConfigFound)
|
||||
{
|
||||
File mlPropBackup = new File(modConfig.getParent(),modConfig.getName()+".bak");
|
||||
FMLLog.fine("MLProp configuration file for %s found but not required. Attempting to rename file to %s", getModId(), mlPropBackup.getName());
|
||||
boolean renamed = modConfig.renameTo(mlPropBackup);
|
||||
if (renamed)
|
||||
{
|
||||
FMLLog.fine("Unused MLProp configuration file for %s renamed successfully to %s", getModId(), mlPropBackup.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.fine("Unused MLProp configuration file for %s renamed UNSUCCESSFULLY to %s", getModId(), mlPropBackup.getName());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
FileWriter configWriter = new FileWriter(modConfig);
|
||||
props.store(configWriter, comments.toString());
|
||||
configWriter.close();
|
||||
FMLLog.fine("Configuration for %s written to %s", getModId(), modConfig.getName());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Error trying to write the config file %s", modConfig.getName());
|
||||
throw new LoaderException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Object parseValue(String val, ModProperty property, Class<?> type, String propertyName)
|
||||
{
|
||||
if (type.isAssignableFrom(String.class))
|
||||
{
|
||||
return (String)val;
|
||||
}
|
||||
else if (type.isAssignableFrom(Boolean.TYPE) || type.isAssignableFrom(Boolean.class))
|
||||
{
|
||||
return Boolean.parseBoolean(val);
|
||||
}
|
||||
else if (Number.class.isAssignableFrom(type) || type.isPrimitive())
|
||||
{
|
||||
Number n = null;
|
||||
|
||||
if (type.isAssignableFrom(Double.TYPE) || Double.class.isAssignableFrom(type))
|
||||
{
|
||||
n = Double.parseDouble(val);
|
||||
}
|
||||
else if (type.isAssignableFrom(Float.TYPE) || Float.class.isAssignableFrom(type))
|
||||
{
|
||||
n = Float.parseFloat(val);
|
||||
}
|
||||
else if (type.isAssignableFrom(Long.TYPE) || Long.class.isAssignableFrom(type))
|
||||
{
|
||||
n = Long.parseLong(val);
|
||||
}
|
||||
else if (type.isAssignableFrom(Integer.TYPE) || Integer.class.isAssignableFrom(type))
|
||||
{
|
||||
n = Integer.parseInt(val);
|
||||
}
|
||||
else if (type.isAssignableFrom(Short.TYPE) || Short.class.isAssignableFrom(type))
|
||||
{
|
||||
n = Short.parseShort(val);
|
||||
}
|
||||
else if (type.isAssignableFrom(Byte.TYPE) || Byte.class.isAssignableFrom(type))
|
||||
{
|
||||
n = Byte.parseByte(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException(String.format("MLProp declared on %s of type %s, an unsupported type",propertyName, type.getName()));
|
||||
}
|
||||
|
||||
double dVal = n.doubleValue();
|
||||
if ((property.min()!=Double.MIN_VALUE && dVal < property.min()) || (property.max()!=Double.MAX_VALUE && dVal > property.max()))
|
||||
{
|
||||
FMLLog.warning("Configuration for %s.%s found value %s outside acceptable range %s,%s", modClazzName,propertyName, n, property.min(), property.max());
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("MLProp declared on %s of type %s, an unsupported type",propertyName, type.getName()));
|
||||
}
|
||||
private String extractValue(Object value)
|
||||
{
|
||||
if (String.class.isInstance(value))
|
||||
{
|
||||
return (String)value;
|
||||
}
|
||||
else if (Number.class.isInstance(value) || Boolean.class.isInstance(value))
|
||||
{
|
||||
return String.valueOf(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("MLProp declared on non-standard type");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return mod != null ? mod.getName() : modId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSortingRules()
|
||||
{
|
||||
return sortingProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Object mod)
|
||||
{
|
||||
return this.mod == mod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all the BaseMods in the system
|
||||
* @param <A>
|
||||
*/
|
||||
public static <A extends BaseModProxy> List<A> findAll(Class<A> clazz)
|
||||
{
|
||||
ArrayList<A> modList = new ArrayList<A>();
|
||||
|
||||
for (ModContainer mc : Loader.instance().getActiveModList())
|
||||
{
|
||||
if (mc instanceof ModLoaderModContainer && mc.getMod()!=null)
|
||||
{
|
||||
modList.add((A)((ModLoaderModContainer)mc).mod);
|
||||
}
|
||||
}
|
||||
|
||||
return modList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getSource()
|
||||
{
|
||||
return modSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMod()
|
||||
{
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ArtifactVersion> getRequirements()
|
||||
{
|
||||
return requirements;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArtifactVersion> getDependants()
|
||||
{
|
||||
return dependants;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArtifactVersion> getDependencies()
|
||||
{
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return modId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModMetadata getMetadata()
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion()
|
||||
{
|
||||
if (mod == null || mod.getVersion() == null)
|
||||
{
|
||||
return "Not available";
|
||||
}
|
||||
return mod.getVersion();
|
||||
}
|
||||
|
||||
public BaseModTicker getGameTickHandler()
|
||||
{
|
||||
return this.gameTickHandler;
|
||||
}
|
||||
|
||||
public BaseModTicker getGUITickHandler()
|
||||
{
|
||||
return this.guiTickHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModId()
|
||||
{
|
||||
return modId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindMetadata(MetadataCollection mc)
|
||||
{
|
||||
Map<String, Object> dummyMetadata = ImmutableMap.<String,Object>builder().put("name", modId).put("version", "1.0").build();
|
||||
this.metadata = mc.getMetadataForId(modId, dummyMetadata);
|
||||
Loader.instance().computeDependencies(sortingProperties, getRequirements(), getDependencies(), getDependants());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabledState(boolean enabled)
|
||||
{
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerBus(EventBus bus, LoadController controller)
|
||||
{
|
||||
if (this.enabled)
|
||||
{
|
||||
FMLLog.fine("Enabling mod %s", getModId());
|
||||
this.bus = bus;
|
||||
this.controller = controller;
|
||||
bus.register(this);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Lifecycle mod events
|
||||
|
||||
@Subscribe
|
||||
public void constructMod(FMLConstructionEvent event)
|
||||
{
|
||||
try
|
||||
{
|
||||
ModClassLoader modClassLoader = event.getModClassLoader();
|
||||
modClassLoader.addFile(modSource);
|
||||
EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class);
|
||||
this.gameTickHandler = new BaseModTicker(ticks, false);
|
||||
this.guiTickHandler = new BaseModTicker(ticks.clone(), true);
|
||||
Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) modClassLoader.loadBaseModClass(modClazzName);
|
||||
configureMod(modClazz, event.getASMHarvestedData());
|
||||
isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData());
|
||||
ModLoaderNetworkHandler dummyHandler = null;
|
||||
if (!isNetworkMod)
|
||||
{
|
||||
FMLLog.fine("Injecting dummy network mod handler for BaseMod %s", getModId());
|
||||
dummyHandler = new ModLoaderNetworkHandler(this);
|
||||
FMLNetworkHandler.instance().registerNetworkMod(dummyHandler);
|
||||
}
|
||||
Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor();
|
||||
ctor.setAccessible(true);
|
||||
mod = modClazz.newInstance();
|
||||
if (dummyHandler != null)
|
||||
{
|
||||
dummyHandler.setBaseMod(mod);
|
||||
}
|
||||
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), new ILanguageAdapter.JavaAdapter());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
controller.errorOccurred(this, e);
|
||||
Throwables.propagateIfPossible(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.gameTickHandler.setMod(mod);
|
||||
this.guiTickHandler.setMod(mod);
|
||||
TickRegistry.registerTickHandler(this.gameTickHandler, Side.CLIENT);
|
||||
TickRegistry.registerTickHandler(this.guiTickHandler, Side.CLIENT);
|
||||
GameRegistry.registerWorldGenerator(ModLoaderHelper.buildWorldGenHelper(mod));
|
||||
GameRegistry.registerFuelHandler(ModLoaderHelper.buildFuelHelper(mod));
|
||||
GameRegistry.registerCraftingHandler(ModLoaderHelper.buildCraftingHelper(mod));
|
||||
GameRegistry.registerPickupHandler(ModLoaderHelper.buildPickupHelper(mod));
|
||||
NetworkRegistry.instance().registerChatListener(ModLoaderHelper.buildChatListener(mod));
|
||||
NetworkRegistry.instance().registerConnectionHandler(ModLoaderHelper.buildConnectionHelper(mod));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
controller.errorOccurred(this, e);
|
||||
Throwables.propagateIfPossible(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
try
|
||||
{
|
||||
mod.load();
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
controller.errorOccurred(this, t);
|
||||
Throwables.propagateIfPossible(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
try
|
||||
{
|
||||
mod.modsLoaded();
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
controller.errorOccurred(this, t);
|
||||
Throwables.propagateIfPossible(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void loadComplete(FMLLoadCompleteEvent complete)
|
||||
{
|
||||
ModLoaderHelper.finishModLoading(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void serverStarting(FMLServerStartingEvent evt)
|
||||
{
|
||||
for (ICommand cmd : serverCommands)
|
||||
{
|
||||
evt.registerServerCommand(cmd);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ArtifactVersion getProcessedVersion()
|
||||
{
|
||||
if (processedVersion == null)
|
||||
{
|
||||
processedVersion = new DefaultArtifactVersion(modId, getVersion());
|
||||
}
|
||||
return processedVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImmutable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkMod()
|
||||
{
|
||||
return this.isNetworkMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayVersion()
|
||||
{
|
||||
return metadata!=null ? metadata.version : getVersion();
|
||||
}
|
||||
|
||||
public void addServerCommand(ICommand command)
|
||||
{
|
||||
serverCommands .add(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionRange acceptableMinecraftVersionRange()
|
||||
{
|
||||
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
||||
}
|
||||
@Override
|
||||
public Certificate getSigningCertificate()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getCustomModProperties()
|
||||
{
|
||||
return EMPTY_PROPERTIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getCustomResourcePackClass()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkModHandler;
|
||||
|
||||
public class ModLoaderNetworkHandler extends NetworkModHandler
|
||||
{
|
||||
|
||||
private BaseModProxy baseMod;
|
||||
public ModLoaderNetworkHandler(ModLoaderModContainer mlmc)
|
||||
{
|
||||
super(mlmc, null);
|
||||
}
|
||||
|
||||
public void setBaseMod(BaseModProxy baseMod)
|
||||
{
|
||||
this.baseMod = baseMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresClientSide()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresServerSide()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptVersion(String version)
|
||||
{
|
||||
return baseMod.getVersion().equals(version);
|
||||
}
|
||||
@Override
|
||||
public boolean isNetworkMod()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class ModLoaderPacketHandler implements IPacketHandler
|
||||
{
|
||||
private BaseModProxy mod;
|
||||
|
||||
public ModLoaderPacketHandler(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
|
||||
{
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
mod.serverCustomPayload(((EntityPlayerMP)player).field_71135_a, packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
ModLoaderHelper.sidedHelper.sendClientPacket(mod, packet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.IPickupNotifier;
|
||||
|
||||
public class ModLoaderPickupNotifier implements IPickupNotifier
|
||||
{
|
||||
|
||||
private BaseModProxy mod;
|
||||
|
||||
public ModLoaderPickupNotifier(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyPickup(EntityItem item, EntityPlayer player)
|
||||
{
|
||||
mod.onItemPickup(player, item.func_92059_d());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.src.TradeEntry;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||
|
||||
public class ModLoaderVillageTradeHandler implements IVillageTradeHandler
|
||||
{
|
||||
private List<TradeEntry> trades = Lists.newArrayList();
|
||||
|
||||
@Override
|
||||
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random)
|
||||
{
|
||||
for (TradeEntry ent : trades)
|
||||
{
|
||||
if (ent.buying)
|
||||
{
|
||||
VillagerRegistry.addEmeraldBuyRecipe(villager, recipeList, random, Item.field_77698_e[ent.id], ent.chance, ent.min, ent.max);
|
||||
}
|
||||
else
|
||||
{
|
||||
VillagerRegistry.addEmeraldSellRecipe(villager, recipeList, random, Item.field_77698_e[ent.id], ent.chance, ent.min, ent.max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addTrade(TradeEntry entry)
|
||||
{
|
||||
trades.add(entry);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||
import net.minecraft.world.gen.ChunkProviderHell;
|
||||
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
|
||||
public class ModLoaderWorldGenerator implements IWorldGenerator
|
||||
{
|
||||
private BaseModProxy mod;
|
||||
|
||||
public ModLoaderWorldGenerator(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
|
||||
{
|
||||
if (chunkGenerator instanceof ChunkProviderGenerate)
|
||||
{
|
||||
mod.generateSurface(world, random, chunkX << 4, chunkZ << 4);
|
||||
}
|
||||
else if (chunkGenerator instanceof ChunkProviderHell)
|
||||
{
|
||||
mod.generateNether(world, random, chunkX << 4, chunkZ << 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class ModProperty
|
||||
{
|
||||
private String info;
|
||||
private double min;
|
||||
private double max;
|
||||
private String name;
|
||||
private Field field;
|
||||
|
||||
public ModProperty(Field f, String info, Double min, Double max, String name)
|
||||
{
|
||||
this.field = f;
|
||||
this.info = info;
|
||||
this.min = min != null ? min : Double.MIN_VALUE;
|
||||
this.max = max != null ? max : Double.MAX_VALUE;
|
||||
this.name = name;
|
||||
}
|
||||
public ModProperty(Field field, Map<String, Object> annotationInfo)
|
||||
{
|
||||
this(field, (String)annotationInfo.get("info"), (Double)annotationInfo.get("min"), (Double)annotationInfo.get("max"), (String)annotationInfo.get("name"));
|
||||
}
|
||||
|
||||
public String name()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public double min()
|
||||
{
|
||||
return min;
|
||||
}
|
||||
|
||||
public double max()
|
||||
{
|
||||
return max;
|
||||
}
|
||||
|
||||
public String info()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
public Field field()
|
||||
{
|
||||
return field;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class EntitySpawnAdjustmentPacket extends FMLPacket
|
||||
{
|
||||
|
||||
public EntitySpawnAdjustmentPacket()
|
||||
{
|
||||
super(Type.ENTITYSPAWNADJUSTMENT);
|
||||
}
|
||||
|
||||
public int entityId;
|
||||
public int serverX;
|
||||
public int serverY;
|
||||
public int serverZ;
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket(Object... data)
|
||||
{
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
dat.writeInt((Integer) data[0]);
|
||||
dat.writeInt((Integer) data[1]);
|
||||
dat.writeInt((Integer) data[2]);
|
||||
dat.writeInt((Integer) data[3]);
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLPacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
entityId = dat.readInt();
|
||||
serverX = dat.readInt();
|
||||
serverY = dat.readInt();
|
||||
serverZ = dat.readInt();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
FMLCommonHandler.instance().adjustEntityLocationOnClient(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import cpw.mods.fml.common.registry.IThrowableEntity;
|
||||
|
||||
public class EntitySpawnPacket extends FMLPacket
|
||||
{
|
||||
|
||||
public int networkId;
|
||||
public int modEntityId;
|
||||
public int entityId;
|
||||
public double scaledX;
|
||||
public double scaledY;
|
||||
public double scaledZ;
|
||||
public float scaledYaw;
|
||||
public float scaledPitch;
|
||||
public float scaledHeadYaw;
|
||||
public List metadata;
|
||||
public int throwerId;
|
||||
public double speedScaledX;
|
||||
public double speedScaledY;
|
||||
public double speedScaledZ;
|
||||
public ByteArrayDataInput dataStream;
|
||||
public int rawX;
|
||||
public int rawY;
|
||||
public int rawZ;
|
||||
|
||||
public EntitySpawnPacket()
|
||||
{
|
||||
super(Type.ENTITYSPAWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket(Object... data)
|
||||
{
|
||||
EntityRegistration er = (EntityRegistration) data[0];
|
||||
Entity ent = (Entity) data[1];
|
||||
NetworkModHandler handler = (NetworkModHandler) data[2];
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
|
||||
dat.writeInt(handler.getNetworkId());
|
||||
dat.writeInt(er.getModEntityId());
|
||||
// entity id
|
||||
dat.writeInt(ent.field_70157_k);
|
||||
|
||||
// entity pos x,y,z
|
||||
dat.writeInt(MathHelper.func_76128_c(ent.field_70165_t * 32D));
|
||||
dat.writeInt(MathHelper.func_76128_c(ent.field_70163_u * 32D));
|
||||
dat.writeInt(MathHelper.func_76128_c(ent.field_70161_v * 32D));
|
||||
|
||||
// yaw, pitch
|
||||
dat.writeByte((byte) (ent.field_70177_z * 256.0F / 360.0F));
|
||||
dat.writeByte((byte) (ent.field_70125_A * 256.0F / 360.0F));
|
||||
|
||||
// head yaw
|
||||
if (ent instanceof EntityLiving)
|
||||
{
|
||||
dat.writeByte((byte) (((EntityLiving)ent).field_70759_as * 256.0F / 360.0F));
|
||||
}
|
||||
else
|
||||
{
|
||||
dat.writeByte(0);
|
||||
}
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
DataOutputStream dos = new DataOutputStream(bos);
|
||||
try
|
||||
{
|
||||
ent.func_70096_w().func_75689_a(dos);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// unpossible
|
||||
}
|
||||
|
||||
dat.write(bos.toByteArray());
|
||||
|
||||
if (ent instanceof IThrowableEntity)
|
||||
{
|
||||
Entity owner = ((IThrowableEntity)ent).getThrower();
|
||||
dat.writeInt(owner == null ? ent.field_70157_k : owner.field_70157_k);
|
||||
double maxVel = 3.9D;
|
||||
double mX = ent.field_70159_w;
|
||||
double mY = ent.field_70181_x;
|
||||
double mZ = ent.field_70179_y;
|
||||
if (mX < -maxVel) mX = -maxVel;
|
||||
if (mY < -maxVel) mY = -maxVel;
|
||||
if (mZ < -maxVel) mZ = -maxVel;
|
||||
if (mX > maxVel) mX = maxVel;
|
||||
if (mY > maxVel) mY = maxVel;
|
||||
if (mZ > maxVel) mZ = maxVel;
|
||||
dat.writeInt((int)(mX * 8000D));
|
||||
dat.writeInt((int)(mY * 8000D));
|
||||
dat.writeInt((int)(mZ * 8000D));
|
||||
}
|
||||
else
|
||||
{
|
||||
dat.writeInt(0);
|
||||
}
|
||||
if (ent instanceof IEntityAdditionalSpawnData)
|
||||
{
|
||||
((IEntityAdditionalSpawnData)ent).writeSpawnData(dat);
|
||||
}
|
||||
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLPacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
networkId = dat.readInt();
|
||||
modEntityId = dat.readInt();
|
||||
entityId = dat.readInt();
|
||||
rawX = dat.readInt();
|
||||
rawY = dat.readInt();
|
||||
rawZ = dat.readInt();
|
||||
scaledX = rawX / 32D;
|
||||
scaledY = rawY / 32D;
|
||||
scaledZ = rawZ / 32D;
|
||||
scaledYaw = dat.readByte() * 360F / 256F;
|
||||
scaledPitch = dat.readByte() * 360F / 256F;
|
||||
scaledHeadYaw = dat.readByte() * 360F / 256F;
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(data, 27, data.length - 27);
|
||||
DataInputStream dis = new DataInputStream(bis);
|
||||
try
|
||||
{
|
||||
metadata = DataWatcher.func_75686_a(dis);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// Nope
|
||||
}
|
||||
dat.skipBytes(data.length - bis.available() - 27);
|
||||
throwerId = dat.readInt();
|
||||
if (throwerId != 0)
|
||||
{
|
||||
speedScaledX = dat.readInt() / 8000D;
|
||||
speedScaledY = dat.readInt() / 8000D;
|
||||
speedScaledZ = dat.readInt() / 8000D;
|
||||
}
|
||||
|
||||
this.dataStream = dat;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
NetworkModHandler nmh = handler.findNetworkModHandler(networkId);
|
||||
ModContainer mc = nmh.getContainer();
|
||||
|
||||
EntityRegistration registration = EntityRegistry.instance().lookupModSpawn(mc, modEntityId);
|
||||
if (registration == null || registration.getEntityClass() == null)
|
||||
{
|
||||
FMLLog.log(Level.WARNING, "Missing mod entity information for %s : %d", mc.getModId(), modEntityId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Entity entity = FMLCommonHandler.instance().spawnEntityIntoClientWorld(registration, this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.common.primitives.UnsignedBytes;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public abstract class FMLPacket
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
/**
|
||||
* Opening salutation from the server to the client -> request all mods from the client
|
||||
*/
|
||||
MOD_LIST_REQUEST(ModListRequestPacket.class, false),
|
||||
/**
|
||||
* The client responds with the list of mods and versions it has. This is verified by the server.
|
||||
*/
|
||||
MOD_LIST_RESPONSE(ModListResponsePacket.class, false),
|
||||
/**
|
||||
* At which point the server tells the client the mod identifiers for this session.
|
||||
*/
|
||||
MOD_IDENTIFIERS(ModIdentifiersPacket.class, false),
|
||||
/**
|
||||
* Or, if there is missing stuff, the server tells the client what's missing and drops the connection.
|
||||
*/
|
||||
MOD_MISSING(ModMissingPacket.class, false),
|
||||
/**
|
||||
* Open a GUI on the client from the server
|
||||
*/
|
||||
GUIOPEN(OpenGuiPacket.class, false),
|
||||
/**
|
||||
* Spawn an entity on the client from the server
|
||||
*/
|
||||
ENTITYSPAWN(EntitySpawnPacket.class, false),
|
||||
/**
|
||||
* Fixes entity location data after spawning
|
||||
*/
|
||||
ENTITYSPAWNADJUSTMENT(EntitySpawnAdjustmentPacket.class, false),
|
||||
/**
|
||||
* The ID map to send to the client
|
||||
*/
|
||||
MOD_IDMAP(ModIdMapPacket.class, true);
|
||||
|
||||
|
||||
private Class<? extends FMLPacket> packetType;
|
||||
private boolean isMultipart;
|
||||
private ConcurrentMap<INetworkManager, FMLPacket> partTracker;
|
||||
|
||||
private Type(Class<? extends FMLPacket> clazz, boolean isMultipart)
|
||||
{
|
||||
this.packetType = clazz;
|
||||
this.isMultipart = isMultipart;
|
||||
}
|
||||
|
||||
FMLPacket make()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.packetType.newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Throwables.propagateIfPossible(e);
|
||||
FMLLog.log(Level.SEVERE, e, "A bizarre critical error occured during packet encoding");
|
||||
throw new FMLNetworkException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMultipart()
|
||||
{
|
||||
return isMultipart;
|
||||
}
|
||||
|
||||
private FMLPacket findCurrentPart(INetworkManager network)
|
||||
{
|
||||
if (partTracker == null)
|
||||
{
|
||||
partTracker = new MapMaker().weakKeys().weakValues().makeMap();
|
||||
}
|
||||
if (!partTracker.containsKey(network))
|
||||
{
|
||||
partTracker.put(network, make());
|
||||
}
|
||||
return partTracker.get(network);
|
||||
}
|
||||
}
|
||||
|
||||
private Type type;
|
||||
|
||||
public static byte[][] makePacketSet(Type type, Object... data)
|
||||
{
|
||||
if (!type.isMultipart())
|
||||
{
|
||||
return new byte[0][];
|
||||
}
|
||||
byte[] packetData = type.make().generatePacket(data);
|
||||
|
||||
byte[][] chunks = new byte[packetData.length / 32000 + 1][];
|
||||
for (int i = 0; i < packetData.length / 32000 + 1; i++)
|
||||
{
|
||||
int len = Math.min(32000, packetData.length - i* 32000);
|
||||
chunks[i] = Bytes.concat(new byte[] { UnsignedBytes.checkedCast(type.ordinal()), UnsignedBytes.checkedCast(i), UnsignedBytes.checkedCast(chunks.length)}, Ints.toByteArray(len), Arrays.copyOfRange(packetData, i * 32000, len + i * 32000));
|
||||
}
|
||||
return chunks;
|
||||
}
|
||||
public static byte[] makePacket(Type type, Object... data)
|
||||
{
|
||||
byte[] packetData = type.make().generatePacket(data);
|
||||
return Bytes.concat(new byte[] { UnsignedBytes.checkedCast(type.ordinal()) }, packetData );
|
||||
}
|
||||
|
||||
public static FMLPacket readPacket(INetworkManager network, byte[] payload)
|
||||
{
|
||||
int type = UnsignedBytes.toInt(payload[0]);
|
||||
Type eType = Type.values()[type];
|
||||
FMLPacket pkt;
|
||||
if (eType.isMultipart())
|
||||
{
|
||||
pkt = eType.findCurrentPart(network);
|
||||
}
|
||||
else
|
||||
{
|
||||
pkt = eType.make();
|
||||
}
|
||||
return pkt.consumePacket(Arrays.copyOfRange(payload, 1, payload.length));
|
||||
}
|
||||
|
||||
public FMLPacket(Type type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public abstract byte[] generatePacket(Object... data);
|
||||
|
||||
public abstract FMLPacket consumePacket(byte[] data);
|
||||
|
||||
public abstract void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.network.packet.*;
|
||||
|
||||
public interface IChatListener
|
||||
{
|
||||
/**
|
||||
* Called when there is a chat message received on the server
|
||||
* @param handler
|
||||
* @param message
|
||||
*/
|
||||
public Packet3Chat serverChat(NetHandler handler, Packet3Chat message);
|
||||
|
||||
/**
|
||||
* Called when there is a chat message recived on the client
|
||||
*
|
||||
* @param handler
|
||||
* @param message
|
||||
*/
|
||||
public Packet3Chat clientChat(NetHandler handler, Packet3Chat message);
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetLoginHandler;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet1Login;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public interface IConnectionHandler
|
||||
{
|
||||
/**
|
||||
* Called when a player logs into the server
|
||||
* SERVER SIDE
|
||||
*
|
||||
* @param player
|
||||
* @param netHandler
|
||||
* @param manager
|
||||
*/
|
||||
void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager);
|
||||
|
||||
/**
|
||||
* If you don't want the connection to continue, return a non-empty string here
|
||||
* If you do, you can do other stuff here- note no FML negotiation has occured yet
|
||||
* though the client is verified as having FML installed
|
||||
*
|
||||
* SERVER SIDE
|
||||
*
|
||||
* @param netHandler
|
||||
* @param manager
|
||||
*/
|
||||
String connectionReceived(NetLoginHandler netHandler, INetworkManager manager);
|
||||
|
||||
/**
|
||||
* Fired when a remote connection is opened
|
||||
* CLIENT SIDE
|
||||
*
|
||||
* @param netClientHandler
|
||||
* @param server
|
||||
* @param port
|
||||
*/
|
||||
void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager);
|
||||
/**
|
||||
*
|
||||
* Fired when a local connection is opened
|
||||
*
|
||||
* CLIENT SIDE
|
||||
*
|
||||
* @param netClientHandler
|
||||
* @param server
|
||||
*/
|
||||
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager);
|
||||
|
||||
/**
|
||||
* Fired when a connection closes
|
||||
*
|
||||
* ALL SIDES
|
||||
*
|
||||
* @param manager
|
||||
*/
|
||||
void connectionClosed(INetworkManager manager);
|
||||
|
||||
/**
|
||||
* Fired when the client established the connection to the server
|
||||
*
|
||||
* CLIENT SIDE
|
||||
* @param clientHandler
|
||||
* @param manager
|
||||
* @param login
|
||||
*/
|
||||
void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login);
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
|
||||
public interface IPacketHandler
|
||||
{
|
||||
/**
|
||||
* Recieve a packet from one of the registered channels for this packet handler
|
||||
* @param manager The network manager this packet arrived from
|
||||
* @param packet The packet itself
|
||||
* @param player A dummy interface representing the player - it can be cast into a real player instance if needed
|
||||
*/
|
||||
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.network.packet.*;
|
||||
|
||||
public interface ITinyPacketHandler
|
||||
{
|
||||
void handle(NetHandler handler, Packet131MapData mapData);
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.BitSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.common.primitives.UnsignedBytes;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.ItemData;
|
||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDMAP;
|
||||
|
||||
public class ModIdMapPacket extends FMLPacket {
|
||||
private byte[][] partials;
|
||||
|
||||
public ModIdMapPacket()
|
||||
{
|
||||
super(MOD_IDMAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket(Object... data)
|
||||
{
|
||||
NBTTagList completeList = (NBTTagList) data[0];
|
||||
NBTTagCompound wrap = new NBTTagCompound();
|
||||
wrap.func_74782_a("List", completeList);
|
||||
try
|
||||
{
|
||||
return CompressedStreamTools.func_74798_a(wrap);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "A critical error writing the id map");
|
||||
throw new FMLNetworkException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLPacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
|
||||
int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
|
||||
int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
|
||||
int chunkLength = bdi.readInt();
|
||||
if (partials == null)
|
||||
{
|
||||
partials = new byte[chunkTotal][];
|
||||
}
|
||||
partials[chunkIdx] = new byte[chunkLength];
|
||||
bdi.readFully(partials[chunkIdx]);
|
||||
for (int i = 0; i < partials.length; i++)
|
||||
{
|
||||
if (partials[i] == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
byte[] allData = Bytes.concat(partials);
|
||||
GameData.initializeServerGate(1);
|
||||
try
|
||||
{
|
||||
NBTTagCompound serverList = CompressedStreamTools.func_74792_a(allData);
|
||||
NBTTagList list = serverList.func_74761_m("List");
|
||||
Set<ItemData> itemData = GameData.buildWorldItemData(list);
|
||||
GameData.validateWorldSave(itemData);
|
||||
MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
|
||||
if (serverDifference!=null)
|
||||
{
|
||||
FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);
|
||||
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDENTIFIERS;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
public class ModIdentifiersPacket extends FMLPacket
|
||||
{
|
||||
|
||||
private Map<String, Integer> modIds = Maps.newHashMap();
|
||||
|
||||
public ModIdentifiersPacket()
|
||||
{
|
||||
super(MOD_IDENTIFIERS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket(Object... data)
|
||||
{
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
Collection<NetworkModHandler >networkMods = FMLNetworkHandler.instance().getNetworkIdMap().values();
|
||||
|
||||
dat.writeInt(networkMods.size());
|
||||
for (NetworkModHandler handler : networkMods)
|
||||
{
|
||||
dat.writeUTF(handler.getContainer().getModId());
|
||||
dat.writeInt(handler.getNetworkId());
|
||||
}
|
||||
|
||||
// TODO send the other id maps as well
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLPacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
int listSize = dat.readInt();
|
||||
for (int i = 0; i < listSize; i++)
|
||||
{
|
||||
String modId = dat.readUTF();
|
||||
int networkId = dat.readInt();
|
||||
modIds.put(modId, networkId);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
for (Entry<String,Integer> idEntry : modIds.entrySet())
|
||||
{
|
||||
handler.bindNetworkId(idEntry.getKey(), idEntry.getValue());
|
||||
}
|
||||
// TODO other id maps
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_REQUEST;
|
||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_RESPONSE;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
|
||||
public class ModListRequestPacket extends FMLPacket
|
||||
{
|
||||
private List<String> sentModList;
|
||||
private byte compatibilityLevel;
|
||||
|
||||
public ModListRequestPacket()
|
||||
{
|
||||
super(MOD_LIST_REQUEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket(Object... data)
|
||||
{
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
Set<ModContainer> activeMods = FMLNetworkHandler.instance().getNetworkModList();
|
||||
dat.writeInt(activeMods.size());
|
||||
for (ModContainer mc : activeMods)
|
||||
{
|
||||
dat.writeUTF(mc.getModId());
|
||||
}
|
||||
dat.writeByte(FMLNetworkHandler.getCompatibilityLevel());
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLPacket consumePacket(byte[] data)
|
||||
{
|
||||
sentModList = Lists.newArrayList();
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(data);
|
||||
int listSize = in.readInt();
|
||||
for (int i = 0; i < listSize; i++)
|
||||
{
|
||||
sentModList.add(in.readUTF());
|
||||
}
|
||||
try
|
||||
{
|
||||
compatibilityLevel = in.readByte();
|
||||
}
|
||||
catch (IllegalStateException e)
|
||||
{
|
||||
FMLLog.fine("No compatibility byte found - the server is too old");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This packet is executed on the client to evaluate the server's mod list against
|
||||
* the client
|
||||
*
|
||||
* @see cpw.mods.fml.common.network.FMLPacket#execute(INetworkManager, FMLNetworkHandler, NetHandler, String)
|
||||
*/
|
||||
@Override
|
||||
public void execute(INetworkManager mgr, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
List<String> missingMods = Lists.newArrayList();
|
||||
Map<String,String> modVersions = Maps.newHashMap();
|
||||
Map<String, ModContainer> indexedModList = Maps.newHashMap(Loader.instance().getIndexedModList());
|
||||
|
||||
for (String m : sentModList)
|
||||
{
|
||||
ModContainer mc = indexedModList.get(m);
|
||||
if (mc == null)
|
||||
{
|
||||
missingMods.add(m);
|
||||
continue;
|
||||
}
|
||||
indexedModList.remove(m);
|
||||
modVersions.put(m, mc.getVersion());
|
||||
}
|
||||
|
||||
if (indexedModList.size()>0)
|
||||
{
|
||||
for (Entry<String, ModContainer> e : indexedModList.entrySet())
|
||||
{
|
||||
if (e.getValue().isNetworkMod())
|
||||
{
|
||||
NetworkModHandler missingHandler = FMLNetworkHandler.instance().findNetworkModHandler(e.getValue());
|
||||
if (missingHandler.requiresServerSide())
|
||||
{
|
||||
// TODO : what should we do if a mod is marked "serverSideRequired"? Stop the connection?
|
||||
FMLLog.warning("The mod %s was not found on the server you connected to, but requested that the server side be present", e.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FMLLog.fine("The server has compatibility level %d", compatibilityLevel);
|
||||
FMLCommonHandler.instance().getSidedDelegate().setClientCompatibilityLevel(compatibilityLevel);
|
||||
|
||||
mgr.func_74429_a(PacketDispatcher.getPacket("FML", FMLPacket.makePacket(MOD_LIST_RESPONSE, modVersions, missingMods)));
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDENTIFIERS;
|
||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_RESPONSE;
|
||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_MISSING;
|
||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDMAP;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.*;
|
||||
import net.minecraft.network.packet.*;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ModListResponsePacket extends FMLPacket
|
||||
{
|
||||
private Map<String,String> modVersions;
|
||||
private List<String> missingMods;
|
||||
|
||||
public ModListResponsePacket()
|
||||
{
|
||||
super(MOD_LIST_RESPONSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket(Object... data)
|
||||
{
|
||||
Map<String,String> modVersions = (Map<String, String>) data[0];
|
||||
List<String> missingMods = (List<String>) data[1];
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
dat.writeInt(modVersions.size());
|
||||
for (Entry<String, String> version : modVersions.entrySet())
|
||||
{
|
||||
dat.writeUTF(version.getKey());
|
||||
dat.writeUTF(version.getValue());
|
||||
}
|
||||
dat.writeInt(missingMods.size());
|
||||
for (String missing : missingMods)
|
||||
{
|
||||
dat.writeUTF(missing);
|
||||
}
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLPacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
int versionListSize = dat.readInt();
|
||||
modVersions = Maps.newHashMapWithExpectedSize(versionListSize);
|
||||
for (int i = 0; i < versionListSize; i++)
|
||||
{
|
||||
String modName = dat.readUTF();
|
||||
String modVersion = dat.readUTF();
|
||||
modVersions.put(modName, modVersion);
|
||||
}
|
||||
|
||||
int missingModSize = dat.readInt();
|
||||
missingMods = Lists.newArrayListWithExpectedSize(missingModSize);
|
||||
|
||||
for (int i = 0; i < missingModSize; i++)
|
||||
{
|
||||
missingMods.add(dat.readUTF());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
Map<String, ModContainer> indexedModList = Maps.newHashMap(Loader.instance().getIndexedModList());
|
||||
List<String> missingClientMods = Lists.newArrayList();
|
||||
List<String> versionIncorrectMods = Lists.newArrayList();
|
||||
|
||||
for (String m : missingMods)
|
||||
{
|
||||
ModContainer mc = indexedModList.get(m);
|
||||
NetworkModHandler networkMod = handler.findNetworkModHandler(mc);
|
||||
if (networkMod.requiresClientSide())
|
||||
{
|
||||
missingClientMods.add(m);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<String,String> modVersion : modVersions.entrySet())
|
||||
{
|
||||
ModContainer mc = indexedModList.get(modVersion.getKey());
|
||||
NetworkModHandler networkMod = handler.findNetworkModHandler(mc);
|
||||
if (!networkMod.acceptVersion(modVersion.getValue()))
|
||||
{
|
||||
versionIncorrectMods.add(modVersion.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
Packet250CustomPayload pkt = new Packet250CustomPayload();
|
||||
pkt.field_73630_a = "FML";
|
||||
if (missingClientMods.size()>0 || versionIncorrectMods.size() > 0)
|
||||
{
|
||||
pkt.field_73629_c = FMLPacket.makePacket(MOD_MISSING, missingClientMods, versionIncorrectMods);
|
||||
Logger.getLogger("Minecraft").info(String.format("User %s connection failed: missing %s, bad versions %s", userName, missingClientMods, versionIncorrectMods));
|
||||
FMLLog.info("User %s connection failed: missing %s, bad versions %s", userName, missingClientMods, versionIncorrectMods);
|
||||
// Mark this as bad
|
||||
FMLNetworkHandler.setHandlerState((NetLoginHandler) netHandler, FMLNetworkHandler.MISSING_MODS_OR_VERSIONS);
|
||||
pkt.field_73628_b = pkt.field_73629_c.length;
|
||||
network.func_74429_a(pkt);
|
||||
}
|
||||
else
|
||||
{
|
||||
pkt.field_73629_c = FMLPacket.makePacket(MOD_IDENTIFIERS, netHandler);
|
||||
Logger.getLogger("Minecraft").info(String.format("User %s connecting with mods %s", userName, modVersions.keySet()));
|
||||
FMLLog.info("User %s connecting with mods %s", userName, modVersions.keySet());
|
||||
pkt.field_73628_b = pkt.field_73629_c.length;
|
||||
network.func_74429_a(pkt);
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
GameData.writeItemData(itemList);
|
||||
byte[][] registryPackets = FMLPacket.makePacketSet(MOD_IDMAP, itemList);
|
||||
for (int i = 0; i < registryPackets.length; i++)
|
||||
{
|
||||
network.func_74429_a(PacketDispatcher.getPacket("FML", registryPackets[i]));
|
||||
}
|
||||
}
|
||||
|
||||
// reset the continuation flag - we have completed extra negotiation and the login should complete now
|
||||
NetLoginHandler.func_72531_a((NetLoginHandler) netHandler, true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableList.Builder;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
|
||||
public class ModMissingPacket extends FMLPacket
|
||||
{
|
||||
|
||||
private List<ModData> missing;
|
||||
private List<ModData> badVersion;
|
||||
|
||||
public ModMissingPacket()
|
||||
{
|
||||
super(Type.MOD_MISSING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket(Object... data)
|
||||
{
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
|
||||
List<String> missing = (List<String>) data[0];
|
||||
List<String> badVersion = (List<String>) data[1];
|
||||
|
||||
dat.writeInt(missing.size());
|
||||
for (String missed : missing)
|
||||
{
|
||||
ModContainer mc = Loader.instance().getIndexedModList().get(missed);
|
||||
dat.writeUTF(missed);
|
||||
dat.writeUTF(mc.getVersion());
|
||||
}
|
||||
dat.writeInt(badVersion.size());
|
||||
for (String bad : badVersion)
|
||||
{
|
||||
ModContainer mc = Loader.instance().getIndexedModList().get(bad);
|
||||
dat.writeUTF(bad);
|
||||
dat.writeUTF(mc.getVersion());
|
||||
}
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
private static class ModData
|
||||
{
|
||||
String modId;
|
||||
String modVersion;
|
||||
}
|
||||
@Override
|
||||
public FMLPacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
int missingLen = dat.readInt();
|
||||
missing = Lists.newArrayListWithCapacity(missingLen);
|
||||
for (int i = 0; i < missingLen; i++)
|
||||
{
|
||||
ModData md = new ModData();
|
||||
md.modId = dat.readUTF();
|
||||
md.modVersion = dat.readUTF();
|
||||
missing.add(md);
|
||||
}
|
||||
int badVerLength = dat.readInt();
|
||||
badVersion = Lists.newArrayListWithCapacity(badVerLength);
|
||||
for (int i = 0; i < badVerLength; i++)
|
||||
{
|
||||
ModData md = new ModData();
|
||||
md.modId = dat.readUTF();
|
||||
md.modVersion = dat.readUTF();
|
||||
badVersion.add(md);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
FMLCommonHandler.instance().getSidedDelegate().displayMissingMods(this);
|
||||
}
|
||||
|
||||
public List<ArtifactVersion> getModList()
|
||||
{
|
||||
Builder<ArtifactVersion> builder = ImmutableList.<ArtifactVersion>builder();
|
||||
for (ModData md : missing)
|
||||
{
|
||||
builder.add(new DefaultArtifactVersion(md.modId, VersionRange.createFromVersion(md.modVersion, null)));
|
||||
}
|
||||
for (ModData md : badVersion)
|
||||
{
|
||||
builder.add(new DefaultArtifactVersion(md.modId, VersionRange.createFromVersion(md.modVersion, null)));
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface NetworkMod
|
||||
{
|
||||
/**
|
||||
* Does this mod require the client side to be present when installed on a server?
|
||||
*/
|
||||
boolean clientSideRequired() default false;
|
||||
/**
|
||||
* Does this mod require the server side to be present when installed on a client?
|
||||
*/
|
||||
boolean serverSideRequired() default false;
|
||||
/**
|
||||
* A list of Packet250 network channels to register for this mod - these channels
|
||||
* will be universal and will require a universal packethandler to handle them
|
||||
*/
|
||||
String[] channels() default {};
|
||||
/**
|
||||
* An optional range check for client to server communication version compatibility
|
||||
*/
|
||||
String versionBounds() default "";
|
||||
|
||||
/**
|
||||
* A packet handler implementation for channels registered through this annotation
|
||||
* - this packet handler will be universal and handle both client and server
|
||||
* requests.
|
||||
*/
|
||||
Class<? extends IPacketHandler> packetHandler() default NULL.class;
|
||||
|
||||
/**
|
||||
* A tiny packet handler implementation based on {@link net.minecraft.network.packet.Packet131MapData} for "small"
|
||||
* data packet loads.
|
||||
*/
|
||||
Class<? extends ITinyPacketHandler> tinyPacketHandler() default NULL.class;
|
||||
/**
|
||||
* A connection handler implementation for this network mod
|
||||
*/
|
||||
Class<? extends IConnectionHandler> connectionHandler() default NULL.class;
|
||||
/**
|
||||
* A packet handler and channels to register for the client side
|
||||
*/
|
||||
SidedPacketHandler clientPacketHandlerSpec() default @SidedPacketHandler(channels = {}, packetHandler = NULL.class );
|
||||
|
||||
/**
|
||||
* A packet handler and channels to register for the server side
|
||||
*/
|
||||
SidedPacketHandler serverPacketHandlerSpec() default @SidedPacketHandler(channels = {}, packetHandler = NULL.class );
|
||||
|
||||
/**
|
||||
* Special dummy class for handling stupid annotation default values
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
static interface NULL extends IPacketHandler, IConnectionHandler, ITinyPacketHandler {};
|
||||
|
||||
/**
|
||||
* A marker for a method that will be offered the client's version string
|
||||
* if more sophisticated version rejection handling is required:
|
||||
* The method should accept a "String", a "NetworkManager" and return a boolean true
|
||||
* if the version can be accepted.
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VersionCheckHandler { }
|
||||
|
||||
/**
|
||||
* Bundles together a packet handler and it's associated channels for the sided packet handlers
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public @interface SidedPacketHandler {
|
||||
String[] channels();
|
||||
Class<? extends IPacketHandler> packetHandler();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,369 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class NetworkModHandler
|
||||
{
|
||||
private static Object connectionHandlerDefaultValue;
|
||||
private static Object packetHandlerDefaultValue;
|
||||
private static Object clientHandlerDefaultValue;
|
||||
private static Object serverHandlerDefaultValue;
|
||||
private static Object tinyPacketHandlerDefaultValue;
|
||||
|
||||
private static int assignedIds = 1;
|
||||
|
||||
private int localId;
|
||||
private int networkId;
|
||||
|
||||
private ModContainer container;
|
||||
private NetworkMod mod;
|
||||
private Method checkHandler;
|
||||
|
||||
private VersionRange acceptableRange;
|
||||
private ITinyPacketHandler tinyPacketHandler;
|
||||
|
||||
public NetworkModHandler(ModContainer container, NetworkMod modAnnotation)
|
||||
{
|
||||
this.container = container;
|
||||
this.mod = modAnnotation;
|
||||
this.localId = assignedIds++;
|
||||
this.networkId = this.localId;
|
||||
// Skip over the map object because it has special network id meaning
|
||||
if (Item.field_77744_bd.field_77779_bT == assignedIds)
|
||||
{
|
||||
assignedIds++;
|
||||
}
|
||||
}
|
||||
public NetworkModHandler(ModContainer container, Class<?> networkModClass, ASMDataTable table)
|
||||
{
|
||||
this(container, networkModClass.getAnnotation(NetworkMod.class));
|
||||
if (this.mod == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Set<ASMData> versionCheckHandlers = table.getAnnotationsFor(container).get(NetworkMod.VersionCheckHandler.class.getName());
|
||||
String versionCheckHandlerMethod = null;
|
||||
for (ASMData vch : versionCheckHandlers)
|
||||
{
|
||||
if (vch.getClassName().equals(networkModClass.getName()))
|
||||
{
|
||||
versionCheckHandlerMethod = vch.getObjectName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (versionCheckHandlerMethod != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method checkHandlerMethod = networkModClass.getDeclaredMethod(versionCheckHandlerMethod, String.class);
|
||||
if (checkHandlerMethod.isAnnotationPresent(NetworkMod.VersionCheckHandler.class))
|
||||
{
|
||||
this.checkHandler = checkHandlerMethod;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.WARNING, e, "The declared version check handler method %s on network mod id %s is not accessible", versionCheckHandlerMethod, container.getModId());
|
||||
}
|
||||
}
|
||||
|
||||
configureNetworkMod(container);
|
||||
}
|
||||
protected void configureNetworkMod(ModContainer container)
|
||||
{
|
||||
if (this.checkHandler == null)
|
||||
{
|
||||
String versionBounds = mod.versionBounds();
|
||||
if (!Strings.isNullOrEmpty(versionBounds))
|
||||
{
|
||||
try
|
||||
{
|
||||
this.acceptableRange = VersionRange.createFromVersionSpec(versionBounds);
|
||||
}
|
||||
catch (InvalidVersionSpecificationException e)
|
||||
{
|
||||
FMLLog.log(Level.WARNING, e, "Invalid bounded range %s specified for network mod id %s", versionBounds, container.getModId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FMLLog.finest("Testing mod %s to verify it accepts its own version in a remote connection", container.getModId());
|
||||
boolean acceptsSelf = acceptVersion(container.getVersion());
|
||||
if (!acceptsSelf)
|
||||
{
|
||||
FMLLog.severe("The mod %s appears to reject its own version number (%s) in its version handling. This is likely a severe bug in the mod!", container.getModId(), container.getVersion());
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.finest("The mod %s accepts its own version (%s)", container.getModId(), container.getVersion());
|
||||
}
|
||||
|
||||
tryCreatingPacketHandler(container, mod.packetHandler(), mod.channels(), null);
|
||||
if (FMLCommonHandler.instance().getSide().isClient())
|
||||
{
|
||||
if (mod.clientPacketHandlerSpec() != getClientHandlerSpecDefaultValue())
|
||||
{
|
||||
tryCreatingPacketHandler(container, mod.clientPacketHandlerSpec().packetHandler(), mod.clientPacketHandlerSpec().channels(), Side.CLIENT);
|
||||
}
|
||||
}
|
||||
if (mod.serverPacketHandlerSpec() != getServerHandlerSpecDefaultValue())
|
||||
{
|
||||
tryCreatingPacketHandler(container, mod.serverPacketHandlerSpec().packetHandler(), mod.serverPacketHandlerSpec().channels(), Side.SERVER);
|
||||
}
|
||||
|
||||
if (mod.connectionHandler() != getConnectionHandlerDefaultValue())
|
||||
{
|
||||
IConnectionHandler instance;
|
||||
try
|
||||
{
|
||||
instance = mod.connectionHandler().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Unable to create connection handler instance %s", mod.connectionHandler().getName());
|
||||
throw new FMLNetworkException(e);
|
||||
}
|
||||
|
||||
NetworkRegistry.instance().registerConnectionHandler(instance);
|
||||
}
|
||||
|
||||
if (mod.tinyPacketHandler()!=getTinyPacketHandlerDefaultValue())
|
||||
{
|
||||
try
|
||||
{
|
||||
tinyPacketHandler = mod.tinyPacketHandler().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Unable to create tiny packet handler instance %s", mod.tinyPacketHandler().getName());
|
||||
throw new FMLNetworkException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param container
|
||||
*/
|
||||
private void tryCreatingPacketHandler(ModContainer container, Class<? extends IPacketHandler> clazz, String[] channels, Side side)
|
||||
{
|
||||
if (side!=null && side.isClient() && ! FMLCommonHandler.instance().getSide().isClient())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (clazz!=getPacketHandlerDefaultValue())
|
||||
{
|
||||
if (channels.length==0)
|
||||
{
|
||||
FMLLog.log(Level.WARNING, "The mod id %s attempted to register a packet handler without specifying channels for it", container.getModId());
|
||||
}
|
||||
else
|
||||
{
|
||||
IPacketHandler instance;
|
||||
try
|
||||
{
|
||||
instance = clazz.newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Unable to create a packet handler instance %s for mod %s", clazz.getName(), container.getModId());
|
||||
throw new FMLNetworkException(e);
|
||||
}
|
||||
|
||||
for (String channel : channels)
|
||||
{
|
||||
NetworkRegistry.instance().registerChannel(instance, channel, side);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (channels.length > 0)
|
||||
{
|
||||
FMLLog.warning("The mod id %s attempted to register channels without specifying a packet handler", container.getModId());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return the default {@link NetworkMod#connectionHandler()} annotation value
|
||||
*/
|
||||
private Object getConnectionHandlerDefaultValue()
|
||||
{
|
||||
try {
|
||||
if (connectionHandlerDefaultValue == null)
|
||||
{
|
||||
connectionHandlerDefaultValue = NetworkMod.class.getMethod("connectionHandler").getDefaultValue();
|
||||
}
|
||||
return connectionHandlerDefaultValue;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
throw new RuntimeException("Derp?", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the default {@link NetworkMod#packetHandler()} annotation value
|
||||
*/
|
||||
private Object getPacketHandlerDefaultValue()
|
||||
{
|
||||
try {
|
||||
if (packetHandlerDefaultValue == null)
|
||||
{
|
||||
packetHandlerDefaultValue = NetworkMod.class.getMethod("packetHandler").getDefaultValue();
|
||||
}
|
||||
return packetHandlerDefaultValue;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
throw new RuntimeException("Derp?", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the default {@link NetworkMod#tinyPacketHandler()} annotation value
|
||||
*/
|
||||
private Object getTinyPacketHandlerDefaultValue()
|
||||
{
|
||||
try {
|
||||
if (tinyPacketHandlerDefaultValue == null)
|
||||
{
|
||||
tinyPacketHandlerDefaultValue = NetworkMod.class.getMethod("tinyPacketHandler").getDefaultValue();
|
||||
}
|
||||
return tinyPacketHandlerDefaultValue;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
throw new RuntimeException("Derp?", e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return the {@link NetworkMod#clientPacketHandlerSpec()} default annotation value
|
||||
*/
|
||||
private Object getClientHandlerSpecDefaultValue()
|
||||
{
|
||||
try {
|
||||
if (clientHandlerDefaultValue == null)
|
||||
{
|
||||
clientHandlerDefaultValue = NetworkMod.class.getMethod("clientPacketHandlerSpec").getDefaultValue();
|
||||
}
|
||||
return clientHandlerDefaultValue;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
throw new RuntimeException("Derp?", e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return the default {@link NetworkMod#serverPacketHandlerSpec()} annotation value
|
||||
*/
|
||||
private Object getServerHandlerSpecDefaultValue()
|
||||
{
|
||||
try {
|
||||
if (serverHandlerDefaultValue == null)
|
||||
{
|
||||
serverHandlerDefaultValue = NetworkMod.class.getMethod("serverPacketHandlerSpec").getDefaultValue();
|
||||
}
|
||||
return serverHandlerDefaultValue;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
throw new RuntimeException("Derp?", e);
|
||||
}
|
||||
}
|
||||
public boolean requiresClientSide()
|
||||
{
|
||||
return mod.clientSideRequired();
|
||||
}
|
||||
|
||||
public boolean requiresServerSide()
|
||||
{
|
||||
return mod.serverSideRequired();
|
||||
}
|
||||
|
||||
public boolean acceptVersion(String version)
|
||||
{
|
||||
if (checkHandler != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (Boolean)checkHandler.invoke(container.getMod(), version);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.WARNING, e, "There was a problem invoking the checkhandler method %s for network mod id %s", checkHandler.getName(), container.getModId());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (acceptableRange!=null)
|
||||
{
|
||||
return acceptableRange.containsVersion(new DefaultArtifactVersion(version));
|
||||
}
|
||||
|
||||
return container.getVersion().equals(version);
|
||||
}
|
||||
|
||||
public int getLocalId()
|
||||
{
|
||||
return localId;
|
||||
}
|
||||
|
||||
public int getNetworkId()
|
||||
{
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public ModContainer getContainer()
|
||||
{
|
||||
return container;
|
||||
}
|
||||
|
||||
public NetworkMod getMod()
|
||||
{
|
||||
return mod;
|
||||
}
|
||||
|
||||
public boolean isNetworkMod()
|
||||
{
|
||||
return mod != null;
|
||||
}
|
||||
|
||||
public void setNetworkId(int value)
|
||||
{
|
||||
this.networkId = value;
|
||||
}
|
||||
|
||||
public boolean hasTinyPacketHandler()
|
||||
{
|
||||
return tinyPacketHandler != null;
|
||||
}
|
||||
public ITinyPacketHandler getTinyPacketHandler()
|
||||
{
|
||||
return tinyPacketHandler;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
public class OpenGuiPacket extends FMLPacket
|
||||
{
|
||||
private int windowId;
|
||||
private int networkId;
|
||||
private int modGuiId;
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
public OpenGuiPacket()
|
||||
{
|
||||
super(Type.GUIOPEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket(Object... data)
|
||||
{
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
dat.writeInt((Integer) data[0]); // windowId
|
||||
dat.writeInt((Integer) data[1]); // networkId
|
||||
dat.writeInt((Integer) data[2]); // modGuiId
|
||||
dat.writeInt((Integer) data[3]); // x
|
||||
dat.writeInt((Integer) data[4]); // y
|
||||
dat.writeInt((Integer) data[5]); // z
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLPacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
windowId = dat.readInt();
|
||||
networkId = dat.readInt();
|
||||
modGuiId = dat.readInt();
|
||||
x = dat.readInt();
|
||||
y = dat.readInt();
|
||||
z = dat.readInt();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
EntityPlayer player = netHandler.getPlayer();
|
||||
player.openGui(networkId, modGuiId, player.field_70170_p, x, y, z);
|
||||
player.field_71070_bA.field_75152_c = windowId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet131MapData;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
/**
|
||||
* A simple utility class to send packet 250 packets around the place
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class PacketDispatcher
|
||||
{
|
||||
public static Packet250CustomPayload getPacket(String type, byte[] data)
|
||||
{
|
||||
return new Packet250CustomPayload(type, data);
|
||||
}
|
||||
|
||||
public static void sendPacketToServer(Packet packet)
|
||||
{
|
||||
FMLCommonHandler.instance().getSidedDelegate().sendPacket(packet);
|
||||
}
|
||||
|
||||
public static void sendPacketToPlayer(Packet packet, Player player)
|
||||
{
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP)player).field_71135_a.func_72567_b(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPacketToAllAround(double X, double Y, double Z, double range, int dimensionId, Packet packet)
|
||||
{
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
if (server != null)
|
||||
{
|
||||
server.func_71203_ab().func_72393_a(X, Y, Z, range, dimensionId, packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.fine("Attempt to send packet to all around without a server instance available");
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPacketToAllInDimension(Packet packet, int dimId)
|
||||
{
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
if (server != null)
|
||||
{
|
||||
server.func_71203_ab().func_72396_a(packet, dimId);
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.fine("Attempt to send packet to all in dimension without a server instance available");
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPacketToAllPlayers(Packet packet)
|
||||
{
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
if (server != null)
|
||||
{
|
||||
server.func_71203_ab().func_72384_a(packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.fine("Attempt to send packet to all in dimension without a server instance available");
|
||||
}
|
||||
}
|
||||
|
||||
public static Packet131MapData getTinyPacket(Object mod, short tag, byte[] data)
|
||||
{
|
||||
NetworkModHandler nmh = FMLNetworkHandler.instance().findNetworkModHandler(mod);
|
||||
return new Packet131MapData((short) nmh.getNetworkId(), tag, data);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public interface Player
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package cpw.mods.fml.common.patcher;
|
||||
|
||||
public class ClassPatchingTransformer {
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.registry;
|
||||
|
||||
public interface BlockProxy
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.registry;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
class BlockTracker
|
||||
{
|
||||
private static final BlockTracker INSTANCE = new BlockTracker();
|
||||
private BitSet allocatedBlocks;
|
||||
|
||||
private BlockTracker()
|
||||
{
|
||||
allocatedBlocks = new BitSet(4096);
|
||||
allocatedBlocks.set(0, 4096);
|
||||
for (int i = 0; i < Block.field_71973_m.length; i++)
|
||||
{
|
||||
if (Block.field_71973_m[i]!=null)
|
||||
{
|
||||
allocatedBlocks.clear(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int nextBlockId()
|
||||
{
|
||||
return instance().getNextBlockId();
|
||||
}
|
||||
|
||||
private int getNextBlockId()
|
||||
{
|
||||
int idx = allocatedBlocks.nextSetBit(0);
|
||||
allocatedBlocks.clear(idx);
|
||||
return idx;
|
||||
}
|
||||
private static BlockTracker instance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
public static void reserveBlockId(int id)
|
||||
{
|
||||
instance().doReserveId(id);
|
||||
}
|
||||
private void doReserveId(int id)
|
||||
{
|
||||
allocatedBlocks.clear(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,390 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.registry;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSand;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.base.Joiner.MapJoiner;
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.ImmutableListMultimap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableTable;
|
||||
import com.google.common.collect.ImmutableTable.Builder;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.Tables;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.common.collect.Table.Cell;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.LoaderState;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
|
||||
public class GameData {
|
||||
private static Map<Integer, ItemData> idMap = Maps.newHashMap();
|
||||
private static CountDownLatch serverValidationLatch;
|
||||
private static CountDownLatch clientValidationLatch;
|
||||
private static MapDifference<Integer, ItemData> difference;
|
||||
private static boolean shouldContinue = true;
|
||||
private static boolean isSaveValid = true;
|
||||
private static ImmutableTable<String, String, Integer> modObjectTable;
|
||||
private static Table<String, String, ItemStack> customItemStacks = HashBasedTable.create();
|
||||
private static Map<String,String> ignoredMods;
|
||||
|
||||
private static boolean isModIgnoredForIdValidation(String modId)
|
||||
{
|
||||
if (ignoredMods == null)
|
||||
{
|
||||
File f = new File(Loader.instance().getConfigDir(),"fmlIDChecking.properties");
|
||||
if (f.exists())
|
||||
{
|
||||
Properties p = new Properties();
|
||||
try
|
||||
{
|
||||
p.load(new FileInputStream(f));
|
||||
ignoredMods = Maps.fromProperties(p);
|
||||
if (ignoredMods.size()>0)
|
||||
{
|
||||
FMLLog.log("fml.ItemTracker", Level.WARNING, "Using non-empty ignored mods configuration file %s", ignoredMods.keySet());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Throwables.propagateIfPossible(e);
|
||||
FMLLog.log("fml.ItemTracker", Level.SEVERE, e, "Failed to read ignored ID checker mods properties file");
|
||||
ignoredMods = ImmutableMap.<String, String>of();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ignoredMods = ImmutableMap.<String, String>of();
|
||||
}
|
||||
}
|
||||
return ignoredMods.containsKey(modId);
|
||||
}
|
||||
|
||||
public static void newItemAdded(Item item)
|
||||
{
|
||||
ModContainer mc = Loader.instance().activeModContainer();
|
||||
if (mc == null)
|
||||
{
|
||||
mc = Loader.instance().getMinecraftModContainer();
|
||||
if (Loader.instance().hasReachedState(LoaderState.AVAILABLE))
|
||||
{
|
||||
FMLLog.severe("It appears something has tried to allocate an Item outside of the initialization phase of Minecraft, this could be very bad for your network connectivity.");
|
||||
}
|
||||
}
|
||||
String itemType = item.getClass().getName();
|
||||
ItemData itemData = new ItemData(item, mc);
|
||||
if (idMap.containsKey(item.field_77779_bT))
|
||||
{
|
||||
ItemData id = idMap.get(item.field_77779_bT);
|
||||
FMLLog.log("fml.ItemTracker", Level.INFO, "The mod %s is overwriting existing item at %d (%s from %s) with %s", mc.getModId(), id.getItemId(), id.getItemType(), id.getModId(), itemType);
|
||||
}
|
||||
idMap.put(item.field_77779_bT, itemData);
|
||||
if (!"Minecraft".equals(mc.getModId()))
|
||||
{
|
||||
FMLLog.log("fml.ItemTracker",Level.FINE, "Adding item %s(%d) owned by %s", item.getClass().getName(), item.field_77779_bT, mc.getModId());
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateWorldSave(Set<ItemData> worldSaveItems)
|
||||
{
|
||||
isSaveValid = true;
|
||||
shouldContinue = true;
|
||||
// allow ourselves to continue if there's no saved data
|
||||
if (worldSaveItems == null)
|
||||
{
|
||||
serverValidationLatch.countDown();
|
||||
try
|
||||
{
|
||||
clientValidationLatch.await();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Function<? super ItemData, Integer> idMapFunction = new Function<ItemData, Integer>() {
|
||||
public Integer apply(ItemData input) {
|
||||
return input.getItemId();
|
||||
};
|
||||
};
|
||||
|
||||
Map<Integer,ItemData> worldMap = Maps.uniqueIndex(worldSaveItems,idMapFunction);
|
||||
difference = Maps.difference(worldMap, idMap);
|
||||
FMLLog.log("fml.ItemTracker", Level.FINE, "The difference set is %s", difference);
|
||||
if (!difference.entriesDiffering().isEmpty() || !difference.entriesOnlyOnLeft().isEmpty())
|
||||
{
|
||||
FMLLog.log("fml.ItemTracker", Level.SEVERE, "FML has detected item discrepancies");
|
||||
FMLLog.log("fml.ItemTracker", Level.SEVERE, "Missing items : %s", difference.entriesOnlyOnLeft());
|
||||
FMLLog.log("fml.ItemTracker", Level.SEVERE, "Mismatched items : %s", difference.entriesDiffering());
|
||||
boolean foundNonIgnored = false;
|
||||
for (ItemData diff : difference.entriesOnlyOnLeft().values())
|
||||
{
|
||||
if (!isModIgnoredForIdValidation(diff.getModId()))
|
||||
{
|
||||
foundNonIgnored = true;
|
||||
}
|
||||
}
|
||||
for (ValueDifference<ItemData> diff : difference.entriesDiffering().values())
|
||||
{
|
||||
if (! ( isModIgnoredForIdValidation(diff.leftValue().getModId()) || isModIgnoredForIdValidation(diff.rightValue().getModId()) ) )
|
||||
{
|
||||
foundNonIgnored = true;
|
||||
}
|
||||
}
|
||||
if (!foundNonIgnored)
|
||||
{
|
||||
FMLLog.log("fml.ItemTracker", Level.SEVERE, "FML is ignoring these ID discrepancies because of configuration. YOUR GAME WILL NOW PROBABLY CRASH. HOPEFULLY YOU WON'T HAVE CORRUPTED YOUR WORLD. BLAME %s", ignoredMods.keySet());
|
||||
}
|
||||
isSaveValid = !foundNonIgnored;
|
||||
serverValidationLatch.countDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
isSaveValid = true;
|
||||
serverValidationLatch.countDown();
|
||||
}
|
||||
try
|
||||
{
|
||||
clientValidationLatch.await();
|
||||
if (!shouldContinue)
|
||||
{
|
||||
throw new RuntimeException("This server instance is going to stop abnormally because of a fatal ID mismatch");
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeItemData(NBTTagList itemList)
|
||||
{
|
||||
for (ItemData dat : idMap.values())
|
||||
{
|
||||
itemList.func_74742_a(dat.toNBT());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the server gate
|
||||
* @param gateCount the countdown amount. If it's 2 we're on the client and the client and server
|
||||
* will wait at the latch. 1 is a server and the server will proceed
|
||||
*/
|
||||
public static void initializeServerGate(int gateCount)
|
||||
{
|
||||
serverValidationLatch = new CountDownLatch(gateCount - 1);
|
||||
clientValidationLatch = new CountDownLatch(gateCount - 1);
|
||||
}
|
||||
|
||||
public static MapDifference<Integer, ItemData> gateWorldLoadingForValidation()
|
||||
{
|
||||
try
|
||||
{
|
||||
serverValidationLatch.await();
|
||||
if (!isSaveValid)
|
||||
{
|
||||
return difference;
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
}
|
||||
difference = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void releaseGate(boolean carryOn)
|
||||
{
|
||||
shouldContinue = carryOn;
|
||||
clientValidationLatch.countDown();
|
||||
}
|
||||
|
||||
public static Set<ItemData> buildWorldItemData(NBTTagList modList)
|
||||
{
|
||||
Set<ItemData> worldSaveItems = Sets.newHashSet();
|
||||
for (int i = 0; i < modList.func_74745_c(); i++)
|
||||
{
|
||||
NBTTagCompound mod = (NBTTagCompound) modList.func_74743_b(i);
|
||||
ItemData dat = new ItemData(mod);
|
||||
worldSaveItems.add(dat);
|
||||
}
|
||||
return worldSaveItems;
|
||||
}
|
||||
|
||||
static void setName(Item item, String name, String modId)
|
||||
{
|
||||
int id = item.field_77779_bT;
|
||||
ItemData itemData = idMap.get(id);
|
||||
itemData.setName(name,modId);
|
||||
}
|
||||
|
||||
public static void buildModObjectTable()
|
||||
{
|
||||
if (modObjectTable != null)
|
||||
{
|
||||
throw new IllegalStateException("Illegal call to buildModObjectTable!");
|
||||
}
|
||||
|
||||
Map<Integer, Cell<String, String, Integer>> map = Maps.transformValues(idMap, new Function<ItemData,Cell<String,String,Integer>>() {
|
||||
public Cell<String,String,Integer> apply(ItemData data)
|
||||
{
|
||||
if ("Minecraft".equals(data.getModId()) || !data.isOveridden())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Tables.immutableCell(data.getModId(), data.getItemType(), data.getItemId());
|
||||
}
|
||||
});
|
||||
|
||||
Builder<String, String, Integer> tBuilder = ImmutableTable.builder();
|
||||
for (Cell<String, String, Integer> c : map.values())
|
||||
{
|
||||
if (c!=null)
|
||||
{
|
||||
tBuilder.put(c);
|
||||
}
|
||||
}
|
||||
modObjectTable = tBuilder.build();
|
||||
}
|
||||
static Item findItem(String modId, String name)
|
||||
{
|
||||
if (modObjectTable == null || !modObjectTable.contains(modId, name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Item.field_77698_e[modObjectTable.get(modId, name)];
|
||||
}
|
||||
|
||||
static Block findBlock(String modId, String name)
|
||||
{
|
||||
if (modObjectTable == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer blockId = modObjectTable.get(modId, name);
|
||||
if (blockId == null || blockId >= Block.field_71973_m.length)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Block.field_71973_m[blockId];
|
||||
}
|
||||
|
||||
static ItemStack findItemStack(String modId, String name)
|
||||
{
|
||||
ItemStack is = customItemStacks.get(modId, name);
|
||||
if (is == null)
|
||||
{
|
||||
Item i = findItem(modId, name);
|
||||
if (i != null)
|
||||
{
|
||||
is = new ItemStack(i, 0 ,0);
|
||||
}
|
||||
}
|
||||
if (is == null)
|
||||
{
|
||||
Block b = findBlock(modId, name);
|
||||
if (b != null)
|
||||
{
|
||||
is = new ItemStack(b, 0, Short.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
static void registerCustomItemStack(String name, ItemStack itemStack)
|
||||
{
|
||||
customItemStacks.put(Loader.instance().activeModContainer().getModId(), name, itemStack);
|
||||
}
|
||||
|
||||
public static void dumpRegistry(File minecraftDir)
|
||||
{
|
||||
if (customItemStacks == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Boolean.valueOf(System.getProperty("fml.dumpRegistry", "false")).booleanValue())
|
||||
{
|
||||
ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
|
||||
for (String modId : customItemStacks.rowKeySet())
|
||||
{
|
||||
builder.putAll(modId, customItemStacks.row(modId).keySet());
|
||||
}
|
||||
|
||||
File f = new File(minecraftDir, "itemStackRegistry.csv");
|
||||
MapJoiner mapJoiner = Joiner.on("\n").withKeyValueSeparator(",");
|
||||
try
|
||||
{
|
||||
Files.write(mapJoiner.join(builder.build().entries()), f, Charsets.UTF_8);
|
||||
FMLLog.log(Level.INFO, "Dumped item registry data to %s", f.getAbsolutePath());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Failed to write registry data to %s", f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static UniqueIdentifier getUniqueName(Block block)
|
||||
{
|
||||
if (block == null) return null;
|
||||
ItemData itemData = idMap.get(block.field_71990_ca);
|
||||
if (itemData == null || !itemData.isOveridden() || customItemStacks.contains(itemData.getModId(), itemData.getItemType()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new UniqueIdentifier(itemData.getModId(), itemData.getItemType());
|
||||
}
|
||||
|
||||
static UniqueIdentifier getUniqueName(Item item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
ItemData itemData = idMap.get(item.field_77779_bT);
|
||||
if (itemData == null || !itemData.isOveridden() || customItemStacks.contains(itemData.getModId(), itemData.getItemType()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new UniqueIdentifier(itemData.getModId(), itemData.getItemType());
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.registry;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.HashMultiset;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multiset;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.LoaderException;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
|
||||
public class ItemData {
|
||||
|
||||
private static Map<String, Multiset<String>> modOrdinals = Maps.newHashMap();
|
||||
private final String modId;
|
||||
private final String itemType;
|
||||
private final int itemId;
|
||||
private final int ordinal;
|
||||
private String forcedModId;
|
||||
private String forcedName;
|
||||
|
||||
public ItemData(Item item, ModContainer mc)
|
||||
{
|
||||
this.itemId = item.field_77779_bT;
|
||||
if (item.getClass().equals(ItemBlock.class))
|
||||
{
|
||||
this.itemType = Block.field_71973_m[this.getItemId()].getClass().getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.itemType = item.getClass().getName();
|
||||
}
|
||||
this.modId = mc.getModId();
|
||||
if (!modOrdinals.containsKey(mc.getModId()))
|
||||
{
|
||||
modOrdinals.put(mc.getModId(), HashMultiset.<String>create());
|
||||
}
|
||||
this.ordinal = modOrdinals.get(mc.getModId()).add(itemType, 1);
|
||||
}
|
||||
|
||||
public ItemData(NBTTagCompound tag)
|
||||
{
|
||||
this.modId = tag.func_74779_i("ModId");
|
||||
this.itemType = tag.func_74779_i("ItemType");
|
||||
this.itemId = tag.func_74762_e("ItemId");
|
||||
this.ordinal = tag.func_74762_e("ordinal");
|
||||
this.forcedModId = tag.func_74764_b("ForcedModId") ? tag.func_74779_i("ForcedModId") : null;
|
||||
this.forcedName = tag.func_74764_b("ForcedName") ? tag.func_74779_i("ForcedName") : null;
|
||||
}
|
||||
|
||||
public String getItemType()
|
||||
{
|
||||
return this.forcedName !=null ? forcedName : itemType;
|
||||
}
|
||||
|
||||
public String getModId()
|
||||
{
|
||||
return this.forcedModId != null ? forcedModId : modId;
|
||||
}
|
||||
|
||||
public int getOrdinal()
|
||||
{
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public int getItemId()
|
||||
{
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public NBTTagCompound toNBT()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.func_74778_a("ModId", modId);
|
||||
tag.func_74778_a("ItemType", itemType);
|
||||
tag.func_74768_a("ItemId", itemId);
|
||||
tag.func_74768_a("ordinal", ordinal);
|
||||
if (forcedModId != null)
|
||||
{
|
||||
tag.func_74778_a("ForcedModId", forcedModId);
|
||||
}
|
||||
if (forcedName != null)
|
||||
{
|
||||
tag.func_74778_a("ForcedName", forcedName);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hashCode(itemId, ordinal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
ItemData other = (ItemData) obj;
|
||||
return Objects.equal(getModId(), other.getModId()) && Objects.equal(getItemType(), other.getItemType()) && Objects.equal(itemId, other.itemId) && ( isOveridden() || Objects.equal(ordinal, other.ordinal));
|
||||
}
|
||||
catch (ClassCastException cce)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("Item %d, Type %s, owned by %s, ordinal %d, name %s, claimedModId %s", itemId, itemType, modId, ordinal, forcedName, forcedModId);
|
||||
}
|
||||
|
||||
public boolean mayDifferByOrdinal(ItemData rightValue)
|
||||
{
|
||||
return Objects.equal(getItemType(), rightValue.getItemType()) && Objects.equal(getModId(), rightValue.getModId());
|
||||
}
|
||||
|
||||
public boolean isOveridden()
|
||||
{
|
||||
return forcedName != null;
|
||||
}
|
||||
|
||||
public void setName(String name, String modId)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
this.forcedName = null;
|
||||
this.forcedModId = null;
|
||||
return;
|
||||
}
|
||||
String localModId = modId;
|
||||
if (modId == null)
|
||||
{
|
||||
localModId = Loader.instance().activeModContainer().getModId();
|
||||
}
|
||||
if (modOrdinals.get(localModId).count(name)>0)
|
||||
{
|
||||
FMLLog.severe("The mod %s is attempting to redefine the item at id %d with a non-unique name (%s.%s)", Loader.instance().activeModContainer(), itemId, localModId, name);
|
||||
throw new LoaderException();
|
||||
}
|
||||
modOrdinals.get(localModId).add(name);
|
||||
this.forcedModId = modId;
|
||||
this.forcedName = name;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.common.registry;
|
||||
|
||||
public interface ItemProxy
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Forge Mod Loader
|
||||
* Copyright (c) 2012-2013 cpw.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributors:
|
||||
* cpw - implementation
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.relauncher;
|
||||
|
||||
/**
|
||||
* Interface for certain core plugins to register libraries to
|
||||
* be loaded in by the FML class loader at launch time
|
||||
* Deprecated without replacement.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public interface ILibrarySet
|
||||
{
|
||||
/**
|
||||
* Return a list of libraries available from a common location
|
||||
*
|
||||
* @return a list of libraries available from a common location
|
||||
*/
|
||||
String[] getLibraries();
|
||||
/**
|
||||
* Return the string encoded sha1 hash for each library in the returned list
|
||||
*
|
||||
* @return the string encoded sha1 hash for each library in the returned list
|
||||
*/
|
||||
String[] getHashes();
|
||||
/**
|
||||
* Return the root URL format string from which this library set can be obtained
|
||||
* There needs to be a single %s string substitution which is the library name
|
||||
* @return the root URL format string from which this library set can be obtained
|
||||
*/
|
||||
String getRootURL();
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
#Main FML Access Transformer configuration file
|
||||
# TileEntity addMapping
|
||||
public asp.a(Ljava/lang/Class;Ljava/lang/String;)V #MD:TileEntity/func_70306_a
|
||||
# EntityList addMappings
|
||||
public nt.a(Ljava/lang/Class;Ljava/lang/String;I)V #MD:EntityList/func_75618_a
|
||||
public nt.a(Ljava/lang/Class;Ljava/lang/String;III)V #MD:EntityList/func_75614_a
|
||||
public nt.b #FD:EntityList/field_75625_b #nameToClassMap
|
||||
public nt.c #FD:EntityList/field_75626_c #classToNameMap
|
||||
public nt.d #FD:EntityList/field_75623_d #idToClassMap
|
||||
# RenderEngine
|
||||
#public bba.h #FD:RenderEngine/field_78367_h #textureList # -- MISSING MAPPING # -- MISSING MAPPING
|
||||
#public bge.g #FD:RenderEngine/field_78366_k #texturePack # -- MISSING MAPPING
|
||||
# RenderManager
|
||||
public bgl.q #FD:RenderManager/field_78729_o #renderers
|
||||
# RenderBlocks - everything
|
||||
public bfr.* #FD:RenderBlocks/*
|
||||
public bfr.*() #MD:RenderBlocks/*
|
||||
#RenderPlayer
|
||||
#public-f bht.h #FD:RenderPlayer/field_77110_j #armorlist # -- MISSING MAPPING
|
||||
#RenderBiped
|
||||
public-f bgu.l #FD:RenderBiped/field_82424_k #armorlist
|
||||
#StringTranslate
|
||||
#public bp.b #FD:StringTranslate/field_74815_b # -- MISSING MAPPING
|
||||
#public bp.e #FD:StringTranslate/field_74813_d # -- MISSING MAPPING
|
||||
# TileEntityRenderer
|
||||
public bjd.m #FD:TileEntityRenderer/field_76966_m
|
||||
# CraftingManager - make the add recipe methods public
|
||||
public aaf.a(Lye;[Ljava/lang/Object;)Laai; #MD:CraftingManager/func_92103_a
|
||||
public aaf.b(Lye;[Ljava/lang/Object;)V #MD:CraftingManager/func_77596_b
|
||||
# WeightedRandomItem
|
||||
public mj.a #FD:WeightedRandomItem/field_76292_a #probability
|
||||
# ItemStack
|
||||
#public+f tv.c #FD:ItemStack/field_77993_c #itemId
|
||||
# StatBase
|
||||
public ku.a #FD:StatBase/field_75978_a #statName
|
||||
# NetLoginHandler
|
||||
public jy.a(Ljy;Z)Z #MD:NetLoginHandler/func_72531_a #'complete connection'
|
||||
public jy.g #FD:NetLoginHandler/field_72543_h #userName
|
||||
# EntityPlayerMP getNextWindowId
|
||||
public jv.bN()V #MD:EntityPlayerMP/func_71117_bO
|
||||
public jv.bY #FD:EntityPlayerMP/field_71139_cq
|
||||
# EntityAITaskEntry
|
||||
public pu #CL:EntityAITaskEntry
|
||||
# EntityAITasks
|
||||
public pt.a #FD:EntityAITasks/field_75782_a #taskList
|
||||
# BlockChest
|
||||
public ank.m(Labw;III)Z #MD:BlockChest/func_72292_n #isOcelotBlockingChest
|
||||
# EntityLiving
|
||||
#public ng.aU #FD:EntityLiving/field_70736_aM #carryoverDamage # -- MISSING MAPPING
|
||||
public og.c #FD:EntityLiving/field_70714_bg #tasks
|
||||
#public ng.bG #FD:EntityLiving/field_70703_bu #isJumping # -- MISSING MAPPING
|
||||
# EntityAIOcelotSit
|
||||
protected qg.a(Labw;III)Z #MD:EntityAIOcelotSit/func_75398_a #nearestSittableBlock
|
||||
protected qg.f()Z #MD:EntityAIOcelotSit/func_75399_f #isblocksittable
|
||||
# CallableMinecraftVersion - sanity check the MC version
|
||||
public c #CL:CallableMinecraftVersion
|
||||
public c.<init>(Lb;)V #MD:CallableMinecraftVersion/<init>(Lnet/minecraft/src/CrashReport;) #constructor
|
||||
# EntityAnimal
|
||||
public rp.bp #FD:EntityAnimal/field_70881_d #inLove
|
||||
# WorldType
|
||||
public acg.<init>(ILjava/lang/String;)V #MD:WorldType/<init>(ILjava/lang/String;)
|
||||
public acg.<init>(ILjava/lang/String;I)V #MD:WorldType/<init>(ILjava/lang/String;I)
|
||||
# ComponentVillage
|
||||
public ajm #CL:ComponentVillage
|
||||
# StructureStart
|
||||
public aiv.a #FD:StructureStart/field_75075_a
|
||||
# EntityVillager - minmax lists
|
||||
public ub.a(Labm;ILjava/util/Random;F)V #MD:EntityVillager/func_70948_a #addBuy
|
||||
public ub.b(Labm;ILjava/util/Random;F)V #MD:EntityVillager/func_70949_b #addSell
|
||||
public ub.bB #FD:EntityVillager/field_70958_bB
|
||||
public ub.bC #FD:EntityVillager/field_70960_bC
|
||||
# GuiButtonMerchant
|
||||
public axx #CL:GuiButtonMerchant
|
||||
|
||||
protected aux.a #FD:GuiYesNo/field_73942_a #guiScreen
|
||||
# Minecraft
|
||||
public atv.D #FD:Minecraft/field_71425_J #running
|
||||
public atv.N #FD:Minecraft/field_71446_o # textureManager
|
||||
@@ -1,12 +0,0 @@
|
||||
# Marker interfaces to add to minecraft - helps in bukkit and client/server unification
|
||||
# Only runs at runtime because it's not necessary at compile time
|
||||
# has deobf and obf mappings so it runs OK in mcp
|
||||
# entityplayer -> network/player
|
||||
uf cpw/mods/fml/common/network/Player
|
||||
net.minecraft.entity.player.EntityPlayer cpw/mods/fml/common/network/Player
|
||||
# block -> blockproxy
|
||||
aqz cpw/mods/fml/common/registry/BlockProxy
|
||||
net.minecraft.block.Block cpw/mods/fml/common/registry/BlockProxy
|
||||
# item -> itemproxy
|
||||
yc cpw/mods/fml/common/registry/ItemProxy
|
||||
net.minecraft.item.Item cpw/mods/fml/common/registry/ItemProxy
|
||||
+8690
File diff suppressed because it is too large.
Load diff
+365
-44
@@ -2361,35 +2361,23 @@ field_74885_f,coordBaseMode,2,switches the Coordinate System base off the Boundi
|
||||
field_74886_g,componentType,2,The type ID of this component.
|
||||
field_74887_e,boundingBox,2,
|
||||
field_74896_a,villagersSpawned,2,The number of villagers that have been spawned in this component.
|
||||
field_74897_k,startPiece,0,The starting piece of the village.
|
||||
field_74897_k,startPiece,1,The starting piece of the village.
|
||||
field_74899_a,averageGroundLevel,0,
|
||||
field_74899_a,averageGroundLevel,1,
|
||||
field_74901_a,averageGroundLevel,0,
|
||||
field_74901_a,averageGroundLevel,1,
|
||||
field_74903_a,averageGroundLevel,0,
|
||||
field_74903_a,averageGroundLevel,1,
|
||||
field_74905_a,averageGroundLevel,0,
|
||||
field_74905_a,averageGroundLevel,1,
|
||||
field_74907_a,averageGroundLevel,0,
|
||||
field_74907_a,averageGroundLevel,1,
|
||||
field_74897_k,startPiece,2,The starting piece of the village.
|
||||
field_74899_a,averageGroundLevel,2,
|
||||
field_74901_a,averageGroundLevel,2,
|
||||
field_74903_a,averageGroundLevel,2,
|
||||
field_74905_a,averageGroundLevel,2,
|
||||
field_74907_a,averageGroundLevel,2,
|
||||
field_74909_b,isTallHouse,2,
|
||||
field_74910_c,tablePosition,2,
|
||||
field_74911_a,averageGroundLevel,0,
|
||||
field_74911_a,averageGroundLevel,1,
|
||||
field_74911_a,averageGroundLevel,2,
|
||||
field_74913_b,isRoofAccessible,2,
|
||||
field_74914_a,averageGroundLevel,0,
|
||||
field_74914_a,averageGroundLevel,1,
|
||||
field_74916_b,averageGroundLevel,0,
|
||||
field_74916_b,averageGroundLevel,1,
|
||||
field_74914_a,averageGroundLevel,2,
|
||||
field_74916_b,averageGroundLevel,2,
|
||||
field_74917_c,hasMadeChest,2,
|
||||
field_74918_a,villageBlacksmithChestContents,2,List of items that Village's Blacksmith chest can contain.
|
||||
field_74920_a,averageGroundLevel,0,
|
||||
field_74920_a,averageGroundLevel,1,
|
||||
field_74922_a,averageGroundLevel,0,
|
||||
field_74922_a,averageGroundLevel,1,
|
||||
field_74923_b,averageGroundLevel,0,
|
||||
field_74923_b,averageGroundLevel,1,
|
||||
field_74920_a,averageGroundLevel,2,
|
||||
field_74922_a,averageGroundLevel,2,
|
||||
field_74923_b,averageGroundLevel,2,
|
||||
field_74926_d,structVillagePieceWeight,2,
|
||||
field_74927_b,inDesert,2,Boolean that determines if the village is in a desert or not.
|
||||
field_74928_c,terrainType,2,"World terrain type, 0 for normal, 1 for flap map"
|
||||
@@ -2415,35 +2403,26 @@ field_74969_c,secondaryWeights,2,Contains the list of valid piece weights for th
|
||||
field_74970_a,theNetherBridgePieceWeight,2,Instance of StructureNetherBridgePieceWeight.
|
||||
field_74972_a,fillSeed,2,
|
||||
field_74976_a,hasSpawner,2,
|
||||
field_74998_a,doorType,0,
|
||||
field_74998_a,doorType,1,
|
||||
field_75001_b,doorType,0,
|
||||
field_75001_b,doorType,1,
|
||||
field_74998_a,doorType,2,
|
||||
field_75001_b,doorType,2,
|
||||
field_75002_c,hasMadeChest,2,
|
||||
field_75003_a,strongholdChestContents,2,List of items that Stronghold chests can contain.
|
||||
field_75005_a,hasSpawner,2,
|
||||
field_75007_b,strongholdLibraryChestContents,2,List of items that Stronghold Library chests can contain.
|
||||
field_75008_c,isLargeRoom,2,
|
||||
field_75009_a,doorType,0,
|
||||
field_75009_a,doorType,1,
|
||||
field_75011_a,doorType,0,
|
||||
field_75011_a,doorType,1,
|
||||
field_75009_a,doorType,2,
|
||||
field_75011_a,doorType,2,
|
||||
field_75013_b,roomType,2,
|
||||
field_75014_c,strongholdRoomCrossingChestContents,2,Items that could generate in the chest that is located in Stronghold Room Crossing.
|
||||
field_75015_a,doorType,0,
|
||||
field_75015_a,doorType,1,
|
||||
field_75017_a,doorType,0,
|
||||
field_75017_a,doorType,1,
|
||||
field_75015_a,doorType,2,
|
||||
field_75017_a,doorType,2,
|
||||
field_75019_b,expandsX,2,
|
||||
field_75020_c,expandsZ,2,
|
||||
field_75021_a,doorType,0,
|
||||
field_75021_a,doorType,1,
|
||||
field_75023_b,doorType,0,
|
||||
field_75023_b,doorType,1,
|
||||
field_75021_a,doorType,2,
|
||||
field_75023_b,doorType,2,
|
||||
field_75025_b,strongholdPortalRoom,2,
|
||||
field_75027_a,strongholdPieceWeight,2,
|
||||
field_75029_a,doorType,0,
|
||||
field_75029_a,doorType,1,
|
||||
field_75029_a,doorType,2,
|
||||
field_75038_b,rand,2,The RNG used by the MapGen classes.
|
||||
field_75039_c,worldObj,2,This world object.
|
||||
field_75040_a,range,2,The number of Chunks to gen-check in any given direction.
|
||||
@@ -3807,8 +3786,8 @@ field_77929_j,glowstoneEffect,2,
|
||||
field_77930_k,gunpowderEffect,2,
|
||||
field_77931_h,magmaCreamEffect,2,
|
||||
field_77932_i,redstoneEffect,2,
|
||||
field_77934_f,rarityName,0,Rarity name.
|
||||
field_77937_e,rarityColor,0,A decimal representation of the hex color codes of a the color assigned to this rarity type. (13 becomes d as in \247d which is light purple)
|
||||
field_77934_f,rarityName,2,Rarity name.
|
||||
field_77937_e,rarityColor,2,A decimal representation of the hex color codes of a the color assigned to this rarity type. (13 becomes d as in \247d which is light purple)
|
||||
field_77990_d,stackTagCompound,2,A NBTTagMap containing data about an ItemStack. Can only be used for non stackable items
|
||||
field_77991_e,itemDamage,2,Damage dealt to the item or number of use. Raise when using items.
|
||||
field_77992_b,animationsToGo,2,"Number of animation frames to go when receiving an item (by walking into it, for example)."
|
||||
@@ -4941,3 +4920,345 @@ field_98294_i,spawnCount,2,A counter for spawn tries.
|
||||
field_98295_a,mobSpawnerEntity,2,The mob spawner we deal with
|
||||
field_98296_a,spawnerMinecart,2,The spawner minecart using this mob spawner logic.
|
||||
field_98303_au,AMBIENT_OCCLUSIONS,0,
|
||||
field_150350_a,air,2,
|
||||
field_150348_b,stone,2,
|
||||
field_150349_c,grass,2,
|
||||
field_150346_d,dirt,2,
|
||||
field_150347_e,cobblestone,2,
|
||||
field_150344_f,planks,2,
|
||||
field_150345_g,sapling,2,
|
||||
field_150357_h,bedrock,2,
|
||||
field_150358_i,flowing_water,2,
|
||||
field_150355_j,water,2,
|
||||
field_150356_k,flowing_lava,2,
|
||||
field_150353_l,lava,2,
|
||||
field_150354_m,sand,2,
|
||||
field_150351_n,gravel,2,
|
||||
field_150352_o,gold_ore,2,
|
||||
field_150366_p,iron_ore,2,
|
||||
field_150365_q,coal_ore,2,
|
||||
field_150364_r,log,2,
|
||||
field_150363_s,log2,2,
|
||||
field_150362_t,leaves,2,
|
||||
field_150361_u,leaves2,2,
|
||||
field_150360_v,sponge,2,
|
||||
field_150359_w,glass,2,
|
||||
field_150369_x,lapis_ore,2,
|
||||
field_150368_y,lapis_block,2,
|
||||
field_150367_z,dispenser,2,
|
||||
field_150322_A,sandstone,2,
|
||||
field_150323_B,noteblock,2,
|
||||
field_150324_C,bed,2,
|
||||
field_150318_D,golden_rail,2,
|
||||
field_150319_E,detector_rail,2,
|
||||
field_150320_F,sticky_piston,2,
|
||||
field_150321_G,web,2,
|
||||
field_150329_H,tallgrass,2,
|
||||
field_150330_I,deadbush,2,
|
||||
field_150331_J,piston,2,
|
||||
field_150332_K,piston_head,2,
|
||||
field_150325_L,wool,2,
|
||||
field_150326_M,piston_extension,2,
|
||||
field_150327_N,yellow_flower,2,
|
||||
field_150328_O,red_flower,2,
|
||||
field_150338_P,brown_mushroom,2,
|
||||
field_150337_Q,red_mushroom,2,
|
||||
field_150340_R,gold_block,2,
|
||||
field_150339_S,iron_block,2,
|
||||
field_150334_T,double_stone_slab,2,
|
||||
field_150333_U,stone_slab,2,
|
||||
field_150336_V,brick_block,2,
|
||||
field_150335_W,tnt,2,
|
||||
field_150342_X,bookshelf,2,
|
||||
field_150341_Y,mossy_cobblestone,2,
|
||||
field_150343_Z,obsidian,2,
|
||||
field_150478_aa,torch,2,
|
||||
field_150480_ab,fire,2,
|
||||
field_150474_ac,mob_spawner,2,
|
||||
field_150476_ad,oak_stairs,2,
|
||||
field_150486_ae,chest,2,
|
||||
field_150488_af,redstone_wire,2,
|
||||
field_150482_ag,diamond_ore,2,
|
||||
field_150484_ah,diamond_block,2,
|
||||
field_150462_ai,crafting_table,2,
|
||||
field_150464_aj,wheat,2,
|
||||
field_150458_ak,farmland,2,
|
||||
field_150460_al,furnace,2,
|
||||
field_150470_am,lit_furnace,2,
|
||||
field_150472_an,standing_sign,2,
|
||||
field_150466_ao,wooden_door,2,
|
||||
field_150468_ap,ladder,2,
|
||||
field_150448_aq,rail,2,
|
||||
field_150446_ar,stone_stairs,2,
|
||||
field_150444_as,wall_sign,2,
|
||||
field_150442_at,lever,2,
|
||||
field_150456_au,stone_pressure_plate,2,
|
||||
field_150454_av,iron_door,2,
|
||||
field_150452_aw,wooden_pressure_plate,2,
|
||||
field_150450_ax,redstone_ore,2,
|
||||
field_150439_ay,lit_redstone_ore,2,
|
||||
field_150437_az,unlit_redstone_torch,2,
|
||||
field_150429_aA,redstone_torch,2,
|
||||
field_150430_aB,stone_button,2,
|
||||
field_150431_aC,snow_layer,2,
|
||||
field_150432_aD,ice,2,
|
||||
field_150433_aE,snow,2,
|
||||
field_150434_aF,cactus,2,
|
||||
field_150435_aG,clay,2,
|
||||
field_150436_aH,reeds,2,
|
||||
field_150421_aI,jukebox,2,
|
||||
field_150422_aJ,fence,2,
|
||||
field_150423_aK,pumpkin,2,
|
||||
field_150424_aL,netherrack,2,
|
||||
field_150425_aM,soul_sand,2,
|
||||
field_150426_aN,glowstone,2,
|
||||
field_150427_aO,portal,2,
|
||||
field_150428_aP,lit_pumpkin,2,
|
||||
field_150414_aQ,cake,2,
|
||||
field_150413_aR,unpowered_repeater,2,
|
||||
field_150416_aS,powered_repeater,2,
|
||||
field_150415_aT,trapdoor,2,
|
||||
field_150418_aU,monster_egg,2,
|
||||
field_150417_aV,stonebrick,2,
|
||||
field_150420_aW,brown_mushroom_block,2,
|
||||
field_150419_aX,red_mushroom_block,2,
|
||||
field_150411_aY,iron_bars,2,
|
||||
field_150410_aZ,glass_pane,2,
|
||||
field_150440_ba,melon_block,2,
|
||||
field_150393_bb,pumpkin_stem,2,
|
||||
field_150394_bc,melon_stem,2,
|
||||
field_150395_bd,vine,2,
|
||||
field_150396_be,fence_gate,2,
|
||||
field_150389_bf,brick_stairs,2,
|
||||
field_150390_bg,stone_brick_stairs,2,
|
||||
field_150391_bh,mycelium,2,
|
||||
field_150392_bi,waterlily,2,
|
||||
field_150385_bj,nether_brick,2,
|
||||
field_150386_bk,nether_brick_fence,2,
|
||||
field_150387_bl,nether_brick_stairs,2,
|
||||
field_150388_bm,nether_wart,2,
|
||||
field_150381_bn,enchanting_table,2,
|
||||
field_150382_bo,brewing_stand,2,
|
||||
field_150383_bp,cauldron,2,
|
||||
field_150384_bq,end_portal,2,
|
||||
field_150378_br,end_portal_frame,2,
|
||||
field_150377_bs,end_stone,2,
|
||||
field_150380_bt,dragon_egg,2,
|
||||
field_150379_bu,redstone_lamp,2,
|
||||
field_150374_bv,lit_redstone_lamp,2,
|
||||
field_150373_bw,double_wooden_slab,2,
|
||||
field_150376_bx,wooden_slab,2,
|
||||
field_150375_by,cocoa,2,
|
||||
field_150372_bz,sandstone_stairs,2,
|
||||
field_150412_bA,emerald_ore,2,
|
||||
field_150477_bB,ender_chest,2,
|
||||
field_150479_bC,tripwire_hook,2,
|
||||
field_150473_bD,tripwire,2,
|
||||
field_150475_bE,emerald_block,2,
|
||||
field_150485_bF,spruce_stairs,2,
|
||||
field_150487_bG,birch_stairs,2,
|
||||
field_150481_bH,jungle_stairs,2,
|
||||
field_150483_bI,command_block,2,
|
||||
field_150461_bJ,beacon,2,
|
||||
field_150463_bK,cobblestone_wall,2,
|
||||
field_150457_bL,flower_pot,2,
|
||||
field_150459_bM,carrots,2,
|
||||
field_150469_bN,potatoes,2,
|
||||
field_150471_bO,wooden_button,2,
|
||||
field_150465_bP,skull,2,
|
||||
field_150467_bQ,anvil,2,
|
||||
field_150447_bR,trapped_chest,2,
|
||||
field_150445_bS,light_weighted_pressure_plate,2,
|
||||
field_150443_bT,heavy_weighted_pressure_plate,2,
|
||||
field_150441_bU,unpowered_comparator,2,
|
||||
field_150455_bV,powered_comparator,2,
|
||||
field_150453_bW,daylight_detector,2,
|
||||
field_150451_bX,redstone_block,2,
|
||||
field_150449_bY,quartz_ore,2,
|
||||
field_150438_bZ,hopper,2,
|
||||
field_150371_ca,quartz_block,2,
|
||||
field_150370_cb,quartz_stairs,2,
|
||||
field_150408_cc,activator_rail,2,
|
||||
field_150409_cd,dropper,2,
|
||||
field_150406_ce,stained_hardened_clay,2,
|
||||
field_150407_cf,hay_block,2,
|
||||
field_150404_cg,carpet,2,
|
||||
field_150405_ch,hardened_clay,2,
|
||||
field_150402_ci,coal_block,2,
|
||||
field_150403_cj,packed_ice,2,
|
||||
field_150400_ck,acacia_stairs,2,
|
||||
field_150401_cl,dark_oak_stairs,2,
|
||||
field_150398_cm,double_plant,2,
|
||||
field_150399_cn,stained_glass,2,
|
||||
field_150397_co,stained_glass_pane,2,
|
||||
field_151037_a,iron_shovel,2,
|
||||
field_151035_b,iron_pickaxe,2,
|
||||
field_151036_c,iron_axe,2,
|
||||
field_151033_d,flint_and_steel,2,
|
||||
field_151034_e,apple,2,
|
||||
field_151031_f,bow,2,
|
||||
field_151032_g,arrow,2,
|
||||
field_151044_h,coal,2,
|
||||
field_151045_i,diamond,2,
|
||||
field_151042_j,iron_ingot,2,
|
||||
field_151043_k,gold_ingot,2,
|
||||
field_151040_l,iron_sword,2,
|
||||
field_151041_m,wooden_sword,2,
|
||||
field_151038_n,wooden_shovel,2,
|
||||
field_151039_o,wooden_pickaxe,2,
|
||||
field_151053_p,wooden_axe,2,
|
||||
field_151052_q,stone_sword,2,
|
||||
field_151051_r,stone_shovel,2,
|
||||
field_151050_s,stone_pickaxe,2,
|
||||
field_151049_t,stone_axe,2,
|
||||
field_151048_u,diamond_sword,2,
|
||||
field_151047_v,diamond_shovel,2,
|
||||
field_151046_w,diamond_pickaxe,2,
|
||||
field_151056_x,diamond_axe,2,
|
||||
field_151055_y,stick,2,
|
||||
field_151054_z,bowl,2,
|
||||
field_151009_A,mushroom_stew,2,
|
||||
field_151010_B,golden_sword,2,
|
||||
field_151011_C,golden_shovel,2,
|
||||
field_151005_D,golden_pickaxe,2,
|
||||
field_151006_E,golden_axe,2,
|
||||
field_151007_F,string,2,
|
||||
field_151008_G,feather,2,
|
||||
field_151016_H,gunpowder,2,
|
||||
field_151017_I,wooden_hoe,2,
|
||||
field_151018_J,stone_hoe,2,
|
||||
field_151019_K,iron_hoe,2,
|
||||
field_151012_L,diamond_hoe,2,
|
||||
field_151013_M,golden_hoe,2,
|
||||
field_151014_N,wheat_seeds,2,
|
||||
field_151015_O,wheat,2,
|
||||
field_151025_P,bread,2,
|
||||
field_151024_Q,leather_helmet,2,
|
||||
field_151027_R,leather_chestplate,2,
|
||||
field_151026_S,leather_leggings,2,
|
||||
field_151021_T,leather_boots,2,
|
||||
field_151020_U,chainmail_helmet,2,
|
||||
field_151023_V,chainmail_chestplate,2,
|
||||
field_151022_W,chainmail_leggings,2,
|
||||
field_151029_X,chainmail_boots,2,
|
||||
field_151028_Y,iron_helmet,2,
|
||||
field_151030_Z,iron_chestplate,2,
|
||||
field_151165_aa,iron_leggings,2,
|
||||
field_151167_ab,iron_boots,2,
|
||||
field_151161_ac,diamond_helmet,2,
|
||||
field_151163_ad,diamond_chestplate,2,
|
||||
field_151173_ae,diamond_leggings,2,
|
||||
field_151175_af,diamond_boots,2,
|
||||
field_151169_ag,golden_helmet,2,
|
||||
field_151171_ah,golden_chestplate,2,
|
||||
field_151149_ai,golden_leggings,2,
|
||||
field_151151_aj,golden_boots,2,
|
||||
field_151145_ak,flint,2,
|
||||
field_151147_al,porkchop,2,
|
||||
field_151157_am,cooked_porkchop,2,
|
||||
field_151159_an,painting,2,
|
||||
field_151153_ao,golden_apple,2,
|
||||
field_151155_ap,sign,2,
|
||||
field_151135_aq,wooden_door,2,
|
||||
field_151133_ar,bucket,2,
|
||||
field_151131_as,water_bucket,2,
|
||||
field_151129_at,lava_bucket,2,
|
||||
field_151143_au,minecart,2,
|
||||
field_151141_av,saddle,2,
|
||||
field_151139_aw,iron_door,2,
|
||||
field_151137_ax,redstone,2,
|
||||
field_151126_ay,snowball,2,
|
||||
field_151124_az,boat,2,
|
||||
field_151116_aA,leather,2,
|
||||
field_151117_aB,milk_bucket,2,
|
||||
field_151118_aC,brick,2,
|
||||
field_151119_aD,clay_ball,2,
|
||||
field_151120_aE,reeds,2,
|
||||
field_151121_aF,paper,2,
|
||||
field_151122_aG,book,2,
|
||||
field_151123_aH,slime_ball,2,
|
||||
field_151108_aI,chest_minecart,2,
|
||||
field_151109_aJ,furnace_minecart,2,
|
||||
field_151110_aK,egg,2,
|
||||
field_151111_aL,compass,2,
|
||||
field_151112_aM,fishing_rod,2,
|
||||
field_151113_aN,clock,2,
|
||||
field_151114_aO,glowstone_dust,2,
|
||||
field_151115_aP,fish,2,
|
||||
field_151101_aQ,cooked_fished,2,
|
||||
field_151100_aR,dye,2,
|
||||
field_151103_aS,bone,2,
|
||||
field_151102_aT,sugar,2,
|
||||
field_151105_aU,cake,2,
|
||||
field_151104_aV,bed,2,
|
||||
field_151107_aW,repeater,2,
|
||||
field_151106_aX,cookie,2,
|
||||
field_151098_aY,filled_map,2,
|
||||
field_151097_aZ,shears,2,
|
||||
field_151127_ba,melon,2,
|
||||
field_151080_bb,pumpkin_seeds,2,
|
||||
field_151081_bc,melon_seeds,2,
|
||||
field_151082_bd,beef,2,
|
||||
field_151083_be,cooked_beef,2,
|
||||
field_151076_bf,chicken,2,
|
||||
field_151077_bg,cooked_chicken,2,
|
||||
field_151078_bh,rotten_flesh,2,
|
||||
field_151079_bi,ender_pearl,2,
|
||||
field_151072_bj,blaze_rod,2,
|
||||
field_151073_bk,ghast_tear,2,
|
||||
field_151074_bl,gold_nugget,2,
|
||||
field_151075_bm,nether_wart,2,
|
||||
field_151068_bn,potionitem,2,
|
||||
field_151069_bo,glass_bottle,2,
|
||||
field_151070_bp,spider_eye,2,
|
||||
field_151071_bq,fermented_spider_eye,2,
|
||||
field_151065_br,blaze_powder,2,
|
||||
field_151064_bs,magma_cream,2,
|
||||
field_151067_bt,brewing_stand,2,
|
||||
field_151066_bu,cauldron,2,
|
||||
field_151061_bv,ender_eye,2,
|
||||
field_151060_bw,speckled_melon,2,
|
||||
field_151063_bx,spawn_egg,2,
|
||||
field_151062_by,experience_bottle,2,
|
||||
field_151059_bz,fire_charge,2,
|
||||
field_151099_bA,writable_book,2,
|
||||
field_151164_bB,written_book,2,
|
||||
field_151166_bC,emerald,2,
|
||||
field_151160_bD,item_frame,2,
|
||||
field_151162_bE,flower_pot,2,
|
||||
field_151172_bF,carrot,2,
|
||||
field_151174_bG,potato,2,
|
||||
field_151168_bH,baked_potato,2,
|
||||
field_151170_bI,poisonous_potato,2,
|
||||
field_151148_bJ,map,2,
|
||||
field_151150_bK,golden_carrot,2,
|
||||
field_151144_bL,skull,2,
|
||||
field_151146_bM,carrot_on_a_stick,2,
|
||||
field_151156_bN,nether_star,2,
|
||||
field_151158_bO,pumpkin_pie,2,
|
||||
field_151152_bP,fireworks,2,
|
||||
field_151154_bQ,firework_charge,2,
|
||||
field_151134_bR,enchanted_book,2,
|
||||
field_151132_bS,comparator,2,
|
||||
field_151130_bT,netherbrick,2,
|
||||
field_151128_bU,quartz,2,
|
||||
field_151142_bV,tnt_minecart,2,
|
||||
field_151140_bW,hopper_minecart,2,
|
||||
field_151138_bX,iron_horse_armor,2,
|
||||
field_151136_bY,golden_horse_armor,2,
|
||||
field_151125_bZ,diamond_horse_armor,2,
|
||||
field_151058_ca,lead,2,
|
||||
field_151057_cb,name_tag,2,
|
||||
field_151095_cc,command_block_minecart,2,
|
||||
field_151096_cd,record_13,2,
|
||||
field_151093_ce,record_cat,2,
|
||||
field_151094_cf,record_blocks,2,
|
||||
field_151091_cg,record_chirp,2,
|
||||
field_151092_ch,record_far,2,
|
||||
field_151089_ci,record_mall,2,
|
||||
field_151090_cj,record_mellohi,2,
|
||||
field_151087_ck,record_stal,2,
|
||||
field_151088_cl,record_strad,2,
|
||||
field_151085_cm,record_ward,2,
|
||||
field_151086_cn,record_11,2,
|
||||
field_151084_co,record_wait,2,
|
||||
|
+16645
-12930
File diff suppressed because it is too large.
Load diff
+21401
-18738
File diff suppressed because it is too large.
Load diff
+19
-17
@@ -22,8 +22,8 @@ Params = %(DirConf)s/params.csv
|
||||
NewIds = %(DirConf)s/newids.csv
|
||||
|
||||
[SRGS]
|
||||
ConfClient = %(DirConf)s/packaged.srg
|
||||
ConfServer = %(DirConf)s/packaged.srg
|
||||
ConfClient = %(DirConf)s/client.srg
|
||||
ConfServer = %(DirConf)s/server.srg
|
||||
Client = %(DirTemp)s/client_rg.srg
|
||||
Server = %(DirTemp)s/server_rg.srg
|
||||
DeobfClient = %(DirTemp)s/client_deobf.srg
|
||||
@@ -38,8 +38,8 @@ DirNatives = %(DirJars)s/bin/natives
|
||||
Client = %(DirJars)s/bin/minecraft.jar
|
||||
Server = %(DirJars)s/minecraft_server.jar
|
||||
LWJGL = %(DirJars)s/bin/jinput.jar,%(DirJars)s/bin/lwjgl.jar,%(DirJars)s/bin/lwjgl_util.jar
|
||||
MD5Client = 2e5044f5359e82245551167a237f3167
|
||||
MD5Server = ba3145656b1480122bd8759cecd7b7a1
|
||||
MD5Client = 7a304554fdea879a799efe6eaedd8c95
|
||||
MD5Server = c48168f463e935262ea65b702f175153
|
||||
|
||||
[RETROGUARD]
|
||||
Location = %(DirRuntime)s/bin/retroguard.jar
|
||||
@@ -58,8 +58,10 @@ ServerDeobLog = %(DirLogs)s/server_deob.log
|
||||
NullPkg = net/minecraft/src
|
||||
|
||||
[EXCEPTOR]
|
||||
XClientCfg = %(DirConf)s/packaged.exc
|
||||
XServerCfg = %(DirConf)s/packaged.exc
|
||||
XClientJson = %(DirConf)s/exceptor.json
|
||||
XServerJson = %(DirConf)s/exceptor.json
|
||||
XClientCfg = %(DirConf)s/joined.exc
|
||||
XServerCfg = %(DirConf)s/joined.exc
|
||||
XClientOut = %(DirTemp)s/minecraft_exc.jar
|
||||
XServerOut = %(DirTemp)s/minecraft_server_exc.jar
|
||||
XClientLog = %(DirLogs)s/client_exc.log
|
||||
@@ -96,11 +98,11 @@ BinClient = %(DirBin)s/minecraft
|
||||
BinServer = %(DirBin)s/minecraft_server
|
||||
LogClient = %(DirLogs)s/client_compile.log
|
||||
LogServer = %(DirLogs)s/server_compile.log
|
||||
ClassPathClient =
|
||||
ClassPathServer =
|
||||
ClassPathClient = %(DirLib)s/,%(DirLib)s/*,%(DirJars)s/bin/minecraft.jar,%(DirJars)s/bin/jinput.jar,%(DirJars)s/bin/lwjgl.jar,%(DirJars)s/bin/lwjgl_util.jar
|
||||
ClassPathServer = %(DirLib)s/,%(DirLib)s/*,%(DirJars)s/minecraft_server.jar
|
||||
ClientFixes = %(DirConf)s/patches
|
||||
FixStart = Start
|
||||
IgnorePkg = paulscode,com,isom,ibxm,de/matthiasmann/twl,org,javax/xml,javax/ws,argo
|
||||
IgnorePkg = paulscode,com,isom,ibxm,de/matthiasmann/twl,org,javax,argo,gnu,io/netty
|
||||
|
||||
[REOBF]
|
||||
MD5Client = %(DirTemp)s/client.md5
|
||||
@@ -125,10 +127,10 @@ OutSRCServer = %(DirModSrc)s/minecraft_server
|
||||
[MCP]
|
||||
LogFile = %(DirLogs)s/mcp.log
|
||||
LogFileErr = %(DirLogs)s/mcperr.log
|
||||
UpdateUrl =
|
||||
UpdateUrl = http://mcp.ocean-labs.de/files/mcprolling_{version}/
|
||||
IgnoreUpdate = %(DirBin)s,%(DirLib)s,%(DirLogs)s,%(DirModSrc)s,%(DirReobf)s,%(DirSrc)s,%(DirTemp)s,%(DirEclipse)s/Client/bin,%(DirEclipse)s/Server/bin,%(DirJars)s/world,%(DirJars)s/saves,%(DirJars)s/resources
|
||||
RGIndex = 143000
|
||||
ParamIndex = 43000
|
||||
RGIndex = 145000
|
||||
ParamIndex = 45000
|
||||
|
||||
[ASTYLE]
|
||||
AstyleConfig = %(DirConf)s/astyle.cfg
|
||||
@@ -155,9 +157,9 @@ CmdRGReobf = %s -cp "{classpath}" RetroGuard -notch {conffile}
|
||||
CmdSS = %s -cp "{classpath}" -jar %s -i {injar} -o {outjar} -m {mapfile} --kill-source
|
||||
CmdSSReobf = %s -cp "{classpath}" -jar %s -i {injar} -o {outjar} -r -m {mapfile} -d {identifier} -e %s
|
||||
CmdJadretro = %s -jar %s {targetdir}
|
||||
CmdFernflower = %s -Xmx512M -jar %s -din=0 -rbr=0 -dgs=1 -asc=1 -log=WARN {indir} {outdir}
|
||||
CmdExceptor = %s -jar %s {input} {output} {conf} {log}
|
||||
CmdRecomp = %s -encoding UTF-8 -Xlint:-options -deprecation -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs}
|
||||
CmdFernflower = %s -jar %s -din=1 -rbr=0 -dgs=1 -asc=1 -log=WARN {indir} {outdir}
|
||||
CmdExceptor = %s -jar %s --jarIn {input} --jarOut {output} --mapIn {conf} --log {log} --jsonIn {json} --applyMarkers
|
||||
CmdRecomp = %s -Xlint:-options -deprecation -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs}
|
||||
CmdRecompScala = %s -encoding UTF-8 -deprecation -target:jvm-1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs}
|
||||
CmdStartSrv = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" cpw.mods.fml.relauncher.ServerLaunchWrapper {extraargs}
|
||||
CmdStartClt = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" -Djava.library.path={natives} net.minecraft.launchwrapper.Launch --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --version FML_DEV {extraargs}
|
||||
CmdStartSrv = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" net.minecraft.server.MinecraftServer
|
||||
CmdStartClt = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" -Djava.library.path={natives} Start
|
||||
+91
-91
@@ -6,7 +6,7 @@ func_100012_b,setPotionDurationMax,0,Toggle the isPotionDurationMax field.
|
||||
func_100015_a,isKeyDown,0,Returns whether the specified key binding is currently being pressed.
|
||||
func_102007_a,canInsertItem,2,"Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, side"
|
||||
func_102008_b,canExtractItem,2,"Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, side"
|
||||
func_102012_a,insertStackFromInventory,2,
|
||||
func_102012_a,insertStackFromInventory,0,
|
||||
func_102013_b,canExtractItemFromInventory,2,
|
||||
func_102015_a,canInsertItemToInventory,2,"Args: inventory, item, slot, side"
|
||||
func_102026_a,isBlockTopFacingSurfaceSolid,2,"Performs check to see if the block is a normal, solid block, or if the metadata of the block indicates that its facing puts its solid side upwards. (inverted stairs, for example)"
|
||||
@@ -83,7 +83,7 @@ func_110252_cg,getTemper,2,
|
||||
func_110254_bY,getHorseSize,2,
|
||||
func_110255_k,setHorseJumping,2,
|
||||
func_110257_ck,isHorseSaddled,2,
|
||||
func_110258_o,getGrassEatingAmount,0,
|
||||
func_110258_o,getGrassEatingAmount,2,
|
||||
func_110260_d,getHorseArmorIndex,2,"0 = iron, 1 = gold, 2 = diamond"
|
||||
func_110261_ca,isChested,2,
|
||||
func_110262_ch,prepareChunkForSpawn,2,
|
||||
@@ -201,7 +201,7 @@ func_110616_f,fixDirResourcepacks,0,
|
||||
func_110623_a,getResourcePath,0,
|
||||
func_110624_b,getResourceDomain,0,
|
||||
func_110628_a,bindTexture,0,
|
||||
func_110647_a,getOSType,0,
|
||||
func_110647_a,getOSType,2,
|
||||
func_110746_b,getLocationTensionFactor,2,"returns a float value that can be used to determine how likely something is to go awry in the area. It increases based on how long the player is within the vicinity, the lunar phase, and game difficulty. The value can be up to 1.5 on the highest difficulty, 1.0 otherwise."
|
||||
func_110750_I,getTensionFactorForBlock,2,"returns a float value that can be used to determine how likely something is to go awry in the area. It increases based on how long the player is within the vicinity, the lunar phase, and game difficulty. The value can be up to 1.5 on the highest difficulty, 1.0 otherwise."
|
||||
func_110775_a,getEntityTexture,0,Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
||||
@@ -395,7 +395,7 @@ func_70012_b,setLocationAndAngles,2,Sets the location and Yaw/Pitch of an entity
|
||||
func_70013_c,getBrightness,2,Gets how bright this entity is.
|
||||
func_70014_b,writeEntityToNBT,2,(abstract) Protected helper method to write subclass entity data to NBT.
|
||||
func_70015_d,setFire,2,"Sets entity to burn for x amount of seconds, cannot lower amount of existing fire."
|
||||
func_70016_h,setVelocity,0,"Sets the velocity to the args. Args: x, y, z"
|
||||
func_70016_h,setVelocity,2,"Sets the velocity to the args. Args: x, y, z"
|
||||
func_70017_D,doBlockCollisions,2,"Checks for block collisions, and calls the associated onBlockCollided method for the collided block."
|
||||
func_70018_K,setBeenAttacked,2,Sets that this entity has been attacked.
|
||||
func_70019_c,setEating,2,
|
||||
@@ -413,7 +413,7 @@ func_70030_z,onEntityUpdate,2,Gets called every tick from main Entity class
|
||||
func_70031_b,setSprinting,2,Set sprinting switch for Entity.
|
||||
func_70032_d,getDistanceToEntity,2,Returns the distance to the entity. Args: entity
|
||||
func_70033_W,getYOffset,2,Returns the Y Offset of this entity.
|
||||
func_70034_d,setRotationYawHead,0,Sets the head's yaw rotation of the entity.
|
||||
func_70034_d,setRotationYawHead,2,Sets the head's yaw rotation of the entity.
|
||||
func_70035_c,getLastActiveItems,2,
|
||||
func_70036_a,playStepSound,2,"Plays step sound at given x, y, z for the entity"
|
||||
func_70037_a,readEntityFromNBT,2,(abstract) Protected helper method to read subclass entity data from NBT.
|
||||
@@ -435,7 +435,7 @@ func_70052_a,setFlag,2,"Enable or disable a entity flag, see getEntityFlag to re
|
||||
func_70053_R,getShadowSize,0,
|
||||
func_70054_a,dropItemWithOffset,2,"Drops an item stack with a specified y offset. Args: itemID, count, yOffset"
|
||||
func_70055_a,isInsideOfMaterial,2,Checks if the current block the entity is within of the specified material type
|
||||
func_70056_a,setPositionAndRotation2,0,"Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, posY, posZ, yaw, pitch"
|
||||
func_70056_a,setPositionAndRotation2,2,"Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, posY, posZ, yaw, pitch"
|
||||
func_70057_ab,performHurtAnimation,0,Setups the entity to do the hurt animation. Only used by packets in multiplayer.
|
||||
func_70058_J,handleLavaMovement,2,Whether or not the current entity is in lava
|
||||
func_70060_a,moveFlying,2,Used in both water and by flying objects
|
||||
@@ -447,7 +447,7 @@ func_70066_B,extinguish,2,Removes fire from entity.
|
||||
func_70067_L,canBeCollidedWith,2,Returns true if other Entities should be prevented from moving through this Entity.
|
||||
func_70068_e,getDistanceSqToEntity,2,Returns the squared distance to the entity. Args: entity
|
||||
func_70069_a,fall,2,Called when the mob is falling. Calculates and applies fall damage.
|
||||
func_70070_b,getBrightnessForRender,0,
|
||||
func_70070_b,getBrightnessForRender,2,
|
||||
func_70071_h_,onUpdate,2,Called to update the entity's position/logic.
|
||||
func_70072_I,handleWaterMovement,2,Returns if this entity is in water and will end up adding the waters velocity to the entity
|
||||
func_70074_a,onKillEntity,2,This method gets called when the entity kills another one.
|
||||
@@ -458,7 +458,7 @@ func_70078_a,mountEntity,2,"Called when a player mounts an entity. e.g. mounts a
|
||||
func_70079_am,getRotationYawHead,2,
|
||||
func_70080_a,setPositionAndRotation,2,"Sets the entity's position and rotation. Args: posX, posY, posZ, yaw, pitch"
|
||||
func_70081_e,dealFireDamage,2,Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args: amountDamage
|
||||
func_70082_c,setAngles,0,"Adds par1*0.15 to the entity's yaw, and *subtracts* par2*0.15 from the pitch. Clamps pitch from -90 to 90. Both arguments in degrees."
|
||||
func_70082_c,setAngles,2,"Adds par1*0.15 to the entity's yaw, and *subtracts* par2*0.15 from the pitch. Clamps pitch from -90 to 90. Both arguments in degrees."
|
||||
func_70083_f,getFlag,2,Returns true if the flag is active for the entity. Known flags: 0) is burning; 1) is sneaking; 2) is riding something; 3) is sprinting; 4) is eating
|
||||
func_70084_c,addToPlayerScore,2,"Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args: entity, scoreToAdd"
|
||||
func_70085_c,interact,2,"Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig."
|
||||
@@ -479,7 +479,7 @@ func_70099_a,entityDropItem,2,Drops an item at the position of the entity.
|
||||
func_70100_b_,onCollideWithPlayer,2,Called by a player entity when they collide with an entity
|
||||
func_70101_b,setRotation,2,Sets the rotation of the entity
|
||||
func_70102_a,isInRangeToRenderVec3D,0,Checks using a Vec3d to determine if this entity is within range of that vector to be rendered. Args: vec3D
|
||||
func_70103_a,handleHealthUpdate,0,
|
||||
func_70103_a,handleHealthUpdate,2,
|
||||
func_70104_M,canBePushed,2,Returns true if this entity should push and be pushed by other entities when colliding.
|
||||
func_70105_a,setSize,2,"Sets the width and height of the entity. Args: width, height"
|
||||
func_70106_y,setDead,2,Will get destroyed next tick.
|
||||
@@ -488,7 +488,7 @@ func_70108_f,applyEntityCollision,2,Applies a velocity to each of the entities p
|
||||
func_70109_d,writeToNBT,2,Save the entity to NBT (calls an abstract helper method to write extra data)
|
||||
func_70110_aj,setInWeb,2,Sets the Entity inside a web block.
|
||||
func_70111_Y,getCollisionBorderSize,2,
|
||||
func_70112_a,isInRangeToRenderDist,0,Checks if the entity is in range to render by using the past in distance and comparing it to its average edge length * 64 * renderDistanceWeight Args: distance
|
||||
func_70112_a,isInRangeToRenderDist,2,Checks if the entity is in range to render by using the past in distance and comparing it to its average edge length * 64 * renderDistanceWeight Args: distance
|
||||
func_70113_ah,isEating,0,
|
||||
func_70114_g,getCollisionBox,2,"Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be pushable on contact, like boats or minecarts."
|
||||
func_70115_ae,isRiding,2,"Returns true if the entity is riding another entity, used by render to rotate the legs to be in 'sit' position for players."
|
||||
@@ -597,7 +597,7 @@ func_70449_g,damageArmor,2,Damages armor in each slot by the specified amount.
|
||||
func_70450_e,hasItem,2,Get if a specifiied item id is inside the inventory.
|
||||
func_70451_h,getHotbarSize,2,Get the size of the player hotbar inventory
|
||||
func_70452_e,storePartialItemStack,2,This function stores as many items of an ItemStack as possible in a matching slot and returns the quantity of left over items.
|
||||
func_70453_c,changeCurrentItem,0,Switch the current item to the next one or the previous one
|
||||
func_70453_c,changeCurrentItem,2,Switch the current item to the next one or the previous one
|
||||
func_70454_b,canHarvestBlock,2,Returns whether the current item (tool) can harvest from the specified block (actually get a result).
|
||||
func_70455_b,copyInventory,2,Copy the ItemStack contents from another InventoryPlayer instance
|
||||
func_70463_b,getStackInRowAndColumn,2,"Returns the itemstack in the slot specified (Top left is 0, 0). Args: row, column"
|
||||
@@ -618,7 +618,7 @@ func_70515_d,explode,2,
|
||||
func_70518_d,onValidSurface,2,checks to make sure painting can be placed there
|
||||
func_70526_d,getXpValue,2,Returns the XP value of this XP orb.
|
||||
func_70527_a,getXPSplit,2,Get xp split rate (Is called until the xp drop code in EntityLiving.onEntityUpdate is complete)
|
||||
func_70528_g,getTextureByXP,0,Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine what texture to use.
|
||||
func_70528_g,getTextureByXP,2,Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine what texture to use.
|
||||
func_70534_d,getRedColorF,0,
|
||||
func_70535_g,getBlueColorF,0,
|
||||
func_70536_a,setParticleTextureIndex,0,Public method to set private field particleTextureIndex.
|
||||
@@ -642,12 +642,12 @@ func_70609_aI,onDeathUpdate,2,"handles entity death timer, experience orb and pa
|
||||
func_70610_aX,isMovementBlocked,2,Dead and sleeping entities cannot move
|
||||
func_70612_e,moveEntityWithHeading,2,"Moves the entity based on the specified heading. Args: strafe, forward"
|
||||
func_70613_aW,isClientWorld,2,Returns whether the entity is in a local (client) world
|
||||
func_70614_a,rayTrace,0,"Performs a ray trace for the distance specified and using the partial tick time. Args: distance, partialTickTime"
|
||||
func_70614_a,rayTrace,2,"Performs a ray trace for the distance specified and using the partial tick time. Args: distance, partialTickTime"
|
||||
func_70615_aA,eatGrassBonus,2,This function applies the benefits of growing back wool and faster growing up to the acting entity. (This function is used in the AIEatGrass)
|
||||
func_70617_f_,isOnLadder,2,"returns true if this entity is by a ladder, false otherwise"
|
||||
func_70618_n,removePotionEffectClient,0,Remove the speified potion effect from this entity.
|
||||
func_70619_bc,updateAITasks,2,
|
||||
func_70620_b,getItemIcon,0,Gets the Icon Index of the item currently held
|
||||
func_70620_b,getItemIcon,2,Gets the Icon Index of the item currently held
|
||||
func_70621_aR,getHurtSound,2,Returns the sound this mob makes when it is hurt.
|
||||
func_70623_bb,despawnEntity,2,Makes the entity despawn if requirements are reached
|
||||
func_70624_b,setAttackTarget,2,Sets the active target the Task system uses for tracking
|
||||
@@ -689,7 +689,7 @@ func_70662_br,isEntityUndead,2,Returns true if this entity is undead.
|
||||
func_70663_b,updateRotation,2,"Arguments: current rotation, intended rotation, max increment."
|
||||
func_70664_aZ,jump,2,Causes this entity to do an upwards motion (jumping).
|
||||
func_70665_d,damageEntity,2,Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health second with the reduced value. Args: damageAmount
|
||||
func_70666_h,getPosition,0,interpolated position vector
|
||||
func_70666_h,getPosition,2,interpolated position vector
|
||||
func_70668_bt,getCreatureAttribute,2,Get this Entity's EnumCreatureAttribute
|
||||
func_70669_a,renderBrokenItemStack,2,Renders broken item particles using the given ItemStack
|
||||
func_70670_a,onNewPotionEffect,2,
|
||||
@@ -699,7 +699,7 @@ func_70673_aS,getDeathSound,2,Returns the sound this mob makes on death.
|
||||
func_70674_bp,clearActivePotions,2,
|
||||
func_70675_k,damageArmor,2,
|
||||
func_70676_i,getLook,2,interpolated look vector
|
||||
func_70678_g,getSwingProgress,0,Returns where in the swing animation the living entity is (from 0 to 1). Args: partialTickTime
|
||||
func_70678_g,getSwingProgress,2,Returns where in the swing animation the living entity is (from 0 to 1). Args: partialTickTime
|
||||
func_70679_bo,updatePotionEffects,2,
|
||||
func_70681_au,getRNG,2,
|
||||
func_70682_h,decreaseAirSupply,2,Decrements the entity's air supply when underwater
|
||||
@@ -750,7 +750,7 @@ func_70824_q,getCarryingData,2,Get the metadata of the block an enderman carries
|
||||
func_70825_j,teleportTo,2,Teleport the enderman
|
||||
func_70829_a,setCreeperState,2,"Sets the state of creeper, -1 to idle and 1 to be 'in fuse'"
|
||||
func_70830_n,getPowered,2,Returns true if the creeper is powered by a lightning bolt.
|
||||
func_70831_j,getCreeperFlashIntensity,0,Params: (Float)Render tick. Returns the intensity of the creeper's flash when it is ignited.
|
||||
func_70831_j,getCreeperFlashIntensity,2,Params: (Float)Render tick. Returns the intensity of the creeper's flash when it is ignited.
|
||||
func_70832_p,getCreeperState,2,"Returns the current state of creeper, -1 is idle, 1 is 'in fuse'"
|
||||
func_70835_c,becomeAngryAt,2,Causes this PigZombie to become angry at the supplied Entity (which will be a player).
|
||||
func_70839_e,setBesideClimbableBlock,2,"Updates the WatchableObject (Byte) created in entityInit(), setting it to 0x01 if par1 is true or 0x00 if it is false."
|
||||
@@ -793,7 +793,7 @@ func_70919_bu,isAngry,2,Determines whether this wolf is angry or not.
|
||||
func_70920_v,getTailRotation,0,
|
||||
func_70921_u,getWolfShaking,0,
|
||||
func_70923_f,getShakeAngle,0,
|
||||
func_70930_a,setRecipes,0,
|
||||
func_70930_a,setRecipes,2,
|
||||
func_70931_l_,getCustomer,2,
|
||||
func_70932_a_,setCustomer,2,
|
||||
func_70933_a,useRecipe,2,
|
||||
@@ -802,7 +802,7 @@ func_70938_b,setProfession,2,
|
||||
func_70939_f,setPlaying,2,
|
||||
func_70940_q,isTrading,2,
|
||||
func_70941_o,isMating,2,
|
||||
func_70942_a,generateRandomParticles,0,par1 is the particleName
|
||||
func_70942_a,generateRandomParticles,2,par1 is the particleName
|
||||
func_70943_c,getRandomCountForBlacksmithItem,2,
|
||||
func_70944_b,getRandomCountForItem,2,"default to 1, and villagerStockList contains a min/max amount for each index"
|
||||
func_70945_p,isPlaying,2,
|
||||
@@ -917,7 +917,7 @@ func_71191_d,setBuildLimit,2,
|
||||
func_71192_d,setUserMessage,2,"Typically ""menu.convertingLevel"", ""menu.loadingLevel"" or others."
|
||||
func_71193_K,allowSpawnMonsters,2,
|
||||
func_71194_c,canCreateBonusChest,2,
|
||||
func_71195_b_,getUserMessage,0,
|
||||
func_71195_b_,getUserMessage,2,
|
||||
func_71196_a,getServerConfigurationManager,2,"Gets the current player count, maximum player count, and player entity list."
|
||||
func_71197_b,startServer,2,Initialises the server and starts it.
|
||||
func_71198_k,logDebug,2,"If isDebuggingEnabled(), logs the message with a level of INFO."
|
||||
@@ -1383,7 +1383,7 @@ func_72353_e,isPlayerOpped,2,"Returns true if the specified player is opped, eve
|
||||
func_72354_b,updateTimeAndWeatherForPlayer,2,Updates the time and weather for the given player to those of the given world
|
||||
func_72355_a,initializeConnectionToPlayer,2,
|
||||
func_72356_a,transferPlayerToDimension,2,
|
||||
func_72357_a,setGameType,0,
|
||||
func_72357_a,setGameType,2,
|
||||
func_72358_d,serverUpdateMountedMovingPlayer,2,"using player's dimension, update their movement when in a vehicle (e.g. cart, boat)"
|
||||
func_72359_h,addToWhiteList,2,Add the specified player to the white list.
|
||||
func_72360_c,removeOp,2,"This removes a username from the ops list, then saves the op list"
|
||||
@@ -1446,7 +1446,7 @@ func_72442_b,rotateAroundY,2,Rotates the vector around the y axis by the specifi
|
||||
func_72443_a,createVectorHelper,2,"Static method for creating a new Vec3D given the three x,y,z values. This is only called from the other static method which creates and places it in the list."
|
||||
func_72444_a,subtract,0,Returns a new vector with the result of the specified vector minus this.
|
||||
func_72445_d,squareDistanceTo,2,"The square of the Euclidean distance between this and the vector of x,y,z components passed in."
|
||||
func_72446_c,rotateAroundZ,0,Rotates the vector around the z axis by the specified angle.
|
||||
func_72446_c,rotateAroundZ,2,Rotates the vector around the z axis by the specified angle.
|
||||
func_72452_a,handleRemoveEntityEffect,2,Handle a remove entity effect packet.
|
||||
func_72453_a,handleMapChunks,2,
|
||||
func_72454_a,handleBlockEvent,2,
|
||||
@@ -1651,7 +1651,7 @@ func_72798_a,getBlockId,2,"Returns the block ID at coords x,y,z"
|
||||
func_72799_c,isAirBlock,2,Returns true if the block at the specified coordinates is empty
|
||||
func_72800_K,getHeight,2,Returns current world height.
|
||||
func_72801_o,getLightBrightness,2,"Returns how bright the block is shown as which is the block's light value looked up in a lookup table (light values aren't linear for brightness). Args: x, y, z"
|
||||
func_72802_i,getLightBrightnessForSkyBlocks,0,Any Light rendered on a 1.8 Block goes through here
|
||||
func_72802_i,getLightBrightnessForSkyBlocks,2,Any Light rendered on a 1.8 Block goes through here
|
||||
func_72803_f,getBlockMaterial,2,Returns the block's material.
|
||||
func_72804_r,isBlockOpaqueCube,2,"Returns true if the block at the specified coordinates is an opaque cube. Args: x, y, z"
|
||||
func_72805_g,getBlockMetadata,2,"Returns the block metadata at coords x,y,z"
|
||||
@@ -1667,16 +1667,16 @@ func_72819_i,getWeightedThunderStrength,2,
|
||||
func_72820_D,getWorldTime,2,
|
||||
func_72821_m,notifyBlockOfNeighborChange,2,"Notifies a block that one of its neighbor change to the specified type Args: x, y, z, blockID"
|
||||
func_72823_a,setItemData,2,"Assigns the given String id to the given MapDataBase using the MapStorage, removing any existing ones of the same id."
|
||||
func_72824_f,getCloudColour,0,
|
||||
func_72824_f,getCloudColour,2,
|
||||
func_72825_h,getTopSolidOrLiquidBlock,2,"Finds the highest block on the x, z coordinate that is solid and returns its y coord. Args x, z"
|
||||
func_72826_c,getCelestialAngle,2,calls calculateCelestialAngle
|
||||
func_72827_u,getProviderName,0,"Returns the name of the current chunk provider, by calling chunkprovider.makeString()"
|
||||
func_72827_u,getProviderName,2,"Returns the name of the current chunk provider, by calling chunkprovider.makeString()"
|
||||
func_72828_b,unloadEntities,2,Adds a list of entities to be unloaded on the next pass of World.updateEntities()
|
||||
func_72829_c,checkBlockCollision,2,Returns true if there are any blocks in the region constrained by an AxisAlignedBB
|
||||
func_72830_b,isAABBInMaterial,2,checks if the given AABB is in the material given. Used while swimming.
|
||||
func_72831_a,rayTraceBlocks_do_do,2,
|
||||
func_72832_d,setBlock,2,"Sets the block ID and metadata at a given location. Args: X, Y, Z, new block ID, new metadata, flags. Flag 1 will cause a block update. Flag 2 will send the change to clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client world. Flags can be added together."
|
||||
func_72833_a,getSkyColor,0,Calculates the color for the skybox
|
||||
func_72833_a,getSkyColor,2,Calculates the color for the skybox
|
||||
func_72834_c,canBlockFreeze,2,"checks to see if a given block is both water, and cold enough to freeze - if the par4 boolean is set, this will only return true if there is a non-water block immediately adjacent to the specified block"
|
||||
func_72835_b,tick,2,Runs a single tick for the world
|
||||
func_72836_a,scheduleBlockUpdate,2,Schedules a tick to a block with a delay (Most commonly the tick rate)
|
||||
@@ -1691,12 +1691,12 @@ func_72844_a,getEntityPathToXYZ,2,
|
||||
func_72845_h,markBlockForUpdate,2,"On the client, re-renders the block. On the server, sends the block to the client (which will re-render it only if the ID or MD changes), including the tile entity description packet if applicable. Args: x, y, z"
|
||||
func_72846_b,getClosestVulnerablePlayer,2,"Returns the closest vulnerable player within the given radius, or null if none is found."
|
||||
func_72847_b,onEntityRemoved,2,
|
||||
func_72848_b,removeWorldAccess,0,Removes a worldAccess from the worldAccesses object
|
||||
func_72848_b,removeWorldAccess,2,Removes a worldAccess from the worldAccesses object
|
||||
func_72849_a,getBlockLightValue_do,2,"Gets the light value of a block location. This is the actual function that gets the value and has a bool flag that indicates if its a half step block to get the maximum light value of a direct neighboring block (left, right, forward, back, and up)"
|
||||
func_72850_v,isBlockFreezableNaturally,2,checks to see if a given block is both water and has at least one immediately adjacent non-water block
|
||||
func_72851_f,notifyBlockChange,2,"The block type change and need to notify other systems Args: x, y, z, blockID"
|
||||
func_72852_a,addTileEntity,2,
|
||||
func_72853_d,getMoonPhase,0,
|
||||
func_72853_d,getMoonPhase,2,
|
||||
func_72854_c,updateAllPlayersSleepingFlag,2,Updates the flag that indicates whether or not all players in the world are sleeping.
|
||||
func_72855_b,checkNoEntityCollision,2,"Returns true if there are no solid, live entities in the specified AxisAlignedBB"
|
||||
func_72856_b,getClosestVulnerablePlayerToEntity,2,"Returns the closest vulnerable player to this entity within the given radius, or null if none is found"
|
||||
@@ -1720,7 +1720,7 @@ func_72876_a,createExplosion,2,"Creates an explosion. Args: entity, x, y, z, str
|
||||
func_72877_b,setWorldTime,2,Sets the world time.
|
||||
func_72878_l,getIndirectPowerLevelTo,2,"Gets the power level from a certain block face. Args: x, y, z, direction"
|
||||
func_72879_k,isBlockProvidingPowerTo,2,"Is this block powering in the specified direction Args: x, y, z, direction"
|
||||
func_72880_h,getStarBrightness,0,How bright are stars in the sky
|
||||
func_72880_h,getStarBrightness,2,How bright are stars in the sky
|
||||
func_72882_A,sendQuittingDisconnectingPacket,0,"If on MP, sends a quitting packet."
|
||||
func_72883_k,getFullBlockLightValue,2,Does the same as getBlockLightValue_do but without checking if its not a normal block
|
||||
func_72884_u,isBlockFreezable,2,checks to see if a given block is both water and is cold enough to freeze
|
||||
@@ -1733,7 +1733,7 @@ func_72890_a,getClosestPlayerToEntity,2,"Gets the closest player to the entity w
|
||||
func_72891_a,setAllowedSpawnTypes,2,Set which types of mobs are allowed to spawn (peaceful vs hostile).
|
||||
func_72892_b,scheduleBlockUpdateFromLoad,2,Schedules a block update from the saved information in a chunk. Called when the chunk is loaded.
|
||||
func_72893_g,tickBlocksAndAmbiance,2,plays random cave ambient sounds and runs updateTick on random blocks within each chunk in the vacinity of a player
|
||||
func_72894_k,setRainStrength,0,
|
||||
func_72894_k,setRainStrength,2,
|
||||
func_72896_J,isRaining,2,Returns true if the current rain strength is greater than 0.2
|
||||
func_72897_h,joinEntityInSurroundings,0,spwans an entity and loads surrounding chunks
|
||||
func_72898_h,notifyBlocksOfNeighborChange,2,"Notifies neighboring blocks that this specified block changed Args: x, y, z, blockID"
|
||||
@@ -1763,7 +1763,7 @@ func_72921_c,setBlockMetadataWithNotify,2,"Sets the blocks metadata and if set w
|
||||
func_72922_b,getFirstUncoveredBlock,2,"Returns the block ID of the first block at this (x,z) location with air above it, searching from sea level upwards."
|
||||
func_72923_a,onEntityAdded,2,
|
||||
func_72924_a,getPlayerEntityByName,2,Find a player by name in this world.
|
||||
func_72925_a,getSkyBlockTypeBrightness,0,Brightness for SkyBlock.Sky is clear white and (through color computing it is assumed) DEPENDENT ON DAYTIME. Brightness for SkyBlock.Block is yellowish and independent.
|
||||
func_72925_a,getSkyBlockTypeBrightness,2,Brightness for SkyBlock.Sky is clear white and (through color computing it is assumed) DEPENDENT ON DAYTIME. Brightness for SkyBlock.Block is yellowish and independent.
|
||||
func_72926_e,playAuxSFX,2,See description for func_72706_a.
|
||||
func_72927_d,blockHasTileEntity,2,Checks if a block at a given position should have a tile entity.
|
||||
func_72928_a,markTileEntityForDespawn,2,adds tile entity to despawn list (renamed from markEntityForDespawn)
|
||||
@@ -1785,8 +1785,8 @@ func_72944_b,markTileEntityChunkModified,2,"Args: X, Y, Z, tile entity Marks the
|
||||
func_72945_a,getCollidingBoundingBoxes,2,"Returns a list of bounding boxes that collide with aabb excluding the passed in entity's collision. Args: entity, aabb"
|
||||
func_72946_b,findClosestStructure,2,Returns the location of the closest structure of the specified type. If not found returns null.
|
||||
func_72947_a,calculateInitialWeather,2,Called from World constructor to set rainingStrength and thunderingStrength
|
||||
func_72948_g,getFogColor,0,Returns vector(ish) with R/G/B for fog
|
||||
func_72950_A,setSpawnLocation,0,
|
||||
func_72948_g,getFogColor,2,Returns vector(ish) with R/G/B for fog
|
||||
func_72950_A,setSpawnLocation,2,
|
||||
func_72951_B,canLightningStrikeAt,2,
|
||||
func_72953_d,isAnyLiquid,2,Returns if any of the blocks within the aabb are liquids. Args: aabb
|
||||
func_72954_a,addWorldAccess,2,Adds a IWorldAccess to the list of worldAccesses
|
||||
@@ -1804,17 +1804,17 @@ func_72966_v,calculateInitialSkylight,2,Called on construction of the World clas
|
||||
func_72967_a,calculateSkylightSubtracted,2,Returns the amount of skylight subtracted for the current time
|
||||
func_72969_x,updateAllLightTypes,2,
|
||||
func_72970_h,createChunkProvider,2,Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider?
|
||||
func_72971_b,getSunBrightness,0,"Returns the sun brightness - checks time of day, rain and thunder"
|
||||
func_72971_b,getSunBrightness,2,"Returns the sun brightness - checks time of day, rain and thunder"
|
||||
func_72972_b,getSavedLightValue,2,Returns saved light value without taking into account the time of day. Either looks in the sky light map or block light map based on the enumSkyBlock arg.
|
||||
func_72973_f,removePlayerEntityDangerously,2,Do NOT use this method to remove normal entities- use normal removeEntity
|
||||
func_72974_f,setSpawnLocation,0,"Sets a new spawn location by finding an uncovered block at a random (x,z) location in the chunk."
|
||||
func_72974_f,setSpawnLocation,2,"Sets a new spawn location by finding an uncovered block at a random (x,z) location in the chunk."
|
||||
func_72975_g,markBlocksDirtyVertical,2,marks a vertical line of blocks as dirty
|
||||
func_72976_f,getHeightValue,2,"Returns the y coordinate with a block in it at this x, z coordinate"
|
||||
func_72977_a,getClosestPlayer,2,"Gets the closest player to the point within the specified distance (distance can be set to less than 0 to not limit the distance). Args: x, y, z, dist"
|
||||
func_72978_e,isBoundingBoxBurning,2,Returns whether or not the given bounding box is on fire or not
|
||||
func_72979_l,updateWeather,2,Updates all weather states.
|
||||
func_72980_b,playSound,2,"par8 is loudness, all pars passed to minecraftInstance.sndManager.playSound"
|
||||
func_72981_t,getDebugLoadedEntities,0,This string is 'All: (number of loaded entities)' Viewable by press ing F3
|
||||
func_72981_t,getDebugLoadedEntities,2,This string is 'All: (number of loaded entities)' Viewable by press ing F3
|
||||
func_73022_a,removeAllEntities,0,also releases skins.
|
||||
func_73023_g,setBlockAndMetadataAndInvalidate,0,
|
||||
func_73025_a,doPreChunk,0,
|
||||
@@ -2293,7 +2293,7 @@ func_74739_b,readNamedTag,2,"Reads and returns a tag from the given DataInput, o
|
||||
func_74740_e,getName,2,"Gets the name corresponding to the tag, or an empty string if none set."
|
||||
func_74742_a,appendTag,2,Adds the provided tag to the end of the list. There is no check to verify this tag is of the same type as any previous tag.
|
||||
func_74743_b,tagAt,2,Retrieves the tag at the specified index from the list.
|
||||
func_74744_a,removeTag,0,Removes a tag at the given index.
|
||||
func_74744_a,removeTag,2,Removes a tag at the given index.
|
||||
func_74745_c,tagCount,2,Returns the number of tags in the list.
|
||||
func_74757_a,setBoolean,2,"Stores the given boolean value as a NBTTagByte, storing 1 for true and 0 for false, using the given string key."
|
||||
func_74758_c,getTags,2,Returns all the values in the tagMap HashMap.
|
||||
@@ -2323,11 +2323,11 @@ func_74781_a,getTag,2,gets a generic tag with the specified name
|
||||
func_74782_a,setTag,2,Stores the given tag into the map with the given string key. This is mostly used to store tag lists.
|
||||
func_74783_a,setIntArray,2,Stores a new NBTTagIntArray with the given array as data into the map with the given string key.
|
||||
func_74792_a,decompress,2,
|
||||
func_74793_a,safeWrite,0,
|
||||
func_74793_a,safeWrite,2,
|
||||
func_74794_a,read,2,Reads from a CompressedStream.
|
||||
func_74795_b,write,0,
|
||||
func_74796_a,readCompressed,2,Load the gzipped compound from the inputstream.
|
||||
func_74797_a,read,0,
|
||||
func_74797_a,read,2,
|
||||
func_74798_a,compress,2,
|
||||
func_74799_a,writeCompressed,2,"Write the compound, gzipped, to the outputstream."
|
||||
func_74800_a,write,2,
|
||||
@@ -2443,20 +2443,20 @@ func_75084_a,getStructureVillageWeightedPieceList,2,
|
||||
func_75085_a,canSpawnMoreVillagePiecesOfType,2,
|
||||
func_75086_a,canSpawnMoreVillagePieces,2,
|
||||
func_75091_a,writeCapabilitiesToNBT,2,
|
||||
func_75092_a,setFlySpeed,0,
|
||||
func_75092_a,setFlySpeed,2,
|
||||
func_75093_a,getFlySpeed,2,
|
||||
func_75094_b,getWalkSpeed,2,
|
||||
func_75095_b,readCapabilitiesFromNBT,2,
|
||||
func_75111_a,addStats,2,Eat some food.
|
||||
func_75112_a,readNBT,2,Reads food stats from an NBT object.
|
||||
func_75113_a,addExhaustion,2,adds input to foodExhaustionLevel to a max of 40
|
||||
func_75114_a,setFoodLevel,0,
|
||||
func_75114_a,setFoodLevel,2,
|
||||
func_75115_e,getSaturationLevel,2,Get the player's food saturation level.
|
||||
func_75116_a,getFoodLevel,2,Get the player's food level.
|
||||
func_75117_b,writeNBT,2,Writes food stats to an NBT object.
|
||||
func_75118_a,onUpdate,2,Handles the food game logic.
|
||||
func_75119_b,setFoodSaturationLevel,0,
|
||||
func_75120_b,getPrevFoodLevel,0,
|
||||
func_75120_b,getPrevFoodLevel,2,
|
||||
func_75121_c,needFood,2,If foodLevel is not max.
|
||||
func_75122_a,addStats,2,"Args: int foodLevel, float foodSaturationModifier"
|
||||
func_75128_a,setPlayerIsPresent,2,adds or removes the player from the container based on par2
|
||||
@@ -2467,8 +2467,8 @@ func_75132_a,addCraftingToCrafters,2,
|
||||
func_75133_b,retrySlotClick,2,
|
||||
func_75134_a,onContainerClosed,2,Called when the container is closed.
|
||||
func_75135_a,mergeItemStack,2,merges provided ItemStack with the first avaliable one in the container/player inventory
|
||||
func_75136_a,getNextTransactionID,0,Gets a unique transaction ID. Parameter is unused.
|
||||
func_75137_b,updateProgressBar,0,
|
||||
func_75136_a,getNextTransactionID,2,Gets a unique transaction ID. Parameter is unused.
|
||||
func_75137_b,updateProgressBar,2,
|
||||
func_75138_a,getInventory,2,"returns a list if itemStacks, for each slot."
|
||||
func_75139_a,getSlot,2,
|
||||
func_75140_a,enchantItem,2,enchants the item on the table using the specified slot; also deducts XP from player
|
||||
@@ -2496,7 +2496,7 @@ func_75208_c,onCrafting,2,"the itemStack passed in is the output - ie, iron ingo
|
||||
func_75209_a,decrStackSize,2,Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new stack.
|
||||
func_75210_a,onCrafting,2,"the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an internal count then calls onCrafting(item)."
|
||||
func_75211_c,getStack,2,Helper fnct to get the stack in the slot.
|
||||
func_75212_b,getBackgroundIconIndex,0,Returns the icon index on items.png that is used as background image of the slot.
|
||||
func_75212_b,getBackgroundIconIndex,2,Returns the icon index on items.png that is used as background image of the slot.
|
||||
func_75214_a,isItemValid,2,Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
func_75215_d,putStack,2,Helper method to put a stack in the slot.
|
||||
func_75216_d,getHasStack,2,Returns if this slot contains a stack.
|
||||
@@ -2644,7 +2644,7 @@ func_75683_a,getWatchableObjectByte,2,gets the bytevalue of a watchable object
|
||||
func_75684_a,hasChanges,2,
|
||||
func_75685_c,getAllWatched,2,
|
||||
func_75686_a,readWatchableObjects,2,
|
||||
func_75687_a,updateWatchedObjectsFromList,0,
|
||||
func_75687_a,updateWatchedObjectsFromList,2,
|
||||
func_75688_b,unwatchAndReturnAllWatched,2,
|
||||
func_75689_a,writeWatchableObjects,2,
|
||||
func_75690_a,writeWatchableObject,2,
|
||||
@@ -2688,14 +2688,14 @@ func_75787_a,compareTo,0,
|
||||
func_75788_b,getDisplayName,0,return the display name of the save
|
||||
func_75789_g,isHardcoreModeEnabled,0,
|
||||
func_75790_f,getEnumGameType,0,Gets the EnumGameType.
|
||||
func_75799_b,getSaveList,0,
|
||||
func_75799_b,getSaveList,2,
|
||||
func_75800_d,flushCache,2,
|
||||
func_75801_b,isOldMapFormat,2,Checks if the save directory uses the old map format
|
||||
func_75802_e,deleteWorldDirectory,2,@args: Takes one argument - the name of the directory of the world to delete. @desc: Delete the world by deleting the associated directory recursively.
|
||||
func_75803_c,getWorldInfo,2,gets the world info
|
||||
func_75804_a,getSaveLoader,2,Returns back a loader for the specified save directory
|
||||
func_75805_a,convertMapFormat,2,"Converts the specified map to the new map format. Args: worldName, loadingScreen"
|
||||
func_75806_a,renameWorld,0,@args: Takes two arguments - first the name of the directory containing the world and second the new name for that world. @desc: Renames the world by storing the new name in level.dat. It does *not* rename the directory containing the world data.
|
||||
func_75806_a,renameWorld,2,@args: Takes two arguments - first the name of the directory containing the world and second the new name for that world. @desc: Renames the world by storing the new name in level.dat. It does *not* rename the directory containing the world data.
|
||||
func_75807_a,deleteFiles,2,@args: Takes one argument - the list of files and directories to delete. @desc: Deletes the files and directory listed in the list recursively.
|
||||
func_75809_f,createFile,2,par: filename for the level.dat_mcr backup
|
||||
func_75810_a,addRegionFilesToCollection,2,"filters the files in the par1 directory, and adds them to the par2 collections"
|
||||
@@ -2750,11 +2750,11 @@ func_75886_a,createTheCipherInstance,2,Creates the Cipher Instance.
|
||||
func_75887_a,decryptSharedKey,2,Decrypt shared secret AES key using RSA private key
|
||||
func_75888_a,decryptInputStream,2,
|
||||
func_75889_b,decryptData,2,Decrypt byte[] data with RSA private key
|
||||
func_75890_a,createNewSharedKey,0,Generate a new shared secret AES key from a secure random source
|
||||
func_75890_a,createNewSharedKey,2,Generate a new shared secret AES key from a secure random source
|
||||
func_75891_b,createNewKeyPair,2,
|
||||
func_75892_a,createBufferedBlockCipher,2,Create a new BufferedBlockCipher instance
|
||||
func_75893_a,digestOperation,2,Compute a message digest on arbitrary byte[] data
|
||||
func_75894_a,encryptData,0,Encrypt byte[] data with RSA public key
|
||||
func_75894_a,encryptData,2,Encrypt byte[] data with RSA public key
|
||||
func_75895_a,getServerIdHash,2,Compute a serverId hash for use by sendSessionRequest()
|
||||
func_75896_a,decodePublicKey,2,Create a new PublicKey from encoded X.509 data
|
||||
func_75897_a,encryptOuputStream,2,
|
||||
@@ -2782,12 +2782,12 @@ func_75927_a,replaceSimilarBlocks,2,"Forces stats for one block to add to anothe
|
||||
func_75962_a,getGuid,2,Returns the unique GUID of a achievement id.
|
||||
func_75965_j,getNumberFormat,0,
|
||||
func_75966_h,initIndependentStat,2,"Initializes the current stat as independent (i.e., lacking prerequisites for being updated) and returns the current instance."
|
||||
func_75967_d,isAchievement,0,Returns whether or not the StatBase-derived class is a statistic (running counter) or an achievement (one-shot).
|
||||
func_75967_d,isAchievement,2,Returns whether or not the StatBase-derived class is a statistic (running counter) or an achievement (one-shot).
|
||||
func_75969_k,getDecimalFormat,0,
|
||||
func_75970_i,getName,0,
|
||||
func_75971_g,registerStat,2,Register the stat into StatList.
|
||||
func_75982_a,getItemID,0,
|
||||
func_75984_f,getSpecial,0,"Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to achieve."
|
||||
func_75984_f,getSpecial,2,"Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to achieve."
|
||||
func_75985_c,registerAchievement,2,"Adds the achievement on the internal list of registered achievements, also, it's check for duplicated id's."
|
||||
func_75986_a,setIndependent,2,"Indicates whether or not the given achievement or statistic is independent (i.e., lacks prerequisites for being update)."
|
||||
func_75987_b,setSpecial,2,"Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to achieve."
|
||||
@@ -2809,9 +2809,9 @@ func_76046_c,clearMap,2,Removes all entries from the map
|
||||
func_76047_h,grow,2,Increases the number of hash slots
|
||||
func_76048_a,copyTo,2,Copies the hash slots to a new array
|
||||
func_76049_d,removeObject,2,Removes the specified object from the map and returns it
|
||||
func_76056_b,setSpawnY,0,Sets the y spawn position
|
||||
func_76057_l,getLastTimePlayed,0,Return the last time the player was in this world.
|
||||
func_76058_a,setSpawnX,0,Set the x spawn position to the passed in value
|
||||
func_76056_b,setSpawnY,2,Sets the y spawn position
|
||||
func_76057_l,getLastTimePlayed,2,Return the last time the player was in this world.
|
||||
func_76058_a,setSpawnX,2,Set the x spawn position to the passed in value
|
||||
func_76059_o,isRaining,2,"Returns true if it is raining, false otherwise."
|
||||
func_76060_a,setGameType,2,Sets the GameType.
|
||||
func_76061_m,isThundering,2,"Returns true if it is thundering, false otherwise."
|
||||
@@ -2840,12 +2840,12 @@ func_76083_p,getRainTime,2,Return the number of ticks until rain.
|
||||
func_76084_b,setRaining,2,Sets whether it is raining or not.
|
||||
func_76085_a,setTerrainType,2,
|
||||
func_76086_u,areCommandsAllowed,2,Returns true if commands are allowed on this World.
|
||||
func_76087_c,setSpawnZ,0,Set the z spawn position to the passed in value
|
||||
func_76087_c,setSpawnZ,2,Set the z spawn position to the passed in value
|
||||
func_76088_k,getSaveVersion,2,Returns the save version of this world
|
||||
func_76089_r,isMapFeaturesEnabled,2,Get whether the map features (e.g. strongholds) generation is enabled or disabled.
|
||||
func_76090_f,setThunderTime,2,Defines the number of ticks until next thunderbolt.
|
||||
func_76091_d,setServerInitialized,2,Sets the initialization status of the World.
|
||||
func_76092_g,getSizeOnDisk,0,
|
||||
func_76092_g,getSizeOnDisk,2,
|
||||
func_76093_s,isHardcoreModeEnabled,2,"Returns true if hardcore mode is enabled, otherwise false"
|
||||
func_76116_a,putLower,2,a map already defines a general put
|
||||
func_76118_a,countPacket,2,
|
||||
@@ -2863,10 +2863,10 @@ func_76133_a,sqrt_double,2,
|
||||
func_76134_b,cos,2,cos looked up in the sin table with the appropriate offset
|
||||
func_76135_e,abs,2,
|
||||
func_76136_a,getRandomIntegerInRange,2,
|
||||
func_76137_a,bucketInt,0,"Buckets an integer with specifed bucket sizes. Args: i, bucketSize"
|
||||
func_76137_a,bucketInt,2,"Buckets an integer with specifed bucket sizes. Args: i, bucketSize"
|
||||
func_76138_g,wrapAngleTo180_double,2,"the angle is reduced to an angle between -180 and +180 by mod, and a 360 check"
|
||||
func_76139_a,stringNullOrLengthZero,0,Tests if a string is null or of length zero
|
||||
func_76140_b,truncateDoubleToInt,0,"returns par0 cast as an int, and no greater than Integer.MAX_VALUE-1024"
|
||||
func_76139_a,stringNullOrLengthZero,2,Tests if a string is null or of length zero
|
||||
func_76140_b,truncateDoubleToInt,2,"returns par0 cast as an int, and no greater than Integer.MAX_VALUE-1024"
|
||||
func_76141_d,floor_float,2,Returns the greatest integer less than or equal to the float argument
|
||||
func_76142_g,wrapAngleTo180_float,2,"the angle is reduced to an angle between -180 and +180 by mod, and a 360 check"
|
||||
func_76143_f,ceiling_double_int,2,
|
||||
@@ -2961,7 +2961,7 @@ func_76363_c,isUnblockable,2,
|
||||
func_76364_f,getSourceOfDamage,2,
|
||||
func_76365_a,causePlayerDamage,2,returns an EntityDamageSource of type player
|
||||
func_76388_g,getEffectiveness,2,
|
||||
func_76389_a,getDurationString,0,
|
||||
func_76389_a,getDurationString,2,
|
||||
func_76390_b,setPotionName,2,Set the potion name.
|
||||
func_76392_e,getStatusIconIndex,0,Returns the index for the icon to display when the potion is active.
|
||||
func_76393_a,getName,2,returns the name of the potion
|
||||
@@ -2988,7 +2988,7 @@ func_76458_c,getAmplifier,2,
|
||||
func_76459_b,getDuration,2,
|
||||
func_76463_a,startSnooper,2,Note issuing start multiple times is not an error.
|
||||
func_76464_f,addBaseDataToSnooper,2,
|
||||
func_76465_c,getCurrentStats,0,
|
||||
func_76465_c,getCurrentStats,2,
|
||||
func_76466_d,getSelfCounterFor,2,returns a value indicating how many times this function has been run on the snooper
|
||||
func_76467_g,addJvmArgsToSnooper,2,
|
||||
func_76468_d,isSnooperRunning,2,
|
||||
@@ -3029,7 +3029,7 @@ func_76556_a,generateLightBrightnessTable,2,Creates the light to brightness tabl
|
||||
func_76557_i,getAverageGroundLevel,2,
|
||||
func_76558_a,registerWorld,2,"associate an existing world with a World provider, and setup its lightbrightness table"
|
||||
func_76559_b,getMoonPhase,2,
|
||||
func_76560_a,calcSunriseSunsetColors,0,Returns array with sunrise/sunset colors
|
||||
func_76560_a,calcSunriseSunsetColors,2,Returns array with sunrise/sunset colors
|
||||
func_76561_g,isSkyColored,0,
|
||||
func_76562_b,getFogColor,0,Return Vec3D with biome specific fog color
|
||||
func_76563_a,calculateCelestialAngle,2,Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime)
|
||||
@@ -3048,7 +3048,7 @@ func_76586_k,updateSkylight,2,"Checks whether skylight needs updated; if it does
|
||||
func_76587_i,getBlockStorageArray,2,Returns the ExtendedBlockStorage array for this Chunk.
|
||||
func_76588_a,getEntitiesWithinAABBForEntity,2,"Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity Args: entity, aabb, listToFill"
|
||||
func_76589_b,setBlockMetadata,2,Set the metadata of a block in the chunk
|
||||
func_76590_a,generateHeightMap,0,Generates the height map for a chunk from scratch
|
||||
func_76590_a,generateHeightMap,2,Generates the height map for a chunk from scratch
|
||||
func_76591_a,getBiomeGenForWorldCoords,2,This method retrieves the biome at a set of coordinates
|
||||
func_76592_a,setBlockIDWithMetadata,2,"Sets a blockID of a position within a chunk with metadata. Args: x, y, z, blockID, metadata"
|
||||
func_76593_q,updateSkylight_do,2,Runs delayed skylight updates.
|
||||
@@ -3134,7 +3134,7 @@ func_76727_i,getFloatRainfall,0,Gets a floating point representation of this bio
|
||||
func_76728_a,decorate,2,
|
||||
func_76729_a,createBiomeDecorator,2,Allocate a new BiomeDecorator for this BiomeGenBase
|
||||
func_76730_b,getRandomWorldGenForGrass,2,Gets a WorldGen appropriate for this biome.
|
||||
func_76731_a,getSkyColorByTemp,0,"takes temperature, returns color"
|
||||
func_76731_a,getSkyColorByTemp,2,"takes temperature, returns color"
|
||||
func_76732_a,setTemperatureRainfall,2,Sets the temperature and rainfall of this biome.
|
||||
func_76734_h,getIntTemperature,2,Gets an integer representation of this biome's temperature
|
||||
func_76735_a,setBiomeName,2,
|
||||
@@ -3186,7 +3186,7 @@ func_76935_a,getBiomeGenAt,2,"Returns the BiomeGenBase related to the x, z posit
|
||||
func_76936_a,getRainfall,2,"Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length."
|
||||
func_76937_a,getBiomesForGeneration,2,Returns an array of biomes for the location input.
|
||||
func_76938_b,cleanupCache,2,Calls the WorldChunkManager's biomeCache.cleanupCache()
|
||||
func_76939_a,getTemperatureAtHeight,0,Return an adjusted version of a given temperature based on the y height
|
||||
func_76939_a,getTemperatureAtHeight,2,Return an adjusted version of a given temperature based on the y height
|
||||
func_76940_a,areBiomesViable,2,checks given Chunk's Biomes against List of allowed ones
|
||||
func_76941_a,findBiomePosition,2,"Finds a valid position within a range, that is in one of the listed biomes. Searches {par1,par2} +-par3 blocks. Strongly favors positive y positions."
|
||||
func_76949_a,renderTileEntityAt,0,Render this TileEntity at a given set of coordinates
|
||||
@@ -3300,7 +3300,7 @@ func_77129_f,setVersioned,2,Flags this world type as having an associated versio
|
||||
func_77130_a,parseWorldType,2,
|
||||
func_77131_c,getGeneratorVersion,2,Returns generatorVersion.
|
||||
func_77132_a,getWorldTypeForGeneratorVersion,2,
|
||||
func_77142_a,getByName,0,"Returns the game type with the specified name, or SURVIVAL if none found. This is case sensitive. Args: name"
|
||||
func_77142_a,getByName,2,"Returns the game type with the specified name, or SURVIVAL if none found. This is case sensitive. Args: name"
|
||||
func_77144_e,isSurvivalOrAdventure,0,Returns true if this is the SURVIVAL or ADVENTURE game type
|
||||
func_77145_d,isCreative,2,Returns true if this is the CREATIVE game type
|
||||
func_77146_a,getByID,2,"Returns the game type with the specified ID, or SURVIVAL if none found. Args: id"
|
||||
@@ -3390,9 +3390,9 @@ func_77420_c,syncStatsFileWithMap,0,
|
||||
func_77423_b,beginReceiveStats,0,Attempts to begin receiving stats from the server. Will throw an IllegalStateException if the syncher is already busy.
|
||||
func_77424_g,getUnsentOldFile,0,
|
||||
func_77439_a,getChunkProvider,2,Returns the result of the ChunkProvider's makeString
|
||||
func_77442_b,canUnlockAchievement,0,"Returns true if the parent has been unlocked, or there is no parent"
|
||||
func_77443_a,hasAchievementUnlocked,0,Returns true if the achievement has been unlocked.
|
||||
func_77444_a,writeStat,0,
|
||||
func_77442_b,canUnlockAchievement,2,"Returns true if the parent has been unlocked, or there is no parent"
|
||||
func_77443_a,hasAchievementUnlocked,2,Returns true if the achievement has been unlocked.
|
||||
func_77444_a,writeStat,2,
|
||||
func_77446_d,syncStats,0,
|
||||
func_77447_a,writeStats,0,write a whole Map of stats to the statmap
|
||||
func_77450_a,readStat,0,
|
||||
@@ -3462,18 +3462,18 @@ func_77607_a,addRecipes,2,Adds the dye recipes to the CraftingManager.
|
||||
func_77608_a,addRecipes,2,Adds the food recipes to the CraftingManager.
|
||||
func_77609_a,addRecipes,2,Adds the armor recipes to the CraftingManager.
|
||||
func_77612_l,getMaxDamage,2,Returns the maximum damage an item can take.
|
||||
func_77613_e,getRarity,0,Return an item rarity from EnumRarity
|
||||
func_77613_e,getRarity,2,Return an item rarity from EnumRarity
|
||||
func_77614_k,getHasSubtypes,2,
|
||||
func_77615_a,onPlayerStoppedUsing,2,"called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount"
|
||||
func_77616_k,isItemTool,2,Checks isDamagable and if it cannot be stacked
|
||||
func_77617_a,getIconFromDamage,0,Gets an icon index based on an item's damage value
|
||||
func_77618_c,getIconFromDamageForRenderPass,0,Gets an icon index based on an item's damage value and the given render pass
|
||||
func_77618_c,getIconFromDamageForRenderPass,2,Gets an icon index based on an item's damage value and the given render pass
|
||||
func_77619_b,getItemEnchantability,2,"Return the enchantability factor of the item, most of the time is based on material."
|
||||
func_77620_a,getColorFromDamage,0,
|
||||
func_77621_a,getMovingObjectPositionFromPlayer,2,
|
||||
func_77622_d,onCreated,2,Called when item is crafted/smelted. Used only by maps so far.
|
||||
func_77623_v,requiresMultipleRenderPasses,0,
|
||||
func_77624_a,addInformation,0,allows items to add custom lines of information to the mouseover description
|
||||
func_77623_v,requiresMultipleRenderPasses,2,
|
||||
func_77624_a,addInformation,2,allows items to add custom lines of information to the mouseover description
|
||||
func_77625_d,setMaxStackSize,2,
|
||||
func_77626_a,getMaxItemUseDuration,2,How long it takes to use or consume an item
|
||||
func_77627_a,setHasSubtypes,2,
|
||||
@@ -3485,7 +3485,7 @@ func_77632_u,isPotionIngredient,2,Returns true if this item serves as a potion i
|
||||
func_77633_a,getSubItems,0,"returns a list of items with the same ID, but different meta (eg: dye returns 16 items)"
|
||||
func_77634_r,hasContainerItem,2,True if this Item has a container item (a.k.a. crafting result)
|
||||
func_77635_s,getStatName,2,
|
||||
func_77636_d,hasEffect,0,
|
||||
func_77636_d,hasEffect,2,
|
||||
func_77637_a,setCreativeTab,2,returns this;
|
||||
func_77638_a,getStrVsBlock,2,"Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if sword"
|
||||
func_77639_j,getItemStackLimit,2,Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?*
|
||||
@@ -3508,7 +3508,7 @@ func_77658_a,getUnlocalizedName,2,Returns the unlocalized name of this item.
|
||||
func_77659_a,onItemRightClick,2,"Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer"
|
||||
func_77660_a,onBlockDestroyed,2,
|
||||
func_77661_b,getItemUseAction,2,returns the action that specifies what animation to play when the items is being used
|
||||
func_77662_d,isFull3D,0,Returns True is the item is renderer in full 3D when hold.
|
||||
func_77662_d,isFull3D,2,Returns True is the item is renderer in full 3D when hold.
|
||||
func_77663_a,onUpdate,2,Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and update it's contents.
|
||||
func_77664_n,setFull3D,2,Sets bFull3D to True and return the object.
|
||||
func_77666_t,getPotionEffect,2,Returns a string representing what this item does to a potion.
|
||||
@@ -3560,8 +3560,8 @@ func_77949_a,loadItemStackFromNBT,2,
|
||||
func_77950_b,onFoodEaten,2,
|
||||
func_77951_h,isItemDamaged,2,returns true when a damageable item is damaged
|
||||
func_77952_i,getItemDamageForDisplay,2,"gets the damage of an itemstack, for displaying purposes"
|
||||
func_77953_t,getRarity,0,
|
||||
func_77954_c,getIconIndex,0,Returns the icon index of the current stack.
|
||||
func_77953_t,getRarity,2,
|
||||
func_77954_c,getIconIndex,2,Returns the icon index of the current stack.
|
||||
func_77955_b,writeToNBT,2,Write the stack fields to a NBT object. Return the new NBT object.
|
||||
func_77956_u,isItemEnchantable,2,True if it is a tool and has no enchantments to begin with
|
||||
func_77957_a,useItemRightClick,2,"Called whenever this item stack is equipped and right clicked. Returns the new item stack to put in the position where this item is. Args: world, player"
|
||||
@@ -3608,7 +3608,7 @@ func_78017_i,shouldHidePlayerInventory,0,
|
||||
func_78018_a,displayAllReleventItems,0,only shows items which have tabToDisplayOn == this
|
||||
func_78019_g,drawInForegroundOfTab,0,
|
||||
func_78020_k,getTabColumn,0,returns index % 6
|
||||
func_78021_a,getTabIndex,0,
|
||||
func_78021_a,getTabIndex,2,
|
||||
func_78022_j,setNoScrollbar,2,
|
||||
func_78023_l,isTabInFirstRow,0,returns tabIndex < 6
|
||||
func_78024_c,getTranslatedTabLabel,0,Gets the translated Label.
|
||||
@@ -4156,7 +4156,7 @@ func_82782_a,setEnchantments,2,Set the enchantments for the specified stack.
|
||||
func_82787_a,findMatchingRecipe,2,
|
||||
func_82788_x,canItemEditBlocks,2,"Returns true if players can use this item to affect the world (e.g. placing blocks, placing ender eyes in portal) when not in creative"
|
||||
func_82789_a,getIsRepairable,2,Return whether this item is repairable in an anvil.
|
||||
func_82790_a,getColorFromItemStack,0,
|
||||
func_82790_a,getColorFromItemStack,2,
|
||||
func_82810_a,createHangingEntity,2,Create the hanging entity associated to this item.
|
||||
func_82812_d,getArmorMaterial,2,Return the armor material for this armor item.
|
||||
func_82814_b,getColor,2,Return the color for the specified armor ItemStack.
|
||||
@@ -4188,7 +4188,7 @@ func_82851_a,getRepairInputInventory,2,
|
||||
func_82863_d,getBeacon,2,Returns the Tile Entity behind this beacon inventory / container
|
||||
func_82869_a,canTakeStack,2,Return whether this slot's stack can be taken from this slot.
|
||||
func_82870_a,onPickupFromSlot,2,
|
||||
func_82877_b,setPlayerWalkSpeed,0,
|
||||
func_82877_b,setPlayerWalkSpeed,2,
|
||||
func_82879_c,sendSettingsToServer,0,Send a client info packet with settings information to the server
|
||||
func_82883_a,getUnicodeFlag,0,Get unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png font.
|
||||
func_82889_a,getBatSize,0,"not actually sure this is size, is not used as of now, but the model would be recreated if the value changed and it seems a good match for a bats size"
|
||||
@@ -4462,11 +4462,11 @@ func_94577_B,getBlockPowerInput,2,"Returns the highest redstone signal strength
|
||||
func_94578_a,destroyBlock,2,"Destroys a block and optionally drops items. Args: X, Y, Z, dropItems"
|
||||
func_94581_a,registerIcons,0,
|
||||
func_94599_c,getItemIconForUseDuration,0,"used to cycle through icons based on their used duration, i.e. for the bow"
|
||||
func_94608_d,getItemSpriteNumber,0,
|
||||
func_94608_d,getItemSpriteNumber,2,
|
||||
func_94609_a,callTileEntityID,2,
|
||||
func_94611_a,callTileEntityDataInfo,2,
|
||||
func_94613_c,getExplosivePlacedBy,2,"Returns either the entity that placed the explosive block, the entity that caused the explosion or null."
|
||||
func_94901_k,getSpriteNumber,0,"Returns 0 for /terrain.png, 1 for /gui/items.png"
|
||||
func_94901_k,getSpriteNumber,2,"Returns 0 for /terrain.png, 1 for /gui/items.png"
|
||||
func_96090_ax,getTranslatedEntityName,2,Returns the translated name of the entity.
|
||||
func_96091_a,shouldExplodeBlock,2,
|
||||
func_96092_aw,isPushedByWater,2,
|
||||
@@ -4475,20 +4475,20 @@ func_96095_a,onActivatorRailPass,2,Called every tick the minecart is on an activ
|
||||
func_96096_ay,isIgnited,2,Returns true if the TNT minecart is ignited.
|
||||
func_96099_a,setOutputSignal,2,
|
||||
func_96100_a,getOutputSignal,2,
|
||||
func_96102_a,setSignalStrength,2,
|
||||
func_96103_d,getSignalStrength,2,
|
||||
func_96102_a,setSignalStrength,1,
|
||||
func_96103_d,getSignalStrength,1,
|
||||
func_96104_c,setCommandSenderName,2,Sets the name of the command sender
|
||||
func_96107_aA,getXPos,2,Gets the world X position for this hopper entity.
|
||||
func_96108_aC,getZPos,2,Gets the world Z position for this hopper entity.
|
||||
func_96109_aB,getYPos,2,Gets the world Y position for this hopper entity.
|
||||
func_96110_f,setBlocked,2,Set whether this hopper minecart is being blocked by an activator rail.
|
||||
func_96111_ay,getBlocked,2,Get whether this hopper minecart is being blocked by an activator rail.
|
||||
func_96114_a,insertStackFromEntity,2,
|
||||
func_96114_a,insertStackFromEntity,0,
|
||||
func_96115_a,setInventoryName,2,
|
||||
func_96116_a,suckItemsIntoHopper,2,Sucks one item into the given hopper from an inventory or EntityItem above it.
|
||||
func_96117_b,getInventoryAtLocation,2,Gets an inventory at the given location to extract items into or take items from. Can find either a tile entity or regular entity implementing IInventory.
|
||||
func_96118_b,getInventoryAboveHopper,2,"Looks for anything, that can hold items (like chests, furnaces, etc.) one block above the given hopper."
|
||||
func_96119_a,getEntityAbove,2,
|
||||
func_96119_a,getEntityAbove,0,
|
||||
func_96120_a,setEquipmentDropChance,2,
|
||||
func_96122_a,canAttackPlayer,2,
|
||||
func_96123_co,getWorldScoreboard,2,
|
||||
@@ -4540,7 +4540,7 @@ func_96512_b,removePlayerFromTeam,2,Removes the given username from the given Sc
|
||||
func_96514_c,getScoreObjectives,2,
|
||||
func_96517_b,getObjectiveDisplaySlot,2,"Returns 'list' for 0, 'sidebar' for 1, 'belowName for 2, otherwise null."
|
||||
func_96518_b,getObjective,2,Returns a ScoreObjective for the objective name
|
||||
func_96521_a,addPlayerToTeam,2,
|
||||
func_96521_a,addPlayerToTeam,1,
|
||||
func_96524_g,removePlayerFromTeams,2,
|
||||
func_96526_d,getObjectiveNames,2,
|
||||
func_96527_f,createTeam,2,
|
||||
@@ -4575,14 +4575,14 @@ func_96678_d,getDisplayName,2,
|
||||
func_96679_b,getName,2,
|
||||
func_96680_c,getCriteria,2,
|
||||
func_96681_a,setDisplayName,2,
|
||||
func_96682_a,getScoreboard,0,
|
||||
func_96682_a,getScoreboard,2,
|
||||
func_98033_al,getLogAgent,2,
|
||||
func_98034_c,isInvisibleToPlayer,0,"Only used by renderer in EntityLivingBase subclasses.\nDetermines if an entity is visible or not to a specfic player, if the entity is normally invisible.\nFor EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent."
|
||||
func_98034_c,isInvisibleToPlayer,2,"Only used by renderer in EntityLivingBase subclasses.\nDetermines if an entity is visible or not to a specfic player, if the entity is normally invisible.\nFor EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent."
|
||||
func_98035_c,writeMountToNBT,2,Like writeToNBTOptional but does not check if the entity is ridden. Used for saving ridden entities with their riders.
|
||||
func_98041_l,getChestType,2,
|
||||
func_98042_n,setTransferTicker,2,"Sets the transfer ticker, used to determine the delay between transfers."
|
||||
func_98043_aE,canTransfer,2,Returns whether the hopper cart can currently transfer an item.
|
||||
func_98045_j,updateHopper,2,
|
||||
func_98045_j,updateHopper,0,
|
||||
func_98046_c,setTransferCooldown,2,
|
||||
func_98047_l,isCoolingDown,2,
|
||||
func_98049_a,getSpawnerLogic,2,Returns the spawner logic associated with this spawner
|
||||
|
||||
|
+1764
-1764
File diff suppressed because it is too large.
Load diff
@@ -1,309 +0,0 @@
|
||||
diff -r -U 3 minecraft\net\minecraft\src\CallableSuspiciousClasses.java minecraft_patched\net\minecraft\src\CallableSuspiciousClasses.java
|
||||
--- minecraft\net\minecraft\src\CallableSuspiciousClasses.java Tue Sep 17 13:58:48 2013
|
||||
+++ minecraft_patched\net\minecraft\src\CallableSuspiciousClasses.java Tue Sep 17 14:01:01 2013
|
||||
@@ -21,9 +21,14 @@
|
||||
|
||||
public String func_85085_a() throws SecurityException, NoSuchFieldException, IllegalAccessException, IllegalArgumentException {
|
||||
StringBuilder var1 = new StringBuilder();
|
||||
+ ArrayList var3;
|
||||
+ try {
|
||||
Field var2 = ClassLoader.class.getDeclaredField("classes");
|
||||
var2.setAccessible(true);
|
||||
- ArrayList var3 = new ArrayList((Vector)var2.get(CrashReport.class.getClassLoader()));
|
||||
+ var3 = new ArrayList((Vector)var2.get(CrashReport.class.getClassLoader()));
|
||||
+ } catch(Exception ex) {
|
||||
+ return "";
|
||||
+ }
|
||||
boolean var4 = true;
|
||||
boolean var5 = !CrashReport.class.getCanonicalName().equals("net.minecraft.CrashReport");
|
||||
HashMap var6 = new HashMap();
|
||||
@@ -98,6 +103,10 @@
|
||||
|
||||
// $FF: synthetic method
|
||||
public Object call() {
|
||||
+ try {
|
||||
return this.func_85085_a();
|
||||
+ } catch(Exception ex) {
|
||||
+ return null;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
diff -r -U 3 minecraft\net\minecraft\src\ComponentStrongholdRightTurn.java minecraft_patched\net\minecraft\src\ComponentStrongholdRightTurn.java
|
||||
--- minecraft\net\minecraft\src\ComponentStrongholdRightTurn.java Tue Sep 17 13:58:48 2013
|
||||
+++ minecraft_patched\net\minecraft\src\ComponentStrongholdRightTurn.java Tue Sep 17 14:01:01 2013
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
public class ComponentStrongholdRightTurn extends ComponentStrongholdLeftTurn {
|
||||
|
||||
+ public ComponentStrongholdRightTurn(int p_i2074_1_, Random p_i2074_2_, StructureBoundingBox p_i2074_3_, int p_i2074_4_) {
|
||||
+ super(p_i2074_1_, p_i2074_2_, p_i2074_3_, p_i2074_4_);
|
||||
+ }
|
||||
+
|
||||
public void func_74861_a(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_) {
|
||||
if(this.field_74885_f != 2 && this.field_74885_f != 3) {
|
||||
this.func_74989_b((ComponentStrongholdStairs2)p_74861_1_, p_74861_2_, p_74861_3_, 1, 1);
|
||||
diff -r -U 3 minecraft\net\minecraft\src\DedicatedServer.java minecraft_patched\net\minecraft\src\DedicatedServer.java
|
||||
--- minecraft\net\minecraft\src\DedicatedServer.java Tue Sep 17 13:58:48 2013
|
||||
+++ minecraft_patched\net\minecraft\src\DedicatedServer.java Tue Sep 17 14:01:01 2013
|
||||
@@ -208,7 +208,7 @@
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
- protected void func_71190_q() {
|
||||
+ public void func_71190_q() {
|
||||
super.func_71190_q();
|
||||
this.func_71333_ah();
|
||||
}
|
||||
diff -r -U 3 minecraft\net\minecraft\src\EnumChatFormatting.java minecraft_patched\net\minecraft\src\EnumChatFormatting.java
|
||||
--- minecraft\net\minecraft\src\EnumChatFormatting.java Tue Sep 17 13:58:49 2013
|
||||
+++ minecraft_patched\net\minecraft\src\EnumChatFormatting.java Tue Sep 17 14:01:01 2013
|
||||
@@ -38,7 +38,7 @@
|
||||
private final String field_96304_B;
|
||||
|
||||
private EnumChatFormatting(char p_i1336_3_) {
|
||||
- this(p_i1336_1_, p_i1336_2_, p_i1336_3_, false);
|
||||
+ this(p_i1336_3_, false);
|
||||
}
|
||||
|
||||
private EnumChatFormatting(char p_i1337_3_, boolean p_i1337_4_) {
|
||||
diff -r -U 3 minecraft\net\minecraft\src\FileResourcePack.java minecraft_patched\net\minecraft\src\FileResourcePack.java
|
||||
--- minecraft\net\minecraft\src\FileResourcePack.java Tue Sep 17 13:58:49 2013
|
||||
+++ minecraft_patched\net\minecraft\src\FileResourcePack.java Tue Sep 17 14:01:01 2013
|
||||
@@ -84,12 +84,18 @@
|
||||
|
||||
protected void finalize() {
|
||||
this.close();
|
||||
+ try {
|
||||
super.finalize();
|
||||
+ } catch(Throwable t) {
|
||||
+ }
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if(this.field_110600_d != null) {
|
||||
+ try {
|
||||
this.field_110600_d.close();
|
||||
+ } catch(Exception ex) {
|
||||
+ }
|
||||
this.field_110600_d = null;
|
||||
}
|
||||
|
||||
diff -r -U 3 minecraft\net\minecraft\src\FolderResourcePack.java minecraft_patched\net\minecraft\src\FolderResourcePack.java
|
||||
--- minecraft\net\minecraft\src\FolderResourcePack.java Tue Sep 17 13:58:49 2013
|
||||
+++ minecraft_patched\net\minecraft\src\FolderResourcePack.java Tue Sep 17 14:01:01 2013
|
||||
@@ -29,7 +29,7 @@
|
||||
HashSet var1 = Sets.newHashSet();
|
||||
File var2 = new File(this.field_110597_b, "assets/");
|
||||
if(var2.isDirectory()) {
|
||||
- File[] var3 = var2.listFiles(DirectoryFileFilter.DIRECTORY);
|
||||
+ File[] var3 = var2.listFiles((java.io.FileFilter)DirectoryFileFilter.DIRECTORY);
|
||||
int var4 = var3.length;
|
||||
|
||||
for(int var5 = 0; var5 < var4; ++var5) {
|
||||
diff -r -U 3 minecraft\net\minecraft\src\FontRenderer.java minecraft_patched\net\minecraft\src\FontRenderer.java
|
||||
--- minecraft\net\minecraft\src\FontRenderer.java Tue Sep 17 13:58:49 2013
|
||||
+++ minecraft_patched\net\minecraft\src\FontRenderer.java Tue Sep 17 14:01:01 2013
|
||||
@@ -630,8 +630,6 @@
|
||||
case 10:
|
||||
--var5;
|
||||
break;
|
||||
- case 32:
|
||||
- var6 = var5;
|
||||
case 167:
|
||||
if(var5 < var3 - 1) {
|
||||
++var5;
|
||||
@@ -645,6 +643,8 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
+ case 32:
|
||||
+ var6 = var5;
|
||||
default:
|
||||
var4 += this.func_78263_a(var8);
|
||||
if(var7) {
|
||||
diff -r -U 3 minecraft\net\minecraft\src\IntegratedServer.java minecraft_patched\net\minecraft\src\IntegratedServer.java
|
||||
--- minecraft\net\minecraft\src\IntegratedServer.java Tue Sep 17 13:58:50 2013
|
||||
+++ minecraft_patched\net\minecraft\src\IntegratedServer.java Tue Sep 17 14:01:01 2013
|
||||
@@ -103,7 +103,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
- protected void func_71217_p() {
|
||||
+ public void func_71217_p() {
|
||||
boolean var1 = this.field_71348_o;
|
||||
this.field_71348_o = this.field_71347_n.func_71752_f();
|
||||
if(!var1 && this.field_71348_o) {
|
||||
diff -r -U 3 minecraft\net\minecraft\src\Minecraft.java minecraft_patched\net\minecraft\src\Minecraft.java
|
||||
--- minecraft\net\minecraft\src\Minecraft.java Tue Sep 17 13:58:50 2013
|
||||
+++ minecraft_patched\net\minecraft\src\Minecraft.java Tue Sep 17 14:01:01 2013
|
||||
@@ -604,8 +604,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- while(true) {
|
||||
- try {
|
||||
+ try {
|
||||
+ while(this.field_71425_J) {
|
||||
if(this.field_71425_J) {
|
||||
if(this.field_71434_R && this.field_71433_S != null) {
|
||||
this.func_71377_b(this.field_71433_S);
|
||||
@@ -626,23 +626,20 @@
|
||||
}
|
||||
continue;
|
||||
}
|
||||
- } catch (MinecraftError var12) {
|
||||
- ;
|
||||
- } catch (ReportedException var13) {
|
||||
- this.func_71396_d(var13.func_71575_a());
|
||||
- this.func_71398_f();
|
||||
- var13.printStackTrace();
|
||||
- this.func_71377_b(var13.func_71575_a());
|
||||
- } catch (Throwable var14) {
|
||||
- var2 = this.func_71396_d(new CrashReport("Unexpected error", var14));
|
||||
- this.func_71398_f();
|
||||
- var14.printStackTrace();
|
||||
- this.func_71377_b(var2);
|
||||
- } finally {
|
||||
- this.func_71405_e();
|
||||
}
|
||||
-
|
||||
- return;
|
||||
+ } catch (MinecraftError var12) {
|
||||
+ } catch (ReportedException var13) {
|
||||
+ this.func_71396_d(var13.func_71575_a());
|
||||
+ this.func_71398_f();
|
||||
+ var13.printStackTrace();
|
||||
+ this.func_71377_b(var13.func_71575_a());
|
||||
+ } catch (Throwable var14) {
|
||||
+ var2 = this.func_71396_d(new CrashReport("Unexpected error", var14));
|
||||
+ this.func_71398_f();
|
||||
+ var14.printStackTrace();
|
||||
+ this.func_71377_b(var2);
|
||||
+ } finally {
|
||||
+ this.func_71405_e();
|
||||
}
|
||||
}
|
||||
|
||||
diff -r -U 3 minecraft\net\minecraft\src\RConThreadClient.java minecraft_patched\net\minecraft\src\RConThreadClient.java
|
||||
--- minecraft\net\minecraft\src\RConThreadClient.java Tue Sep 17 13:58:51 2013
|
||||
+++ minecraft_patched\net\minecraft\src\RConThreadClient.java Tue Sep 17 14:01:01 2013
|
||||
@@ -32,8 +32,8 @@
|
||||
}
|
||||
|
||||
public void run() {
|
||||
- while(true) {
|
||||
- try {
|
||||
+ try {
|
||||
+ while(true) {
|
||||
if(!this.field_72619_a) {
|
||||
break;
|
||||
}
|
||||
@@ -84,20 +84,14 @@
|
||||
continue;
|
||||
}
|
||||
}
|
||||
- } catch (SocketTimeoutException var17) {
|
||||
- break;
|
||||
- } catch (IOException var18) {
|
||||
- break;
|
||||
- } catch (Exception var19) {
|
||||
- System.out.println(var19);
|
||||
- break;
|
||||
- } finally {
|
||||
- this.func_72653_g();
|
||||
}
|
||||
-
|
||||
- return;
|
||||
+ } catch (SocketTimeoutException var17) {
|
||||
+ } catch (IOException var18) {
|
||||
+ } catch (Exception var19) {
|
||||
+ System.out.println(var19);
|
||||
+ } finally {
|
||||
+ this.func_72653_g();
|
||||
}
|
||||
-
|
||||
}
|
||||
|
||||
private void func_72654_a(int p_72654_1_, int p_72654_2_, String p_72654_3_) throws IOException {
|
||||
diff -r -U 3 minecraft\net\minecraft\src\RenderBlocks.java minecraft_patched\net\minecraft\src\RenderBlocks.java
|
||||
--- minecraft\net\minecraft\src\RenderBlocks.java Tue Sep 17 13:58:51 2013
|
||||
+++ minecraft_patched\net\minecraft\src\RenderBlocks.java Tue Sep 17 14:01:01 2013
|
||||
@@ -1960,16 +1960,16 @@
|
||||
float var25 = (float)(p_78589_2_ + 1);
|
||||
float var26 = (float)(p_78589_4_ + 0);
|
||||
float var27 = (float)(p_78589_4_ + 1);
|
||||
- boolean var28 = false;
|
||||
+ int var28 = 0;
|
||||
if((var20 || var21) && !var22 && !var23) {
|
||||
- var28 = true;
|
||||
+ var28 = 1;
|
||||
}
|
||||
|
||||
if((var22 || var23) && !var21 && !var20) {
|
||||
- var28 = true;
|
||||
+ var28 = 2;
|
||||
}
|
||||
|
||||
- if(!var28) {
|
||||
+ if(var28 == 0) {
|
||||
int var29 = 0;
|
||||
int var30 = 0;
|
||||
int var31 = 16;
|
||||
@@ -2016,7 +2016,7 @@
|
||||
var5.func_78374_a((double)var25, (double)p_78589_3_ + 0.015625D, (double)var26, (double)var9.func_94214_a((double)var31), (double)var9.func_94207_b((double)var30));
|
||||
var5.func_78374_a((double)var24, (double)p_78589_3_ + 0.015625D, (double)var26, (double)var9.func_94214_a((double)var29), (double)var9.func_94207_b((double)var30));
|
||||
var5.func_78374_a((double)var24, (double)p_78589_3_ + 0.015625D, (double)var27, (double)var9.func_94214_a((double)var29), (double)var9.func_94207_b((double)var32));
|
||||
- } else if(var28) {
|
||||
+ } else if(var28 == 1) {
|
||||
var5.func_78374_a((double)var25, (double)p_78589_3_ + 0.015625D, (double)var27, (double)var8.func_94212_f(), (double)var8.func_94210_h());
|
||||
var5.func_78374_a((double)var25, (double)p_78589_3_ + 0.015625D, (double)var26, (double)var8.func_94212_f(), (double)var8.func_94206_g());
|
||||
var5.func_78374_a((double)var24, (double)p_78589_3_ + 0.015625D, (double)var26, (double)var8.func_94209_e(), (double)var8.func_94206_g());
|
||||
diff -r -U 3 minecraft\net\minecraft\src\RenderGlobal.java minecraft_patched\net\minecraft\src\RenderGlobal.java
|
||||
--- minecraft\net\minecraft\src\RenderGlobal.java Tue Sep 17 13:58:51 2013
|
||||
+++ minecraft_patched\net\minecraft\src\RenderGlobal.java Tue Sep 17 14:01:01 2013
|
||||
@@ -1445,7 +1445,7 @@
|
||||
double var15 = this.field_72777_q.field_71451_h.field_70165_t - p_72726_2_;
|
||||
double var17 = this.field_72777_q.field_71451_h.field_70163_u - p_72726_4_;
|
||||
double var19 = this.field_72777_q.field_71451_h.field_70161_v - p_72726_6_;
|
||||
- Object var21 = null;
|
||||
+ EntityFX var21 = null;
|
||||
if(p_72726_1_.equals("hugeexplosion")) {
|
||||
this.field_72777_q.field_71452_i.func_78873_a(var21 = new EntityHugeExplodeFX(this.field_72769_h, p_72726_2_, p_72726_4_, p_72726_6_, p_72726_8_, p_72726_10_, p_72726_12_));
|
||||
} else if(p_72726_1_.equals("largeexplode")) {
|
||||
diff -r -U 3 minecraft\net\minecraft\src\SoundPoolURLConnection.java minecraft_patched\net\minecraft\src\SoundPoolURLConnection.java
|
||||
--- minecraft\net\minecraft\src\SoundPoolURLConnection.java Tue Sep 17 13:58:51 2013
|
||||
+++ minecraft_patched\net\minecraft\src\SoundPoolURLConnection.java Tue Sep 17 14:01:01 2013
|
||||
@@ -22,7 +22,11 @@
|
||||
public void connect() {}
|
||||
|
||||
public InputStream getInputStream() {
|
||||
+ try {
|
||||
return SoundPool.func_110655_a(this.field_110660_a).func_110536_a(this.field_110659_b).func_110527_b();
|
||||
+ } catch(Exception ex) {
|
||||
+ return null;
|
||||
+ }
|
||||
}
|
||||
|
||||
// $FF: synthetic method
|
||||
diff -r -U 3 minecraft\net\minecraft\src\TcpMasterThread.java minecraft_patched\net\minecraft\src\TcpMasterThread.java
|
||||
--- minecraft\net\minecraft\src\TcpMasterThread.java Tue Sep 17 13:58:51 2013
|
||||
+++ minecraft_patched\net\minecraft\src\TcpMasterThread.java Tue Sep 17 14:01:01 2013
|
||||
@@ -11,6 +11,7 @@
|
||||
this.field_74504_a = p_i1395_1_;
|
||||
}
|
||||
|
||||
+ @SuppressWarnings("deprecation")
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(5000L);
|
||||
diff -r -U 3 minecraft\net\minecraft\src\ThreadedFileIOBase.java minecraft_patched\net\minecraft\src\ThreadedFileIOBase.java
|
||||
--- minecraft\net\minecraft\src\ThreadedFileIOBase.java Tue Sep 17 13:58:52 2013
|
||||
+++ minecraft_patched\net\minecraft\src\ThreadedFileIOBase.java Tue Sep 17 14:01:01 2013
|
||||
@@ -20,6 +20,7 @@
|
||||
}
|
||||
|
||||
public void run() {
|
||||
+ while(true)
|
||||
this.func_75736_b();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
diff -r -U 3 minecraft\net\minecraft\client\Minecraft.java minecraft_patched\net\minecraft\client\Minecraft.java
|
||||
--- minecraft\net\minecraft\client\Minecraft.java
|
||||
+++ minecraft_patched\net\minecraft\client\Minecraft.java
|
||||
@@ -695,9 +695,7 @@
|
||||
|
||||
while(true) {
|
||||
try {
|
||||
- if(!this.field_71425_J) {
|
||||
- break;
|
||||
- }
|
||||
+ while(this.field_71425_J) {
|
||||
|
||||
if(!this.field_71434_R || this.field_71433_S == null) {
|
||||
try {
|
||||
@@ -711,6 +709,7 @@
|
||||
}
|
||||
|
||||
this.func_71377_b(this.field_71433_S);
|
||||
+ }
|
||||
} catch (MinecraftError var12) {
|
||||
break;
|
||||
} catch (ReportedException var13) {
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -r -U 3 minecraft\net\minecraft\client\Minecraft.java minecraft_patched\net\minecraft\client\Minecraft.java
|
||||
--- minecraft\net\minecraft\client\Minecraft.java
|
||||
+++ minecraft_patched\net\minecraft\client\Minecraft.java
|
||||
@@ -695,7 +695,7 @@
|
||||
|
||||
while(true) {
|
||||
try {
|
||||
- if(this.field_71425_J) {
|
||||
+ while(this.field_71425_J) {
|
||||
if(!this.field_71434_R || this.field_71433_S == null) {
|
||||
try {
|
||||
this.func_71411_J();
|
||||
@@ -0,0 +1,21 @@
|
||||
diff -r -U 3 minecraft\net\minecraft\client\gui\FontRenderer.java minecraft_patched\net\minecraft\client\gui\FontRenderer.java
|
||||
--- minecraft\net\minecraft\client\gui\FontRenderer.java
|
||||
+++ minecraft_patched\net\minecraft\client\gui\FontRenderer.java
|
||||
@@ -581,8 +581,6 @@
|
||||
case 10:
|
||||
--var5;
|
||||
break;
|
||||
- case 32:
|
||||
- var6 = var5;
|
||||
case 167:
|
||||
if(var5 < var3 - 1) {
|
||||
++var5;
|
||||
@@ -596,6 +594,8 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
+ case 32:
|
||||
+ var6 = var5;
|
||||
default:
|
||||
var4 += this.func_78263_a(var8);
|
||||
if(var7) {
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
diff -r -U 3 minecraft\net\minecraft\client\network\NetHandlerHandshakeMemory.java minecraft_patched\net\minecraft\client\network\NetHandlerHandshakeMemory.java
|
||||
--- minecraft\net\minecraft\client\network\NetHandlerHandshakeMemory.java
|
||||
+++ minecraft_patched\net\minecraft\client\network\NetHandlerHandshakeMemory.java
|
||||
@@ -31,6 +31,7 @@
|
||||
switch(NetHandlerHandshakeMemory.SwitchEnumConnectionState.field_151263_a[p_147232_2_.ordinal()]) {
|
||||
case 1:
|
||||
this.field_147384_b.func_150719_a(new NetHandlerLoginServer(this.field_147385_a, this.field_147384_b));
|
||||
+ break;
|
||||
case 2:
|
||||
throw new UnsupportedOperationException("NYI");
|
||||
default:
|
||||
@@ -0,0 +1,23 @@
|
||||
diff -r -U 3 minecraft\net\minecraft\client\particle\EffectRenderer.java minecraft_patched\net\minecraft\client\particle\EffectRenderer.java
|
||||
--- minecraft\net\minecraft\client\particle\EffectRenderer.java
|
||||
+++ minecraft_patched\net\minecraft\client\particle\EffectRenderer.java
|
||||
@@ -53,7 +53,8 @@
|
||||
}
|
||||
|
||||
public void func_78868_a() {
|
||||
- for(final int var1 = 0; var1 < 4; ++var1) {
|
||||
+ for(int var11 = 0; var11 < 4; ++var11) {
|
||||
+ final int var1 = var11;
|
||||
for(int var2 = 0; var2 < this.field_78876_b[var1].size(); ++var2) {
|
||||
final EntityFX var3 = (EntityFX)this.field_78876_b[var1].get(var2);
|
||||
|
||||
@@ -99,7 +100,8 @@
|
||||
EntityFX.field_70554_ao = p_78874_1_.field_70137_T + (p_78874_1_.field_70163_u - p_78874_1_.field_70137_T) * (double)p_78874_2_;
|
||||
EntityFX.field_70555_ap = p_78874_1_.field_70136_U + (p_78874_1_.field_70161_v - p_78874_1_.field_70136_U) * (double)p_78874_2_;
|
||||
|
||||
- for(final int var8 = 0; var8 < 3; ++var8) {
|
||||
+ for(int var88 = 0; var88 < 3; ++var88) {
|
||||
+ final int var8 = var88;
|
||||
if(!this.field_78876_b[var8].isEmpty()) {
|
||||
switch(var8) {
|
||||
case 0:
|
||||
@@ -0,0 +1,33 @@
|
||||
diff -r -U 3 minecraft\net\minecraft\client\renderer\RenderBlocks.java minecraft_patched\net\minecraft\client\renderer\RenderBlocks.java
|
||||
--- minecraft\net\minecraft\client\renderer\RenderBlocks.java
|
||||
+++ minecraft_patched\net\minecraft\client\renderer\RenderBlocks.java
|
||||
@@ -1929,16 +1929,16 @@
|
||||
float var24 = (float)(p_147788_2_ + 1);
|
||||
float var25 = (float)(p_147788_4_ + 0);
|
||||
float var26 = (float)(p_147788_4_ + 1);
|
||||
- boolean var27 = false;
|
||||
+ int var27 = 0;
|
||||
if((var19 || var20) && !var21 && !var22) {
|
||||
- var27 = true;
|
||||
+ var27 = 1;
|
||||
}
|
||||
|
||||
if((var21 || var22) && !var20 && !var19) {
|
||||
- var27 = true;
|
||||
+ var27 = 2;
|
||||
}
|
||||
|
||||
- if(!var27) {
|
||||
+ if(var27 == 0) {
|
||||
int var28 = 0;
|
||||
int var29 = 0;
|
||||
int var30 = 16;
|
||||
@@ -1985,7 +1985,7 @@
|
||||
var5.func_78374_a((double)var24, (double)p_147788_3_ + 0.015625D, (double)var25, (double)var9.func_94214_a((double)var30), (double)var9.func_94207_b((double)var29));
|
||||
var5.func_78374_a((double)var23, (double)p_147788_3_ + 0.015625D, (double)var25, (double)var9.func_94214_a((double)var28), (double)var9.func_94207_b((double)var29));
|
||||
var5.func_78374_a((double)var23, (double)p_147788_3_ + 0.015625D, (double)var26, (double)var9.func_94214_a((double)var28), (double)var9.func_94207_b((double)var31));
|
||||
- } else if(var27) {
|
||||
+ } else if(var27 == 1) {
|
||||
var5.func_78374_a((double)var24, (double)p_147788_3_ + 0.015625D, (double)var26, (double)var8.func_94212_f(), (double)var8.func_94210_h());
|
||||
var5.func_78374_a((double)var24, (double)p_147788_3_ + 0.015625D, (double)var25, (double)var8.func_94212_f(), (double)var8.func_94206_g());
|
||||
var5.func_78374_a((double)var23, (double)p_147788_3_ + 0.015625D, (double)var25, (double)var8.func_94209_e(), (double)var8.func_94206_g());
|
||||
Loaded 100 of 422 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user