Item Facades now use the IMC comms system to know about custom facade
block types. Send your blocks through the API (FacadeManager) or the IMC system (use key "add-facade" and value "blockid@meta")
This commit is contained in:
parent
047120b324
commit
58c7dd3d1e
9 changed files with 1167 additions and 1120 deletions
7
.classpath
Normal file
7
.classpath
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="common"/>
|
||||||
|
<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="/Forge-Client"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/bin
|
17
.project
Normal file
17
.project
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>BuildCraft</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>
|
424
build.xml
424
build.xml
|
@ -1,212 +1,212 @@
|
||||||
<project name="Buildcraft" basedir="../" default="main">
|
<project name="Buildcraft" basedir="../" default="main">
|
||||||
<property environment="env" />
|
<property environment="env" />
|
||||||
<!-- Properties -->
|
<!-- Properties -->
|
||||||
|
|
||||||
<property name="build.dir" value="build"/>
|
<property name="build.dir" value="build"/>
|
||||||
<property name="src.dir" value="BuildCraft"/>
|
<property name="src.dir" value="BuildCraft"/>
|
||||||
<property name="lang.dir" value="BuildCraft-Localization"/>
|
<property name="lang.dir" value="BuildCraft-Localization"/>
|
||||||
|
|
||||||
<property name="download.dir" value="download"/>
|
<property name="download.dir" value="download"/>
|
||||||
<property name="files.minecraft.dir" value="jars"/>
|
<property name="files.minecraft.dir" value="jars"/>
|
||||||
|
|
||||||
<property name="classes.dir" value="${build.dir}/classes"/>
|
<property name="classes.dir" value="${build.dir}/classes"/>
|
||||||
<property name="jar.dir" value="${build.dir}/dist"/>
|
<property name="jar.dir" value="${build.dir}/dist"/>
|
||||||
|
|
||||||
<property name="mcp.dir" value="${build.dir}/mcp"/>
|
<property name="mcp.dir" value="${build.dir}/mcp"/>
|
||||||
<property name="forge.dir" value="${mcp.dir}/forge"/>
|
<property name="forge.dir" value="${mcp.dir}/forge"/>
|
||||||
|
|
||||||
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/>
|
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/>
|
||||||
|
|
||||||
<property name="mcp.version" value="72"/>
|
<property name="mcp.version" value="72"/>
|
||||||
<property name="forge.version" value="4.1.4.287"/>
|
<property name="forge.version" value="4.1.4.287"/>
|
||||||
<property name="bc.version" value="3.1.8"/>
|
<property name="bc.version" value="3.1.8"/>
|
||||||
|
|
||||||
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
|
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
|
||||||
<condition property="should-download-ant-contrib">
|
<condition property="should-download-ant-contrib">
|
||||||
<or>
|
<or>
|
||||||
<available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
<available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
||||||
<available file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
|
<available file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
|
||||||
</or>
|
</or>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<mkdir dir="${download.dir}"/>
|
<mkdir dir="${download.dir}"/>
|
||||||
|
|
||||||
<!-- Targets -->
|
<!-- Targets -->
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete dir="${build.dir}"/>
|
<delete dir="${build.dir}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Set build number -->
|
<!-- Set build number -->
|
||||||
<target name="initialize-version" depends="version-provided,version-not-provided">
|
<target name="initialize-version" depends="version-provided,version-not-provided">
|
||||||
<property name="bc.version.full" value="${bc.version}.${build.number}"/>
|
<property name="bc.version.full" value="${bc.version}.${build.number}"/>
|
||||||
<echo message="Starting build for ${bc.version.full}"/>
|
<echo message="Starting build for ${bc.version.full}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="version-not-provided" unless="env.BUILD_NUMBER">
|
<target name="version-not-provided" unless="env.BUILD_NUMBER">
|
||||||
<buildnumber/>
|
<buildnumber/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="version-provided" if="env.BUILD_NUMBER">
|
<target name="version-provided" if="env.BUILD_NUMBER">
|
||||||
<property name="build.number" value="${env.BUILD_NUMBER}"/>
|
<property name="build.number" value="${env.BUILD_NUMBER}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Download necessary files -->
|
<!-- Download necessary files -->
|
||||||
<target name="download-files" depends="download-mcp,download-forge"/>
|
<target name="download-files" depends="download-mcp,download-forge"/>
|
||||||
|
|
||||||
<!-- Download ant-contrib, necessary to be able to download forge (only if neither forge zip nor ant-contrib exist) -->
|
<!-- Download ant-contrib, necessary to be able to download forge (only if neither forge zip nor ant-contrib exist) -->
|
||||||
<target name="download-ant-contrib" unless="should-download-ant-contrib">
|
<target name="download-ant-contrib" unless="should-download-ant-contrib">
|
||||||
|
|
||||||
<echo message="Getting: ant-contrib"/>
|
<echo message="Getting: ant-contrib"/>
|
||||||
<mkdir dir="${download.dir}/tmp"/>
|
<mkdir dir="${download.dir}/tmp"/>
|
||||||
|
|
||||||
<get src="http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download" dest="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip"/>
|
<get src="http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download" dest="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip"/>
|
||||||
<get src="http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp/commons-codec-1.6-bin.zip"/>
|
<get src="http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp/commons-codec-1.6-bin.zip"/>
|
||||||
|
|
||||||
<unzip src="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip" dest="${download.dir}"/>
|
<unzip src="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip" dest="${download.dir}"/>
|
||||||
<unzip src="${download.dir}/tmp/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp"/>
|
<unzip src="${download.dir}/tmp/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp"/>
|
||||||
|
|
||||||
<move todir="${download.dir}/ant-contrib/lib">
|
<move todir="${download.dir}/ant-contrib/lib">
|
||||||
<fileset file="${download.dir}/tmp/commons-codec-1.6/commons-codec-1.6.jar"/>
|
<fileset file="${download.dir}/tmp/commons-codec-1.6/commons-codec-1.6.jar"/>
|
||||||
</move>
|
</move>
|
||||||
|
|
||||||
<!-- Delete useless files -->
|
<!-- Delete useless files -->
|
||||||
<delete dir="${download.dir}/ant-contrib/docs"/>
|
<delete dir="${download.dir}/ant-contrib/docs"/>
|
||||||
<delete dir="${download.dir}/tmp"/>
|
<delete dir="${download.dir}/tmp"/>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Download mcp -->
|
<!-- Download mcp -->
|
||||||
<target name="download-mcp">
|
<target name="download-mcp">
|
||||||
|
|
||||||
<get src="http://mcp.ocean-labs.de/files/mcp${mcp.version}.zip" dest="${download.dir}" usetimestamp="True"/>
|
<get src="http://mcp.ocean-labs.de/files/mcp${mcp.version}.zip" dest="${download.dir}" usetimestamp="True"/>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Download forge (if it doesn't exist) -->
|
<!-- Download forge (if it doesn't exist) -->
|
||||||
<target name="download-forge" depends="download-ant-contrib" unless="forge-exists" >
|
<target name="download-forge" depends="download-ant-contrib" unless="forge-exists" >
|
||||||
|
|
||||||
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
||||||
<classpath>
|
<classpath>
|
||||||
<pathelement location="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
<pathelement location="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
||||||
<fileset dir="${download.dir}/ant-contrib/lib">
|
<fileset dir="${download.dir}/ant-contrib/lib">
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</classpath>
|
</classpath>
|
||||||
</taskdef>
|
</taskdef>
|
||||||
|
|
||||||
<getMethod url="http://files.minecraftforge.net/minecraftforge-src-${forge.version}.zip"
|
<getMethod url="http://files.minecraftforge.net/minecraftforge-src-${forge.version}.zip"
|
||||||
responseDataFile="${download.dir}/minecraftforge-src-${forge.version}.zip">
|
responseDataFile="${download.dir}/minecraftforge-src-${forge.version}.zip">
|
||||||
<header name="User-Agent" value="Ant-${ant.version}/${ant.java.version}"/>
|
<header name="User-Agent" value="Ant-${ant.version}/${ant.java.version}"/>
|
||||||
</getMethod>
|
</getMethod>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Setup mcp and forge -->
|
<!-- Setup mcp and forge -->
|
||||||
<target name="setup" depends="initialize-version">
|
<target name="setup" depends="initialize-version">
|
||||||
|
|
||||||
<!-- Unzip them -->
|
<!-- Unzip them -->
|
||||||
<unzip dest="${mcp.dir}">
|
<unzip dest="${mcp.dir}">
|
||||||
<fileset dir="${download.dir}">
|
<fileset dir="${download.dir}">
|
||||||
<include name="mcp${mcp.version}.zip"/>
|
<include name="mcp${mcp.version}.zip"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</unzip>
|
</unzip>
|
||||||
|
|
||||||
<unzip dest="${mcp.dir}">
|
<unzip dest="${mcp.dir}">
|
||||||
<fileset dir="${download.dir}">
|
<fileset dir="${download.dir}">
|
||||||
<include name="minecraftforge-src-${forge.version}.zip"/>
|
<include name="minecraftforge-src-${forge.version}.zip"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</unzip>
|
</unzip>
|
||||||
|
|
||||||
<!-- Copy the necessary jars -->
|
<!-- Copy the necessary jars -->
|
||||||
<copy todir="${mcp.dir}/jars">
|
<copy todir="${mcp.dir}/jars">
|
||||||
<fileset dir="${files.minecraft.dir}"/>
|
<fileset dir="${files.minecraft.dir}"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<!-- Change executables' permitions -->
|
<!-- Change executables' permitions -->
|
||||||
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
|
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
|
||||||
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
|
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
|
||||||
<chmod file="${mcp.dir}/reobfuscate.sh" perm="+x"/>
|
<chmod file="${mcp.dir}/reobfuscate.sh" perm="+x"/>
|
||||||
<chmod file="${forge.dir}/install.sh" perm="+x"/>
|
<chmod file="${forge.dir}/install.sh" perm="+x"/>
|
||||||
|
|
||||||
<!-- if your building on OSX these 2 should be executable -->
|
<!-- if your building on OSX these 2 should be executable -->
|
||||||
<chmod file="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
|
<chmod file="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
|
||||||
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
|
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
|
||||||
|
|
||||||
<!-- Install forge -->
|
<!-- Install forge -->
|
||||||
<exec dir="${forge.dir}" executable="cmd" osfamily="windows">
|
<exec dir="${forge.dir}" executable="cmd" osfamily="windows">
|
||||||
<arg line="/c install.cmd"/>
|
<arg line="/c install.cmd"/>
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec dir="${forge.dir}" executable="sh" osfamily="unix">
|
<exec dir="${forge.dir}" executable="sh" osfamily="unix">
|
||||||
<arg value="install.sh" />
|
<arg value="install.sh" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<!-- Copy BC source -->
|
<!-- Copy BC source -->
|
||||||
<copy todir="${mcpsrc.dir}">
|
<copy todir="${mcpsrc.dir}">
|
||||||
<fileset dir="${src.dir}/common">
|
<fileset dir="${src.dir}/common">
|
||||||
<exclude name="**/buildcraft/devel"/>
|
<exclude name="**/buildcraft/devel"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<filterset>
|
<filterset>
|
||||||
<filter token="VERSION" value="${bc.version}" />
|
<filter token="VERSION" value="${bc.version}" />
|
||||||
<filter token="BUILD_NUMBER" value="${build.number}" />
|
<filter token="BUILD_NUMBER" value="${build.number}" />
|
||||||
</filterset>
|
</filterset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="compile" depends="setup">
|
<target name="compile" depends="setup">
|
||||||
|
|
||||||
<!-- Recompile -->
|
<!-- Recompile -->
|
||||||
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
||||||
<arg line="/c recompile.bat"/>
|
<arg line="/c recompile.bat"/>
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
||||||
<arg value="recompile.sh" />
|
<arg value="recompile.sh" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<!-- Reobf -->
|
<!-- Reobf -->
|
||||||
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
||||||
<arg line="/c reobfuscate.bat"/>
|
<arg line="/c reobfuscate.bat"/>
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
||||||
<arg value="reobfuscate.sh" />
|
<arg value="reobfuscate.sh" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<!-- Copy BC classes -->
|
<!-- Copy BC classes -->
|
||||||
<copy todir="${classes.dir}">
|
<copy todir="${classes.dir}">
|
||||||
<fileset dir="${mcp.dir}/reobf/minecraft"/>
|
<fileset dir="${mcp.dir}/reobf/minecraft"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<!-- Copy resources -->
|
<!-- Copy resources -->
|
||||||
<copy todir="${classes.dir}">
|
<copy todir="${classes.dir}">
|
||||||
<fileset dir="${src.dir}/buildcraft_resources">
|
<fileset dir="${src.dir}/buildcraft_resources">
|
||||||
<exclude name="build.xml"/>
|
<exclude name="build.xml"/>
|
||||||
<exclude name="build.number"/>
|
<exclude name="build.number"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<!-- Copy localizations -->
|
<!-- Copy localizations -->
|
||||||
<copy todir="${classes.dir}">
|
<copy todir="${classes.dir}">
|
||||||
<fileset dir="${lang.dir}">
|
<fileset dir="${lang.dir}">
|
||||||
<exclude name="README.md"/>
|
<exclude name="README.md"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Zip the compiled files -->
|
<!-- Zip the compiled files -->
|
||||||
<target name="package" depends="compile">
|
<target name="package" depends="compile">
|
||||||
|
|
||||||
<jar destfile="${jar.dir}/buildcraft-A-${bc.version.full}.jar" basedir="${classes.dir}"/>
|
<jar destfile="${jar.dir}/buildcraft-A-${bc.version.full}.jar" basedir="${classes.dir}"/>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Default target to run -->
|
<!-- Default target to run -->
|
||||||
<target name="main" depends="initialize-version,download-files,clean,package"/>
|
<target name="main" depends="initialize-version,download-files,clean,package"/>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -9,13 +9,22 @@
|
||||||
package buildcraft;
|
package buildcraft;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.primitives.Ints;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
|
import cpw.mods.fml.common.Mod.IMCCallback;
|
||||||
import cpw.mods.fml.common.Mod.Init;
|
import cpw.mods.fml.common.Mod.Init;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
import cpw.mods.fml.common.Mod.PreInit;
|
import cpw.mods.fml.common.Mod.PreInit;
|
||||||
import cpw.mods.fml.common.Mod.PostInit;
|
import cpw.mods.fml.common.Mod.PostInit;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkMod;
|
import cpw.mods.fml.common.network.NetworkMod;
|
||||||
|
@ -402,6 +411,31 @@ public class BuildCraftTransport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IMCCallback
|
||||||
|
public void processIMCRequests(FMLInterModComms.IMCEvent event) {
|
||||||
|
Splitter splitter = Splitter.on("@").trimResults();
|
||||||
|
for (IMCMessage m : event.getMessages())
|
||||||
|
{
|
||||||
|
if ("add-facade".equals(m.key))
|
||||||
|
{
|
||||||
|
String[] array = Iterables.toArray(splitter.split(m.value), String.class);
|
||||||
|
if (array.length!=2)
|
||||||
|
{
|
||||||
|
Logger.getLogger("Buildcraft").log(Level.INFO,String.format("Received an invalid add-facade request %s from mod %s",m.value,m.sender));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Integer blId = Ints.tryParse(array[0]);
|
||||||
|
Integer metaId = Ints.tryParse(array[1]);
|
||||||
|
if (blId == null || metaId == null)
|
||||||
|
{
|
||||||
|
Logger.getLogger("Buildcraft").log(Level.INFO,String.format("Received an invalid add-facade request %s from mod %s",m.value,m.sender));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ItemFacade.addFacade(new ItemStack(blId, 0, metaId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static Item createPipe(int defaultID, Class<? extends Pipe> clas, String descr, Object ingredient1, Object ingredient2, Object ingredient3) {
|
private static Item createPipe(int defaultID, Class<? extends Pipe> clas, String descr, Object ingredient1, Object ingredient2, Object ingredient3) {
|
||||||
String name = Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1);
|
String name = Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1);
|
||||||
|
|
||||||
|
|
11
common/buildcraft/api/transport/FacadeManager.java
Normal file
11
common/buildcraft/api/transport/FacadeManager.java
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package buildcraft.api.transport;
|
||||||
|
|
||||||
|
import buildcraft.transport.ItemFacade;
|
||||||
|
import net.minecraft.src.ItemStack;
|
||||||
|
|
||||||
|
public class FacadeManager
|
||||||
|
{
|
||||||
|
public static void addFacade(ItemStack is) {
|
||||||
|
ItemFacade.addFacade(is);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +1,19 @@
|
||||||
package buildcraft.api.transport;
|
package buildcraft.api.transport;
|
||||||
|
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.src.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement and register with the PipeManager if you want to suppress connections from wooden pipes.
|
* Implement and register with the PipeManager if you want to suppress connections from wooden pipes.
|
||||||
*/
|
*/
|
||||||
public interface IExtractionHandler {
|
public interface IExtractionHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can this pipe extract items from the block located at these coordinates?
|
* Can this pipe extract items from the block located at these coordinates?
|
||||||
*/
|
*/
|
||||||
boolean canExtractItems(IPipe pipe, World world, int i, int j, int k);
|
boolean canExtractItems(IPipe pipe, World world, int i, int j, int k);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can this pipe extract liquids from the block located at these coordinates?
|
* Can this pipe extract liquids from the block located at these coordinates?
|
||||||
*/
|
*/
|
||||||
boolean canExtractLiquids(IPipe pipe, World world, int i, int j, int k);
|
boolean canExtractLiquids(IPipe pipe, World world, int i, int j, int k);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,12 +1,16 @@
|
||||||
package buildcraft.transport;
|
package buildcraft.transport;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Side;
|
import cpw.mods.fml.common.Side;
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
import cpw.mods.fml.common.asm.SideOnly;
|
||||||
|
@ -90,67 +94,32 @@ public class ItemFacade extends ItemBuildCraft {
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public static void initialize(){
|
public static void initialize(){
|
||||||
List creativeItems = getCreativeContents();
|
for (Field f : Block.class.getDeclaredFields())
|
||||||
ListIterator creativeIterator = creativeItems.listIterator();
|
|
||||||
|
|
||||||
while(creativeIterator.hasNext()){
|
|
||||||
ItemStack stack = (ItemStack) creativeIterator.next();
|
|
||||||
if (stack.getItem() instanceof ItemBlock){
|
|
||||||
ItemBlock itemBlock = (ItemBlock) stack.getItem();
|
|
||||||
int blockId = itemBlock.getBlockID();
|
|
||||||
//Block certain IDs (Bedrock, leaves, sponge, lockedchest)
|
|
||||||
if (blockId == 7 || blockId == 18 || blockId == 19 || blockId == 95) continue;
|
|
||||||
|
|
||||||
if (Block.blocksList[blockId] != null
|
|
||||||
&& Block.blocksList[blockId].isOpaqueCube()
|
|
||||||
&& Block.blocksList[blockId].getBlockName() != null
|
|
||||||
&& !Block.blocksList[blockId].hasTileEntity(0)
|
|
||||||
&& Block.blocksList[blockId].renderAsNormalBlock())
|
|
||||||
{
|
|
||||||
allFacades.add(new ItemStack(BuildCraftTransport.facadeItem, 1, ItemFacade.encode(blockId, stack.getItemDamage())));
|
|
||||||
|
|
||||||
//3 Structurepipes + this block makes 6 facades
|
|
||||||
AssemblyRecipe.assemblyRecipes.add(
|
|
||||||
new AssemblyRecipe(
|
|
||||||
new ItemStack[] {new ItemStack(BuildCraftTransport.pipeStructureCobblestone, 3), new ItemStack(blockId, 1, stack.getItemDamage())},
|
|
||||||
8000,
|
|
||||||
new ItemStack(BuildCraftTransport.facadeItem, 6, ItemFacade.encode(blockId, stack.getItemDamage()))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<ItemStack> getCreativeContents() {
|
|
||||||
List<ItemStack> list = Lists.newArrayList();
|
|
||||||
for (Item i : Item.itemsList)
|
|
||||||
{
|
{
|
||||||
if (i instanceof ItemBlock)
|
if (Modifier.isStatic(f.getModifiers()) && Block.class.isAssignableFrom(f.getType()))
|
||||||
{
|
{
|
||||||
int blId = ((ItemBlock) i).getBlockID();
|
Block b;
|
||||||
ItemStack rootIS = new ItemStack(blId, 0, 0);
|
try {
|
||||||
if (i.getHasSubtypes())
|
b = (Block) f.get(null);
|
||||||
{
|
} catch (Exception e) {
|
||||||
String base = i.getItemNameIS(rootIS);
|
continue;
|
||||||
for (int j = 0; j < 16; j++)
|
}
|
||||||
{
|
if (b.blockID == 7 || b.blockID == 18 || b.blockID == 19 || b.blockID == 95) continue;
|
||||||
int md = i.getMetadata(j);
|
if (!b.isOpaqueCube() || b.hasTileEntity(0)|| !b.renderAsNormalBlock()) continue;
|
||||||
ItemStack comp = new ItemStack(blId, 0, j);
|
ItemStack base = new ItemStack(b,1);
|
||||||
try {
|
if (base.getHasSubtypes()) {
|
||||||
if (! base.equals(i.getItemNameIS(comp)) && !Strings.isNullOrEmpty(i.getItemNameIS(comp)))
|
Set<String> names = Sets.newHashSet();
|
||||||
{
|
for (int meta = 0; meta < 15; meta++) {
|
||||||
list.add(comp);
|
ItemStack is = new ItemStack(b, 1, meta);
|
||||||
}
|
if (!Strings.isNullOrEmpty(is.getItemName()) && names.add(is.getItemName())) {
|
||||||
} catch (Exception e)
|
ItemFacade.addFacade(is);
|
||||||
{
|
}
|
||||||
break;
|
}
|
||||||
}
|
} else {
|
||||||
}
|
ItemFacade.addFacade(base);
|
||||||
}
|
}
|
||||||
list.add(rootIS);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int encode(int blockId, int metaData){
|
public static int encode(int blockId, int metaData){
|
||||||
|
@ -165,6 +134,14 @@ public class ItemFacade extends ItemBuildCraft {
|
||||||
return ((encoded & 0xFFF0) >>> 4);
|
return ((encoded & 0xFFF0) >>> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addFacade(ItemStack itemStack) {
|
||||||
|
allFacades.add(new ItemStack(BuildCraftTransport.facadeItem, 1, ItemFacade.encode(itemStack.itemID, itemStack.getItemDamage())));
|
||||||
|
|
||||||
|
//3 Structurepipes + this block makes 6 facades
|
||||||
|
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(
|
||||||
|
new ItemStack[] {new ItemStack(BuildCraftTransport.pipeStructureCobblestone, 3), itemStack},
|
||||||
|
8000,
|
||||||
|
new ItemStack(BuildCraftTransport.facadeItem, 6, ItemFacade.encode(itemStack.itemID, itemStack.getItemDamage()))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue