2012-05-09 22:43:05 +02:00
|
|
|
/**
|
|
|
|
* BuildCraft is open-source. It is distributed under the terms of the
|
|
|
|
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
|
|
|
* or run the code. It does *NOT* grant the right to redistribute this software
|
|
|
|
* or its modifications in any form, binary or source, except if expressively
|
|
|
|
* granted by the copyright holder.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package net.minecraft.src;
|
|
|
|
|
2012-07-13 21:52:39 +02:00
|
|
|
import java.util.ArrayList;
|
2012-05-09 22:43:05 +02:00
|
|
|
import java.util.LinkedList;
|
2012-07-13 21:52:39 +02:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.ListIterator;
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
|
|
|
import net.minecraft.src.buildcraft.api.IPipe;
|
2012-07-20 20:13:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.api.gates.Action;
|
|
|
|
import net.minecraft.src.buildcraft.api.gates.ActionManager;
|
|
|
|
import net.minecraft.src.buildcraft.api.gates.Trigger;
|
2012-07-17 22:40:36 +02:00
|
|
|
import net.minecraft.src.buildcraft.api.recipes.AssemblyRecipe;
|
2012-05-09 22:43:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.core.CoreProxy;
|
|
|
|
import net.minecraft.src.buildcraft.core.DefaultProps;
|
2012-05-19 11:42:36 +02:00
|
|
|
import net.minecraft.src.buildcraft.core.ItemBuildCraft;
|
2012-05-09 22:43:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.ActionEnergyPulser;
|
|
|
|
import net.minecraft.src.buildcraft.transport.ActionSignalOutput;
|
|
|
|
import net.minecraft.src.buildcraft.transport.BlockGenericPipe;
|
|
|
|
import net.minecraft.src.buildcraft.transport.BptBlockPipe;
|
|
|
|
import net.minecraft.src.buildcraft.transport.BptItemPipeDiamond;
|
|
|
|
import net.minecraft.src.buildcraft.transport.BptItemPipeIron;
|
|
|
|
import net.minecraft.src.buildcraft.transport.BptItemPipeWodden;
|
|
|
|
import net.minecraft.src.buildcraft.transport.GuiHandler;
|
2012-07-13 21:52:39 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.ItemFacade;
|
2012-05-09 22:43:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.ItemGate;
|
2012-07-16 01:23:19 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.ItemPipe;
|
2012-05-09 22:43:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.Pipe;
|
|
|
|
import net.minecraft.src.buildcraft.transport.PipeLogicWood;
|
|
|
|
import net.minecraft.src.buildcraft.transport.PipeTriggerProvider;
|
|
|
|
import net.minecraft.src.buildcraft.transport.TileDummyGenericPipe;
|
|
|
|
import net.minecraft.src.buildcraft.transport.TileDummyGenericPipe2;
|
|
|
|
import net.minecraft.src.buildcraft.transport.TileGenericPipe;
|
|
|
|
import net.minecraft.src.buildcraft.transport.TriggerPipeContents;
|
|
|
|
import net.minecraft.src.buildcraft.transport.TriggerPipeContents.Kind;
|
|
|
|
import net.minecraft.src.buildcraft.transport.TriggerPipeSignal;
|
|
|
|
import net.minecraft.src.buildcraft.transport.network.ConnectionHandler;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsCobblestone;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsDiamond;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsGold;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsIron;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsObsidian;
|
2012-06-28 17:25:09 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsSandstone;
|
2012-05-09 22:43:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsStone;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsStripes;
|
2012-06-28 16:26:50 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsVoid;
|
2012-05-09 22:43:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeItemsWood;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeLiquidsCobblestone;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeLiquidsGold;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeLiquidsIron;
|
2012-06-28 17:25:09 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeLiquidsSandstone;
|
2012-05-09 22:43:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeLiquidsStone;
|
2012-06-28 16:26:50 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeLiquidsVoid;
|
2012-05-09 22:43:05 +02:00
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeLiquidsWood;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipePowerGold;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipePowerStone;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipePowerWood;
|
|
|
|
import net.minecraft.src.buildcraft.transport.pipes.PipeStructureCobblestone;
|
|
|
|
import net.minecraft.src.forge.Configuration;
|
|
|
|
import net.minecraft.src.forge.MinecraftForge;
|
|
|
|
import net.minecraft.src.forge.Property;
|
|
|
|
|
|
|
|
public class BuildCraftTransport {
|
|
|
|
|
|
|
|
private static boolean initialized = false;
|
|
|
|
|
|
|
|
public static BlockGenericPipe genericPipeBlock;
|
|
|
|
|
2012-06-04 22:48:18 +02:00
|
|
|
public static int[] diamondTextures = new int[6];
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
public static boolean alwaysConnectPipes;
|
|
|
|
public static int maxItemsInPipes;
|
|
|
|
|
|
|
|
public static Item pipeWaterproof;
|
|
|
|
public static Item pipeGate;
|
|
|
|
public static Item pipeGateAutarchic;
|
|
|
|
public static Item redPipeWire;
|
|
|
|
public static Item bluePipeWire;
|
|
|
|
public static Item greenPipeWire;
|
|
|
|
public static Item yellowPipeWire;
|
|
|
|
|
|
|
|
public static Item pipeItemsWood;
|
|
|
|
public static Item pipeItemsStone;
|
|
|
|
public static Item pipeItemsCobblestone;
|
|
|
|
public static Item pipeItemsIron;
|
|
|
|
public static Item pipeItemsGold;
|
|
|
|
public static Item pipeItemsDiamond;
|
|
|
|
public static Item pipeItemsObsidian;
|
2012-06-28 16:26:50 +02:00
|
|
|
public static Item pipeItemsVoid;
|
2012-06-28 17:25:09 +02:00
|
|
|
public static Item pipeItemsSandstone;
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
public static Item pipeLiquidsWood;
|
|
|
|
public static Item pipeLiquidsCobblestone;
|
|
|
|
public static Item pipeLiquidsStone;
|
|
|
|
public static Item pipeLiquidsIron;
|
|
|
|
public static Item pipeLiquidsGold;
|
2012-06-28 16:26:50 +02:00
|
|
|
public static Item pipeLiquidsVoid;
|
2012-06-28 17:25:09 +02:00
|
|
|
public static Item pipeLiquidsSandstone;
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
public static Item pipePowerWood;
|
|
|
|
public static Item pipePowerStone;
|
|
|
|
public static Item pipePowerGold;
|
2012-07-13 21:52:39 +02:00
|
|
|
|
|
|
|
public static Item facadeItem;
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
public static Item pipeItemsStipes;
|
|
|
|
public static Item pipeStructureCobblestone;
|
|
|
|
public static int groupItemsTrigger;
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
public static Trigger triggerPipeEmpty = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_EMPTY, Kind.Empty);
|
|
|
|
public static Trigger triggerPipeItems = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_ITEMS, Kind.ContainsItems);
|
|
|
|
public static Trigger triggerPipeLiquids = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_LIQUIDS, Kind.ContainsLiquids);
|
|
|
|
public static Trigger triggerPipeEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_ENERGY, Kind.ContainsEnergy);
|
|
|
|
public static Trigger triggerRedSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_RED_SIGNAL_ACTIVE, true,
|
2012-06-04 22:48:18 +02:00
|
|
|
IPipe.WireColor.Red);
|
2012-06-08 02:13:31 +02:00
|
|
|
public static Trigger triggerRedSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_RED_SIGNAL_INACTIVE, false,
|
|
|
|
IPipe.WireColor.Red);
|
|
|
|
public static Trigger triggerBlueSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_BLUE_SIGNAL_ACTIVE, true,
|
|
|
|
IPipe.WireColor.Blue);
|
|
|
|
public static Trigger triggerBlueSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_BLUE_SIGNAL_INACTIVE, false,
|
2012-06-04 22:48:18 +02:00
|
|
|
IPipe.WireColor.Blue);
|
2012-06-08 02:13:31 +02:00
|
|
|
public static Trigger triggerGreenSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_GREEN_SIGNAL_ACTIVE, true,
|
2012-06-04 22:48:18 +02:00
|
|
|
IPipe.WireColor.Green);
|
2012-06-08 02:13:31 +02:00
|
|
|
public static Trigger triggerGreenSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_GREEN_SIGNAL_INACTIVE, false,
|
2012-06-04 22:48:18 +02:00
|
|
|
IPipe.WireColor.Green);
|
2012-06-08 02:13:31 +02:00
|
|
|
public static Trigger triggerYellowSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_YELLOW_SIGNAL_ACTIVE, true,
|
2012-06-04 22:48:18 +02:00
|
|
|
IPipe.WireColor.Yellow);
|
2012-06-08 02:13:31 +02:00
|
|
|
public static Trigger triggerYellowSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_YELLOW_SIGNAL_INACTIVE, false,
|
2012-06-04 22:48:18 +02:00
|
|
|
IPipe.WireColor.Yellow);
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
public static Action actionRedSignal = new ActionSignalOutput(DefaultProps.ACTION_RED_SIGNAL, IPipe.WireColor.Red);
|
|
|
|
public static Action actionBlueSignal = new ActionSignalOutput(DefaultProps.ACTION_BLUE_SIGNAL, IPipe.WireColor.Blue);
|
|
|
|
public static Action actionGreenSignal = new ActionSignalOutput(DefaultProps.ACTION_GREEN_SIGNAL, IPipe.WireColor.Green);
|
|
|
|
public static Action actionYellowSignal = new ActionSignalOutput(DefaultProps.ACTION_YELLOW_SIGNAL, IPipe.WireColor.Yellow);
|
|
|
|
public static Action actionEnergyPulser = new ActionEnergyPulser(DefaultProps.ACTION_ENERGY_PULSER);
|
2012-07-10 13:14:58 +02:00
|
|
|
|
|
|
|
public static int pipeModel;
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
private static class PipeRecipe {
|
2012-06-08 02:13:31 +02:00
|
|
|
|
2012-05-09 22:43:05 +02:00
|
|
|
boolean isShapeless = false; // pipe recipes come shaped and unshaped.
|
|
|
|
ItemStack result;
|
2012-06-04 22:48:18 +02:00
|
|
|
Object[] input;
|
2012-05-09 22:43:05 +02:00
|
|
|
}
|
|
|
|
|
2012-06-04 22:48:18 +02:00
|
|
|
private static LinkedList<PipeRecipe> pipeRecipes = new LinkedList<PipeRecipe>();
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
public static void load() {
|
|
|
|
// Register connection handler
|
|
|
|
MinecraftForge.registerConnectionHandler(new ConnectionHandler());
|
|
|
|
|
|
|
|
// Register gui handler
|
2012-06-08 02:13:31 +02:00
|
|
|
MinecraftForge.setGuiHandler(mod_BuildCraftTransport.instance, new GuiHandler());
|
2012-05-09 22:43:05 +02:00
|
|
|
}
|
|
|
|
|
2012-06-04 22:48:18 +02:00
|
|
|
public static void initialize() {
|
2012-05-09 22:43:05 +02:00
|
|
|
if (initialized)
|
|
|
|
return;
|
|
|
|
|
|
|
|
initialized = true;
|
|
|
|
|
|
|
|
mod_BuildCraftCore.initialize();
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
Property alwaysConnect = BuildCraftCore.mainConfiguration.getOrCreateBooleanProperty("pipes.alwaysConnect",
|
|
|
|
Configuration.CATEGORY_GENERAL, DefaultProps.PIPES_ALWAYS_CONNECT);
|
2012-05-09 22:43:05 +02:00
|
|
|
alwaysConnect.comment = "set to false to deactivate pipe connection rules, true by default";
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
Property exclusionList = BuildCraftCore.mainConfiguration.getOrCreateProperty("woodenPipe.exclusion",
|
|
|
|
Configuration.CATEGORY_BLOCK, "");
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
PipeLogicWood.excludedBlocks = exclusionList.value.split(",");
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
Property maxItemInPipesProp = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("pipes.maxItems",
|
|
|
|
Configuration.CATEGORY_GENERAL, 100);
|
2012-05-09 22:43:05 +02:00
|
|
|
maxItemInPipesProp.comment = "pipes containing more than this amount of items will explode, not dropping any item";
|
|
|
|
|
|
|
|
maxItemsInPipes = Integer.parseInt(maxItemInPipesProp.value);
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("pipes.groupItemsTrigger",
|
|
|
|
Configuration.CATEGORY_GENERAL, 32);
|
2012-05-09 22:43:05 +02:00
|
|
|
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
|
|
|
|
|
|
|
|
groupItemsTrigger = Integer.parseInt(groupItemsTriggerProp.value);
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
Property genericPipeId = BuildCraftCore.mainConfiguration.getOrCreateBlockIdProperty("pipe.id",
|
|
|
|
DefaultProps.GENERIC_PIPE_ID);
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
for (int j = 0; j < PipeLogicWood.excludedBlocks.length; ++j)
|
2012-06-08 02:13:31 +02:00
|
|
|
PipeLogicWood.excludedBlocks[j] = PipeLogicWood.excludedBlocks[j].trim();
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
BuildCraftCore.mainConfiguration.save();
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeWaterproof = new ItemBuildCraft(DefaultProps.PIPE_WATERPROOF_ID).setIconIndex(2 * 16 + 1);
|
2012-05-09 22:43:05 +02:00
|
|
|
pipeWaterproof.setItemName("pipeWaterproof");
|
|
|
|
CoreProxy.addName(pipeWaterproof, "Pipe Waterproof");
|
2012-06-08 02:13:31 +02:00
|
|
|
genericPipeBlock = new BlockGenericPipe(Integer.parseInt(genericPipeId.value));
|
2012-05-09 22:43:05 +02:00
|
|
|
CoreProxy.registerBlock(genericPipeBlock);
|
|
|
|
|
|
|
|
// Fixing retro-compatiblity
|
2012-06-08 02:13:31 +02:00
|
|
|
mod_BuildCraftTransport.registerTilePipe(TileDummyGenericPipe.class, "net.minecraft.src.buildcraft.GenericPipe");
|
2012-05-09 22:43:05 +02:00
|
|
|
mod_BuildCraftTransport.registerTilePipe(TileDummyGenericPipe2.class,
|
|
|
|
"net.minecraft.src.buildcraft.transport.TileGenericPipe");
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
mod_BuildCraftTransport.registerTilePipe(TileGenericPipe.class, "net.minecraft.src.buildcraft.transport.GenericPipe");
|
2012-05-09 22:43:05 +02:00
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeItemsWood = createPipe(DefaultProps.PIPE_ITEMS_WOOD_ID, PipeItemsWood.class, "Wooden Transport Pipe", Block.planks,
|
2012-06-04 22:48:18 +02:00
|
|
|
Block.glass, Block.planks);
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeItemsCobblestone = createPipe(DefaultProps.PIPE_ITEMS_COBBLESTONE_ID, PipeItemsCobblestone.class,
|
|
|
|
"Cobblestone Transport Pipe", Block.cobblestone, Block.glass, Block.cobblestone);
|
|
|
|
pipeItemsStone = createPipe(DefaultProps.PIPE_ITEMS_STONE_ID, PipeItemsStone.class, "Stone Transport Pipe", Block.stone,
|
2012-06-04 22:48:18 +02:00
|
|
|
Block.glass, Block.stone);
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeItemsIron = createPipe(DefaultProps.PIPE_ITEMS_IRON_ID, PipeItemsIron.class, "Iron Transport Pipe", Item.ingotIron,
|
2012-06-04 22:48:18 +02:00
|
|
|
Block.glass, Item.ingotIron);
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeItemsGold = createPipe(DefaultProps.PIPE_ITEMS_GOLD_ID, PipeItemsGold.class, "Golden Transport Pipe", Item.ingotGold,
|
2012-06-04 22:48:18 +02:00
|
|
|
Block.glass, Item.ingotGold);
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeItemsDiamond = createPipe(DefaultProps.PIPE_ITEMS_DIAMOND_ID, PipeItemsDiamond.class, "Diamond Transport Pipe",
|
|
|
|
Item.diamond, Block.glass, Item.diamond);
|
|
|
|
pipeItemsObsidian = createPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe",
|
2012-06-04 22:48:18 +02:00
|
|
|
Block.obsidian, Block.glass, Block.obsidian);
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeLiquidsWood = createPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeLiquidsWood.class, "Wooden Waterproof Pipe",
|
2012-06-04 22:48:18 +02:00
|
|
|
pipeWaterproof, pipeItemsWood, null);
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeLiquidsCobblestone = createPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeLiquidsCobblestone.class,
|
|
|
|
"Cobblestone Waterproof Pipe", pipeWaterproof, pipeItemsCobblestone, null);
|
|
|
|
pipeLiquidsStone = createPipe(DefaultProps.PIPE_LIQUIDS_STONE_ID, PipeLiquidsStone.class, "Stone Waterproof Pipe",
|
2012-06-04 22:48:18 +02:00
|
|
|
pipeWaterproof, pipeItemsStone, null);
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeLiquidsIron = createPipe(DefaultProps.PIPE_LIQUIDS_IRON_ID, PipeLiquidsIron.class, "Iron Waterproof Pipe",
|
|
|
|
pipeWaterproof, pipeItemsIron, null);
|
|
|
|
pipeLiquidsGold = createPipe(DefaultProps.PIPE_LIQUIDS_GOLD_ID, PipeLiquidsGold.class, "Golden Waterproof Pipe",
|
2012-06-04 22:48:18 +02:00
|
|
|
pipeWaterproof, pipeItemsGold, null);
|
2012-05-09 22:43:05 +02:00
|
|
|
// diamond
|
|
|
|
// obsidian
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
pipePowerWood = createPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Conductive Pipe", Item.redstone,
|
2012-06-04 22:48:18 +02:00
|
|
|
pipeItemsWood, null);
|
2012-05-09 22:43:05 +02:00
|
|
|
// cobblestone
|
2012-06-08 02:13:31 +02:00
|
|
|
pipePowerStone = createPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Conductive Pipe",
|
|
|
|
Item.redstone, pipeItemsStone, null);
|
2012-05-09 22:43:05 +02:00
|
|
|
// iron
|
2012-06-08 02:13:31 +02:00
|
|
|
pipePowerGold = createPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Conductive Pipe", Item.redstone,
|
2012-06-04 22:48:18 +02:00
|
|
|
pipeItemsGold, null);
|
2012-05-09 22:43:05 +02:00
|
|
|
// diamond
|
|
|
|
// obsidian
|
|
|
|
|
|
|
|
// Fix name and recipe (Structure pipe insteand of Signal?)
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeStructureCobblestone = createPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class,
|
|
|
|
"Cobblestone Structure Pipe", Block.gravel, pipeItemsCobblestone, null);
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
// Fix the recipe
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeItemsStipes = createPipe(DefaultProps.PIPE_ITEMS_STRIPES_ID, PipeItemsStripes.class, "Stripes Transport Pipe",
|
|
|
|
new ItemStack(Item.dyePowder, 1, 0), Block.glass, new ItemStack(Item.dyePowder, 1, 11));
|
2012-06-28 16:26:50 +02:00
|
|
|
|
|
|
|
pipeItemsVoid = createPipe(DefaultProps.PIPE_ITEMS_VOID_ID, PipeItemsVoid.class, "Void Transport Pipe",
|
|
|
|
new ItemStack(Item.dyePowder, 1, 0), Block.glass, Item.redstone);
|
|
|
|
|
|
|
|
pipeLiquidsVoid = createPipe(DefaultProps.PIPE_LIQUIDS_VOID_ID, PipeLiquidsVoid.class, "Void Waterproof Pipe",
|
|
|
|
pipeWaterproof, pipeItemsVoid, null);
|
2012-06-28 17:25:09 +02:00
|
|
|
|
|
|
|
pipeItemsSandstone = createPipe(DefaultProps.PIPE_ITEMS_SANDSTONE_ID, PipeItemsSandstone.class, "Sandstone Transport Pipe",
|
|
|
|
Block.sandStone, Block.glass, Block.sandStone);
|
|
|
|
|
|
|
|
pipeLiquidsSandstone = createPipe(DefaultProps.PIPE_LIQUIDS_SANDSTONE_ID, PipeLiquidsSandstone.class, "Sandstone Waterproof Pipe",
|
|
|
|
pipeWaterproof, pipeItemsSandstone, null);
|
2012-05-09 22:43:05 +02:00
|
|
|
|
2012-06-04 22:48:18 +02:00
|
|
|
// dockingStationBlock = new
|
|
|
|
// BlockDockingStation(Integer.parseInt(dockingStationId.value));
|
|
|
|
// ModLoader.registerBlock(dockingStationBlock);
|
|
|
|
// CoreProxy.addName(dockingStationBlock.setBlockName("dockingStation"),
|
|
|
|
// "Docking Station");
|
2012-05-09 22:43:05 +02:00
|
|
|
|
2012-06-04 22:48:18 +02:00
|
|
|
// ModLoader.RegisterTileEntity(TileDockingStation.class,
|
|
|
|
// "net.minecraft.src.buildcraft.TileDockingStation");
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
for (int j = 0; j < 6; ++j)
|
2012-06-04 22:48:18 +02:00
|
|
|
diamondTextures[j] = 1 * 16 + 6 + j;
|
2012-05-09 22:43:05 +02:00
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
redPipeWire = new ItemBuildCraft(DefaultProps.RED_PIPE_WIRE).setIconIndex(4 * 16 + 0);
|
2012-05-09 22:43:05 +02:00
|
|
|
redPipeWire.setItemName("redPipeWire");
|
|
|
|
CoreProxy.addName(redPipeWire, "Red Pipe Wire");
|
2012-07-17 22:40:36 +02:00
|
|
|
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 1),
|
2012-06-08 02:13:31 +02:00
|
|
|
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(redPipeWire, 8)));
|
|
|
|
|
|
|
|
bluePipeWire = new ItemBuildCraft(DefaultProps.BLUE_PIPE_WIRE).setIconIndex(4 * 16 + 1);
|
2012-05-09 22:43:05 +02:00
|
|
|
bluePipeWire.setItemName("bluePipeWire");
|
|
|
|
CoreProxy.addName(bluePipeWire, "Blue Pipe Wire");
|
2012-07-17 22:40:36 +02:00
|
|
|
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4),
|
2012-06-08 02:13:31 +02:00
|
|
|
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(bluePipeWire, 8)));
|
|
|
|
|
|
|
|
greenPipeWire = new ItemBuildCraft(DefaultProps.GREEN_PIPE_WIRE).setIconIndex(4 * 16 + 2);
|
2012-05-09 22:43:05 +02:00
|
|
|
greenPipeWire.setItemName("greenPipeWire");
|
|
|
|
CoreProxy.addName(greenPipeWire, "Green Pipe Wire");
|
2012-07-17 22:40:36 +02:00
|
|
|
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 2),
|
2012-06-08 02:13:31 +02:00
|
|
|
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(greenPipeWire, 8)));
|
|
|
|
|
|
|
|
yellowPipeWire = new ItemBuildCraft(DefaultProps.YELLOW_PIPE_WIRE).setIconIndex(4 * 16 + 3);
|
2012-05-09 22:43:05 +02:00
|
|
|
yellowPipeWire.setItemName("yellowPipeWire");
|
|
|
|
CoreProxy.addName(yellowPipeWire, "Yellow Pipe Wire");
|
2012-07-17 22:40:36 +02:00
|
|
|
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 11),
|
2012-06-08 02:13:31 +02:00
|
|
|
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(yellowPipeWire, 8)));
|
|
|
|
|
|
|
|
pipeGate = new ItemGate(DefaultProps.GATE_ID, 0).setIconIndex(2 * 16 + 3);
|
2012-05-09 22:43:05 +02:00
|
|
|
pipeGate.setItemName("pipeGate");
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
pipeGateAutarchic = new ItemGate(DefaultProps.GATE_AUTARCHIC_ID, 1).setIconIndex(2 * 16 + 3);
|
2012-05-09 22:43:05 +02:00
|
|
|
pipeGateAutarchic.setItemName("pipeGateAutarchic");
|
2012-07-13 21:52:39 +02:00
|
|
|
|
|
|
|
facadeItem = new ItemFacade(DefaultProps.PIPE_FACADE_ID);
|
|
|
|
facadeItem.setItemName("pipeFacade");
|
|
|
|
ItemFacade.initialize();
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
alwaysConnectPipes = Boolean.parseBoolean(alwaysConnect.value);
|
|
|
|
|
|
|
|
BuildCraftCore.mainConfiguration.save();
|
|
|
|
|
2012-06-04 22:48:18 +02:00
|
|
|
new BptBlockPipe(genericPipeBlock.blockID);
|
2012-05-09 22:43:05 +02:00
|
|
|
|
2012-06-04 22:48:18 +02:00
|
|
|
BuildCraftCore.itemBptProps[pipeItemsWood.shiftedIndex] = new BptItemPipeWodden();
|
|
|
|
BuildCraftCore.itemBptProps[pipeLiquidsWood.shiftedIndex] = new BptItemPipeWodden();
|
|
|
|
BuildCraftCore.itemBptProps[pipeItemsIron.shiftedIndex] = new BptItemPipeIron();
|
|
|
|
BuildCraftCore.itemBptProps[pipeLiquidsIron.shiftedIndex] = new BptItemPipeIron();
|
|
|
|
BuildCraftCore.itemBptProps[pipeItemsDiamond.shiftedIndex] = new BptItemPipeDiamond();
|
2012-05-09 22:43:05 +02:00
|
|
|
|
2012-07-20 20:13:05 +02:00
|
|
|
ActionManager.registerTriggerProvider(new PipeTriggerProvider());
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
if (BuildCraftCore.loadDefaultRecipes)
|
|
|
|
loadRecipes();
|
|
|
|
}
|
|
|
|
|
2012-06-04 22:48:18 +02:00
|
|
|
public static void loadRecipes() {
|
2012-05-09 22:43:05 +02:00
|
|
|
CraftingManager craftingmanager = CraftingManager.getInstance();
|
|
|
|
|
|
|
|
// Add base recipe for pipe waterproof.
|
2012-06-08 02:13:31 +02:00
|
|
|
craftingmanager.addRecipe(new ItemStack(pipeWaterproof, 1), new Object[] { "W ", " ", Character.valueOf('W'),
|
|
|
|
new ItemStack(Item.dyePowder, 1, 2) });
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
// Add pipe recipes
|
|
|
|
for (PipeRecipe p : pipeRecipes)
|
2012-06-04 22:48:18 +02:00
|
|
|
if (p.isShapeless)
|
2012-05-09 22:43:05 +02:00
|
|
|
craftingmanager.addShapelessRecipe(p.result, p.input);
|
|
|
|
else
|
|
|
|
craftingmanager.addRecipe(p.result, p.input);
|
|
|
|
}
|
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
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);
|
2012-05-09 22:43:05 +02:00
|
|
|
|
2012-06-08 02:13:31 +02:00
|
|
|
Property prop = BuildCraftCore.mainConfiguration.getOrCreateIntProperty(name + ".id", Configuration.CATEGORY_ITEM,
|
|
|
|
defaultID);
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
int id = Integer.parseInt(prop.value);
|
2012-07-16 01:23:19 +02:00
|
|
|
ItemPipe res = BlockGenericPipe.registerPipe(id, clas);
|
2012-05-09 22:43:05 +02:00
|
|
|
res.setItemName(clas.getSimpleName());
|
|
|
|
CoreProxy.addName(res, descr);
|
|
|
|
|
|
|
|
// Add appropriate recipe to temporary list
|
2012-06-04 22:48:18 +02:00
|
|
|
PipeRecipe recipe = new PipeRecipe();
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
if (ingredient1 != null && ingredient2 != null && ingredient3 != null) {
|
|
|
|
recipe.result = new ItemStack(res, 8);
|
2012-06-08 02:13:31 +02:00
|
|
|
recipe.input = new Object[] { " ", "ABC", " ", Character.valueOf('A'), ingredient1, Character.valueOf('B'),
|
|
|
|
ingredient2, Character.valueOf('C'), ingredient3 };
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
pipeRecipes.add(recipe);
|
|
|
|
} else if (ingredient1 != null && ingredient2 != null) {
|
|
|
|
recipe.isShapeless = true;
|
|
|
|
recipe.result = new ItemStack(res, 1);
|
2012-06-04 22:48:18 +02:00
|
|
|
recipe.input = new Object[] { ingredient1, ingredient2 };
|
2012-05-09 22:43:05 +02:00
|
|
|
|
|
|
|
pipeRecipes.add(recipe);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
2012-07-10 13:14:58 +02:00
|
|
|
|
|
|
|
public static void initializeModel(mod_BuildCraftTransport mod) {
|
|
|
|
pipeModel = ModLoader.getUniqueBlockModelID(mod, true);
|
|
|
|
}
|
2012-07-13 21:52:39 +02:00
|
|
|
|
|
|
|
|
2012-05-09 22:43:05 +02:00
|
|
|
}
|