Finalize Gate Rework

-Added Integration Table Recipes
-Finished and tested Integration Table
-Re-added all Gate recipes
-Clean up Pipe Wires, Chipsets, etc...

Changes:
-Gate Logic Swap recipes moved from Workbench to Integration Table.
-Pipe Wires condensed into a single Item
-Pipe Wires are now distributed evenly between the gates: Red with the
Basic Gate, Blue with Iron, Yellow with Gold, and Green with Diamond.
Recipes adjusted to match.

As of this commit, Gates should be both craftable and usable again. The
Integration Table is also ready to be used. Gate Expansions are
completely implemented and usable.

Enjoy!
This commit is contained in:
CovertJaguar 2014-01-02 04:58:08 -08:00
parent 0c057f28d1
commit 3b0a047570
28 changed files with 641 additions and 408 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

View file

@ -0,0 +1,5 @@
{
"animation": {
"frametime": 4
}
}

View file

@ -51,7 +51,7 @@ gate.material.gold=Gold
gate.material.diamond=Diamond gate.material.diamond=Diamond
gate.name=%s %s Gate gate.name=%s %s Gate
gate.name.basic=Gate gate.name.basic=Basic Gate
gate.trigger.engine.blue=Engine Blue gate.trigger.engine.blue=Engine Blue
gate.trigger.engine.green=Engine Green gate.trigger.engine.green=Engine Green
@ -117,12 +117,13 @@ item.redPipeWire=Red Pipe Wire
item.bluePipeWire=Blue Pipe Wire item.bluePipeWire=Blue Pipe Wire
item.greenPipeWire=Green Pipe Wire item.greenPipeWire=Green Pipe Wire
item.yellowPipeWire=Yellow Pipe Wire item.yellowPipeWire=Yellow Pipe Wire
item.redstoneChipset.0=Redstone Chipset item.redstone_red_chipset=Redstone Chipset
item.redstoneChipset.1=Redstone Iron Chipset item.redstone_iron_chipset=Iron Chipset
item.redstoneChipset.2=Redstone Golden Chipset item.redstone_gold_chipset=Golden Chipset
item.redstoneChipset.3=Redstone Diamond Chipset item.redstone_diamond_chipset=Diamond Chipset
item.redstoneChipset.4=Pulsating Chipset item.redstone_pulsating_chipset=Pulsating Chipset
item.redstoneChipset.5=Redstone Quartz Chipset item.redstone_quartz_chipset=Quartz Chipset
item.redstone_comp_chipset=Redstone Comp Chipset
item.blueprintItem=Blueprint item.blueprintItem=Blueprint
item.PipeItemsWood=Wooden Transport Pipe item.PipeItemsWood=Wooden Transport Pipe
item.PipeItemsCobblestone=Cobblestone Transport Pipe item.PipeItemsCobblestone=Cobblestone Transport Pipe
@ -190,6 +191,13 @@ tile.spring.oil=Oil Spring
tile.spring.water=Water Spring tile.spring.water=Water Spring
tile.tankBlock=Tank tile.tankBlock=Tank
tip.gate.wires=Compatible Wires:
tip.gate.wires.redstone=Red
tip.gate.wires.iron=Red, Blue
tip.gate.wires.gold=Red, Blue, Yellow
tip.gate.wires.diamond=Red, Blue, Yellow, Green
tip.gate.expansions=Installed Expansions:
tip.PipeFluidsCobblestone=Basic pipe, 10 mB/t\nWon't connect to Stone tip.PipeFluidsCobblestone=Basic pipe, 10 mB/t\nWon't connect to Stone
tip.PipeFluidsEmerald=Extraction pipe, 40 mB/t tip.PipeFluidsEmerald=Extraction pipe, 40 mB/t
tip.PipeFluidsGold=Basic pipe, 40 mB/t tip.PipeFluidsGold=Basic pipe, 40 mB/t

View file

@ -10,9 +10,11 @@ package buildcraft;
import buildcraft.api.bptblocks.BptBlockInventory; import buildcraft.api.bptblocks.BptBlockInventory;
import buildcraft.api.bptblocks.BptBlockRotateMeta; import buildcraft.api.bptblocks.BptBlockRotateMeta;
import buildcraft.api.recipes.BuildcraftRecipes; import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.transport.PipeWire;
import buildcraft.core.DefaultProps; import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms; import buildcraft.core.InterModComms;
import buildcraft.core.ItemRedstoneChipset; import buildcraft.silicon.ItemRedstoneChipset;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import buildcraft.core.Version; import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.silicon.BlockLaser; import buildcraft.silicon.BlockLaser;
@ -25,6 +27,14 @@ import buildcraft.silicon.TileAssemblyTable;
import buildcraft.silicon.TileIntegrationTable; import buildcraft.silicon.TileIntegrationTable;
import buildcraft.silicon.TileLaser; import buildcraft.silicon.TileLaser;
import buildcraft.silicon.network.PacketHandlerSilicon; import buildcraft.silicon.network.PacketHandlerSilicon;
import buildcraft.transport.gates.GateDefinition.GateMaterial;
import buildcraft.transport.gates.GateExpansionPulsar;
import buildcraft.silicon.recipes.GateExpansionRecipe;
import buildcraft.silicon.recipes.GateLogicSwapRecipe;
import buildcraft.transport.gates.GateDefinition.GateLogic;
import buildcraft.transport.gates.GateExpansionRedstoneFader;
import buildcraft.transport.gates.GateExpansionTimer;
import buildcraft.transport.gates.ItemGate;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
@ -34,6 +44,9 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -46,7 +59,6 @@ public class BuildCraftSilicon {
public static ItemRedstoneChipset redstoneChipset; public static ItemRedstoneChipset redstoneChipset;
public static BlockLaser laserBlock; public static BlockLaser laserBlock;
public static BlockLaserTable assemblyTableBlock; public static BlockLaserTable assemblyTableBlock;
@Instance("BuildCraft|Silicon") @Instance("BuildCraft|Silicon")
public static BuildCraftSilicon instance; public static BuildCraftSilicon instance;
@ -97,147 +109,87 @@ public class BuildCraftSilicon {
public static void loadRecipes() { public static void loadRecipes() {
// TABLES
CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock), CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock),
new Object[]{"ORR", "DDR", "ORR", 'O', Block.obsidian, 'R', Item.redstone, 'D', "ORR",
Item.diamond,}); "DDR",
"ORR",
'O', Block.obsidian,
'R', Item.redstone,
'D', Item.diamond);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0), new Object[]{"ORO", "ODO", "OGO", 'O', Block.obsidian, CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0),
'R', Item.redstone, 'D', Item.diamond, 'G', BuildCraftCore.diamondGearItem,}); "ORO",
"ODO",
"OGO",
'O', Block.obsidian,
'R', Item.redstone,
'D', Item.diamond,
'G', BuildCraftCore.diamondGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1), new Object[]{"OWO", "OCO", "ORO", 'O', Block.obsidian, CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1),
'W', Block.workbench, 'C', Block.chest, 'R', new ItemStack(redstoneChipset, 1, 0),}); "OWO",
// Add reverse recipies for all gates "OCO",
"ORO",
'O', Block.obsidian,
'W', Block.workbench,
'C', Block.chest,
'R', new ItemStack(redstoneChipset, 1, 0));
// Iron CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 2),
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 2), new Object[]{new ItemStack(redstoneChipset, 1, 0), "ORO",
new ItemStack(BuildCraftTransport.pipeGate, 1, 1)}); "OCO",
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 1), new Object[]{new ItemStack(redstoneChipset, 1, 0), "OGO",
new ItemStack(BuildCraftTransport.pipeGate, 1, 2)}); 'O', Block.obsidian,
'R', Item.redstone,
'C', new ItemStack(redstoneChipset, 1, 0),
'G', BuildCraftCore.diamondGearItem);
// Gold // PIPE WIRE
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 4), new Object[]{new ItemStack(redstoneChipset, 1, 0), BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.RED.getStack(8), "dyeRed", 1, Item.redstone, Item.ingotIron);
new ItemStack(BuildCraftTransport.pipeGate, 1, 3)}); BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.BLUE.getStack(8), "dyeBlue", 1, Item.redstone, Item.ingotIron);
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 3), new Object[]{new ItemStack(redstoneChipset, 1, 0), BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.GREEN.getStack(8), "dyeGreen", 1, Item.redstone, Item.ingotIron);
new ItemStack(BuildCraftTransport.pipeGate, 1, 4)}); BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.YELLOW.getStack(8), "dyeYellow", 1, Item.redstone, Item.ingotIron);
// Diamond // CHIPSETS
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 6), new Object[]{new ItemStack(redstoneChipset, 1, 0), BuildcraftRecipes.assemblyTable.addRecipe(10000, Chipset.RED.getStack(), Item.redstone);
new ItemStack(BuildCraftTransport.pipeGate, 1, 5)}); BuildcraftRecipes.assemblyTable.addRecipe(20000, Chipset.IRON.getStack(), Item.redstone, Item.ingotIron);
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 5), new Object[]{new ItemStack(redstoneChipset, 1, 0), BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.GOLD.getStack(), Item.redstone, Item.ingotGold);
new ItemStack(BuildCraftTransport.pipeGate, 1, 6)}); BuildcraftRecipes.assemblyTable.addRecipe(80000, Chipset.DIAMOND.getStack(), Item.redstone, Item.diamond);
BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.PULSATING.getStack(2), Item.redstone, Item.enderPearl);
BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.QUARTZ.getStack(), Item.redstone, Item.netherQuartz);
BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.COMP.getStack(), Item.redstone, Item.comparator);
// Quartz // GATES
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 8), new Object[]{new ItemStack(redstoneChipset, 1, 0), BuildcraftRecipes.assemblyTable.addRecipe(10000, ItemGate.makeGateItem(GateMaterial.REDSTONE, GateLogic.AND), Chipset.RED.getStack(), PipeWire.RED.getStack());
new ItemStack(BuildCraftTransport.pipeGate, 1, 7)});
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 7), new Object[]{new ItemStack(redstoneChipset, 1, 0),
new ItemStack(BuildCraftTransport.pipeGate, 1, 8)});
// Iron - Autarchic addGateRecipe(20000, GateMaterial.IRON, Chipset.IRON, PipeWire.RED, PipeWire.BLUE);
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2), new Object[]{new ItemStack(redstoneChipset, 1, 0), addGateRecipe(40000, GateMaterial.GOLD, Chipset.GOLD, PipeWire.RED, PipeWire.BLUE, PipeWire.YELLOW);
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1)}); addGateRecipe(80000, GateMaterial.DIAMOND, Chipset.DIAMOND, PipeWire.RED, PipeWire.BLUE, PipeWire.YELLOW, PipeWire.GREEN);
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1), new Object[]{new ItemStack(redstoneChipset, 1, 0),
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2)});
//
// // Gold - Autarchic
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4), new Object[]{new ItemStack(redstoneChipset, 1, 0),
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3)});
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3), new Object[]{new ItemStack(redstoneChipset, 1, 0),
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4)});
//
// // Diamond - Autarchic
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6), new Object[]{new ItemStack(redstoneChipset, 1, 0),
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5)});
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5), new Object[]{new ItemStack(redstoneChipset, 1, 0),
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6)});
//
// // Quartz - Autarchic
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 8), new Object[]{new ItemStack(redstoneChipset, 1, 0),
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 7)});
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 7), new Object[]{new ItemStack(redstoneChipset, 1, 0),
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 8)});
// / REDSTONE CHIPSETS // REVERSAL RECIPES
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 0), "Redstone Chipset"); EnumSet<GateMaterial> materials = EnumSet.allOf(GateMaterial.class);
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 1), "Redstone Iron Chipset"); materials.remove(GateMaterial.REDSTONE);
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 2), "Redstone Golden Chipset"); for (GateMaterial material : materials) {
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 3), "Redstone Diamond Chipset"); BuildcraftRecipes.integrationTable.addRecipe(new GateLogicSwapRecipe(material, GateLogic.AND, GateLogic.OR));
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 4), "Pulsating Chipset"); BuildcraftRecipes.integrationTable.addRecipe(new GateLogicSwapRecipe(material, GateLogic.OR, GateLogic.AND));
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 5), "Redstone Quartz Chipset"); }
BuildcraftRecipes.assemblyTable.addRecipe(10000, new ItemStack(redstoneChipset, 1, 0), Item.redstone);
BuildcraftRecipes.assemblyTable.addRecipe(20000, new ItemStack(redstoneChipset, 1, 1), Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(40000, new ItemStack(redstoneChipset, 1, 2), Item.redstone, Item.ingotGold);
BuildcraftRecipes.assemblyTable.addRecipe(80000, new ItemStack(redstoneChipset, 1, 3), Item.redstone, Item.diamond);
BuildcraftRecipes.assemblyTable.addRecipe(40000, new ItemStack(redstoneChipset, 2, 4), Item.redstone, Item.enderPearl);
BuildcraftRecipes.assemblyTable.addRecipe(60000, new ItemStack(redstoneChipset, 1, 5), Item.redstone, Item.netherQuartz);
// / REDSTONE GATES
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 0), "Gate");
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 1), "Iron AND Gate");
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 3), "Gold AND Gate");
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 5), "Diamond AND Gate");
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 2), "Iron OR Gate");
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 4), "Gold OR Gate");
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 6), "Diamond OR Gate");
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 0), "Autarchic Gate");
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1), "Autarchic Iron AND Gate");
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3), "Autarchic Gold AND Gate");
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5), "Autarchic Diamond AND Gate");
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2), "Autarchic Iron OR Gate");
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4), "Autarchic Gold OR Gate");
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6), "Autarchic Diamond OR Gate");
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 0), 20000, new ItemStack(redstoneChipset, 1, 0));
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 1), 40000, new ItemStack(redstoneChipset, 1, 1), new ItemStack(BuildCraftTransport.redPipeWire));
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 2), 40000, new ItemStack(redstoneChipset, 1, 1), new ItemStack(BuildCraftTransport.redPipeWire));
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 0), 10000, new ItemStack(BuildCraftTransport.pipeGate, 1, 0), new ItemStack(redstoneChipset, 1, 4), new ItemStack(redstoneChipset, 1, 1));
//
//
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1), 20000, new ItemStack(BuildCraftTransport.pipeGate, 1, 1), new ItemStack(redstoneChipset, 1, 4), new ItemStack(redstoneChipset, 1, 1));
//
//
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2), 20000, new ItemStack(BuildCraftTransport.pipeGate, 1, 2), new ItemStack(redstoneChipset, 1, 4), new ItemStack(redstoneChipset, 1, 1));
//
// // / GOLD AND GATES
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 3), 80000, new ItemStack(redstoneChipset, 1, 2), new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire));
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack[]{new ItemStack(BuildCraftTransport.pipeGate, 1, 3), new ItemStack(redstoneChipset, 1, 4), new ItemStack(redstoneChipset, 1, 1)}, 40000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3)));
//
// // / GOLD OR GATES
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack[]{new ItemStack(redstoneChipset, 1, 2), new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire)}, 80000, new ItemStack( BuildCraftTransport.pipeGate, 1, 4)));
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack[]{new ItemStack(BuildCraftTransport.pipeGate, 1, 4), new ItemStack(redstoneChipset, 1, 4), new ItemStack(redstoneChipset, 1, 1)}, 40000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4)));
//
// // / DIAMOND AND GATES
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack[]{new ItemStack(redstoneChipset, 1, 3), new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire),new ItemStack(BuildCraftTransport.greenPipeWire), new ItemStack(BuildCraftTransport.yellowPipeWire)}, 160000, new ItemStack(BuildCraftTransport.pipeGate, 1, 5)));
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack[]{new ItemStack(BuildCraftTransport.pipeGate, 1, 5), new ItemStack(redstoneChipset, 1, 4), new ItemStack(redstoneChipset, 1, 1)}, 80000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5)));
//
// // / DIAMOND OR GATES
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack[]{new ItemStack(redstoneChipset, 1, 3), new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire), new ItemStack(BuildCraftTransport.greenPipeWire), new ItemStack(BuildCraftTransport.yellowPipeWire)}, 160000, new ItemStack(BuildCraftTransport.pipeGate, 1, 6)));
// BuildcraftRecipes.assemblyTable.addRecipe(new ItemStack[]{new ItemStack(BuildCraftTransport.pipeGate, 1, 6), new ItemStack(redstoneChipset, 1, 4), new ItemStack(redstoneChipset, 1, 1)}, 80000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6)));
// / QUARTZ AND GATES
// AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[]{new ItemStack(redstoneChipset, 1, 5),
// new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire),
// new ItemStack(BuildCraftTransport.greenPipeWire), new ItemStack(BuildCraftTransport.yellowPipeWire)}, 120000, new ItemStack(
// BuildCraftTransport.pipeGate, 1, 7)));
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 7), "Quartz AND Gate");
// AssemblyRecipe.assemblyRecipes
// .add(new AssemblyRecipe(new ItemStack[]{new ItemStack(BuildCraftTransport.pipeGate, 1, 7), new ItemStack(redstoneChipset, 1, 4),
// new ItemStack(redstoneChipset, 1, 1)}, 60000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 7)));
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 7), "Autarchic Quartz AND Gate");
//
// // / QUARTZ OR GATES
// AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[]{new ItemStack(redstoneChipset, 1, 5),
// new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire),
// new ItemStack(BuildCraftTransport.greenPipeWire), new ItemStack(BuildCraftTransport.yellowPipeWire)}, 120000, new ItemStack(
// BuildCraftTransport.pipeGate, 1, 8)));
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 8), "Quartz OR Gate");
// AssemblyRecipe.assemblyRecipes
// .add(new AssemblyRecipe(new ItemStack[]{new ItemStack(BuildCraftTransport.pipeGate, 1, 7), new ItemStack(redstoneChipset, 1, 4),
// new ItemStack(redstoneChipset, 1, 1)}, 60000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 8)));
// CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 8), "Autarchic Quartz OR Gate");
// EXPANSIONS
BuildcraftRecipes.integrationTable.addRecipe(new GateExpansionRecipe(GateExpansionPulsar.INSTANCE, Chipset.PULSATING.getStack()));
BuildcraftRecipes.integrationTable.addRecipe(new GateExpansionRecipe(GateExpansionTimer.INSTANCE, Chipset.QUARTZ.getStack()));
BuildcraftRecipes.integrationTable.addRecipe(new GateExpansionRecipe(GateExpansionRedstoneFader.INSTANCE, Chipset.COMP.getStack()));
}
private static void addGateRecipe(double energyCost, GateMaterial material, Chipset chipset, PipeWire... pipeWire) {
List temp = new ArrayList();
temp.add(chipset.getStack());
for (PipeWire wire : pipeWire) {
temp.add(wire.getStack());
}
Object[] inputs = temp.toArray();
BuildcraftRecipes.assemblyTable.addRecipe(energyCost, ItemGate.makeGateItem(material, GateLogic.AND), inputs);
BuildcraftRecipes.assemblyTable.addRecipe(energyCost, ItemGate.makeGateItem(material, GateLogic.OR), inputs);
} }
@EventHandler @EventHandler

View file

@ -19,7 +19,6 @@ import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCAction; import buildcraft.core.triggers.BCAction;
import buildcraft.core.triggers.BCTrigger; import buildcraft.core.triggers.BCTrigger;
import buildcraft.core.utils.BCLog;
import buildcraft.core.utils.EnumColor; import buildcraft.core.utils.EnumColor;
import buildcraft.transport.BlockFilteredBuffer; import buildcraft.transport.BlockFilteredBuffer;
import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.BlockGenericPipe;
@ -41,6 +40,7 @@ import buildcraft.transport.blueprints.BptItemPipeWooden;
import buildcraft.transport.gates.GateExpansionPulsar; import buildcraft.transport.gates.GateExpansionPulsar;
import buildcraft.api.gates.GateExpansions; import buildcraft.api.gates.GateExpansions;
import buildcraft.api.transport.PipeWire; import buildcraft.api.transport.PipeWire;
import buildcraft.transport.ItemPipeWire;
import buildcraft.transport.gates.GateExpansionRedstoneFader; import buildcraft.transport.gates.GateExpansionRedstoneFader;
import buildcraft.transport.gates.GateExpansionTimer; import buildcraft.transport.gates.GateExpansionTimer;
import buildcraft.transport.network.PacketHandlerTransport; import buildcraft.transport.network.PacketHandlerTransport;
@ -119,10 +119,7 @@ public class BuildCraftTransport {
public static float pipeDurability; public static float pipeDurability;
public static Item pipeWaterproof; public static Item pipeWaterproof;
public static Item pipeGate; public static Item pipeGate;
public static Item redPipeWire; public static Item pipeWire;
public static Item bluePipeWire;
public static Item greenPipeWire;
public static Item yellowPipeWire;
public static Item pipeItemsWood; public static Item pipeItemsWood;
public static Item pipeItemsEmerald; public static Item pipeItemsEmerald;
public static Item pipeItemsStone; public static Item pipeItemsStone;
@ -169,7 +166,7 @@ public class BuildCraftTransport {
public static BCAction[] actionPipeColor = new BCAction[16]; public static BCAction[] actionPipeColor = new BCAction[16];
public static BCAction[] actionPipeDirection = new BCAction[16]; public static BCAction[] actionPipeDirection = new BCAction[16];
public static BCAction[] actionPowerLimiter = new BCAction[7]; public static BCAction[] actionPowerLimiter = new BCAction[7];
public static BCAction[] actionRedstoneLevel = new BCAction[15]; public static BCAction[] actionRedstoneLevel = new BCAction[15];
public static BCAction actionExtractionPresetRed = new ActionExtractionPreset(EnumColor.RED); public static BCAction actionExtractionPresetRed = new ActionExtractionPreset(EnumColor.RED);
public static BCAction actionExtractionPresetBlue = new ActionExtractionPreset(EnumColor.BLUE); public static BCAction actionExtractionPresetBlue = new ActionExtractionPreset(EnumColor.BLUE);
public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(EnumColor.GREEN); public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(EnumColor.GREEN);
@ -315,29 +312,11 @@ public class BuildCraftTransport {
// pipeItemsStipes = createPipe(DefaultProps.PIPE_ITEMS_STRIPES_ID, PipeItemsStripes.class, "Stripes Transport Pipe", new ItemStack(Item.dyePowder, // 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)); // 1, 0), Block.glass, new ItemStack(Item.dyePowder, 1, 11));
Property redPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "redPipeWire.id", DefaultProps.RED_PIPE_WIRE); int pipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeWire.id", DefaultProps.PIPE_WIRE).getInt(DefaultProps.PIPE_WIRE);
redPipeWire = new ItemBuildCraft(redPipeWireId.getInt()).setPassSneakClick(true); pipeWire = new ItemPipeWire(pipeWireId);
redPipeWire.setUnlocalizedName("redPipeWire"); LanguageRegistry.addName(pipeWire, "Pipe Wire");
LanguageRegistry.addName(redPipeWire, "Red Pipe Wire"); CoreProxy.proxy.registerItem(pipeWire);
CoreProxy.proxy.registerItem(redPipeWire); PipeWire.item = pipeWire;
Property bluePipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "bluePipeWire.id", DefaultProps.BLUE_PIPE_WIRE);
bluePipeWire = new ItemBuildCraft(bluePipeWireId.getInt()).setPassSneakClick(true);
bluePipeWire.setUnlocalizedName("bluePipeWire");
LanguageRegistry.addName(bluePipeWire, "Blue Pipe Wire");
CoreProxy.proxy.registerItem(bluePipeWire);
Property greenPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "greenPipeWire.id", DefaultProps.GREEN_PIPE_WIRE);
greenPipeWire = new ItemBuildCraft(greenPipeWireId.getInt()).setPassSneakClick(true);
greenPipeWire.setUnlocalizedName("greenPipeWire");
LanguageRegistry.addName(greenPipeWire, "Green Pipe Wire");
CoreProxy.proxy.registerItem(greenPipeWire);
Property yellowPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "yellowPipeWire.id", DefaultProps.YELLOW_PIPE_WIRE);
yellowPipeWire = new ItemBuildCraft(yellowPipeWireId.getInt()).setPassSneakClick(true);
yellowPipeWire.setUnlocalizedName("yellowPipeWire");
LanguageRegistry.addName(yellowPipeWire, "Yellow Pipe Wire");
CoreProxy.proxy.registerItem(yellowPipeWire);
Property pipeGateId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeGate.id", DefaultProps.GATE_ID); Property pipeGateId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeGate.id", DefaultProps.GATE_ID);
pipeGate = new ItemGate(pipeGateId.getInt()); pipeGate = new ItemGate(pipeGateId.getInt());
@ -459,16 +438,7 @@ public class BuildCraftTransport {
//Facade turning helper //Facade turning helper
GameRegistry.addRecipe(facadeItem.new FacadeRecipe()); GameRegistry.addRecipe(facadeItem.new FacadeRecipe());
// Assembly table recipes, moved from PreInit phase to Init, all mods should be done adding to the OreDictionary by now BuildcraftRecipes.assemblyTable.addRecipe(1000, new ItemStack(plugItem, 8), new ItemStack(pipeStructureCobblestone));
try {
BuildcraftRecipes.assemblyTable.addRecipe(500, new ItemStack(redPipeWire, 8), "dyeRed", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron));
BuildcraftRecipes.assemblyTable.addRecipe(500, new ItemStack(bluePipeWire, 8), "dyeBlue", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron));
BuildcraftRecipes.assemblyTable.addRecipe(500, new ItemStack(greenPipeWire, 8), "dyeGreen", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron));
BuildcraftRecipes.assemblyTable.addRecipe(500, new ItemStack(yellowPipeWire, 8), "dyeYellow", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron));
BuildcraftRecipes.assemblyTable.addRecipe(1000, new ItemStack(plugItem, 8), new ItemStack(pipeStructureCobblestone));
} catch (Error error) {
BCLog.logErrorAPI("Buildcraft", error, BuildcraftRecipes.class);
}
} }
@EventHandler @EventHandler

View file

@ -8,25 +8,58 @@
*/ */
package buildcraft.api.transport; package buildcraft.api.transport;
import java.util.Locale;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
/** /**
* *
* @author CovertJaguar <http://www.railcraft.info/> * @author CovertJaguar <http://www.railcraft.info/>
*/ */
public enum PipeWire { public enum PipeWire {
Red, Blue, Green, Yellow;
RED, BLUE, GREEN, YELLOW;
public static Item item;
public static final PipeWire[] VALUES = values(); public static final PipeWire[] VALUES = values();
public PipeWire reverse() { public PipeWire reverse() {
switch (this) { switch (this) {
case Red: case RED:
return Yellow; return YELLOW;
case Blue: case BLUE:
return Green; return GREEN;
case Green: case GREEN:
return Blue; return BLUE;
default: default:
return Red; return RED;
} }
} }
public String getTag() {
return name().toLowerCase(Locale.ENGLISH) + "PipeWire";
}
public ItemStack getStack() {
return getStack(1);
}
public ItemStack getStack(int qty) {
if (item == null)
return null;
return new ItemStack(item, qty, ordinal());
}
public boolean isPipeWire(ItemStack stack) {
if (stack == null)
return false;
if (stack.getItem() != item)
return false;
return stack.getItemDamage() == ordinal();
}
public static PipeWire fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length)
return RED;
return VALUES[ordinal];
}
} }

View file

@ -40,10 +40,7 @@ public class DefaultProps {
public static int PIPE_WATERPROOF_ID = 19109; public static int PIPE_WATERPROOF_ID = 19109;
public static int BUCKET_FUEL_ID = 19110; public static int BUCKET_FUEL_ID = 19110;
public static int GATE_ID = 19111; public static int GATE_ID = 19111;
public static int RED_PIPE_WIRE = 19113; public static int PIPE_WIRE = 19113;
public static int BLUE_PIPE_WIRE = 19114;
public static int GREEN_PIPE_WIRE = 19115;
public static int YELLOW_PIPE_WIRE = 19116;
public static int REDSTONE_CHIPSET = 19117; public static int REDSTONE_CHIPSET = 19117;
public static int BLUEPRINT_ITEM_ID = 19118; public static int BLUEPRINT_ITEM_ID = 19118;

View file

@ -1,60 +0,0 @@
package buildcraft.core;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
public class ItemRedstoneChipset extends ItemBuildCraft {
@SideOnly(Side.CLIENT)
private Icon[] icons;
public ItemRedstoneChipset(int i) {
super(i);
setHasSubtypes(true);
setMaxDamage(0);
}
@SuppressWarnings({"all"})
@Override
public Icon getIconFromDamage(int i) {
return i < icons.length ? icons[i] : null;
}
@Override
public String getUnlocalizedName(ItemStack itemstack) {
return (new StringBuilder()).append(super.getUnlocalizedName()).append(".").append(itemstack.getItemDamage()).toString();
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) {
for (int i = 0; i < 6; i++) {
itemList.add(new ItemStack(this, 1, i));
}
}
private static String[] chipsetNames = {"redstone_red", "redstone_iron", "redstone_gold", "redstone_diamond", "redstone_pulsating", "redstone_quartz"};
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
icons = new Icon[chipsetNames.length];
int i = 0;
for (String csName : chipsetNames) {
icons[i++] = par1IconRegister.registerIcon("buildcraft:" + csName + "_chipset");
}
}
public void registerItemStacks() {
for (int i = 0; i < 5; i++) {
GameRegistry.registerCustomItemStack(chipsetNames[i] + "_chipset", new ItemStack(this, 1, i));
}
}
}

View file

@ -8,6 +8,7 @@ import buildcraft.core.inventory.Transactor;
import buildcraft.core.inventory.filters.ArrayStackFilter; import buildcraft.core.inventory.filters.ArrayStackFilter;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -45,10 +46,16 @@ public class AssemblyRecipeManager implements IAssemblyRecipeManager {
for (int i = 0; i < inputs.length; i++) { for (int i = 0; i < inputs.length; i++) {
if (inputs[i] instanceof String) if (inputs[i] instanceof String)
processedInput[i] = OreDictionary.getOres((String) inputs[i]); processedInput[i] = OreDictionary.getOres((String) inputs[i]);
if (inputs[i] instanceof Item) else if (inputs[i] instanceof ItemStack)
processedInput[i] = new ItemStack((Item) inputs[i]);
else
processedInput[i] = inputs[i]; processedInput[i] = inputs[i];
else if (inputs[i] instanceof Item)
processedInput[i] = new ItemStack((Item) inputs[i]);
else if (inputs[i] instanceof Block)
processedInput[i] = new ItemStack((Block) inputs[i], 1, OreDictionary.WILDCARD_VALUE);
else if (inputs[i] instanceof Integer)
processedInput[i] = inputs[i];
else
throw new IllegalArgumentException("Unknown Object passed to recipe!");
} }
} }

View file

@ -0,0 +1,86 @@
package buildcraft.silicon;
import buildcraft.BuildCraftSilicon;
import buildcraft.core.ItemBuildCraft;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Locale;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
public class ItemRedstoneChipset extends ItemBuildCraft {
public static enum Chipset {
RED,
IRON,
GOLD,
DIAMOND,
PULSATING,
QUARTZ,
COMP;
public static final Chipset[] VALUES = values();
private Icon icon;
public String getChipsetName() {
return "redstone_" + name().toLowerCase(Locale.ENGLISH) + "_chipset";
}
public ItemStack getStack() {
return getStack(1);
}
public ItemStack getStack(int qty) {
return new ItemStack(BuildCraftSilicon.redstoneChipset, qty, ordinal());
}
public static Chipset fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length)
return RED;
return VALUES[ordinal];
}
}
public ItemRedstoneChipset(int i) {
super(i);
setHasSubtypes(true);
setMaxDamage(0);
}
@Override
public Icon getIconFromDamage(int damage) {
return Chipset.fromOrdinal(damage).icon;
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return "item." + Chipset.fromOrdinal(stack.getItemDamage()).getChipsetName();
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int id, CreativeTabs tab, List itemList) {
for (Chipset chipset : Chipset.VALUES) {
itemList.add(chipset.getStack());
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
for (Chipset chipset : Chipset.VALUES) {
chipset.icon = par1IconRegister.registerIcon("buildcraft:" + chipset.getChipsetName());
}
}
public void registerItemStacks() {
for (Chipset chipset : Chipset.VALUES) {
GameRegistry.registerCustomItemStack(chipset.getChipsetName(), chipset.getStack());
}
}
}

View file

@ -37,8 +37,9 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn
private SimpleInventory invRecipeOutput = new SimpleInventory(1, "integrationOutput", 64); private SimpleInventory invRecipeOutput = new SimpleInventory(1, "integrationOutput", 64);
private InventoryMapper invOutput = new InventoryMapper(inv, SLOT_OUTPUT, 1, false); private InventoryMapper invOutput = new InventoryMapper(inv, SLOT_OUTPUT, 1, false);
private IIntegrationRecipe currentRecipe; private IIntegrationRecipe currentRecipe;
private boolean canCraft = false;
public IInventory getRecipeOutput(){
public IInventory getRecipeOutput() {
return invRecipeOutput; return invRecipeOutput;
} }
@ -52,20 +53,35 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn
tick++; tick++;
if (tick % CYCLE_LENGTH != 0) if (tick % CYCLE_LENGTH != 0)
return; return;
canCraft = false;
currentRecipe = findMatchingRecipe(); currentRecipe = findMatchingRecipe();
if (currentRecipe == null) { if (currentRecipe == null) {
setEnergy(0); setEnergy(0);
return; return;
} }
ItemStack inputA = inv.getStackInSlot(SLOT_INPUT_A); ItemStack inputA = inv.getStackInSlot(SLOT_INPUT_A);
ItemStack inputB = inv.getStackInSlot(SLOT_INPUT_B); ItemStack inputB = inv.getStackInSlot(SLOT_INPUT_B);
invRecipeOutput.setInventorySlotContents(0, currentRecipe.getOutputForInputs(inputA, inputB)); ItemStack output = currentRecipe.getOutputForInputs(inputA, inputB);
invRecipeOutput.setInventorySlotContents(0, output);
if (getEnergy() >= currentRecipe.getEnergyCost()) if (!isRoomForOutput(output)) {
tryCraftItem(); setEnergy(0);
return;
}
canCraft = true;
if (getEnergy() >= currentRecipe.getEnergyCost()) {
setEnergy(0);
inv.decrStackSize(SLOT_INPUT_A, 1);
inv.decrStackSize(SLOT_INPUT_B, 1);
ITransactor trans = Transactor.getTransactorFor(invOutput);
trans.add(output, ForgeDirection.UP, true);
}
} }
private IIntegrationRecipe findMatchingRecipe() { private IIntegrationRecipe findMatchingRecipe() {
@ -79,21 +95,6 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn
return null; return null;
} }
private void tryCraftItem() {
ItemStack inputA = inv.getStackInSlot(SLOT_INPUT_A);
ItemStack inputB = inv.getStackInSlot(SLOT_INPUT_B);
ItemStack output = currentRecipe.getOutputForInputs(inputA, inputB);
if (isRoomForOutput(output)) {
setEnergy(0);
inv.decrStackSize(SLOT_INPUT_A, 1);
inv.decrStackSize(SLOT_INPUT_B, 1);
ITransactor trans = Transactor.getTransactorFor(invOutput);
trans.add(output, ForgeDirection.UP, true);
}
}
private boolean isRoomForOutput(ItemStack output) { private boolean isRoomForOutput(ItemStack output) {
ItemStack existingOutput = inv.getStackInSlot(SLOT_OUTPUT); ItemStack existingOutput = inv.getStackInSlot(SLOT_OUTPUT);
if (existingOutput == null) if (existingOutput == null)
@ -108,18 +109,12 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn
if (currentRecipe != null) { if (currentRecipe != null) {
return currentRecipe.getEnergyCost(); return currentRecipe.getEnergyCost();
} }
return 0; return 0.0;
}
public int getProgressScaled(int i) {
if(currentRecipe == null)
return 0;
return (int) ((getEnergy() * i) / currentRecipe.getEnergyCost());
} }
@Override @Override
public boolean canCraft() { public boolean canCraft() {
return currentRecipe != null; return canCraft;
} }
@Override @Override

View file

@ -17,7 +17,6 @@ import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler; import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver; import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.power.PowerHandler.Type; import buildcraft.api.power.PowerHandler.Type;
import buildcraft.core.BlockIndex;
import buildcraft.core.EntityEnergyLaser; import buildcraft.core.EntityEnergyLaser;
import buildcraft.core.IMachine; import buildcraft.core.IMachine;
import buildcraft.core.TileBuildCraft; import buildcraft.core.TileBuildCraft;
@ -31,6 +30,7 @@ import net.minecraftforge.common.ForgeDirection;
public class TileLaser extends TileBuildCraft implements IPowerReceptor, IActionReceptor, IMachine { public class TileLaser extends TileBuildCraft implements IPowerReceptor, IActionReceptor, IMachine {
private static final float LASER_OFFSET = 2.0F / 16.0F;
private EntityEnergyLaser laser = null; private EntityEnergyLaser laser = null;
private final SafeTimeTracker laserTickTracker = new SafeTimeTracker(); private final SafeTimeTracker laserTickTracker = new SafeTimeTracker();
private final SafeTimeTracker searchTracker = new SafeTimeTracker(); private final SafeTimeTracker searchTracker = new SafeTimeTracker();
@ -133,7 +133,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
} }
protected void findTable() { protected void findTable() {
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); int meta = getBlockMetadata();
int minX = xCoord - 5; int minX = xCoord - 5;
int minY = yCoord - 5; int minY = yCoord - 5;
@ -142,7 +142,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
int maxY = yCoord + 5; int maxY = yCoord + 5;
int maxZ = zCoord + 5; int maxZ = zCoord + 5;
switch (ForgeDirection.values()[meta]) { switch (ForgeDirection.getOrientation(meta)) {
case WEST: case WEST:
maxX = xCoord; maxX = xCoord;
break; break;
@ -197,29 +197,29 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
protected void updateLaser() { protected void updateLaser() {
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); int meta = getBlockMetadata();
double px = 0, py = 0, pz = 0; double px = 0, py = 0, pz = 0;
switch (ForgeDirection.values()[meta]) { switch (ForgeDirection.getOrientation(meta)) {
case WEST: case WEST:
px = -0.3; px = -LASER_OFFSET;
break; break;
case EAST: case EAST:
px = 0.3; px = LASER_OFFSET;
break; break;
case DOWN: case DOWN:
py = -0.3; py = -LASER_OFFSET;
break; break;
case UP: case UP:
py = 0.3; py = LASER_OFFSET;
break; break;
case NORTH: case NORTH:
pz = -0.3; pz = -LASER_OFFSET;
break; break;
case SOUTH: case SOUTH:
default: default:
pz = 0.3; pz = LASER_OFFSET;
break; break;
} }

View file

@ -56,12 +56,12 @@ public abstract class TileLaserTableBase extends TileBuildCraft implements ILase
public abstract double getRequiredEnergy(); public abstract double getRequiredEnergy();
public double getCompletionRatio(float ratio) { public int getProgressScaled(int ratio) {
if (!canCraft()) if (clientRequiredEnergy == 0.0)
return 0; return 0;
if (energy >= clientRequiredEnergy) if (energy >= clientRequiredEnergy)
return ratio; return ratio;
return energy / clientRequiredEnergy * ratio; return (int) (energy / clientRequiredEnergy * ratio);
} }
public int getRecentEnergyAverage() { public int getRecentEnergyAverage() {
@ -77,7 +77,7 @@ public abstract class TileLaserTableBase extends TileBuildCraft implements ILase
@Override @Override
public void receiveLaserEnergy(float energy) { public void receiveLaserEnergy(float energy) {
energy += energy; this.energy += energy;
recentEnergy[tick] += energy; recentEnergy[tick] += energy;
} }
@ -153,31 +153,31 @@ public abstract class TileLaserTableBase extends TileBuildCraft implements ILase
energy = nbt.getDouble("energy"); energy = nbt.getDouble("energy");
} }
public void getGUINetworkData(int i, int j) { public void getGUINetworkData(int id, int data) {
int currentStored = (int) (energy * 100.0); int currentStored = (int) (energy * 100.0);
int requiredEnergy = (int) (clientRequiredEnergy * 100.0); int requiredEnergy = (int) (clientRequiredEnergy * 100.0);
switch (i) { switch (id) {
case 0: case 0:
requiredEnergy = (requiredEnergy & 0xFFFF0000) | (j & 0xFFFF); requiredEnergy = (requiredEnergy & 0xFFFF0000) | (data & 0xFFFF);
clientRequiredEnergy = (requiredEnergy / 100.0f); clientRequiredEnergy = (requiredEnergy / 100.0f);
break; break;
case 1: case 1:
currentStored = (currentStored & 0xFFFF0000) | (j & 0xFFFF); currentStored = (currentStored & 0xFFFF0000) | (data & 0xFFFF);
energy = (currentStored / 100.0f); energy = (currentStored / 100.0f);
break; break;
case 2: case 2:
requiredEnergy = (requiredEnergy & 0xFFFF) | ((j & 0xFFFF) << 16); requiredEnergy = (requiredEnergy & 0xFFFF) | ((data & 0xFFFF) << 16);
clientRequiredEnergy = (requiredEnergy / 100.0f); clientRequiredEnergy = (requiredEnergy / 100.0f);
break; break;
case 3: case 3:
currentStored = (currentStored & 0xFFFF) | ((j & 0xFFFF) << 16); currentStored = (currentStored & 0xFFFF) | ((data & 0xFFFF) << 16);
energy = (currentStored / 100.0f); energy = (currentStored / 100.0f);
break; break;
case 4: case 4:
recentEnergyAverage = recentEnergyAverage & 0xFFFF0000 | (j & 0xFFFF); recentEnergyAverage = recentEnergyAverage & 0xFFFF0000 | (data & 0xFFFF);
break; break;
case 5: case 5:
recentEnergyAverage = (recentEnergyAverage & 0xFFFF) | ((j & 0xFFFF) << 16); recentEnergyAverage = (recentEnergyAverage & 0xFFFF) | ((data & 0xFFFF) << 16);
break; break;
} }
} }

View file

@ -159,7 +159,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
} }
} }
int h = (int) table.getCompletionRatio(70); int h = table.getProgressScaled(70);
drawTexturedModalRect(cornerX + 95, cornerY + 36 + 70 - h, 176, 18, 4, h); drawTexturedModalRect(cornerX + 95, cornerY + 36 + 70 - h, 176, 18, 4, h);

View file

@ -9,7 +9,10 @@ import org.lwjgl.opengl.GL11;
public class GuiIntegrationTable extends GuiLaserTable { public class GuiIntegrationTable extends GuiLaserTable {
public static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/integration_table.png"); public static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/integration_table.png");
private static final int FLASH_DELAY = 3;
private final TileIntegrationTable integrationTable; private final TileIntegrationTable integrationTable;
private boolean flash;
private int flashDelay;
public GuiIntegrationTable(InventoryPlayer playerInventory, TileIntegrationTable table) { public GuiIntegrationTable(InventoryPlayer playerInventory, TileIntegrationTable table) {
super(playerInventory, new ContainerIntegrationTable(playerInventory, table), table, TEXTURE); super(playerInventory, new ContainerIntegrationTable(playerInventory, table), table, TEXTURE);
@ -18,6 +21,18 @@ public class GuiIntegrationTable extends GuiLaserTable {
ySize = 166; ySize = 166;
} }
@Override
public void updateScreen() {
super.updateScreen();
if (flashDelay <= 0) {
flashDelay = FLASH_DELAY;
flash = !flash;
} else {
flashDelay--;
}
}
@Override @Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
@ -26,8 +41,10 @@ public class GuiIntegrationTable extends GuiLaserTable {
int cornerX = (width - xSize) / 2; int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2; int cornerY = (height - ySize) / 2;
if (integrationTable.getEnergy() > 0) { if (integrationTable.getEnergy() > 0) {
int progress = integrationTable.getProgressScaled(24); if (flash)
drawTexturedModalRect(cornerX + 93, cornerY + 32, 176, 0, progress + 1, 18); drawTexturedModalRect(cornerX + 13, cornerY + 40, 0, 166, 98, 24);
int progress = integrationTable.getProgressScaled(98);
drawTexturedModalRect(cornerX + 13, cornerY + 40, 0, flash ? 190 : 214, progress, 24);
} }
} }
} }

View file

@ -0,0 +1,75 @@
/*
* Copyright (c) SpaceToad, 2011-2012
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.silicon.recipes;
import buildcraft.api.gates.IGateExpansion;
import buildcraft.api.recipes.IIntegrationRecipeManager.IIntegrationRecipe;
import buildcraft.core.inventory.StackHelper;
import buildcraft.transport.gates.ItemGate;
import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class GateExpansionRecipe implements IIntegrationRecipe {
private final IGateExpansion expansion;
private final ItemStack chipset;
private final ItemStack[] exampleA;
private final ItemStack[] exampleB;
public GateExpansionRecipe(IGateExpansion expansion, ItemStack chipset) {
this.expansion = expansion;
this.chipset = chipset.copy();
exampleA = ItemGate.getGateVarients();
exampleB = new ItemStack[]{chipset};
}
@Override
public double getEnergyCost() {
return 10000;
}
@Override
public boolean isValidInputA(ItemStack inputA) {
if (inputA == null)
return false;
if (!(inputA.getItem() instanceof ItemGate))
return false;
return !ItemGate.hasGateExpansion(inputA, expansion);
}
@Override
public boolean isValidInputB(ItemStack inputB) {
return StackHelper.instance().isMatchingItem(inputB, chipset);
}
@Override
public ItemStack getOutputForInputs(ItemStack inputA, ItemStack inputB) {
if (!isValidInputA(inputA))
return null;
if (!isValidInputB(inputB))
return null;
ItemStack output = inputA.copy();
output.stackSize = 1;
ItemGate.addGateExpansion(output, expansion);
return output;
}
@Override
public ItemStack[] getExampleInputsA() {
return exampleA;
}
@Override
public ItemStack[] getExampleInputsB() {
return exampleB;
}
}

View file

@ -0,0 +1,84 @@
/*
* Copyright (c) SpaceToad, 2011-2012
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.silicon.recipes;
import buildcraft.api.recipes.IIntegrationRecipeManager.IIntegrationRecipe;
import buildcraft.silicon.ItemRedstoneChipset;
import buildcraft.core.inventory.StackHelper;
import buildcraft.transport.gates.GateDefinition.GateLogic;
import buildcraft.transport.gates.GateDefinition.GateMaterial;
import buildcraft.transport.gates.ItemGate;
import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class GateLogicSwapRecipe implements IIntegrationRecipe {
private final GateMaterial material;
private final GateLogic logicIn, logicOut;
private final ItemStack chipset;
private final ItemStack[] exampleA;
private final ItemStack[] exampleB;
public GateLogicSwapRecipe(GateMaterial material, GateLogic logicIn, GateLogic logicOut) {
this.material = material;
this.logicIn = logicIn;
this.logicOut = logicOut;
this.chipset = ItemRedstoneChipset.Chipset.RED.getStack();
exampleA = new ItemStack[]{ItemGate.makeGateItem(material, logicIn)};
exampleB = new ItemStack[]{chipset};
}
@Override
public double getEnergyCost() {
return 2000;
}
@Override
public boolean isValidInputA(ItemStack inputA) {
if (inputA == null)
return false;
if (!(inputA.getItem() instanceof ItemGate))
return false;
if (ItemGate.getMaterial(inputA) != material)
return false;
if (ItemGate.getLogic(inputA) != logicIn)
return false;
return true;
}
@Override
public boolean isValidInputB(ItemStack inputB) {
return StackHelper.instance().isMatchingItem(inputB, chipset);
}
@Override
public ItemStack getOutputForInputs(ItemStack inputA, ItemStack inputB) {
if (!isValidInputA(inputA))
return null;
if (!isValidInputB(inputB))
return null;
ItemStack output = inputA.copy();
output.stackSize = 1;
ItemGate.setLogic(output, logicOut);
return output;
}
@Override
public ItemStack[] getExampleInputsA() {
return exampleA;
}
@Override
public ItemStack[] getExampleInputsB() {
return exampleB;
}
}

View file

@ -661,20 +661,20 @@ public class BlockGenericPipe extends BlockBuildCraft {
// Only check the instance at this point. Call the IToolWrench // Only check the instance at this point. Call the IToolWrench
// interface callbacks for the individual pipe/logic calls // interface callbacks for the individual pipe/logic calls
return pipe.blockActivated(player); return pipe.blockActivated(player);
else if (currentItem.getItem() == BuildCraftTransport.redPipeWire) { else if (PipeWire.RED.isPipeWire(currentItem)) {
if (addOrStripWire(player, pipe, PipeWire.Red)) { if (addOrStripWire(player, pipe, PipeWire.RED)) {
return true; return true;
} }
} else if (currentItem.getItem() == BuildCraftTransport.bluePipeWire) { } else if (PipeWire.BLUE.isPipeWire(currentItem)) {
if (addOrStripWire(player, pipe, PipeWire.Blue)) { if (addOrStripWire(player, pipe, PipeWire.BLUE)) {
return true; return true;
} }
} else if (currentItem.getItem() == BuildCraftTransport.greenPipeWire) { } else if (PipeWire.GREEN.isPipeWire(currentItem)) {
if (addOrStripWire(player, pipe, PipeWire.Green)) { if (addOrStripWire(player, pipe, PipeWire.GREEN)) {
return true; return true;
} }
} else if (currentItem.getItem() == BuildCraftTransport.yellowPipeWire) { } else if (PipeWire.YELLOW.isPipeWire(currentItem)) {
if (addOrStripWire(player, pipe, PipeWire.Yellow)) { if (addOrStripWire(player, pipe, PipeWire.YELLOW)) {
return true; return true;
} }
} else if (currentItem.getItem() instanceof ItemGate) { } else if (currentItem.getItem() instanceof ItemGate) {
@ -858,26 +858,10 @@ public class BlockGenericPipe extends BlockBuildCraft {
/** /**
* Drops a pipe wire item of the passed color. * Drops a pipe wire item of the passed color.
* *
* @param color * @param pipeWire
*/ */
private void dropWire(PipeWire color, Pipe pipe) { private void dropWire(PipeWire pipeWire, Pipe pipe) {
pipe.dropItem(pipeWire.getStack());
Item wireItem;
switch (color) {
case Red:
wireItem = BuildCraftTransport.redPipeWire;
break;
case Blue:
wireItem = BuildCraftTransport.bluePipeWire;
break;
case Green:
wireItem = BuildCraftTransport.greenPipeWire;
break;
default:
wireItem = BuildCraftTransport.yellowPipeWire;
}
pipe.dropItem(new ItemStack(wireItem));
} }
@SuppressWarnings({"all"}) @SuppressWarnings({"all"})

View file

@ -0,0 +1,60 @@
package buildcraft.transport;
import buildcraft.api.transport.PipeWire;
import buildcraft.core.ItemBuildCraft;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
public class ItemPipeWire extends ItemBuildCraft {
private Icon[] icons;
public ItemPipeWire(int i) {
super(i);
setHasSubtypes(true);
setMaxDamage(0);
setPassSneakClick(true);
setUnlocalizedName("pipeWire");
}
@Override
public Icon getIconFromDamage(int damage) {
return icons[damage];
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return "item." + PipeWire.fromOrdinal(stack.getItemDamage()).getTag();
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int id, CreativeTabs tab, List itemList) {
for (PipeWire pipeWire : PipeWire.VALUES) {
itemList.add(pipeWire.getStack());
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
icons = new Icon[PipeWire.VALUES.length];
for (PipeWire pipeWire : PipeWire.VALUES) {
icons[pipeWire.ordinal()] = par1IconRegister.registerIcon("buildcraft:" + pipeWire.getTag());
}
}
public void registerItemStacks() {
for (PipeWire pipeWire : PipeWire.VALUES) {
GameRegistry.registerCustomItemStack(pipeWire.getTag(), pipeWire.getStack());
}
}
}

View file

@ -36,6 +36,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
public abstract class Pipe<T extends PipeTransport> implements IDropControlInventory { public abstract class Pipe<T extends PipeTransport> implements IDropControlInventory {
public int[] signalStrength = new int[]{0, 0, 0, 0}; public int[] signalStrength = new int[]{0, 0, 0, 0};
public TileGenericPipe container; public TileGenericPipe container;
public final T transport; public final T transport;
@ -423,20 +424,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
} }
public void onBlockRemoval() { public void onBlockRemoval() {
if (wireSet[PipeWire.Red.ordinal()]) { for (PipeWire pipeWire : PipeWire.VALUES) {
dropItem(new ItemStack(BuildCraftTransport.redPipeWire)); if (wireSet[pipeWire.ordinal()])
} dropItem(pipeWire.getStack());
if (wireSet[PipeWire.Blue.ordinal()]) {
dropItem(new ItemStack(BuildCraftTransport.bluePipeWire));
}
if (wireSet[PipeWire.Green.ordinal()]) {
dropItem(new ItemStack(BuildCraftTransport.greenPipeWire));
}
if (wireSet[PipeWire.Yellow.ordinal()]) {
dropItem(new ItemStack(BuildCraftTransport.yellowPipeWire));
} }
if (hasGate()) { if (hasGate()) {

View file

@ -250,16 +250,16 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
boolean lit = pipe.signalStrength[color.ordinal()] > 0; boolean lit = pipe.signalStrength[color.ordinal()] > 0;
switch (color) { switch (color) {
case Red: case RED:
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Red_Lit : WireIconProvider.Texture_Red_Dark); renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Red_Lit : WireIconProvider.Texture_Red_Dark);
break; break;
case Blue: case BLUE:
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Blue_Lit : WireIconProvider.Texture_Blue_Dark); renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Blue_Lit : WireIconProvider.Texture_Blue_Dark);
break; break;
case Green: case GREEN:
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Green_Lit : WireIconProvider.Texture_Green_Dark); renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Green_Lit : WireIconProvider.Texture_Green_Dark);
break; break;
case Yellow: case YELLOW:
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Yellow_Lit : WireIconProvider.Texture_Yellow_Dark); renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Yellow_Lit : WireIconProvider.Texture_Yellow_Dark);
break; break;
default: default:

View file

@ -10,20 +10,16 @@
package buildcraft.transport.blueprints; package buildcraft.transport.blueprints;
import buildcraft.BuildCraftCore; import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftTransport;
import buildcraft.api.blueprints.BlockSignature; import buildcraft.api.blueprints.BlockSignature;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
import buildcraft.api.blueprints.BptSlotInfo; import buildcraft.api.blueprints.BptSlotInfo;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBptContext;
import buildcraft.api.gates.ActionManager;
import buildcraft.api.gates.TriggerParameter;
import buildcraft.core.Version; import buildcraft.core.Version;
import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.BlockGenericPipe;
import buildcraft.transport.Pipe; import buildcraft.transport.Pipe;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@Deprecated @Deprecated
public class BptBlockPipe extends BptBlock { public class BptBlockPipe extends BptBlock {
@ -38,21 +34,21 @@ public class BptBlockPipe extends BptBlock {
requirements.add(new ItemStack(pipeId, 1, 0)); requirements.add(new ItemStack(pipeId, 1, 0));
if (slot.cpt.hasKey("wire0")) { // if (slot.cpt.hasKey("wire0")) {
requirements.add(new ItemStack(BuildCraftTransport.redPipeWire)); // requirements.add(new ItemStack(BuildCraftTransport.pipeWire));
} // }
//
if (slot.cpt.hasKey("wire1")) { // if (slot.cpt.hasKey("wire1")) {
requirements.add(new ItemStack(BuildCraftTransport.bluePipeWire)); // requirements.add(new ItemStack(BuildCraftTransport.bluePipeWire));
} // }
//
if (slot.cpt.hasKey("wire2")) { // if (slot.cpt.hasKey("wire2")) {
requirements.add(new ItemStack(BuildCraftTransport.greenPipeWire)); // requirements.add(new ItemStack(BuildCraftTransport.greenPipeWire));
} // }
//
if (slot.cpt.hasKey("wire3")) { // if (slot.cpt.hasKey("wire3")) {
requirements.add(new ItemStack(BuildCraftTransport.yellowPipeWire)); // requirements.add(new ItemStack(BuildCraftTransport.yellowPipeWire));
} // }
// if (slot.cpt.hasKey("gate")) { // if (slot.cpt.hasKey("gate")) {
// int gateId = slot.cpt.getInteger("gate"); // int gateId = slot.cpt.getInteger("gate");

View file

@ -4,16 +4,18 @@ import buildcraft.api.gates.GateExpansions;
import buildcraft.api.gates.IGateExpansion; import buildcraft.api.gates.IGateExpansion;
import buildcraft.BuildCraftTransport; import buildcraft.BuildCraftTransport;
import buildcraft.api.gates.ActionManager; import buildcraft.api.gates.ActionManager;
import buildcraft.api.gates.GateExpansionController;
import buildcraft.api.gates.IAction; import buildcraft.api.gates.IAction;
import buildcraft.api.gates.ITrigger; import buildcraft.api.gates.ITrigger;
import buildcraft.core.ItemBuildCraft; import buildcraft.core.ItemBuildCraft;
import buildcraft.core.inventory.InvUtils; import buildcraft.core.inventory.InvUtils;
import buildcraft.core.utils.Localization;
import buildcraft.transport.Gate; import buildcraft.transport.Gate;
import buildcraft.transport.gates.GateDefinition.GateLogic; import buildcraft.transport.gates.GateDefinition.GateLogic;
import buildcraft.transport.gates.GateDefinition.GateMaterial; import buildcraft.transport.gates.GateDefinition.GateMaterial;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -28,6 +30,10 @@ import net.minecraft.util.Icon;
public class ItemGate extends ItemBuildCraft { public class ItemGate extends ItemBuildCraft {
private static final String NBT_TAG_MAT = "mat";
private static final String NBT_TAG_LOGIC = "logic";
private static final String NBT_TAG_EX = "ex";
public ItemGate(int id) { public ItemGate(int id) {
super(id); super(id);
setHasSubtypes(false); setHasSubtypes(false);
@ -41,27 +47,37 @@ public class ItemGate extends ItemBuildCraft {
return InvUtils.getItemData(stack); return InvUtils.getItemData(stack);
} }
public static void setMaterial(ItemStack stack, GateMaterial material) {
NBTTagCompound nbt = InvUtils.getItemData(stack);
nbt.setByte(NBT_TAG_MAT, (byte) material.ordinal());
}
public static GateMaterial getMaterial(ItemStack stack) { public static GateMaterial getMaterial(ItemStack stack) {
NBTTagCompound nbt = getNBT(stack); NBTTagCompound nbt = getNBT(stack);
if (nbt == null) if (nbt == null)
return GateMaterial.REDSTONE; return GateMaterial.REDSTONE;
return GateMaterial.fromOrdinal(nbt.getByte("mat")); return GateMaterial.fromOrdinal(nbt.getByte(NBT_TAG_MAT));
} }
public static GateLogic getLogic(ItemStack stack) { public static GateLogic getLogic(ItemStack stack) {
NBTTagCompound nbt = getNBT(stack); NBTTagCompound nbt = getNBT(stack);
if (nbt == null) if (nbt == null)
return GateLogic.AND; return GateLogic.AND;
return GateLogic.fromOrdinal(nbt.getByte("logic")); return GateLogic.fromOrdinal(nbt.getByte(NBT_TAG_LOGIC));
}
public static void setLogic(ItemStack stack, GateLogic logic) {
NBTTagCompound nbt = InvUtils.getItemData(stack);
nbt.setByte(NBT_TAG_LOGIC, (byte) logic.ordinal());
} }
public static void addGateExpansion(ItemStack stack, IGateExpansion expansion) { public static void addGateExpansion(ItemStack stack, IGateExpansion expansion) {
NBTTagCompound nbt = getNBT(stack); NBTTagCompound nbt = getNBT(stack);
if (nbt == null) if (nbt == null)
return; return;
NBTTagList expansionList = nbt.getTagList("ex"); NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX);
expansionList.appendTag(new NBTTagString("ex", expansion.getUniqueIdentifier())); expansionList.appendTag(new NBTTagString("", expansion.getUniqueIdentifier()));
nbt.setTag("ex", expansionList); nbt.setTag(NBT_TAG_EX, expansionList);
} }
public static boolean hasGateExpansion(ItemStack stack, IGateExpansion expansion) { public static boolean hasGateExpansion(ItemStack stack, IGateExpansion expansion) {
@ -69,7 +85,7 @@ public class ItemGate extends ItemBuildCraft {
if (nbt == null) if (nbt == null)
return false; return false;
try { try {
NBTTagList expansionList = nbt.getTagList("ex"); NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX);
for (int i = 0; i < expansionList.tagCount(); i++) { for (int i = 0; i < expansionList.tagCount(); i++) {
NBTTagString ex = (NBTTagString) expansionList.tagAt(i); NBTTagString ex = (NBTTagString) expansionList.tagAt(i);
if (ex.data.equals(expansion.getUniqueIdentifier())) if (ex.data.equals(expansion.getUniqueIdentifier()))
@ -86,7 +102,7 @@ public class ItemGate extends ItemBuildCraft {
if (nbt == null) if (nbt == null)
return expansions; return expansions;
try { try {
NBTTagList expansionList = nbt.getTagList("ex"); NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX);
for (int i = 0; i < expansionList.tagCount(); i++) { for (int i = 0; i < expansionList.tagCount(); i++) {
NBTTagString exTag = (NBTTagString) expansionList.tagAt(i); NBTTagString exTag = (NBTTagString) expansionList.tagAt(i);
IGateExpansion ex = GateExpansions.getExpansion(exTag.data); IGateExpansion ex = GateExpansions.getExpansion(exTag.data);
@ -101,16 +117,16 @@ public class ItemGate extends ItemBuildCraft {
public static ItemStack makeGateItem(GateMaterial material, GateLogic logic) { public static ItemStack makeGateItem(GateMaterial material, GateLogic logic) {
ItemStack stack = new ItemStack(BuildCraftTransport.pipeGate); ItemStack stack = new ItemStack(BuildCraftTransport.pipeGate);
NBTTagCompound nbt = InvUtils.getItemData(stack); NBTTagCompound nbt = InvUtils.getItemData(stack);
nbt.setByte("mat", (byte) material.ordinal()); nbt.setByte(NBT_TAG_MAT, (byte) material.ordinal());
nbt.setByte("logic", (byte) logic.ordinal()); nbt.setByte(NBT_TAG_LOGIC, (byte) logic.ordinal());
return stack; return stack;
} }
public static ItemStack makeGateItem(Gate gate) { public static ItemStack makeGateItem(Gate gate) {
ItemStack stack = new ItemStack(BuildCraftTransport.pipeGate); ItemStack stack = new ItemStack(BuildCraftTransport.pipeGate);
NBTTagCompound nbt = InvUtils.getItemData(stack); NBTTagCompound nbt = InvUtils.getItemData(stack);
nbt.setByte("mat", (byte) gate.material.ordinal()); nbt.setByte(NBT_TAG_MAT, (byte) gate.material.ordinal());
nbt.setByte("logic", (byte) gate.logic.ordinal()); nbt.setByte(NBT_TAG_LOGIC, (byte) gate.logic.ordinal());
for (IGateExpansion expansion : gate.expansions.keySet()) { for (IGateExpansion expansion : gate.expansions.keySet()) {
addGateExpansion(stack, expansion); addGateExpansion(stack, expansion);
} }
@ -139,11 +155,29 @@ public class ItemGate extends ItemBuildCraft {
} }
} }
public static ItemStack[] getGateVarients() {
ArrayList<ItemStack> gates = new ArrayList<ItemStack>();
for (GateMaterial material : GateMaterial.VALUES) {
for (GateLogic logic : GateLogic.VALUES) {
if (material == GateMaterial.REDSTONE && logic == GateLogic.OR)
continue;
gates.add(makeGateItem(material, logic));
}
}
return gates.toArray(new ItemStack[gates.size()]);
}
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) {
super.addInformation(stack, player, list, adv); super.addInformation(stack, player, list, adv);
for (IGateExpansion expansion : getInstalledExpansions(stack)) { list.add("§9§o" + Localization.get("tip.gate.wires"));
list.add(expansion.getDisplayName()); list.add(Localization.get("tip.gate.wires." + getMaterial(stack).getTag()));
Set<IGateExpansion> expansions = getInstalledExpansions(stack);
if (!expansions.isEmpty()) {
list.add("§9§o" + Localization.get("tip.gate.expansions"));
for (IGateExpansion expansion : expansions) {
list.add(expansion.getDisplayName());
}
} }
} }

View file

@ -276,20 +276,20 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
private void renderGatesWires(TileGenericPipe pipe, double x, double y, double z) { private void renderGatesWires(TileGenericPipe pipe, double x, double y, double z) {
PipeRenderState state = pipe.renderState; PipeRenderState state = pipe.renderState;
if (state.wireMatrix.hasWire(PipeWire.Red)) { if (state.wireMatrix.hasWire(PipeWire.RED)) {
pipeWireRender(pipe, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MIN_POS, PipeWire.Red, x, y, z); pipeWireRender(pipe, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MIN_POS, PipeWire.RED, x, y, z);
} }
if (state.wireMatrix.hasWire(PipeWire.Blue)) { if (state.wireMatrix.hasWire(PipeWire.BLUE)) {
pipeWireRender(pipe, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MAX_POS, PipeWire.Blue, x, y, z); pipeWireRender(pipe, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MAX_POS, PipeWire.BLUE, x, y, z);
} }
if (state.wireMatrix.hasWire(PipeWire.Green)) { if (state.wireMatrix.hasWire(PipeWire.GREEN)) {
pipeWireRender(pipe, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MIN_POS, PipeWire.Green, x, y, z); pipeWireRender(pipe, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MIN_POS, PipeWire.GREEN, x, y, z);
} }
if (state.wireMatrix.hasWire(PipeWire.Yellow)) { if (state.wireMatrix.hasWire(PipeWire.YELLOW)) {
pipeWireRender(pipe, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MAX_POS, PipeWire.Yellow, x, y, z); pipeWireRender(pipe, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MAX_POS, PipeWire.YELLOW, x, y, z);
} }
if (pipe.pipe.gate != null) { if (pipe.pipe.gate != null) {

View file

@ -31,13 +31,13 @@ public class ActionSignalOutput extends BCAction {
@Override @Override
public int getIconIndex() { public int getIconIndex() {
switch (color) { switch (color) {
case Red: case RED:
return ActionTriggerIconProvider.Trigger_PipeSignal_Red_Active; return ActionTriggerIconProvider.Trigger_PipeSignal_Red_Active;
case Blue: case BLUE:
return ActionTriggerIconProvider.Trigger_PipeSignal_Blue_Active; return ActionTriggerIconProvider.Trigger_PipeSignal_Blue_Active;
case Green: case GREEN:
return ActionTriggerIconProvider.Trigger_PipeSignal_Green_Active; return ActionTriggerIconProvider.Trigger_PipeSignal_Green_Active;
case Yellow: case YELLOW:
default: default:
return ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Active; return ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Active;
} }

View file

@ -51,24 +51,24 @@ public class TriggerPipeSignal extends BCTrigger implements IPipeTrigger {
public int getIconIndex() { public int getIconIndex() {
if (active) { if (active) {
switch (color) { switch (color) {
case Red: case RED:
return ActionTriggerIconProvider.Trigger_PipeSignal_Red_Active; return ActionTriggerIconProvider.Trigger_PipeSignal_Red_Active;
case Blue: case BLUE:
return ActionTriggerIconProvider.Trigger_PipeSignal_Blue_Active; return ActionTriggerIconProvider.Trigger_PipeSignal_Blue_Active;
case Green: case GREEN:
return ActionTriggerIconProvider.Trigger_PipeSignal_Green_Active; return ActionTriggerIconProvider.Trigger_PipeSignal_Green_Active;
case Yellow: case YELLOW:
return ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Active; return ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Active;
} }
} else { } else {
switch (color) { switch (color) {
case Red: case RED:
return ActionTriggerIconProvider.Trigger_PipeSignal_Red_Inactive; return ActionTriggerIconProvider.Trigger_PipeSignal_Red_Inactive;
case Blue: case BLUE:
return ActionTriggerIconProvider.Trigger_PipeSignal_Blue_Inactive; return ActionTriggerIconProvider.Trigger_PipeSignal_Blue_Inactive;
case Green: case GREEN:
return ActionTriggerIconProvider.Trigger_PipeSignal_Green_Inactive; return ActionTriggerIconProvider.Trigger_PipeSignal_Green_Inactive;
case Yellow: case YELLOW:
return ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Inactive; return ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Inactive;
} }
} }

Binary file not shown.