Skip to content

Commit

Permalink
Adding mob counter files?
Browse files Browse the repository at this point in the history
i have no idea what i'm doing
  • Loading branch information
Kyzderp committed Oct 23, 2014
1 parent 97ba257 commit 9f3c12b
Show file tree
Hide file tree
Showing 14 changed files with 659 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry combineaccessrules="false" kind="src" path="/Client"/>
<classpathentry combineaccessrules="false" kind="src" path="/LiteLoader"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MobCountMod</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
240 changes: 240 additions & 0 deletions ant/build_examplemod.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!-- This file is part of the LiteLoader Example mod and is provided for you to use as a base -->
<!-- for your own build scripts. This file is provided with ABSOLUTELY NO WARRANTY and I won't -->
<!-- be responsible for any failures caused by using this script such as premature hair loss or -->
<!-- accidental triggering of global thermonuclear warfare. -->
<!-- -->
<!-- Like the liteloader build script, this build script requires the clean MCP sources to be -->
<!-- located in MCPDIR/src/mcp and NOT in MCPDIR/src/minecraft: that folder will be DELETED by -->
<!-- this script and therefore anything contained within it will be lost, so if you're working -->
<!-- in a "traditional" MCP setup then DO NOT RUN THIS SCRIPT WITHOUT BACKING UP YOUR WORK! -->
<!-- -->
<!-- The file is well commented and you should have a read through this script before making -->
<!-- changes to ensure that you know how it works. -->

<project name="mobcounter" basedir="." default="main">

<!-- The version of your mod, can be any string as long as it's valid as part of a file name -->
<!-- and should match the version string returned by your mod. -->
<property name="version" value="1.0.0" />

<!-- The Minecraft version the mod is for, appended to the output file name for reference -->
<property name="mcversion" value="1.7.2" />

<!-- The version inserted into the mod metadata to tell the loader what version of MC this mod is for -->
<property name="litemodversion" value="1.7.2_02" />

<!-- Your name, this gets written into the mod metadata and jar metadata -->
<property name="author" value="Kyzeragon" />

<!-- The name of the eclipse project to build, for upstream dependencies see the targets below -->
<property name="project" value="MobCountMod" />

<!-- The upstream MD5 set to use when outputting your mod classes, usually liteloader -->
<property name="md5set" value="liteloader" />

<!-- The MD5 set to *write* for downstream projects to use, uncomment this line to enable -->
<!-- <property name="outmd5set" value="${ant.project.name}" /> -->

<!-- The base MCP directory, normally 3 levels up from here but change if the build script is moved -->
<property name="mcp.dir" location="../../.." />

<!-- These directory entries should not be changed, they point at various resources below the MCP dir -->
<property name="eclipse.dir" location="${mcp.dir}/eclipse" />
<property name="mc.src.dir" location="${mcp.dir}/src/minecraft" />
<property name="temp.dir" location="${mcp.dir}/temp" />
<property name="md5.dir" location="${mcp.dir}/md5" />
<property name="build.dir" location="${mcp.dir}/build" />
<property name="target.dir" location="${build.dir}/src" />
<property name="dist.dir" location="${build.dir}/dist" />
<property name="stage.dir" location="${build.dir}/stage/${ant.project.name}/${version}" />

<!-- Output file properties, change as required but in general you won't need to -->
<property name="file.prefix" value="mod" />
<property name="file.type" value="litemod" />

<!-- Path to the python executable used by MCP, change if using a non-windows OS -->
<property name="python" location="${mcp.dir}/runtime/bin/python/python_mcp.exe" />

<!-- Main target -->
<target name="main" description="Perform all tasks for a build">
<!-- Init sets up the environment ready for the build, cleaning the old staging paths -->
<!-- and creating new clean ones that we will use for output. Also copies all the -->
<!-- required source files to the target source directory ready for MCP to build them. -->
<antcall target="init" />

<!-- Calls the MCP recompile process on the aggregated sources. -->
<antcall target="recompile" />

<!-- Calls the MCP reobfuscate process, this will output all modified classes not masked -->
<!-- by the upstream MD5 set, which should be our mod classes! -->
<antcall target="reobfuscate" />

<!-- Saves the new MD5's to our own file, for use by downstream projects. If enabled. -->
<antcall target="savemd5" />

<!-- Stages the new class files, and our project resources into the staging directory -->
<!-- ready to be built into the output jar file. -->
<antcall target="stage" />

<!-- Builds the output jar file and writes it as a .litemod file to the build directory. -->
<antcall target="litemod" />
</target>

<!-- Clean the target and reobf dirs -->
<target name="clean">
<delete dir="${target.dir}" />
<delete dir="${mcp.dir}/reobf" />
</target>

<!-- Copies the upstream MD5's to the MCP directory -->
<target name="preparemd5" description="Copy patched MD5 to the temp directory" depends="clean">
<echo level="info" message="Prepare exclusion MD5s, using exclusion set &quot;${md5set}&quot;" />

<copy tofile="${temp.dir}/client.md5" file="${md5.dir}/client_${md5set}.md5" failonerror="true" verbose="true" overwrite="true" />
</target>

<!-- Contributes MCP and project sources to the target dir -->
<target name="prepare" description="Prepare source for MCP" depends="preparemd5">
<echo level="info" message="Prepare sources for compile" />

<!-- Contribute the MCP sources -->
<copy todir="${target.dir}" verbose="false" overwrite="true">
<fileset dir="${mc.src.dir}" />
</copy>

<!-- UPSTREAM PROJECTS -->
<!-- This is where upstream projects are contributed to the target directory, each -->
<!-- upstream project needs a line below, so if you have additional upstreams then -->
<!-- simply duplicate the line below and change "LiteLoader" to the name of the eclipse -->
<!-- project that you want to contribute sources from. -->
<antcall target="contributesource"><param name="lib" value="LiteLoader" /></antcall>

<!-- Lastly we contribute sources from the project itself, you do not need to change this -->
<antcall target="contributesource"><param name="lib" value="${project}" /></antcall>
</target>

<!-- Stage class files and resources into the staging directory -->
<target name="stage" description="Stage resources into staging directory">
<echo level="info" message="Staging resources" />

<!-- Stages the freshly-obfuscated class files into the staging directory. -->
<copy todir="${stage.dir}">
<fileset dir="${mcp.dir}/reobf/minecraft" excludes=".svn/**, *.txt">
<exclude name="*.class"/>
</fileset>
</copy>

<!-- UPSTREAM PROJECTS -->
<!-- Like with the sources, this is where upstream project resources are contributed to -->
<!-- the target directory, each upstream project needs a line below, so if you have -->
<!-- additioanl upstreams then simply duplicate the line below and change "LiteLoader" -->
<!-- to the name of the eclipse project that you want to contribute resources from. -->
<antcall target="contributeresources"><param name="lib" value="LiteLoader" /></antcall>

<!-- Lastly we contribute resources from the project itself -->
<antcall target="contributeresources"><param name="lib" value="${project}" /></antcall>

<!-- Increments and retrieves the build number. -->
<buildnumber file="./buildnumber.txt" />

<!-- Uses the template file to build the litemod.json file and stages it to the staging -->
<!-- directory. -->
<concat destfile="${stage.dir}/litemod.json" append="false">
<fileset file="./litemod.template.json" />
<filterchain><expandproperties /></filterchain>
</concat>
</target>

<!-- Contributes java sources from a project, do not alter -->
<target name="contributesource" description="Contribute an upstream project source code to the source path">
<echo level="info" message="Contributing project ${lib}" />
<copy todir="${target.dir}" verbose="false" overwrite="true" failonerror="false">
<!-- Eclipse default -->
<fileset dir="${eclipse.dir}/${lib}/src" />
<!-- Legacy default -->
<fileset dir="${eclipse.dir}/${lib}/java" />
<!-- Maven default -->
<fileset dir="${eclipse.dir}/${lib}/src/main/java" />
</copy>
</target>

<!-- Contribute resources from a project, do not alter -->
<target name="contributeresources" description="Contribute resources to the staging path">
<echo level="info" message="Contributing project resources for ${lib}" />
<copy todir="${stage.dir}" verbose="false" failonerror="false">
<fileset dir="${eclipse.dir}/${lib}/res" excludes=".svn/**">
<exclude name="**/Thumbs.db" />
<exclude name="**/classes" />
<exclude name="liteloader.properties" />
</fileset>
<fileset dir="${eclipse.dir}/${lib}/src/main/resources" excludes=".svn/**">
<exclude name="**/Thumbs.db" />
<exclude name="**/classes" />
<exclude name="liteloader.properties" />
</fileset>
</copy>
</target>

<!-- Init task -->
<target name="init" description="Initialize build environment" depends="prepare">
<echo level="info" message="Cleaning old stage and dist, MCP reobf directories" />

<delete dir="${stage.dir}" />

<echo level="info" message="Creating stage and dist dirs" />
<mkdir dir="${stage.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${md5.dir}" />
</target>

<!-- MCP recompilation task -->
<target name="recompile" description="MCP recompile">
<echo level="info" message="Compiling projects" />

<echo append="false" file="${temp.dir}/build.cfg" message="[OUTPUT]&#x0A;SrcClient = build/src" />

<exec executable="${python}" dir="${mcp.dir}">
<arg value="runtime/recompile.py" />
<arg value="--client" />
<arg value="--config" />
<arg value="${temp.dir}/build.cfg" />
<arg value="%*" />
</exec>
</target>

<!-- MCP reobfuscation task -->
<target name="reobfuscate" description="MCP reobfuscate">
<echo level="info" message="Obfuscating classes" />

<exec executable="${python}" dir="${mcp.dir}">
<arg value="runtime/reobfuscate.py" />
<arg value="--client" />
<arg value="%*" />
</exec>
</target>

<!-- Stores generated output MD5's for downstream projects if specifed -->
<target name="savemd5" description="Put post-obfuscation MD5 to stored md5 set" if="outmd5set">
<echo level="info" message="Storing obfuscated MD5s" />

<copy file="${temp.dir}/client_reobf.md5" tofile="${md5.dir}/client_${outmd5set}.md5" overwrite="true" verbose="true" />
</target>

<!-- Builds the litemod jar file -->
<target name="litemod" description="Build the litemod file">
<echo level="info" message="Building final output" />

<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/${file.prefix}_${ant.project.name}_${version}_mc${mcversion}.${file.type}" duplicate="preserve" index="true" manifestencoding="UTF-8">
<manifest>
<attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
<attribute name="Implementation-Vendor" value="${author}" />
<attribute name="Implementation-Title" value="${ant.project.name}" />
<attribute name="Implementation-Version" value="${version}" />
</manifest>
<fileset dir="${stage.dir}" />
</jar>
</target>
</project>
3 changes: 3 additions & 0 deletions ant/buildnumber.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Build Number for ANT. Do not edit!
#Sun Aug 24 15:42:45 PDT 2014
build.number=27
7 changes: 7 additions & 0 deletions ant/litemod.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "${ant.project.name}",
"mcversion": "${litemodversion}",
"revision": "${build.number}",
"author": "${author}",
"description": "Simple LiteMod that displays entity counts for certain mobs within a specified radius"
}
2 changes: 2 additions & 0 deletions bin/assets/mobcounter/lang/en_US.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
key.counter.toggle=Toggle Passive Counter
key.counter.togglehostile=Toggle Hostile Counter
Binary file not shown.
Binary file added bin/com/kyzeragon/mobcountmod/MobCounter.class
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 9f3c12b

Please sign in to comment.