mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Gradle, be gone!
This commit is contained in:
1 parent
d547e1f06f
commit
f26da02a70
40 files changed
+441
-1592
No files matched your search
+3
-1
@@ -13,7 +13,8 @@ remotebuild.py
|
||||
## ForgeGradle
|
||||
/run
|
||||
/out
|
||||
|
||||
/ForgeModule
|
||||
/libs/download
|
||||
## idea
|
||||
*.iml
|
||||
*.ipr
|
||||
@@ -36,6 +37,7 @@ TCDEOBF*
|
||||
*.DS_Store
|
||||
_MACOSX
|
||||
Thumbs.db
|
||||
/forgelibs
|
||||
|
||||
## Ignore unnecessary files
|
||||
*.log
|
||||
|
||||
@@ -1,77 +1,305 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project name="ThaumicTinkerer" default="build">
|
||||
<project name="ThaumicTinkerer" default="install" basedir=".">
|
||||
<!-- Buildscript thanks to CoFH -->
|
||||
<property environment="env"/>
|
||||
<!-- Basic directories -->
|
||||
<property name="src.dir" value="src/main/java"/>
|
||||
<property name="api.dir" value="src/api/java"/>
|
||||
<property name="library.dir" value="libs"/>
|
||||
<property name="library.download.dir" value="${library.dir}/downloads"/>
|
||||
<property name="resources.dir" value="src/main/resources"/>
|
||||
<property name="build.dir" value="build"/>
|
||||
<property name="download.dir" value="${build.dir}/downloads"/>
|
||||
<!-- Project information -->
|
||||
<property name="build.name" value="${ant.project.name}"/>
|
||||
<property name="class.pckg" value="thaumic/tinkerer"/>
|
||||
<!-- Version file -->
|
||||
<property name="verclass.dir" value="${src.dir}/${class.pckg}/common/lib"/>
|
||||
<property name="verclass.name" value="LibMisc.java"/>
|
||||
<!-- Forge version -->
|
||||
<property name="mc.version" value="1.7.2"/>
|
||||
<property name="forge.major" value="10"/>
|
||||
<property name="forge.minor" value="12"/>
|
||||
<property name="forge.patch" value="2"/>
|
||||
<property name="forge.build" value="1147"/>
|
||||
<!-- Packaging -->
|
||||
<property name="dist.dir" value="${build.dir}/dist"/>
|
||||
<property name="classes.dir" value="${build.dir}/packaging"/>
|
||||
<property name="apiclasses.dir" value="${build.dir}/api-packaging"/>
|
||||
<!-- Forge paths -->
|
||||
<property name="forge.version" value="${mc.version}-${forge.major}.${forge.minor}.${forge.patch}.${forge.build}"/>
|
||||
<property name="forge.dir" value="${build.dir}/forge"/>
|
||||
<property name="forgebuild.dir" value="${forge.dir}/build"/>
|
||||
<property name="compile.dir" value="${forgebuild.dir}/tmp/compile"/>
|
||||
<property name="lib.dir" value="${forgebuild.dir}/libs"/>
|
||||
<property name="sources.dir" value="${forgebuild.dir}/sources/minecraft"/>
|
||||
<property name="transformers.dir" value="${forge.dir}/src/main/resources/"/>
|
||||
<property name="forge.stsh"
|
||||
value="${build.dir}/.gradle/caches/minecraft/net/minecraftforge/forge/${forge.version}"/>
|
||||
<property name="forge.jar" value="${forge.stsh}/forgeSrc-${forge.version}.jar"/>
|
||||
<property name="reobf.cmd" value="${download.dir}/bon.jar"/>
|
||||
<property name="forge.url"
|
||||
value="http://files.minecraftforge.net/maven/net/minecraftforge/forge/${forge.version}/forge-${forge.version}-src.zip"/>
|
||||
<!-- Classpaths -->
|
||||
<path id="lib.classpath">
|
||||
<pathelement location="${forge.jar}"/>
|
||||
<fileset dir="${lib.dir}">
|
||||
<include name="*.jar"/>
|
||||
<include name="**/*.jar"/>
|
||||
<exclude name="${reobf.jar}"/>
|
||||
</fileset>
|
||||
<fileset dir="libs">
|
||||
<include name="*.jar"/>
|
||||
<include name="**/*.jar"/>
|
||||
</fileset>
|
||||
<!--fileset dir="${build.dir}/.gradle/caches">
|
||||
<include name="modules*/files*/**/*.jar"/>
|
||||
|
||||
<property file="build.properties" prefix="build"/>
|
||||
<exclude name="commons-io-1.4.jar"/>
|
||||
<exclude name="commons-lang3-3.1.jar"/>
|
||||
<exclude name="modules*/files*/commons-io/commons-io/1.4/**/*.jar"/>
|
||||
<exclude name="modules*/files*/com.google.guava/guava/14*/**/*.jar"/>
|
||||
<exclude name="modules*/files*/com.google.guava/guava/15*/**/*.jar"/>
|
||||
</fileset-->
|
||||
</path>
|
||||
<path id="gson">
|
||||
<!--fileset dir="${build.dir}/.gradle/caches">
|
||||
<include name="modules*/files*/com.google.code.gson/**/*.jar"/>
|
||||
</fileset-->
|
||||
</path>
|
||||
<!-- Task skipping -->
|
||||
<target name="properties">
|
||||
<!-- Enforce some paths -->
|
||||
<mkdir dir="${build.dir}"/>
|
||||
<mkdir dir="${download.dir}"/>
|
||||
<!-- Set properties -->
|
||||
<available property="has.api" file="${src.dir}/${class.pckg}/api"/>
|
||||
<available property="forge.exists" file="${download.dir}/forge-${forge.version}-src.zip"/>
|
||||
<available property="bon.exists" file="${reobf.cmd}"/>
|
||||
<condition property="forge.already.installed">
|
||||
<available file="${forge.jar}" type="file"/>
|
||||
</condition>
|
||||
<condition property="have.libs">
|
||||
<and>
|
||||
<istrue value="${forge.exists}"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
<!-- Dependency downloading -->
|
||||
<target name="download-core" depends="properties" unless="forge.exists">
|
||||
</target>
|
||||
<target name="get-dependencies" depends="get-version" unless="have.libs">
|
||||
<delete dir="${library.download.dir}/"/>
|
||||
<mkdir dir="${library.download.dir}/"/>
|
||||
<echo message="Downloading libs"/>
|
||||
|
||||
<get src="http://files.minecraftforge.net/maven/codechicken/ForgeMultipart/1.7.2-1.1.0.268/ForgeMultipart-1.7.2-1.1.0.268-dev.jar"
|
||||
dest="${library.download.dir}/FMP.jar"/>
|
||||
<get src="http://dvs1.progwml6.com/files/maven/tconstruct/TConstruct/1.7.2-1.6.0.jenkins494/TConstruct-1.7.2-1.6.0.jenkins494-deobf.jar"
|
||||
dest="${library.download.dir}/TCONSTRUCT.jar"/>
|
||||
<get src="http://dvs1.progwml6.com/files/maven/mantle/Mantle/1.7.2-145.3a637c2/Mantle-1.7.2-145.3a637c2-deobf.jar"
|
||||
dest="${library.download.dir}/MANTLE.jar"/>
|
||||
<!-- Begin hack -->
|
||||
<delete dir="${compile.dir}" failonerror="false"/>
|
||||
<!-- End hack -->
|
||||
</target>
|
||||
<!-- Building process -->
|
||||
<target name="install" depends="build">
|
||||
<!-- Cleanup -->
|
||||
<delete dir="${apiclasses.dir}"/>
|
||||
<delete dir="${classes.dir}"/>
|
||||
<delete>
|
||||
<fileset dir="${dist.dir}">
|
||||
<exclude name="${build.name}${build.full}${build.number}.jar"/>
|
||||
<exclude name="${build.name}${build.full}dev-${build.number}.jar"/>
|
||||
<exclude name="${build.name}-API${build.full}${build.number}.zip"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
<macrodef name="install-lite">
|
||||
<attribute name="build"/>
|
||||
<attribute name="classes" default="${compile.dir}"/>
|
||||
<sequential>
|
||||
<copy todir="${classes.dir}" preservelastmodified="true">
|
||||
<fileset dir="@{classes}">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="${resources.dir}"/>
|
||||
</copy>
|
||||
<update-languages/>
|
||||
<manifest file="${classes.dir}/MANIFEST.MF">
|
||||
<attribute name="FMLCorePlugin" value="cofh.asm.LoadingPlugin"/>
|
||||
<attribute name="FMLCorePluginContainsFMLMod" value="true"/>
|
||||
</manifest>
|
||||
<jar destfile="${dist.dir}/${build.name}${build.full}@{build}.jar"
|
||||
compress="true" level="9" basedir="${classes.dir}"
|
||||
manifest="${classes.dir}/MANIFEST.MF">
|
||||
<exclude name="MANIFEST.MF"/>
|
||||
</jar>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<target name="build" depends="get-dependencies,get-build-number,copy-sources">
|
||||
<!-- Recompile -->
|
||||
<echo message="Compiling..."/>
|
||||
<mkdir dir="${compile.dir}"/>
|
||||
<depend srcdir="${sources.dir}" destdir="${compile.dir}"
|
||||
cache="${forgebuild.dir}/tmp/depcache" closure="true">
|
||||
<include name="**/*.java"/>
|
||||
</depend>
|
||||
|
||||
<!--Print out detailed classpath-->
|
||||
<pathconvert pathsep="${line.separator}| |-- "
|
||||
property="echo.path.compile"
|
||||
refid="lib.classpath">
|
||||
</pathconvert>
|
||||
<echo message="|-- compile classpath"/>
|
||||
<echo message="| |"/>
|
||||
<echo message="| |-- ${echo.path.compile}"/>
|
||||
|
||||
<javac srcdir="${sources.dir}" destdir="${compile.dir}" target="1.6" source="1.6"
|
||||
classpathref="lib.classpath" debug="true" debuglevel="lines,source" includeAntRuntime="false">
|
||||
<include name="**/*.java"/>
|
||||
</javac>
|
||||
<!-- Dev jar -->
|
||||
<echo message="Building jar..."/>
|
||||
<local name="build"/>
|
||||
<property name="build" value="dev-${build.number}"/>
|
||||
<install-lite build="${build}"/>
|
||||
<!-- Reobf -->
|
||||
<echo message="Reobfuscating..."/>
|
||||
<java classpath="${reobf.cmd}" classname="immibis.bon.cui.MCPRemap">
|
||||
<arg line="-q -m"/>
|
||||
<arg value="-to SRG"/>
|
||||
<arg value="-from MCP"/>
|
||||
<arg value="-mcp ${forge.stsh}/unpacked"/>
|
||||
<arg value="-in ${dist.dir}/${build.name}${build.full}${build}.jar"/>
|
||||
<arg value="-out ${dist.dir}/${build.name}${build.full}${build.number}.jar"/>
|
||||
<arg value="-ref ${forge.jar}"/>
|
||||
<arg value="-jref ${lib.dir}"/>
|
||||
</java>
|
||||
</target>
|
||||
<target name="copy-sources" depends="package-api">
|
||||
<!-- Copy source -->
|
||||
<mkdir dir="${sources.dir}"/>
|
||||
<sync todir="${sources.dir}">
|
||||
<fileset dir="${src.dir}"/>
|
||||
<fileset dir="${api.dir}"/>
|
||||
</sync>
|
||||
</target>
|
||||
<target name="package-api" depends="get-version" if="has.api">
|
||||
<!-- Copy & package API -->
|
||||
<copy todir="${apiclasses.dir}/${class.pckg}/api">
|
||||
<fileset dir="${src.dir}/${class.pckg}/api"/>
|
||||
</copy>
|
||||
<zip destfile="${dist.dir}/${build.name}-API${build.full}${build.number}.zip" basedir="${apiclasses.dir}"/>
|
||||
</target>
|
||||
<target name="setup-forge" depends="download-forge" unless="forge.already.installed">
|
||||
<delete dir="${forge.dir}" failonerror="false"/>
|
||||
<mkdir dir="${forge.dir}"/>
|
||||
<unzip dest="${forge.dir}">
|
||||
<fileset dir="${download.dir}">
|
||||
<include name="forge-${forge.version}-src.zip"/>
|
||||
</fileset>
|
||||
</unzip>
|
||||
<!-- Cleanup -->
|
||||
<delete>
|
||||
<fileset dir="${forge.dir}">
|
||||
<include name="*.txt"/>
|
||||
<include name="src/**/*.info"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<delete dir="${forge.dir}/eclipse" failonerror="false"/>
|
||||
<delete dir="${forge.dir}/src/main/java" failonerror="false"/>
|
||||
<delete dir="${build.dir}/.gradle/caches/minecraft/net/minecraftforge/forge/${forge.version}/srgs"
|
||||
failonerror="false"/>
|
||||
<!-- Change executables' permissions -->
|
||||
<chmod file="${forge.dir}/gradlew" perm="+x"/>
|
||||
<copy file="${resources.dir}/ThaumicTinkerer_at.cfg" tofile="${transformers.dir}/ThaumicTinkerer_at.cfg"/>
|
||||
<!-- Install forge -->
|
||||
<exec executable="./gradlew" failonerror="true" dir="${forge.dir}/" vmlauncher="false">
|
||||
<arg line="-g ../.gradle"/>
|
||||
<arg line="extractMinecraftSrc"/>
|
||||
<arg line="eclipseClasspath"/>
|
||||
</exec>
|
||||
<mkdir dir="${compile.dir}"/>
|
||||
<mkdir dir="${lib.dir}"/>
|
||||
<javac srcdir="${forgebuild.dir}/tmp/recompSrc" destdir="${compile.dir}" target="1.6" source="1.6"
|
||||
classpathref="lib.classpath" debug="true" debuglevel="lines,source" includeAntRuntime="false"/>
|
||||
<jar destfile="${forge.jar}" compress="true" level="9" basedir="${compile.dir}"/>
|
||||
<copy file="${forge.jar}" todir="${forgebuild.dir}/dirtyArtifacts/"/>
|
||||
<delete dir="${compile.dir}"/>
|
||||
</target>
|
||||
<target name="download-forge" depends="setup-bon,download-core" unless="forge.exists">
|
||||
<echo message="Downloading forge... "/>
|
||||
<get src="${forge.url}" dest="${download.dir}/forge-${forge.version}-src.zip"/>
|
||||
</target>
|
||||
<target name="setup-bon" depends="properties" unless="bon.exists">
|
||||
<echo message="Downloading BON..."/>
|
||||
<get src="https://github.com/skyboy/bearded-octo-nemesis/releases/download/1.1/BON.jar" dest="${reobf.cmd}"/>
|
||||
</target>
|
||||
<macrodef name="update-languages">
|
||||
<sequential>
|
||||
<script language="javascript"><![CDATA[
|
||||
importPackage(java.io);
|
||||
var path = "/assets/cofh/language/";
|
||||
var languages = new File(project.getProperty("resources.dir") + path);
|
||||
if (languages.exists() && languages.isDirectory()) {
|
||||
var out = "";
|
||||
for each(var i in languages.list()) {
|
||||
if (i != null && i.length() > 5 && i.indexOf(".lang") == i.length() - 5) {
|
||||
out += i.substring(0, i.length() - 5) + ", ";
|
||||
}
|
||||
}
|
||||
if (out.length > 0) {
|
||||
var os = new PrintWriter(project.getProperty("classes.dir") + path + ".languages");
|
||||
os.write("["+out.substring(0, out.length - 2)+"]");
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
]]></script>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<target name="verify-version">
|
||||
<script language="javascript"><![CDATA[
|
||||
var name = project.getProperty("build.full");
|
||||
if (name == null || name == "") {
|
||||
name = project.getProperty("verclass.name");
|
||||
if (name == null || name == "") {
|
||||
project.setProperty("build.full", "-");
|
||||
}
|
||||
}
|
||||
]]></script>
|
||||
</target>
|
||||
<target name="get-version" depends="verify-version,setup-forge" unless="build.full">
|
||||
<local name="grep.out"/>
|
||||
<local name="mfrv"/>
|
||||
<local name="mcv"/>
|
||||
<!-- Read version out of file -->
|
||||
<property name="version" value="2.4"/>
|
||||
<!-- Split mod&mc version, update mcmod -->
|
||||
<property name="build.full" value="-[${mcv}]${mfrv}-"/>
|
||||
</target>
|
||||
<target name="get-build-number" depends="build-number-there" unless="build.number">
|
||||
<echo message="!! No build number set !!"/>
|
||||
<property name="build.number" value="CUSTOM_BUILD"/>
|
||||
</target>
|
||||
<target name="build-number-there" depends="get-version" if="env.BUILD_NUMBER" unless="build.number">
|
||||
<echo message="Using build number ${env.BUILD_NUMBER}..."/>
|
||||
<property name="build.number" value="${env.BUILD_NUMBER}"/>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="${build.dir.gradle}\build\classes\main"/>
|
||||
<delete file="${build.dir.gradle}\src\main\java\mcmod.info"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\vazkii"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\ic2"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\uildcraft"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\dan200"/>
|
||||
<delete dir="${build.dir.gradle}\src\main\java\cofh"/>
|
||||
<delete dir="${build.dir.temp}"/>
|
||||
<delete dir="${build.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="increment_build_number">
|
||||
<propertyfile file="build.properties">
|
||||
<entry key="build_number" type="int" operation="+" default="1"/>
|
||||
</propertyfile>
|
||||
<target name="rebuild">
|
||||
<delete file="${forge.jar}" failonerror="false"/>
|
||||
<delete dir="${forge.dir}"/>
|
||||
<delete dir="${download.dir}"/>
|
||||
<antcall target="install"/>
|
||||
</target>
|
||||
|
||||
<target name="prep">
|
||||
<mkdir dir="${build.dir.temp}"/>
|
||||
|
||||
<copy todir="${build.dir.temp}">
|
||||
<fileset dir="${build.dir.repo}\resources\"/>
|
||||
</copy>
|
||||
|
||||
<copy todir="${build.dir.gradle}\src\main\java">
|
||||
<fileset dir="${build.dir.repo}\MODSRC\"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="replace_tokens">
|
||||
<replace dir="${build.dir.temp}" token="ANT:VERSION" value="${build.version}"/>
|
||||
<replace dir="${build.dir.temp}" token="ANT:BUILD" value="${build.build_number}"/>
|
||||
|
||||
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:VERSION" value="${build.version}"/>
|
||||
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:BUILD" value="${build.build_number}"/>
|
||||
</target>
|
||||
|
||||
<target name="gradle_build">
|
||||
<copy todir="${build.dir.gradle}" overwrite="true">
|
||||
<fileset file="${build.dir.repo}\build.gradle"/>
|
||||
</copy>
|
||||
|
||||
<exec dir="${build.dir.gradle}" executable="cmd" osfamily="windows">
|
||||
<arg line="/c gradle build"/>
|
||||
</exec>
|
||||
|
||||
<exec dir="${build.dir.gradle}" executable="gradle" osfamily="unix">
|
||||
<arg value="build"/>
|
||||
</exec>
|
||||
|
||||
<move file="${build.dir.gradle}\build\libs\modid-1.0.jar"
|
||||
tofile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar"/>
|
||||
</target>
|
||||
|
||||
<target name="inject_assets">
|
||||
<jar update="true"
|
||||
destfile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar">
|
||||
<fileset dir="${build.dir.temp}" excludes="**/psd/**"/>
|
||||
</jar>
|
||||
<delete dir="${build.dir.temp}"/>
|
||||
</target>
|
||||
|
||||
<target name="build">
|
||||
<antcall target="clean"/>
|
||||
<antcall target="prep"/>
|
||||
<antcall target="replace_tokens"/>
|
||||
<antcall target="gradle_build"/>
|
||||
<antcall target="inject_assets"/>
|
||||
<antcall target="increment_build_number"/>
|
||||
<antcall target="clean"/>
|
||||
<target name="refresh-deps">
|
||||
<delete dir="${lib.dir}"/>
|
||||
<delete dir="${download.dir}"/>
|
||||
<antcall target="install"/>
|
||||
</target>
|
||||
<target name="jar" depends="install"/>
|
||||
</project>
|
||||
@@ -0,0 +1,41 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
|
||||
*
|
||||
* @author King Lemming
|
||||
*/
|
||||
public interface IEnergyContainerItem {
|
||||
/**
|
||||
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
|
||||
*
|
||||
* @param container ItemStack to be charged.
|
||||
* @param maxReceive Maximum amount of energy to be sent into the item.
|
||||
* @param simulate If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received by the item.
|
||||
*/
|
||||
int receiveEnergy(ItemStack container, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
|
||||
* discharged.
|
||||
*
|
||||
* @param container ItemStack to be discharged.
|
||||
* @param maxExtract Maximum amount of energy to be extracted from the item.
|
||||
* @param simulate If TRUE, the discharge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the item.
|
||||
*/
|
||||
int extractEnergy(ItemStack container, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the amount of energy currently stored in the container item.
|
||||
*/
|
||||
int getEnergyStored(ItemStack container);
|
||||
|
||||
/**
|
||||
* Get the max amount of energy that can be stored in the container item.
|
||||
*/
|
||||
int getMaxEnergyStored(ItemStack container);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cofh.api.block;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on blocks which have some debug method which can be activated via a tool or other means.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IBlockDebug {
|
||||
|
||||
/**
|
||||
* This function debugs a block.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block.
|
||||
* @param player
|
||||
* Player doing the debugging.
|
||||
*/
|
||||
public void debugBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player);
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package cofh.api.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on blocks which can provide information about themselves.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IBlockInfo {
|
||||
|
||||
/**
|
||||
* This function appends information to a list provided to it.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block that is being queried.
|
||||
* @param player
|
||||
* Player doing the querying - this can be NULL.
|
||||
* @param info
|
||||
* The list that the information should be appended to.
|
||||
* @param debug
|
||||
* If true, the Block should return "debug" information.
|
||||
*/
|
||||
public void getBlockInfo(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player, List<String> info, boolean debug);
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package cofh.api.block;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Implemented on Blocks which have some method of being instantly dismantled.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IDismantleable {
|
||||
|
||||
/**
|
||||
* Dismantles the block. If returnBlock is true, the drop(s) should be placed into the player's inventory.
|
||||
*/
|
||||
public ItemStack dismantleBlock(EntityPlayer player, World world, int x, int y, int z, boolean returnBlock);
|
||||
|
||||
/**
|
||||
* Return true if the block can be dismantled. The criteria for this is entirely up to the block.
|
||||
*/
|
||||
public boolean canDismantle(EntityPlayer player, World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package cofh.api.core;
|
||||
|
||||
/**
|
||||
* Interface which can be put on just about anything to allow for iteration during initialization.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInitializer {
|
||||
|
||||
public boolean preInit();
|
||||
|
||||
public boolean initialize();
|
||||
|
||||
public boolean postInit();
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package cofh.api.core;
|
||||
|
||||
/**
|
||||
* Basic interface for the Cape and Skin Registries.
|
||||
*
|
||||
* @author Zeldo Kavira
|
||||
*
|
||||
*/
|
||||
public interface ISimpleRegistry {
|
||||
|
||||
/**
|
||||
* Register a new entry.
|
||||
*
|
||||
* @param playerName
|
||||
* The player to register.
|
||||
* @param URL
|
||||
* Location of the cape/skin.
|
||||
* @return True if registration was successful.
|
||||
*/
|
||||
public boolean register(String playerName, String URL);
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package cofh.api.core;
|
||||
|
||||
/**
|
||||
* Dummy class used to initialize Cape and Skin Registries to prevent accidental NPEs.
|
||||
*
|
||||
* @author Zeldo Kavira
|
||||
*
|
||||
*/
|
||||
public class NullSimpleRegistry implements ISimpleRegistry {
|
||||
|
||||
@Override
|
||||
public boolean register(String playerName, String URL) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package cofh.api.core;
|
||||
|
||||
/**
|
||||
* Access to the Cape and Skin Registries of CoFH Core.
|
||||
*
|
||||
* @author Zeldo Kavira
|
||||
*
|
||||
*/
|
||||
public class RegistryAccess {
|
||||
|
||||
public static ISimpleRegistry capeRegistry = new NullSimpleRegistry();
|
||||
public static ISimpleRegistry skinRegistry = new NullSimpleRegistry();
|
||||
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class EnergyStorage implements IEnergyStorage {
|
||||
|
||||
protected int energy;
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public EnergyStorage(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public EnergyStorage readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
this.energy = nbt.getInteger("Energy");
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
if (energy < 0) {
|
||||
energy = 0;
|
||||
}
|
||||
nbt.setInteger("Energy", energy);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public int getMaxReceive() {
|
||||
|
||||
return maxReceive;
|
||||
}
|
||||
|
||||
public int getMaxExtract() {
|
||||
|
||||
return maxExtract;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers are
|
||||
* guaranteed to have it.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void setEnergyStored(int energy) {
|
||||
|
||||
this.energy = energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
|
||||
* externally, as not all IEnergyHandlers are guaranteed to have it.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void modifyEnergyStored(int energy) {
|
||||
|
||||
this.energy += energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* IEnergyStorage */
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
|
||||
* accept it; otherwise just use IEnergyHandler.
|
||||
*
|
||||
* Note that {@link IEnergyHandler} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectEnergy(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
|
||||
*
|
||||
* A reference implementation is provided {@link ItemEnergyContainer}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyContainerItem {
|
||||
|
||||
/**
|
||||
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
|
||||
*
|
||||
* @param container
|
||||
* ItemStack to be charged.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be sent into the item.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received by the item.
|
||||
*/
|
||||
int receiveEnergy(ItemStack container, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
|
||||
* discharged.
|
||||
*
|
||||
* @param container
|
||||
* ItemStack to be discharged.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted from the item.
|
||||
* @param simulate
|
||||
* If TRUE, the discharge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the item.
|
||||
*/
|
||||
int extractEnergy(ItemStack container, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the amount of energy currently stored in the container item.
|
||||
*/
|
||||
int getEnergyStored(ItemStack container);
|
||||
|
||||
/**
|
||||
* Get the max amount of energy that can be stored in the container item.
|
||||
*/
|
||||
int getMaxEnergyStored(ItemStack container);
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
*
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyHandler extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Add energy to an IEnergyHandler, internal distribution is left entirely to the IEnergyHandler.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is received from.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to receive.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyHandler, internal distribution is left entirely to the IEnergyHandler.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to extract.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
/**
|
||||
* An energy storage is the unit of interaction with Energy inventories.
|
||||
*
|
||||
* A reference implementation can be found at {@link EnergyStorage}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyStorage {
|
||||
|
||||
/**
|
||||
* Adds energy to the storage. Returns quantity of energy that was accepted.
|
||||
*
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be inserted.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) accepted by the storage.
|
||||
*/
|
||||
int receiveEnergy(int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from the storage. Returns quantity of energy that was removed.
|
||||
*
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the storage.
|
||||
*/
|
||||
int extractEnergy(int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored();
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored();
|
||||
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public ItemEnergyContainer() {
|
||||
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
|
||||
|
||||
protected EnergyStorage storage = new EnergyStorage(32000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.readFromNBT(nbt);
|
||||
storage.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.writeToNBT(nbt);
|
||||
storage.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
/* IEnergyHandler */
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to item transportation blocks.
|
||||
*
|
||||
* Note that {@link IInventoryHandler} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryConnection {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectInventory(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes that are themselves inventories.
|
||||
*
|
||||
* A reference implementation is provided {@link ItemInventoryContainer}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryContainerItem {
|
||||
|
||||
/**
|
||||
* Add an ItemStack to the inventory of this container item. This returns what is remaining of the original stack - a null return means that the entire
|
||||
* stack was accepted!
|
||||
*
|
||||
* @param container
|
||||
* ItemStack with the inventory.
|
||||
* @param item
|
||||
* ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return An ItemStack representing how much is remaining after the item was inserted (or would have been, if simulated) into the container inventory.
|
||||
*/
|
||||
ItemStack insertItem(ItemStack container, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from the inventory of this container item. This returns the resulting stack - a null return means that nothing was extracted!
|
||||
*
|
||||
* @param container
|
||||
* ItemStack with the inventory.
|
||||
* @param item
|
||||
* ItemStack to be extracted. The size of this stack corresponds to the maximum amount to extract. If this is null, then a null ItemStack should
|
||||
* immediately be returned.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ItemStack container, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from the inventory of this container item. This returns the resulting stack - a null return means that nothing was extracted!
|
||||
*
|
||||
* @param container
|
||||
* ItemStack with the inventory.
|
||||
* @param maxExtract
|
||||
* Maximum number of items to extract. (The returned ItemStack should have a stackSize no higher than this.)
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ItemStack container, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the contents of the container item's inventory. This should only return non-null ItemStacks, and an empty List if the inventory has nothing.
|
||||
*/
|
||||
List<ItemStack> getInventoryContents(ItemStack container);
|
||||
|
||||
/**
|
||||
* Get the size of this inventory of this container item.
|
||||
*/
|
||||
int getSizeInventory(ItemStack container);
|
||||
|
||||
/**
|
||||
* Returns whether or not the container item's inventory is empty.
|
||||
*/
|
||||
boolean isEmpty(ItemStack container);
|
||||
|
||||
/**
|
||||
* Returns whether or not the container item's inventory is full.
|
||||
*/
|
||||
boolean isFull(ItemStack container);
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should handle items.
|
||||
*
|
||||
* A reference implementation is provided {@link TileInventoryHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryHandler extends IInventoryConnection {
|
||||
|
||||
/**
|
||||
* Insert an ItemStack into the IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns what is remaining of the
|
||||
* original stack - a null return means that the entire stack was accepted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is inserted from.
|
||||
* @param item
|
||||
* ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return An ItemStack representing how much is remaining after the item was inserted (or would have been, if simulated) into the container inventory.
|
||||
*/
|
||||
ItemStack insertItem(ForgeDirection from, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a
|
||||
* null return means that nothing was extracted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is extracted from.
|
||||
* @param item
|
||||
* ItemStack to be extracted. The size of this stack corresponds to the maximum amount to extract. If this is null, then a null ItemStack should
|
||||
* immediately be returned.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ForgeDirection from, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a
|
||||
* null return means that nothing was extracted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum number of items to extract. (The returned ItemStack should have a stackSize no higher than this.)
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the contents of the IInventoryHandler's inventory. This returns a COPY. This should only return non-null ItemStacks, and an empty List if the
|
||||
* inventory has nothing.
|
||||
*/
|
||||
List<ItemStack> getInventoryContents(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Get the size (number of internal slots) of the IInventoryHandler's inventory.
|
||||
*/
|
||||
int getSizeInventory(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns whether or not the IInventoryHandler's inventory is empty (for a given side).
|
||||
*/
|
||||
boolean isEmpty(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns whether or not the IInventoryHandler's inventory is full (for a given side).
|
||||
*/
|
||||
boolean isFull(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes which are secure - linked to a specific player or group of players.
|
||||
*
|
||||
* Obviously, this relies on people using this interface properly. The Wheaton Rule is in effect here - don't be a jerk.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ISecureItem {
|
||||
|
||||
/**
|
||||
* Check whether or not a given player can use this item.
|
||||
*/
|
||||
boolean canPlayerAccess(EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Get the Owner of this item. This function is intentionally nebulous and is not guaranteed to be a player name.
|
||||
*/
|
||||
String getOwnerString();
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes which can be externally modified through tinkering.
|
||||
*
|
||||
* Basically a catch all for "upgrading" a given ItemStack, which may represent an Item or a Block.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ITinkerableItem {
|
||||
|
||||
/**
|
||||
* Returns a list of valid ItemStacks which may be used to upgrade this Tinkerable.
|
||||
*/
|
||||
List<ItemStack> getValidTinkers(ItemStack container);
|
||||
|
||||
/**
|
||||
* Applies a tinker to this item.
|
||||
*
|
||||
* @param container
|
||||
* The ItemStack (Tinkerable) to which the tinker is being applied.
|
||||
* @param tinker
|
||||
* The ItemStack representing the upgrade.
|
||||
* @return True if the application was successful, false if it was not.
|
||||
*/
|
||||
boolean applyTinker(ItemStack container, ItemStack tinker);
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can report information about their energy usage.
|
||||
*
|
||||
* This is used for reporting purposes - Energy transactions are handled through IEnergyHandler!
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyInfo {
|
||||
|
||||
/**
|
||||
* Returns energy usage/generation per tick (RF/t).
|
||||
*/
|
||||
public int getInfoEnergyPerTick();
|
||||
|
||||
/**
|
||||
* Returns maximum energy usage/generation per tick (RF/t).
|
||||
*/
|
||||
public int getInfoMaxEnergyPerTick();
|
||||
|
||||
/**
|
||||
* Returns energy stored (RF).
|
||||
*/
|
||||
public int getInfoEnergy();
|
||||
|
||||
/**
|
||||
* Returns maximum energy stored (RF).
|
||||
*/
|
||||
public int getInfoMaxEnergy();
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which allow for reconfiguration of their facing.
|
||||
*
|
||||
* Coordination with the containing block is required.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IReconfigurableFacing {
|
||||
|
||||
/**
|
||||
* Returns the current facing of the block.
|
||||
*/
|
||||
public int getFacing();
|
||||
|
||||
/**
|
||||
* Returns whether or not the block's face can be aligned with the Y Axis.
|
||||
*/
|
||||
public boolean allowYAxisFacing();
|
||||
|
||||
/**
|
||||
* Attempt to rotate the block. Arbitrary based on implementation.
|
||||
*
|
||||
* @return True if rotation was successful, false otherwise.
|
||||
*/
|
||||
public boolean rotateBlock();
|
||||
|
||||
/**
|
||||
* Set the facing of the block.
|
||||
*
|
||||
* @param side
|
||||
* The side to set the facing to.
|
||||
* @return True if the facing was set, false otherwise.
|
||||
*/
|
||||
public boolean setFacing(int side);
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which allow for reconfiguration of their sides.
|
||||
*
|
||||
* Coordination with the containing block is required.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IReconfigurableSides {
|
||||
|
||||
/**
|
||||
* Decrement the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to decrement.
|
||||
* @return True if config was changed, false otherwise.
|
||||
*/
|
||||
public boolean decrSide(int side);
|
||||
|
||||
/**
|
||||
* Increment the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to decrement.
|
||||
* @return True if config was changed, false otherwise.
|
||||
*/
|
||||
public boolean incrSide(int side);
|
||||
|
||||
/**
|
||||
* Set the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to set.
|
||||
* @param config
|
||||
* The config value to use.
|
||||
* @return True of config was set, false otherwise.
|
||||
*/
|
||||
public boolean setSide(int side, int config);
|
||||
|
||||
/**
|
||||
* Reset configs on all sides to their base values.
|
||||
*
|
||||
* @return True if reset was successful, false otherwise.
|
||||
*/
|
||||
public boolean resetSides();
|
||||
|
||||
/**
|
||||
* Returns the number of possible config settings for a given side.
|
||||
*/
|
||||
public int getNumConfig(int side);
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which cache their redstone status.
|
||||
*
|
||||
* Note that {@link IRedstoneControl} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IRedstoneCache {
|
||||
|
||||
public void setPowered(boolean isPowered);
|
||||
|
||||
public boolean isPowered();
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which have Redstone Control functionality. This means that a tile can be set to ignore redstone entirely, or
|
||||
* respond to a low or high redstone state.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IRedstoneControl extends IRedstoneCache {
|
||||
|
||||
public static enum ControlMode {
|
||||
DISABLED(true), LOW(false), HIGH(true);
|
||||
|
||||
private final boolean state;
|
||||
|
||||
private ControlMode(boolean state) {
|
||||
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
|
||||
return this == DISABLED;
|
||||
}
|
||||
|
||||
public boolean isLow() {
|
||||
|
||||
return this == LOW;
|
||||
}
|
||||
|
||||
public boolean isHigh() {
|
||||
|
||||
return this == HIGH;
|
||||
}
|
||||
|
||||
public boolean getState() {
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
public static ControlMode stepForward(ControlMode curControl) {
|
||||
|
||||
return curControl == DISABLED ? LOW : curControl == HIGH ? DISABLED : HIGH;
|
||||
}
|
||||
|
||||
public static ControlMode stepBackward(ControlMode curControl) {
|
||||
|
||||
return curControl == DISABLED ? HIGH : curControl == HIGH ? LOW : DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
public void setControl(ControlMode control);
|
||||
|
||||
public ControlMode getControl();
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which have access restrictions.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ISecureTile {
|
||||
|
||||
/**
|
||||
* Enum for Access Modes - Restricted is Friends Only, Private is Owner only.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public static enum AccessMode {
|
||||
PUBLIC, RESTRICTED, PRIVATE;
|
||||
|
||||
public boolean isPublic() {
|
||||
|
||||
return this == PUBLIC;
|
||||
}
|
||||
|
||||
public boolean isRestricted() {
|
||||
|
||||
return this == RESTRICTED;
|
||||
}
|
||||
|
||||
public boolean isPrivate() {
|
||||
|
||||
return this == PRIVATE;
|
||||
}
|
||||
|
||||
public static AccessMode stepForward(AccessMode curAccess) {
|
||||
|
||||
return curAccess == PUBLIC ? RESTRICTED : curAccess == PRIVATE ? PUBLIC : PRIVATE;
|
||||
}
|
||||
|
||||
public static AccessMode stepBackward(AccessMode curAccess) {
|
||||
|
||||
return curAccess == PUBLIC ? PRIVATE : curAccess == PRIVATE ? RESTRICTED : PUBLIC;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setAccess(AccessMode access);
|
||||
|
||||
public boolean setOwnerName(String name);
|
||||
|
||||
public AccessMode getAccess();
|
||||
|
||||
public String getOwnerName();
|
||||
|
||||
public boolean canPlayerAccess(String name);
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can change their block's texture based on the current render pass. The block must defer the call to its Tile
|
||||
* Entity.
|
||||
*
|
||||
* @author Zeldo Kavira
|
||||
*
|
||||
*/
|
||||
public interface ISidedBlockTexture {
|
||||
|
||||
/**
|
||||
* Returns the icon to use for a given side and render pass.
|
||||
*
|
||||
* @param side
|
||||
* Block side to get the texture for.
|
||||
* @param pass
|
||||
* Render pass.
|
||||
* @return The icon to use.
|
||||
*/
|
||||
public IIcon getBlockTexture(int side, int pass);
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISubSelectionBoxProvider {
|
||||
|
||||
public void addTraceableCuboids(List<IndexedCuboid6> cuboids);
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IEnderAttuned {
|
||||
|
||||
public enum EnderTypes {
|
||||
ITEM, FLUID, REDSTONE_FLUX
|
||||
}
|
||||
|
||||
String getOwnerString();
|
||||
|
||||
int getFrequency();
|
||||
|
||||
boolean setFrequency(int frequency);
|
||||
|
||||
boolean clearFrequency();
|
||||
|
||||
boolean canSendItems();
|
||||
|
||||
boolean canSendFluid();
|
||||
|
||||
boolean canSendEnergy();
|
||||
|
||||
boolean canReceiveItems();
|
||||
|
||||
boolean canReceiveFluid();
|
||||
|
||||
boolean canReceiveEnergy();
|
||||
|
||||
boolean currentlyValidToReceiveItems(IEnderAttuned asker);
|
||||
|
||||
boolean currentlyValidToReceiveFluid(IEnderAttuned asker);
|
||||
|
||||
boolean currentlyValidToReceiveEnergy(IEnderAttuned asker);
|
||||
|
||||
boolean currentlyValidToSendItems(IEnderAttuned asker);
|
||||
|
||||
boolean currentlyValidToSendFluid(IEnderAttuned asker);
|
||||
|
||||
boolean currentlyValidToSendEnergy(IEnderAttuned asker);
|
||||
|
||||
ItemStack receiveItem(ItemStack item);
|
||||
|
||||
FluidStack receiveFluid(FluidStack fluid, boolean doFill);
|
||||
|
||||
int receiveEnergy(int energy, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Energy (Redstone Flux).
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderEnergyReceptor {
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive energy.
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveEnergy();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive energy. This returns the amount remaining, *not* the amount received - a return of 0 means that all energy
|
||||
* was received!
|
||||
*
|
||||
* @param energy
|
||||
* Amount of energy to be received.
|
||||
* @param simulate
|
||||
* If TRUE, the result will only be simulated.
|
||||
* @return Amount of energy that is remaining (or would be remaining, if simulated).
|
||||
*/
|
||||
int receiveEnergy(int energy, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Fluid.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderFluidReceptor {
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive a FluidStack.
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveFluid();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive a FluidStack. This returns what remains of the original stack, *not* the amount received - a null return
|
||||
* means that the entire stack was received!
|
||||
*
|
||||
* @param fluid
|
||||
* FluidStack to be received.
|
||||
* @param simulate
|
||||
* If TRUE, the result will only be simulated.
|
||||
* @return FluidStack representing how much fluid is remaining (or would be remaining, if simulated).
|
||||
*/
|
||||
FluidStack receiveFluid(FluidStack fluid, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Items.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderItemReceptor {
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive an ItemStack.
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveItems();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive an ItemStack. This returns what remains of the original stack, *not* the amount received - a null return
|
||||
* means that the entire stack was received!
|
||||
*
|
||||
* This function does not support simulation because Inventory manipulation in Minecraft is an absolute mess and it would be a computational liability to do
|
||||
* so.
|
||||
*
|
||||
* @param item
|
||||
* ItemStack to be received.
|
||||
* @return An ItemStack representing how much is remaining.
|
||||
*/
|
||||
ItemStack receiveItem(ItemStack item);
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* This interface is implemented on ItemDucts. Use it to attempt to eject items into an entry point.
|
||||
*
|
||||
* @author Zeldo Kavira, King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IItemDuct {
|
||||
|
||||
/**
|
||||
* Insert an ItemStack into the IItemDuct. Will only accept items if there is a valid destination. This returns what is remaining of the original stack - a
|
||||
* null return means that the entire stack was accepted/routed!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is inserted from.
|
||||
* @param item
|
||||
* ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert.
|
||||
* @return An ItemStack representing how much is remaining after the item was inserted into the Duct.
|
||||
*/
|
||||
public ItemStack insertItem(ForgeDirection from, ItemStack item);
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package cofh.api.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
/**
|
||||
* This interface should be implemented on classes which define a world feature to be generated in a {@link IFeatureHandler}. It is essentially a more robust
|
||||
* version of {@link WorldGenerator}, and may include one or more WorldGenerators should you wish.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IFeatureGenerator {
|
||||
|
||||
/**
|
||||
* Returns the name of the feature, used for displaying in the World.cfg file.
|
||||
*/
|
||||
public String getFeatureName();
|
||||
|
||||
/**
|
||||
* Generates the world feature.
|
||||
*
|
||||
* @param random
|
||||
* Random derived from the world seed.
|
||||
* @param chunkX
|
||||
* Minimum X chunk-coordinate of the chunk. (x16 for block coordinate)
|
||||
* @param chunkZ
|
||||
* Minimum Z chunk-coordinate of the chunk. (x16 for block coordinate)
|
||||
* @param world
|
||||
* The world to generate in.
|
||||
* @param newGen
|
||||
* True on initial generation, false on retrogen.
|
||||
* @return True if generation happened, false otherwise.
|
||||
*/
|
||||
public boolean generateFeature(Random random, int chunkX, int chunkZ, World world, boolean newGen);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package cofh.api.world;
|
||||
|
||||
/**
|
||||
* Provides an interface to allow for the addition of Features to world generation.
|
||||
*
|
||||
* See {@link IFeatureGenerator}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IFeatureHandler {
|
||||
|
||||
/**
|
||||
* Register a feature with an IFeatureHandler.
|
||||
*
|
||||
* @param feature
|
||||
* The feature to register.
|
||||
* @return True if the registration was successful, false if a feature with that name existed.
|
||||
*/
|
||||
public boolean registerFeature(IFeatureGenerator feature);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package thaumic.tinkerer.client.render.block;
|
||||
|
||||
import baubles.client.ClientProxy;
|
||||
import com.sun.prism.util.tess.Tess;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
|
||||
@@ -10,100 +10,100 @@ import thaumic.tinkerer.common.core.helper.ItemNBTHelper;
|
||||
|
||||
public class TinkersConstructCompat {
|
||||
|
||||
private static final String TAG_INFINITOOL = "InfiTool";
|
||||
private static final String TAG_BROKEN = "Broken";
|
||||
private static final String TAG_DAMAGE = "Damage";
|
||||
private static final String TAG_DURABILITY = "TotalDurability";
|
||||
private static final String TAG_CHARGE = "charge";
|
||||
private static final String TAG_ENERGY = "Energy";
|
||||
private static final String TAG_REPAIRCOUNT = "RepairCount";
|
||||
private static final String TAG_INFINITOOL = "InfiTool";
|
||||
private static final String TAG_BROKEN = "Broken";
|
||||
private static final String TAG_DAMAGE = "Damage";
|
||||
private static final String TAG_DURABILITY = "TotalDurability";
|
||||
private static final String TAG_CHARGE = "charge";
|
||||
private static final String TAG_ENERGY = "Energy";
|
||||
private static final String TAG_REPAIRCOUNT = "RepairCount";
|
||||
|
||||
public static boolean isTConstructTool(ItemStack stack) {
|
||||
if (stack == null)
|
||||
return false;
|
||||
Item item = stack.getItem();
|
||||
public static boolean isTConstructTool(ItemStack stack) {
|
||||
if (stack == null)
|
||||
return false;
|
||||
Item item = stack.getItem();
|
||||
|
||||
if (item instanceof ToolCore) {
|
||||
return !(ItemNBTHelper.verifyExistance(stack, TAG_ENERGY) || ItemNBTHelper.verifyExistance(stack, TAG_CHARGE));
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
if (item instanceof ToolCore) {
|
||||
return !(ItemNBTHelper.verifyExistance(stack, TAG_ENERGY) || ItemNBTHelper.verifyExistance(stack, TAG_CHARGE));
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getDamage(ItemStack stack) {
|
||||
if (stack == null)
|
||||
return -1;
|
||||
if (!isTConstructTool(stack))
|
||||
return -1;
|
||||
public static int getDamage(ItemStack stack) {
|
||||
if (stack == null)
|
||||
return -1;
|
||||
if (!isTConstructTool(stack))
|
||||
return -1;
|
||||
|
||||
if (ItemNBTHelper.verifyExistance(stack, TAG_ENERGY) || ItemNBTHelper.verifyExistance(stack, TAG_CHARGE))
|
||||
return -1;
|
||||
if (ItemNBTHelper.getNBT(stack).hasKey(TAG_INFINITOOL)) {
|
||||
NBTTagCompound InfiniTool = ItemNBTHelper.getNBT(stack).getCompoundTag(TAG_INFINITOOL);
|
||||
if (InfiniTool.hasKey(TAG_BROKEN) && InfiniTool.getBoolean(TAG_BROKEN)) {
|
||||
if (InfiniTool.hasKey(TAG_DURABILITY))
|
||||
return InfiniTool.getInteger(TAG_DURABILITY);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if (InfiniTool.hasKey(TAG_DAMAGE)) {
|
||||
return InfiniTool.getInteger(TAG_DAMAGE);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (ItemNBTHelper.verifyExistance(stack, TAG_ENERGY) || ItemNBTHelper.verifyExistance(stack, TAG_CHARGE))
|
||||
return -1;
|
||||
if (ItemNBTHelper.getNBT(stack).hasKey(TAG_INFINITOOL)) {
|
||||
NBTTagCompound InfiniTool = ItemNBTHelper.getNBT(stack).getCompoundTag(TAG_INFINITOOL);
|
||||
if (InfiniTool.hasKey(TAG_BROKEN) && InfiniTool.getBoolean(TAG_BROKEN)) {
|
||||
if (InfiniTool.hasKey(TAG_DURABILITY))
|
||||
return InfiniTool.getInteger(TAG_DURABILITY);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if (InfiniTool.hasKey(TAG_DAMAGE)) {
|
||||
return InfiniTool.getInteger(TAG_DAMAGE);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static boolean fixDamage(ItemStack stack, int amount) {
|
||||
if (stack == null)
|
||||
return false;
|
||||
if (!isTConstructTool(stack))
|
||||
return false;
|
||||
public static boolean fixDamage(ItemStack stack, int amount) {
|
||||
if (stack == null)
|
||||
return false;
|
||||
if (!isTConstructTool(stack))
|
||||
return false;
|
||||
|
||||
if (ItemNBTHelper.verifyExistance(stack, TAG_ENERGY) || ItemNBTHelper.verifyExistance(stack, TAG_CHARGE))
|
||||
return false;
|
||||
if (ItemNBTHelper.getNBT(stack).hasKey(TAG_INFINITOOL)) {
|
||||
NBTTagCompound InfiniTool = ItemNBTHelper.getNBT(stack).getCompoundTag(TAG_INFINITOOL);
|
||||
InfiniTool.setBoolean("Broken", false);
|
||||
int damage = InfiniTool.getInteger("Damage");
|
||||
int itemsUsed = 0;
|
||||
int increase = calculateIncrease(stack, amount);
|
||||
int repair = InfiniTool.getInteger("RepairCount");
|
||||
repair += itemsUsed;
|
||||
InfiniTool.setInteger("RepairCount", repair);
|
||||
if (ItemNBTHelper.verifyExistance(stack, TAG_ENERGY) || ItemNBTHelper.verifyExistance(stack, TAG_CHARGE))
|
||||
return false;
|
||||
if (ItemNBTHelper.getNBT(stack).hasKey(TAG_INFINITOOL)) {
|
||||
NBTTagCompound InfiniTool = ItemNBTHelper.getNBT(stack).getCompoundTag(TAG_INFINITOOL);
|
||||
InfiniTool.setBoolean("Broken", false);
|
||||
int damage = InfiniTool.getInteger("Damage");
|
||||
int itemsUsed = 0;
|
||||
int increase = calculateIncrease(stack, amount);
|
||||
int repair = InfiniTool.getInteger("RepairCount");
|
||||
repair += itemsUsed;
|
||||
InfiniTool.setInteger("RepairCount", repair);
|
||||
|
||||
damage -= increase;
|
||||
if (damage < 0)
|
||||
damage = 0;
|
||||
InfiniTool.setInteger("Damage", damage);
|
||||
damage -= increase;
|
||||
if (damage < 0)
|
||||
damage = 0;
|
||||
InfiniTool.setInteger("Damage", damage);
|
||||
|
||||
AbilityHelper.damageTool(stack, 0, null, true);
|
||||
ItemNBTHelper.setCompound(stack, TAG_INFINITOOL, InfiniTool);
|
||||
AbilityHelper.damageTool(stack, 0, null, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
AbilityHelper.damageTool(stack, 0, null, true);
|
||||
ItemNBTHelper.setCompound(stack, TAG_INFINITOOL, InfiniTool);
|
||||
AbilityHelper.damageTool(stack, 0, null, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static int calculateIncrease(ItemStack tool, int amount) {
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
int increase = amount * 2;
|
||||
private static int calculateIncrease(ItemStack tool, int amount) {
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
int increase = amount * 2;
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
float mods = 1.0f;
|
||||
if (modifiers == 2)
|
||||
mods = 1.0f;
|
||||
else if (modifiers == 1)
|
||||
mods = 0.75f;
|
||||
else if (modifiers == 0)
|
||||
mods = 0.5f;
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
float mods = 1.0f;
|
||||
if (modifiers == 2)
|
||||
mods = 1.0f;
|
||||
else if (modifiers == 1)
|
||||
mods = 0.75f;
|
||||
else if (modifiers == 0)
|
||||
mods = 0.5f;
|
||||
|
||||
increase *= mods;
|
||||
increase *= mods;
|
||||
|
||||
int repair = tags.getInteger("RepairCount");
|
||||
float repairCount = (100 - repair) / 100f;
|
||||
if (repairCount < 0.5f)
|
||||
repairCount = 0.5f;
|
||||
increase *= repairCount;
|
||||
increase /= ((ToolCore) tool.getItem()).getRepairCost();
|
||||
return increase;
|
||||
}
|
||||
int repair = tags.getInteger("RepairCount");
|
||||
float repairCount = (100 - repair) / 100f;
|
||||
if (repairCount < 0.5f)
|
||||
repairCount = 0.5f;
|
||||
increase *= repairCount;
|
||||
increase /= ((ToolCore) tool.getItem()).getRepairCost();
|
||||
return increase;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -122,7 +123,6 @@ public class AspectCropLootManager {
|
||||
addAspectLoot(Aspect.FLESH, new ItemStack(ConfigItems.itemResource, 16, 5), 1);
|
||||
|
||||
addAspectLoot(Aspect.UNDEAD, new ItemStack(Items.rotten_flesh, 32));
|
||||
addAspectLoot(Aspect.UNDEAD, new ItemStack(Items.bone, 32));
|
||||
|
||||
addAspectLoot(Aspect.CRAFT, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 32));
|
||||
addAspectLoot(Aspect.CRAFT, new ItemStack(ConfigBlocks.blockStoneDevice, 16));
|
||||
@@ -175,7 +175,7 @@ public class AspectCropLootManager {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Iter
|
||||
addAspectLoot(Aspect.TRAVEL, new ItemStack(ConfigBlocks.blockCosmeticSolid, 8, 7));
|
||||
|
||||
addAspectLoot(Aspect.SLIME, new ItemStack(Items.slime_ball, 16));
|
||||
addAspectLoot(Aspect.SLIME, "slime");
|
||||
@@ -194,9 +194,13 @@ public class AspectCropLootManager {
|
||||
addAspectLoot(Aspect.METAL, new ItemStack(Items.iron_ingot, 4), 100);
|
||||
addAspectLoot(Aspect.METAL, "iron");
|
||||
|
||||
//TODO: Mortus
|
||||
|
||||
//TODO: Motus
|
||||
addAspectLoot(Aspect.DEATH, new ItemStack(Items.bone, 32));
|
||||
|
||||
addAspectLoot(Aspect.MOTION, new ItemStack(Blocks.rail), 10);
|
||||
|
||||
addAspectLoot(Aspect.MOTION, new ItemStack(Blocks.activator_rail));
|
||||
|
||||
|
||||
addAspectLoot(Aspect.CLOTH, new ItemStack(Blocks.wool, 16), 30);
|
||||
addAspectLoot(Aspect.CLOTH, new ItemStack(Items.string, 15), 10);
|
||||
@@ -211,7 +215,9 @@ public class AspectCropLootManager {
|
||||
|
||||
addAspectLoot(Aspect.MAGIC, "shard");
|
||||
|
||||
//TODO: Sano
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.golden_apple));
|
||||
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Blocks.cake));
|
||||
|
||||
addAspectLoot(Aspect.SENSES, new ItemStack(Items.dye, 20, 4));
|
||||
|
||||
@@ -219,7 +225,8 @@ public class AspectCropLootManager {
|
||||
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.netherrack, 64), 2);
|
||||
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.nether_brick));
|
||||
|
||||
//TODO: Tempestas
|
||||
addAspectLoot(Aspect.WEATHER, new ItemStack(Blocks.air));
|
||||
addAspectLoot(Aspect.WEATHER, "cloud", 100);
|
||||
|
||||
addAspectLoot(Aspect.DARKNESS, new ItemStack(Blocks.obsidian, 10));
|
||||
|
||||
@@ -228,11 +235,11 @@ public class AspectCropLootManager {
|
||||
|
||||
addAspectLoot(Aspect.POISON, new ItemStack(ConfigItems.itemResource, 16, 3));
|
||||
|
||||
//TODO: Victus
|
||||
addAspectLoot(Aspect.LIFE, new ItemStack(Items.egg, 8));
|
||||
|
||||
//TODO: Vinculum
|
||||
addAspectLoot(Aspect.TRAP, new ItemStack(Blocks.web, 4));
|
||||
|
||||
//TODO: Vitium
|
||||
addAspectLoot(Aspect.TAINT, new ItemStack(ConfigItems.itemResource, 4, 11));
|
||||
|
||||
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Items.diamond));
|
||||
|
||||
|
||||
Reference in new issue
Block a user