Merge branch 'marmot' into builder

Conflicts:
	common/buildcraft/BuildCraftCore.java
This commit is contained in:
CovertJaguar 2014-01-03 01:21:50 -08:00
commit bb527bb48c
121 changed files with 2123 additions and 1678 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

View file

@ -30,8 +30,16 @@ fillerpattern.box=Box
fluid.oil=Oil
fluid.fuel=Fuel
gate.action.extraction=%s Extraction Preset
gate.action.pipe.item.color=Paint Items %s
gate.action.machine.on=On
gate.action.machine.off=Off
gate.action.machine.loop=Loop
gate.action.pulsar.constant=Energy Pulsar
gate.action.pulsar.single=Single Energy Pulse
gate.action.pipe.wire=%s Pipe Signal
gate.expansion.fader=Redstone Fader
gate.expansion.pulsar=Autarchic Pulsar
gate.expansion.timer=Clock Timer
@ -43,18 +51,35 @@ gate.material.gold=Gold
gate.material.diamond=Diamond
gate.name=%s %s Gate
gate.name.basic=Gate
gate.name.basic=Basic Gate
gate.trigger.engine.blue=Engine Blue
gate.trigger.engine.green=Engine Green
gate.trigger.engine.yellow=Engine Yellow
gate.trigger.engine.red=Engine Red
gate.trigger.fluid.emtpy=Tank Empty
gate.trigger.fluid.contains=Fluid in Tank
gate.trigger.fluid.space=Space for Fluid
gate.trigger.fluid.full=Tank Full
gate.trigger.inventory.empty=Inventory Empty
gate.trigger.inventory.contains=Items in Inventory
gate.trigger.inventory.space=Space in Inventory
gate.trigger.inventory.full=Inventory Full
gate.trigger.inventorylevel.below=Contains < %d%%
gate.trigger.machine.done=Work Done
gate.trigger.machine.scheduled=Has Work
gate.trigger.redstone.input.active=Redstone Signal On
gate.trigger.redstone.input.inactive=Redstone Signal Off
gate.trigger.redstone.input.level=Redstone Level %d
gate.trigger.pipe.empty=Pipe Empty
gate.trigger.pipe.containsItems=Items Traversing
gate.trigger.pipe.containsFluids=Fluid Traversing
gate.trigger.pipe.containsEnergy=Power Traversing
gate.trigger.pipe.requestsEnergy=Power Requested
gate.trigger.pipe.tooMuchEnergy=Power Overloaded
gate.trigger.engine.blue=Engine Blue
gate.trigger.engine.green=Engine Green
gate.trigger.engine.yellow=Engine Yellow
gate.trigger.engine.red=Engine Red
gate.trigger.pipe.wire.active=%s Pipe Signal On
gate.trigger.pipe.wire.inactive=%s Pipe Signal Off
gate.trigger.timer=%s Sec Timer
gui.building.resources=Building Resources
gui.del=Del
@ -92,12 +117,13 @@ item.redPipeWire=Red Pipe Wire
item.bluePipeWire=Blue Pipe Wire
item.greenPipeWire=Green Pipe Wire
item.yellowPipeWire=Yellow Pipe Wire
item.redstoneChipset.0=Redstone Chipset
item.redstoneChipset.1=Redstone Iron Chipset
item.redstoneChipset.2=Redstone Golden Chipset
item.redstoneChipset.3=Redstone Diamond Chipset
item.redstoneChipset.4=Pulsating Chipset
item.redstoneChipset.5=Redstone Quartz Chipset
item.redstone_red_chipset=Redstone Chipset
item.redstone_iron_chipset=Iron Chipset
item.redstone_gold_chipset=Golden Chipset
item.redstone_diamond_chipset=Diamond Chipset
item.redstone_pulsating_chipset=Pulsating Chipset
item.redstone_quartz_chipset=Quartz Chipset
item.redstone_comp_chipset=Redstone Comp Chipset
item.blueprintItem=Blueprint
item.PipeItemsWood=Wooden Transport Pipe
item.PipeItemsCobblestone=Cobblestone Transport Pipe
@ -136,33 +162,41 @@ item.PipePlug=Pipe Plug
tab.machines=Buildcraft Machines
tab.facades=Buildcraft Facades
tile.miningWellBlock=Mining Well
tile.plainPipeBlock=Mining Pipe
tile.autoWorkbenchBlock=Auto Workbench
tile.machineBlock=Quarry
tile.markerBlock=Land Mark
tile.fillerBlock=Filler
tile.builderBlock=Builder
tile.architectBlock=Architect Table
tile.frameBlock=Frame
tile.tankBlock=Tank
tile.refineryBlock=Refinery
tile.libraryBlock=Blueprint Library
tile.laserBlock=Laser
tile.assemblyTableBlock=Assembly Table
tile.assemblyWorkbenchBlock=Advanced Crafting Table
tile.pathMarkerBlock=Path Marker
tile.blockHopper=Chute
tile.pumpBlock=Pump
tile.floodGateBlock=Flood Gate
tile.engineWood=Redstone Engine
tile.engineStone=Stirling Engine
tile.engineIron=Combustion Engine
tile.blockOil=Oil
tile.autoWorkbenchBlock=Auto Workbench
tile.blockFuel=Fuel
tile.spring.water=Water Spring
tile.spring.oil=Oil Spring
tile.blockHopper=Chute
tile.blockOil=Oil
tile.builderBlock=Builder
tile.engineIron=Combustion Engine
tile.engineStone=Stirling Engine
tile.engineWood=Redstone Engine
tile.fillerBlock=Filler
tile.filteredBufferBlock=Filtered Buffer
tile.floodGateBlock=Flood Gate
tile.frameBlock=Frame
tile.integrationTableBlock=Integration Table
tile.laserBlock=Laser
tile.libraryBlock=Blueprint Library
tile.machineBlock=Quarry
tile.markerBlock=Land Mark
tile.miningWellBlock=Mining Well
tile.pathMarkerBlock=Path Marker
tile.plainPipeBlock=Mining Pipe
tile.pumpBlock=Pump
tile.refineryBlock=Refinery
tile.spring.oil=Oil Spring
tile.spring.water=Water Spring
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.PipeFluidsEmerald=Extraction pipe, 40 mB/t

View file

@ -29,7 +29,6 @@ import buildcraft.api.core.IIconProvider;
import buildcraft.api.gates.ActionManager;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.builders.blueprints.BlueprintDatabase;
import buildcraft.core.BlockIndex;
import buildcraft.core.BlockSpring;
import buildcraft.core.BuildCraftConfiguration;
@ -66,8 +65,9 @@ import buildcraft.core.triggers.TriggerMachine;
import buildcraft.core.utils.BCLog;
import buildcraft.core.utils.Localization;
import buildcraft.core.recipes.AssemblyRecipeManager;
import buildcraft.core.recipes.IntegrationRecipeManager;
import buildcraft.core.recipes.RefineryRecipeManager;
import buildcraft.transport.triggers.TriggerRedstoneInput;
import buildcraft.core.triggers.TriggerRedstoneInput;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@ -125,26 +125,25 @@ public class BuildCraftCore {
public static int legacyPipeModel;
public static int markerModel;
public static int oilModel;
public static BCTrigger triggerMachineActive = new TriggerMachine(DefaultProps.TRIGGER_MACHINE_ACTIVE, true);
public static BCTrigger triggerMachineInactive = new TriggerMachine(DefaultProps.TRIGGER_MACHINE_INACTIVE, false);
public static BCTrigger triggerEmptyInventory = new TriggerInventory(DefaultProps.TRIGGER_EMPTY_INVENTORY, TriggerInventory.State.Empty);
public static BCTrigger triggerContainsInventory = new TriggerInventory(DefaultProps.TRIGGER_CONTAINS_INVENTORY, TriggerInventory.State.Contains);
public static BCTrigger triggerSpaceInventory = new TriggerInventory(DefaultProps.TRIGGER_SPACE_INVENTORY, TriggerInventory.State.Space);
public static BCTrigger triggerFullInventory = new TriggerInventory(DefaultProps.TRIGGER_FULL_INVENTORY, TriggerInventory.State.Full);
public static BCTrigger triggerEmptyFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_EMPTY_LIQUID, TriggerFluidContainer.State.Empty);
public static BCTrigger triggerContainsFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_CONTAINS_LIQUID, TriggerFluidContainer.State.Contains);
public static BCTrigger triggerSpaceFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_SPACE_LIQUID, TriggerFluidContainer.State.Space);
public static BCTrigger triggerFullFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_FULL_LIQUID, TriggerFluidContainer.State.Full);
public static BCTrigger triggerRedstoneActive = new TriggerRedstoneInput(DefaultProps.TRIGGER_REDSTONE_ACTIVE, true);
public static BCTrigger triggerRedstoneInactive = new TriggerRedstoneInput(DefaultProps.TRIGGER_REDSTONE_INACTIVE, false);
public static BCTrigger triggerMachineActive = new TriggerMachine(true);
public static BCTrigger triggerMachineInactive = new TriggerMachine(false);
public static BCTrigger triggerEmptyInventory = new TriggerInventory(TriggerInventory.State.Empty);
public static BCTrigger triggerContainsInventory = new TriggerInventory(TriggerInventory.State.Contains);
public static BCTrigger triggerSpaceInventory = new TriggerInventory(TriggerInventory.State.Space);
public static BCTrigger triggerFullInventory = new TriggerInventory(TriggerInventory.State.Full);
public static BCTrigger triggerEmptyFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Empty);
public static BCTrigger triggerContainsFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Contains);
public static BCTrigger triggerSpaceFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Space);
public static BCTrigger triggerFullFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Full);
public static BCTrigger triggerRedstoneActive = new TriggerRedstoneInput(true);
public static BCTrigger triggerRedstoneInactive = new TriggerRedstoneInput(false);
public static BCTrigger triggerInventoryBelow25 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_25);
public static BCTrigger triggerInventoryBelow50 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_50);
public static BCTrigger triggerInventoryBelow75 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_75);
public static BCAction actionRedstone = new ActionRedstoneOutput(DefaultProps.ACTION_REDSTONE);
public static BCAction actionOn = new ActionMachineControl(DefaultProps.ACTION_ON, Mode.On);
public static BCAction actionOff = new ActionMachineControl(DefaultProps.ACTION_OFF, Mode.Off);
public static BCAction actionLoop = new ActionMachineControl(DefaultProps.ACTION_LOOP, Mode.Loop);
public static BCAction actionRedstone = new ActionRedstoneOutput();
public static BCAction actionOn = new ActionMachineControl(Mode.On);
public static BCAction actionOff = new ActionMachineControl(Mode.Off);
public static BCAction actionLoop = new ActionMachineControl(Mode.Loop);
public static boolean loadDefaultRecipes = true;
public static boolean forcePneumaticPower = true;
public static boolean consumeWaterSources = false;
@ -160,6 +159,7 @@ public class BuildCraftCore {
BlueprintDatabase.init(evt.getModConfigurationDirectory());
BuildcraftRecipes.assemblyTable = AssemblyRecipeManager.INSTANCE;
BuildcraftRecipes.integrationTable = IntegrationRecipeManager.INSTANCE;
BuildcraftRecipes.refinery = RefineryRecipeManager.INSTANCE;
mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf"));

View file

@ -84,10 +84,10 @@ public class BuildCraftEnergy {
public static boolean canOilBurn;
public static double oilWellScalar = 1.0;
public static TreeMap<BlockIndex, Integer> saturationStored = new TreeMap<BlockIndex, Integer>();
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_BLUE_ENGINE_HEAT, EnergyStage.BLUE, "buildcraft.engine.stage.blue");
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_GREEN_ENGINE_HEAT, EnergyStage.GREEN, "buildcraft.engine.stage.green");
public static BCTrigger triggerYellowEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_YELLOW_ENGINE_HEAT, EnergyStage.YELLOW, "buildcraft.engine.stage.yellow");
public static BCTrigger triggerRedEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_RED_ENGINE_HEAT, EnergyStage.RED, "buildcraft.engine.stage.red");
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(EnergyStage.BLUE);
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(EnergyStage.GREEN);
public static BCTrigger triggerYellowEngineHeat = new TriggerEngineHeat(EnergyStage.YELLOW);
public static BCTrigger triggerRedEngineHeat = new TriggerEngineHeat(EnergyStage.RED);
@Instance("BuildCraft|Energy")
public static BuildCraftEnergy instance;

View file

@ -10,9 +10,11 @@ package buildcraft;
import buildcraft.api.bptblocks.BptBlockInventory;
import buildcraft.api.bptblocks.BptBlockRotateMeta;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.transport.PipeWire;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.ItemRedstoneChipset;
import buildcraft.silicon.ItemRedstoneChipset;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.silicon.BlockLaser;
@ -22,8 +24,17 @@ import buildcraft.silicon.ItemLaserTable;
import buildcraft.silicon.SiliconProxy;
import buildcraft.silicon.TileAdvancedCraftingTable;
import buildcraft.silicon.TileAssemblyTable;
import buildcraft.silicon.TileIntegrationTable;
import buildcraft.silicon.TileLaser;
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.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@ -33,10 +44,12 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
@ -46,11 +59,6 @@ public class BuildCraftSilicon {
public static ItemRedstoneChipset redstoneChipset;
public static BlockLaser laserBlock;
public static BlockLaserTable assemblyTableBlock;
public static int timerIntervalShort;
public static int timerIntervalMedium;
public static int timerIntervalLong;
@Instance("BuildCraft|Silicon")
public static BuildCraftSilicon instance;
@ -62,13 +70,6 @@ public class BuildCraftSilicon {
Property redstoneChipsetId = BuildCraftCore.mainConfiguration.getItem("redstoneChipset.id", DefaultProps.REDSTONE_CHIPSET);
Property timerIntervalShort = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "timerShortInterval", 2);
timerIntervalShort.comment = "sets the 'short' duration of the quartz gate timer (default: 2 seconds)";
Property timerIntervalMedium = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "timerMediumInterval", 5);
timerIntervalMedium.comment = "sets the 'medium' duration of the quartz gate timer (default: 5 seconds)";
Property timerIntervalLong = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "timerLongInterval", 10);
timerIntervalLong.comment = "sets the 'long' duration of the quartz gate timer (default: 10 seconds)";
BuildCraftCore.mainConfiguration.save();
laserBlock = new BlockLaser(laserId.getInt());
@ -80,15 +81,12 @@ public class BuildCraftSilicon {
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 0), "Assembly Table");
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 1), "Advanced Crafting Table");
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 2), "Integration Table");
redstoneChipset = new ItemRedstoneChipset(redstoneChipsetId.getInt());
redstoneChipset.setUnlocalizedName("redstoneChipset");
CoreProxy.proxy.registerItem(redstoneChipset);
redstoneChipset.registerItemStacks();
this.timerIntervalShort = timerIntervalShort.getInt();
this.timerIntervalMedium = timerIntervalMedium.getInt();
this.timerIntervalLong = timerIntervalLong.getInt();
}
@EventHandler
@ -97,6 +95,7 @@ public class BuildCraftSilicon {
CoreProxy.proxy.registerTileEntity(TileLaser.class, "net.minecraft.src.buildcraft.factory.TileLaser");
CoreProxy.proxy.registerTileEntity(TileAssemblyTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyTable");
CoreProxy.proxy.registerTileEntity(TileAdvancedCraftingTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench");
CoreProxy.proxy.registerTileEntity(TileIntegrationTable.class, "net.minecraft.src.buildcraft.factory.TileIntegrationTable");
new BptBlockRotateMeta(laserBlock.blockID, new int[]{2, 5, 3, 4}, true);
new BptBlockInventory(assemblyTableBlock.blockID);
@ -110,147 +109,87 @@ public class BuildCraftSilicon {
public static void loadRecipes() {
// TABLES
CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock),
new Object[]{"ORR", "DDR", "ORR", 'O', Block.obsidian, 'R', Item.redstone, 'D',
Item.diamond,});
"ORR",
"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,
'R', Item.redstone, 'D', Item.diamond, 'G', BuildCraftCore.diamondGearItem,});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0),
"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,
'W', Block.workbench, 'C', Block.chest, 'R', new ItemStack(redstoneChipset, 1, 0),});
// Add reverse recipies for all gates
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1),
"OWO",
"OCO",
"ORO",
'O', Block.obsidian,
'W', Block.workbench,
'C', Block.chest,
'R', new ItemStack(redstoneChipset, 1, 0));
// Iron
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 2), new Object[]{new ItemStack(redstoneChipset, 1, 0),
new ItemStack(BuildCraftTransport.pipeGate, 1, 1)});
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 1), new Object[]{new ItemStack(redstoneChipset, 1, 0),
new ItemStack(BuildCraftTransport.pipeGate, 1, 2)});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 2),
"ORO",
"OCO",
"OGO",
'O', Block.obsidian,
'R', Item.redstone,
'C', new ItemStack(redstoneChipset, 1, 0),
'G', BuildCraftCore.diamondGearItem);
// Gold
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 4), new Object[]{new ItemStack(redstoneChipset, 1, 0),
new ItemStack(BuildCraftTransport.pipeGate, 1, 3)});
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 3), new Object[]{new ItemStack(redstoneChipset, 1, 0),
new ItemStack(BuildCraftTransport.pipeGate, 1, 4)});
// PIPE WIRE
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.RED.getStack(8), "dyeRed", 1, Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.BLUE.getStack(8), "dyeBlue", 1, Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.GREEN.getStack(8), "dyeGreen", 1, Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.YELLOW.getStack(8), "dyeYellow", 1, Item.redstone, Item.ingotIron);
// Diamond
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 6), new Object[]{new ItemStack(redstoneChipset, 1, 0),
new ItemStack(BuildCraftTransport.pipeGate, 1, 5)});
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 5), new Object[]{new ItemStack(redstoneChipset, 1, 0),
new ItemStack(BuildCraftTransport.pipeGate, 1, 6)});
// CHIPSETS
BuildcraftRecipes.assemblyTable.addRecipe(10000, Chipset.RED.getStack(), Item.redstone);
BuildcraftRecipes.assemblyTable.addRecipe(20000, Chipset.IRON.getStack(), Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.GOLD.getStack(), Item.redstone, Item.ingotGold);
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
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 8), new Object[]{new ItemStack(redstoneChipset, 1, 0),
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)});
// GATES
BuildcraftRecipes.assemblyTable.addRecipe(10000, ItemGate.makeGateItem(GateMaterial.REDSTONE, GateLogic.AND), Chipset.RED.getStack(), PipeWire.RED.getStack());
// Iron - Autarchic
// CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2), new Object[]{new ItemStack(redstoneChipset, 1, 0),
// new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1)});
// 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)});
addGateRecipe(20000, GateMaterial.IRON, Chipset.IRON, PipeWire.RED, PipeWire.BLUE);
addGateRecipe(40000, GateMaterial.GOLD, Chipset.GOLD, PipeWire.RED, PipeWire.BLUE, PipeWire.YELLOW);
addGateRecipe(80000, GateMaterial.DIAMOND, Chipset.DIAMOND, PipeWire.RED, PipeWire.BLUE, PipeWire.YELLOW, PipeWire.GREEN);
// / REDSTONE CHIPSETS
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 0), "Redstone Chipset");
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 1), "Redstone Iron Chipset");
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 2), "Redstone Golden Chipset");
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 3), "Redstone Diamond Chipset");
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 4), "Pulsating Chipset");
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");
// REVERSAL RECIPES
EnumSet<GateMaterial> materials = EnumSet.allOf(GateMaterial.class);
materials.remove(GateMaterial.REDSTONE);
for (GateMaterial material : materials) {
BuildcraftRecipes.integrationTable.addRecipe(new GateLogicSwapRecipe(material, GateLogic.AND, GateLogic.OR));
BuildcraftRecipes.integrationTable.addRecipe(new GateLogicSwapRecipe(material, GateLogic.OR, GateLogic.AND));
}
// 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

View file

@ -19,7 +19,6 @@ import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCAction;
import buildcraft.core.triggers.BCTrigger;
import buildcraft.core.utils.BCLog;
import buildcraft.core.utils.EnumColor;
import buildcraft.transport.BlockFilteredBuffer;
import buildcraft.transport.BlockGenericPipe;
@ -41,6 +40,9 @@ import buildcraft.transport.blueprints.BptItemPipeWooden;
import buildcraft.transport.gates.GateExpansionPulsar;
import buildcraft.api.gates.GateExpansions;
import buildcraft.api.transport.PipeWire;
import buildcraft.transport.ItemPipeWire;
import buildcraft.transport.gates.GateExpansionRedstoneFader;
import buildcraft.transport.gates.GateExpansionTimer;
import buildcraft.transport.network.PacketHandlerTransport;
import buildcraft.transport.network.TransportConnectionHandler;
import buildcraft.transport.pipes.PipeFluidsCobblestone;
@ -74,7 +76,7 @@ import buildcraft.transport.pipes.PipePowerQuartz;
import buildcraft.transport.pipes.PipePowerStone;
import buildcraft.transport.pipes.PipePowerWood;
import buildcraft.transport.pipes.PipeStructureCobblestone;
import buildcraft.transport.triggers.ActionEnergyPulser;
import buildcraft.transport.triggers.ActionEnergyPulsar;
import buildcraft.transport.triggers.ActionExtractionPreset;
import buildcraft.transport.triggers.ActionPipeColor;
import buildcraft.transport.triggers.ActionPipeDirection;
@ -82,9 +84,12 @@ import buildcraft.transport.triggers.ActionPowerLimiter;
import buildcraft.transport.triggers.ActionSignalOutput;
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
import buildcraft.transport.triggers.TriggerPipeContents;
import buildcraft.transport.triggers.TriggerQuartzTimer;
import buildcraft.transport.triggers.TriggerPipeContents.Kind;
import buildcraft.transport.triggers.TriggerClockTimer;
import buildcraft.transport.triggers.TriggerClockTimer.Time;
import buildcraft.transport.triggers.TriggerPipeContents.PipeContents;
import buildcraft.transport.triggers.TriggerPipeSignal;
import buildcraft.transport.triggers.TriggerRedstoneFaderInput;
import buildcraft.transport.triggers.ActionRedstoneFaderOutput;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@ -114,10 +119,7 @@ public class BuildCraftTransport {
public static float pipeDurability;
public static Item pipeWaterproof;
public static Item pipeGate;
public static Item redPipeWire;
public static Item bluePipeWire;
public static Item greenPipeWire;
public static Item yellowPipeWire;
public static Item pipeWire;
public static Item pipeItemsWood;
public static Item pipeItemsEmerald;
public static Item pipeItemsStone;
@ -153,36 +155,22 @@ public class BuildCraftTransport {
// public static Item pipeItemsStipes;
public static Item pipeStructureCobblestone;
public static int groupItemsTrigger;
public static BCTrigger triggerPipeEmpty = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_EMPTY, Kind.Empty);
public static BCTrigger triggerPipeItems = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_ITEMS, Kind.ContainsItems);
public static BCTrigger triggerPipeFluids = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_LIQUIDS, Kind.ContainsFluids);
public static BCTrigger triggerPipeContainsEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_CONTAINS_ENERGY, Kind.ContainsEnergy);
public static BCTrigger triggerPipeRequestsEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_REQUESTS_ENERGY, Kind.RequestsEnergy);
public static BCTrigger triggerPipeTooMuchEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_TOO_MUCH_ENERGY, Kind.TooMuchEnergy);
public static BCTrigger triggerRedSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_RED_SIGNAL_ACTIVE, true, PipeWire.Red);
public static BCTrigger triggerRedSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_RED_SIGNAL_INACTIVE, false, PipeWire.Red);
public static BCTrigger triggerBlueSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_BLUE_SIGNAL_ACTIVE, true, PipeWire.Blue);
public static BCTrigger triggerBlueSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_BLUE_SIGNAL_INACTIVE, false, PipeWire.Blue);
public static BCTrigger triggerGreenSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_GREEN_SIGNAL_ACTIVE, true, PipeWire.Green);
public static BCTrigger triggerGreenSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_GREEN_SIGNAL_INACTIVE, false, PipeWire.Green);
public static BCTrigger triggerYellowSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_YELLOW_SIGNAL_ACTIVE, true, PipeWire.Yellow);
public static BCTrigger triggerYellowSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_YELLOW_SIGNAL_INACTIVE, false, PipeWire.Yellow);
public static BCTrigger triggerTimerShort = new TriggerQuartzTimer(DefaultProps.TRIGGER_TIMER_SHORT, TriggerQuartzTimer.Time.Short);
public static BCTrigger triggerTimerMedium = new TriggerQuartzTimer(DefaultProps.TRIGGER_TIMER_MEDIUM, TriggerQuartzTimer.Time.Medium);
public static BCTrigger triggerTimerLong = new TriggerQuartzTimer(DefaultProps.TRIGGER_TIMER_LONG, TriggerQuartzTimer.Time.Long);
public static BCAction actionRedSignal = new ActionSignalOutput(DefaultProps.ACTION_RED_SIGNAL, PipeWire.Red);
public static BCAction actionBlueSignal = new ActionSignalOutput(DefaultProps.ACTION_BLUE_SIGNAL, PipeWire.Blue);
public static BCAction actionGreenSignal = new ActionSignalOutput(DefaultProps.ACTION_GREEN_SIGNAL, PipeWire.Green);
public static BCAction actionYellowSignal = new ActionSignalOutput(DefaultProps.ACTION_YELLOW_SIGNAL, PipeWire.Yellow);
public static BCAction actionEnergyPulser = new ActionEnergyPulser(DefaultProps.ACTION_ENERGY_PULSER);
public static BCAction actionSingleEnergyPulse = new ActionSingleEnergyPulse(DefaultProps.ACTION_SINGLE_ENERGY_PULSE);
public static BCTrigger[] triggerPipe = new BCTrigger[PipeContents.values().length];
public static BCTrigger[] triggerPipeWireActive = new BCTrigger[PipeWire.values().length];
public static BCTrigger[] triggerPipeWireInactive = new BCTrigger[PipeWire.values().length];
public static BCTrigger[] triggerTimer = new BCTrigger[TriggerClockTimer.Time.VALUES.length];
public static BCTrigger[] triggerRedstoneLevel = new BCTrigger[15];
public static BCAction[] actionPipeWire = new ActionSignalOutput[PipeWire.values().length];
public static BCAction actionEnergyPulser = new ActionEnergyPulsar();
public static BCAction actionSingleEnergyPulse = new ActionSingleEnergyPulse();
public static BCAction[] actionPipeColor = new BCAction[16];
public static BCAction[] actionPipeDirection = new BCAction[16];
public static BCAction[] actionPowerLimiter = new BCAction[7];
public static BCAction actionExtractionPresetRed = new ActionExtractionPreset(-1, EnumColor.RED);
public static BCAction actionExtractionPresetBlue = new ActionExtractionPreset(-1, EnumColor.BLUE);
public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(-1, EnumColor.GREEN);
public static BCAction actionExtractionPresetYellow = new ActionExtractionPreset(-1, EnumColor.YELLOW);
public static BCAction[] actionRedstoneLevel = new BCAction[15];
public static BCAction actionExtractionPresetRed = new ActionExtractionPreset(EnumColor.RED);
public static BCAction actionExtractionPresetBlue = new ActionExtractionPreset(EnumColor.BLUE);
public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(EnumColor.GREEN);
public static BCAction actionExtractionPresetYellow = new ActionExtractionPreset(EnumColor.YELLOW);
public IIconProvider pipeIconProvider = new PipeIconProvider();
public IIconProvider wireIconProvider = new WireIconProvider();
@Instance("BuildCraft|Transport")
@ -266,6 +254,8 @@ public class BuildCraftTransport {
PipeManager.registerExtractionHandler(new ExtractionHandler(excludedItemBlocks, excludedFluidBlocks));
GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE);
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.groupItemsTrigger", 32);
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
@ -322,29 +312,11 @@ public class BuildCraftTransport {
// 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));
Property redPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "redPipeWire.id", DefaultProps.RED_PIPE_WIRE);
redPipeWire = new ItemBuildCraft(redPipeWireId.getInt()).setPassSneakClick(true);
redPipeWire.setUnlocalizedName("redPipeWire");
LanguageRegistry.addName(redPipeWire, "Red Pipe Wire");
CoreProxy.proxy.registerItem(redPipeWire);
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);
int pipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeWire.id", DefaultProps.PIPE_WIRE).getInt(DefaultProps.PIPE_WIRE);
pipeWire = new ItemPipeWire(pipeWireId);
LanguageRegistry.addName(pipeWire, "Pipe Wire");
CoreProxy.proxy.registerItem(pipeWire);
PipeWire.item = pipeWire;
Property pipeGateId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeGate.id", DefaultProps.GATE_ID);
pipeGate = new ItemGate(pipeGateId.getInt());
@ -412,16 +384,35 @@ public class BuildCraftTransport {
public void postInit(FMLPostInitializationEvent evt) {
ItemFacade.initialize();
for (PipeContents kind : PipeContents.values()) {
triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind);
}
for (PipeWire wire : PipeWire.values()) {
triggerPipeWireActive[wire.ordinal()] = new TriggerPipeSignal(true, wire);
triggerPipeWireInactive[wire.ordinal()] = new TriggerPipeSignal(false, wire);
actionPipeWire[wire.ordinal()] = new ActionSignalOutput(wire);
}
for (Time time : TriggerClockTimer.Time.VALUES) {
triggerTimer[time.ordinal()] = new TriggerClockTimer(time);
}
for (int level = 0; level < triggerRedstoneLevel.length; level++) {
triggerRedstoneLevel[level] = new TriggerRedstoneFaderInput(level + 1);
actionRedstoneLevel[level] = new ActionRedstoneFaderOutput(level + 1);
}
for (EnumColor color : EnumColor.VALUES) {
actionPipeColor[color.ordinal()] = new ActionPipeColor(-1, color);
actionPipeColor[color.ordinal()] = new ActionPipeColor(color);
}
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
actionPipeDirection[direction.ordinal()] = new ActionPipeDirection(-1, direction);
actionPipeDirection[direction.ordinal()] = new ActionPipeDirection(direction);
}
for (PowerMode limit : PowerMode.VALUES) {
actionPowerLimiter[limit.ordinal()] = new ActionPowerLimiter(-1, limit);
actionPowerLimiter[limit.ordinal()] = new ActionPowerLimiter(limit);
}
}
@ -447,16 +438,7 @@ public class BuildCraftTransport {
//Facade turning helper
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
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);
}
BuildcraftRecipes.assemblyTable.addRecipe(1000, new ItemStack(plugItem, 8), new ItemStack(pipeStructureCobblestone));
}
@EventHandler

View file

@ -3,6 +3,7 @@ package buildcraft.api.gates;
import buildcraft.api.transport.IPipeTile;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
@ -11,8 +12,8 @@ public class ActionManager {
public static Map<String, ITrigger> triggers = new HashMap<String, ITrigger>();
public static Map<String, IAction> actions = new HashMap<String, IAction>();
private static LinkedList<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
private static LinkedList<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
private static List<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
private static List<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
public static void registerTriggerProvider(ITriggerProvider provider) {
if (provider != null && !triggerProviders.contains(provider)) {
@ -28,11 +29,11 @@ public class ActionManager {
actions.put(action.getUniqueTag(), action);
}
public static LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
public static List<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
List<ITrigger> triggers = new LinkedList<ITrigger>();
for (ITriggerProvider provider : triggerProviders) {
LinkedList<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
List<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
if (toAdd != null) {
for (ITrigger t : toAdd) {
@ -52,12 +53,11 @@ public class ActionManager {
}
}
//TODO: Use sets not lists
public static LinkedList<IAction> getNeighborActions(Block block, TileEntity entity) {
LinkedList<IAction> actions = new LinkedList<IAction>();
public static List<IAction> getNeighborActions(Block block, TileEntity entity) {
List<IAction> actions = new LinkedList<IAction>();
for (IActionProvider provider : actionProviders) {
LinkedList<IAction> toAdd = provider.getNeighborActions(block, entity);
List<IAction> toAdd = provider.getNeighborActions(block, entity);
if (toAdd != null) {
for (IAction t : toAdd) {
@ -71,11 +71,11 @@ public class ActionManager {
return actions;
}
public static LinkedList<ITrigger> getPipeTriggers(IPipeTile pipe) {
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
public static List<ITrigger> getPipeTriggers(IPipeTile pipe) {
List<ITrigger> triggers = new LinkedList<ITrigger>();
for (ITriggerProvider provider : triggerProviders) {
LinkedList<ITrigger> toAdd = provider.getPipeTriggers(pipe);
List<ITrigger> toAdd = provider.getPipeTriggers(pipe);
if (toAdd != null) {
for (ITrigger t : toAdd) {
@ -88,20 +88,4 @@ public class ActionManager {
return triggers;
}
public static ITrigger getTriggerFromLegacyId(int legacyId) {
for (ITrigger trigger : triggers.values()) {
if (trigger.getLegacyId() == legacyId)
return trigger;
}
return null;
}
public static IAction getActionFromLegacyId(int legacyId) {
for (IAction action : actions.values()) {
if (action.getLegacyId() == legacyId)
return action;
}
return null;
}
}

View file

@ -7,12 +7,6 @@ import net.minecraft.util.Icon;
public interface IAction {
/**
* Return your ID from the old API here, this is only used to convert old
* saves to the new format.
*/
int getLegacyId();
String getUniqueTag();
@SideOnly(Side.CLIENT)

View file

@ -8,11 +8,11 @@ import net.minecraft.util.Icon;
public interface ITrigger {
/**
* Return your ID from the old API here, this is only used to convert old
* saves to the new format.
* Every trigger needs a unique tag, it should be in the format of
* "<modid>:<name>".
*
* @return the unique id
*/
int getLegacyId();
String getUniqueTag();
@SideOnly(Side.CLIENT)

View file

@ -1,3 +1,3 @@
@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|gates")
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|gates")
package buildcraft.api.gates;
import cpw.mods.fml.common.API;

View file

@ -28,7 +28,7 @@ public interface ILaserTarget {
*
* @param energy
*/
void receiveLaserEnergy(float energy);
void receiveLaserEnergy(double energy);
/**
* Return true if the Tile Entity object is no longer a valid target. For

View file

@ -65,7 +65,7 @@ public final class PowerHandler {
public static final float DEFAULT_POWERLOSS = 1F;
public static final float MIN_POWERLOSS = 0.01F;
private final float powerLoss;
private final double powerLoss;
public PerditionCalculator() {
powerLoss = DEFAULT_POWERLOSS;
@ -76,7 +76,7 @@ public final class PowerHandler {
*
* @param powerLoss power loss per tick
*/
public PerditionCalculator(float powerLoss) {
public PerditionCalculator(double powerLoss) {
if (powerLoss < MIN_POWERLOSS) {
powerLoss = MIN_POWERLOSS;
}
@ -93,7 +93,7 @@ public final class PowerHandler {
* @param ticksPassed ticks since the last time this function was called
* @return
*/
public float applyPerdition(PowerHandler powerHandler, float current, long ticksPassed) {
public double applyPerdition(PowerHandler powerHandler, double current, long ticksPassed) {
// float prev = current;
current -= powerLoss * ticksPassed;
if (current < 0) {
@ -110,16 +110,16 @@ public final class PowerHandler {
*
* @return percent of input to tax
*/
public float getTaxPercent() {
public double getTaxPercent() {
return 0;
}
}
public static final PerditionCalculator DEFAULT_PERDITION = new PerditionCalculator();
private float minEnergyReceived;
private float maxEnergyReceived;
private float maxEnergyStored;
private float activationEnergy;
private float energyStored = 0;
private double minEnergyReceived;
private double maxEnergyReceived;
private double maxEnergyStored;
private double activationEnergy;
private double energyStored = 0;
private final SafeTimeTracker doWorkTracker = new SafeTimeTracker();
private final SafeTimeTracker sourcesTracker = new SafeTimeTracker();
private final SafeTimeTracker perditionTracker = new SafeTimeTracker();
@ -145,23 +145,23 @@ public final class PowerHandler {
return receiver;
}
public float getMinEnergyReceived() {
public double getMinEnergyReceived() {
return minEnergyReceived;
}
public float getMaxEnergyReceived() {
public double getMaxEnergyReceived() {
return maxEnergyReceived;
}
public float getMaxEnergyStored() {
public double getMaxEnergyStored() {
return maxEnergyStored;
}
public float getActivationEnergy() {
public double getActivationEnergy() {
return activationEnergy;
}
public float getEnergyStored() {
public double getEnergyStored() {
return energyStored;
}
@ -183,7 +183,7 @@ public final class PowerHandler {
* store. Values tend to range between 100 and 5000. With 1000 and 1500
* being common.
*/
public void configure(float minEnergyReceived, float maxEnergyReceived, float activationEnergy, float maxStoredEnergy) {
public void configure(double minEnergyReceived, double maxEnergyReceived, double activationEnergy, double maxStoredEnergy) {
if (minEnergyReceived > maxEnergyReceived) {
maxEnergyReceived = minEnergyReceived;
}
@ -256,7 +256,7 @@ public final class PowerHandler {
private void applyPerdition() {
if (perditionTracker.markTimeIfDelay(receptor.getWorld(), 1) && energyStored > 0) {
float newEnergy = getPerdition().applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay());
double newEnergy = getPerdition().applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay());
if (newEnergy == 0 || newEnergy < energyStored)
energyStored = newEnergy;
else
@ -296,10 +296,10 @@ public final class PowerHandler {
* @param doUse
* @return amount used
*/
public float useEnergy(float min, float max, boolean doUse) {
public double useEnergy(double min, double max, boolean doUse) {
applyPerdition();
float result = 0;
double result = 0;
if (energyStored >= min) {
if (energyStored <= max) {
@ -329,7 +329,7 @@ public final class PowerHandler {
public void readFromNBT(NBTTagCompound data, String tag) {
NBTTagCompound nbt = data.getCompoundTag(tag);
energyStored = nbt.getFloat("storedEnergy");
energyStored = nbt.getDouble("energyStored");
}
public void writeToNBT(NBTTagCompound data) {
@ -338,7 +338,7 @@ public final class PowerHandler {
public void writeToNBT(NBTTagCompound data, String tag) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setFloat("storedEnergy", energyStored);
nbt.setDouble("energyStored", energyStored);
data.setCompoundTag(tag, nbt);
}
@ -347,23 +347,23 @@ public final class PowerHandler {
private PowerReceiver() {
}
public float getMinEnergyReceived() {
public double getMinEnergyReceived() {
return minEnergyReceived;
}
public float getMaxEnergyReceived() {
public double getMaxEnergyReceived() {
return maxEnergyReceived;
}
public float getMaxEnergyStored() {
public double getMaxEnergyStored() {
return maxEnergyStored;
}
public float getActivationEnergy() {
public double getActivationEnergy() {
return activationEnergy;
}
public float getEnergyStored() {
public double getEnergyStored() {
return energyStored;
}
@ -380,7 +380,7 @@ public final class PowerHandler {
*
* @return
*/
public float powerRequest() {
public double powerRequest() {
update();
return Math.min(maxEnergyReceived, maxEnergyStored - energyStored);
}
@ -394,8 +394,8 @@ public final class PowerHandler {
* @param from
* @return the amount of power used
*/
public float receiveEnergy(Type source, final float quantity, ForgeDirection from) {
float used = quantity;
public double receiveEnergy(Type source, final double quantity, ForgeDirection from) {
double used = quantity;
if (source == Type.ENGINE) {
if (used < minEnergyReceived) {
return 0;
@ -426,7 +426,7 @@ public final class PowerHandler {
*
* @return the amount the power changed by
*/
public float addEnergy(float quantity) {
public double addEnergy(double quantity) {
energyStored += quantity;
if (energyStored > maxEnergyStored) {
@ -442,7 +442,7 @@ public final class PowerHandler {
return quantity;
}
public void setEnergy(float quantity) {
public void setEnergy(double quantity) {
this.energyStored = quantity;
validateEnergy();
}

View file

@ -15,6 +15,7 @@ package buildcraft.api.recipes;
public final class BuildcraftRecipes {
public static IAssemblyRecipeManager assemblyTable;
public static IIntegrationRecipeManager integrationTable;
public static IRefineryRecipeManager refinery;
private BuildcraftRecipes() {

View file

@ -0,0 +1,45 @@
/*
* 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.api.recipes;
import java.util.List;
import net.minecraft.item.ItemStack;
/**
* The Integration Table's primary purpose is to modify an input item's NBT
* data. As such its not a "traditional" type of recipe. Rather than predefined
* inputs and outputs, it takes an input and transforms it.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IIntegrationRecipeManager {
public static interface IIntegrationRecipe {
double getEnergyCost();
boolean isValidInputA(ItemStack inputA);
boolean isValidInputB(ItemStack inputB);
ItemStack getOutputForInputs(ItemStack inputA, ItemStack inputB);
ItemStack[] getExampleInputsA();
ItemStack[] getExampleInputsB();
}
/**
* Add an Integration Table recipe.
*
*/
void addRecipe(IIntegrationRecipe recipe);
List<? extends IIntegrationRecipe> getRecipes();
}

View file

@ -8,24 +8,58 @@
*/
package buildcraft.api.transport;
import java.util.Locale;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public enum PipeWire {
Red, Blue, Green, Yellow;
RED, BLUE, GREEN, YELLOW;
public static Item item;
public static final PipeWire[] VALUES = values();
public PipeWire reverse() {
switch (this) {
case Red:
return Yellow;
case Blue:
return Green;
case Green:
return Blue;
case RED:
return YELLOW;
case BLUE:
return GREEN;
case GREEN:
return BLUE;
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

@ -334,12 +334,6 @@ public class TileFiller extends TileBuildCraft implements IInventory, IPowerRece
@Override
public void readGuiData(DataInputStream data, EntityPlayer player) throws IOException {
IFillerPattern prev = currentPattern;
currentPattern = FillerManager.registry.getPattern(data.readUTF());
if (currentPattern == null)
currentPattern = PatternFill.INSTANCE;
if (prev != currentPattern)
done = false;
sendNetworkUpdate();
setPattern(FillerManager.registry.getPattern(data.readUTF()));
}
}

View file

@ -16,7 +16,7 @@ public class ActionFiller extends BCAction {
public final IFillerPattern pattern;
public ActionFiller(IFillerPattern pattern) {
super(0, "filler:" + pattern.getUniqueTag());
super("filler:" + pattern.getUniqueTag());
this.pattern = pattern;
}

View file

@ -40,10 +40,7 @@ public class DefaultProps {
public static int PIPE_WATERPROOF_ID = 19109;
public static int BUCKET_FUEL_ID = 19110;
public static int GATE_ID = 19111;
public static int RED_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 PIPE_WIRE = 19113;
public static int REDSTONE_CHIPSET = 19117;
public static int BLUEPRINT_ITEM_ID = 19118;
@ -128,52 +125,6 @@ public class DefaultProps {
public static final int FILLER_LIFESPAN_TOUGH = 20;
public static final int FILLER_LIFESPAN_NORMAL = 6000;
// These are only till here for Legacy support, new Triggers/Action don't need them
public static int TRIGGER_REDSTONE_ACTIVE = 1;
public static int TRIGGER_REDSTONE_INACTIVE = 2;
public static int TRIGGER_MACHINE_ACTIVE = 3;
public static int TRIGGER_MACHINE_INACTIVE = 4;
public static int TRIGGER_EMPTY_INVENTORY = 5;
public static int TRIGGER_CONTAINS_INVENTORY = 6;
public static int TRIGGER_SPACE_INVENTORY = 7;
public static int TRIGGER_FULL_INVENTORY = 8;
public static int TRIGGER_EMPTY_LIQUID = 9;
public static int TRIGGER_CONTAINS_LIQUID = 10;
public static int TRIGGER_SPACE_LIQUID = 11;
public static int TRIGGER_FULL_LIQUID = 12;
public static int TRIGGER_PIPE_EMPTY = 13;
public static int TRIGGER_PIPE_ITEMS = 14;
public static int TRIGGER_PIPE_LIQUIDS = 15;
public static int TRIGGER_PIPE_CONTAINS_ENERGY = 16;
public static int TRIGGER_RED_SIGNAL_ACTIVE = 17;
public static int TRIGGER_RED_SIGNAL_INACTIVE = 18;
public static int TRIGGER_BLUE_SIGNAL_ACTIVE = 19;
public static int TRIGGER_BLUE_SIGNAL_INACTIVE = 20;
public static int TRIGGER_GREEN_SIGNAL_ACTIVE = 21;
public static int TRIGGER_GREEN_SIGNAL_INACTIVE = 22;
public static int TRIGGER_YELLOW_SIGNAL_ACTIVE = 23;
public static int TRIGGER_YELLOW_SIGNAL_INACTIVE = 24;
public static int TRIGGER_BLUE_ENGINE_HEAT = 25;
public static int TRIGGER_GREEN_ENGINE_HEAT = 26;
public static int TRIGGER_YELLOW_ENGINE_HEAT = 27;
public static int TRIGGER_RED_ENGINE_HEAT = 28;
public static int TRIGGER_PIPE_REQUESTS_ENERGY = 29;
public static int TRIGGER_PIPE_TOO_MUCH_ENERGY = 30;
public static int TRIGGER_TIMER_SHORT = 31;
public static int TRIGGER_TIMER_MEDIUM = 32;
public static int TRIGGER_TIMER_LONG = 33;
public static int ACTION_REDSTONE = 1;
public static int ACTION_RED_SIGNAL = 2;
public static int ACTION_BLUE_SIGNAL = 3;
public static int ACTION_GREEN_SIGNAL = 4;
public static int ACTION_YELLOW_SIGNAL = 5;
public static int ACTION_ON = 6;
public static int ACTION_OFF = 7;
public static int ACTION_LOOP = 8;
public static int ACTION_ENERGY_PULSER = 9;
public static int ACTION_SINGLE_ENERGY_PULSE = 10;
public static int BIOME_OIL_OCEAN = 160;
public static int BIOME_OIL_DESERT = 161;
}

View file

@ -16,9 +16,9 @@ public class EntityEnergyLaser extends EntityLaser {
public static final short POWER_AVERAGING = 100;
public int displayStage = 0;
private final float power[] = new float[POWER_AVERAGING];
private final double power[] = new double[POWER_AVERAGING];
private int powerIndex = 0;
private float powerAverage = 0;
private double powerAverage = 0;
public EntityEnergyLaser(World world) {
super(world);
@ -28,7 +28,7 @@ public class EntityEnergyLaser extends EntityLaser {
super(world, head, tail);
}
public void pushPower(float received) {
public void pushPower(double received) {
powerAverage -= power[powerIndex];
powerAverage += received;
@ -40,7 +40,7 @@ public class EntityEnergyLaser extends EntityLaser {
}
}
public float getPowerAverage() {
public double getPowerAverage() {
return powerAverage / POWER_AVERAGING;
}

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

@ -11,6 +11,7 @@ import buildcraft.core.utils.SessionVars;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.InventoryPlayer;
@ -44,6 +45,10 @@ public abstract class GuiBuildCraft extends GuiContainer {
initLedgers(inventory);
}
public FontRenderer getFontRenderer() {
return fontRenderer;
}
protected void initLedgers(IInventory inventory) {
}

View file

@ -8,6 +8,7 @@ import buildcraft.core.inventory.Transactor;
import buildcraft.core.inventory.filters.ArrayStackFilter;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -45,10 +46,16 @@ public class AssemblyRecipeManager implements IAssemblyRecipeManager {
for (int i = 0; i < inputs.length; i++) {
if (inputs[i] instanceof String)
processedInput[i] = OreDictionary.getOres((String) inputs[i]);
if (inputs[i] instanceof Item)
processedInput[i] = new ItemStack((Item) inputs[i]);
else
else if (inputs[i] instanceof ItemStack)
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,22 @@
package buildcraft.core.recipes;
import buildcraft.api.recipes.IIntegrationRecipeManager;
import buildcraft.api.recipes.IIntegrationRecipeManager.IIntegrationRecipe;
import java.util.LinkedList;
import java.util.List;
public class IntegrationRecipeManager implements IIntegrationRecipeManager {
public static final IntegrationRecipeManager INSTANCE = new IntegrationRecipeManager();
private List<IIntegrationRecipe> integrationRecipes = new LinkedList<IIntegrationRecipe>();
@Override
public void addRecipe(IIntegrationRecipe recipe) {
integrationRecipes.add(recipe);
}
@Override
public List<IIntegrationRecipe> getRecipes() {
return integrationRecipes;
}
}

View file

@ -1,46 +1,37 @@
package buildcraft.core.triggers;
import buildcraft.core.utils.StringUtils;
import java.util.Locale;
public class ActionMachineControl extends BCAction {
public enum Mode {
Unknown, On, Off, Loop
};
public final Mode mode;
Mode mode;
public ActionMachineControl(int legacyId, Mode mode) {
super(legacyId, "buildcraft.machine." + mode.name().toLowerCase(Locale.ENGLISH));
public ActionMachineControl(Mode mode) {
super("buildcraft:machine." + mode.name().toLowerCase(Locale.ENGLISH), "buildcraft.machine." + mode.name().toLowerCase(Locale.ENGLISH));
this.mode = mode;
}
@Override
public String getDescription() {
switch (mode) {
case On:
return "On";
case Off:
return "Off";
case Loop:
return "Loop";
default:
return "";
}
return StringUtils.localize("gate.action.machine." + mode.name().toLowerCase(Locale.ENGLISH));
}
@Override
public int getIconIndex() {
switch (mode) {
case On:
return ActionTriggerIconProvider.Action_MachineControl_On;
case Off:
return ActionTriggerIconProvider.Action_MachineControl_Off;
case Loop:
default:
return ActionTriggerIconProvider.Action_MachineControl_Loop;
}
case On:
return ActionTriggerIconProvider.Action_MachineControl_On;
case Off:
return ActionTriggerIconProvider.Action_MachineControl_Off;
case Loop:
default:
return ActionTriggerIconProvider.Action_MachineControl_Loop;
}
}
}

View file

@ -1,19 +1,16 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
* Copyright (c) SpaceToad, 2011 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
* 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.core.triggers;
public class ActionRedstoneOutput extends BCAction {
public ActionRedstoneOutput(int legacyId) {
super(legacyId, "buildcraft.redstone.output");
public ActionRedstoneOutput() {
super("buildcraft:redstone.output", "buildcraft.redstone.output");
}
@Override

View file

@ -6,58 +6,57 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
/**
* Don't put new Trigger Icons in here please, put them in the Trigger classes
* like the TriggerQuartzTimer. This class will go away someday.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class ActionTriggerIconProvider implements IIconProvider {
public static ActionTriggerIconProvider INSTANCE = new ActionTriggerIconProvider();
public static final int Action_MachineControl_On = 0;
public static final int Action_MachineControl_Off = 1;
public static final int Action_MachineControl_Loop = 2;
public static final int Trigger_EngineHeat_Blue = 3;
public static final int Trigger_EngineHeat_Green = 4;
public static final int Trigger_EngineHeat_Yellow = 5;
public static final int Trigger_EngineHeat_Red = 6;
public static final int Trigger_Inventory_Empty = 7;
public static final int Trigger_Inventory_Contains = 8;
public static final int Trigger_Inventory_Space = 9;
public static final int Trigger_Inventory_Full = 10;
public static final int Trigger_FluidContainer_Empty = 11;
public static final int Trigger_FluidContainer_Contains = 12;
public static final int Trigger_FluidContainer_Space = 13;
public static final int Trigger_FluidContainer_Full = 14;
public static final int Trigger_Machine_Active = 15;
public static final int Trigger_Machine_Inactive = 16;
public static final int Trigger_PipeContents_Empty = 17;
public static final int Trigger_PipeContents_ContainsItems = 18;
public static final int Action_MachineControl_On = 0;
public static final int Action_MachineControl_Off = 1;
public static final int Action_MachineControl_Loop = 2;
public static final int Trigger_EngineHeat_Blue = 3;
public static final int Trigger_EngineHeat_Green = 4;
public static final int Trigger_EngineHeat_Yellow = 5;
public static final int Trigger_EngineHeat_Red = 6;
public static final int Trigger_Inventory_Empty = 7;
public static final int Trigger_Inventory_Contains = 8;
public static final int Trigger_Inventory_Space = 9;
public static final int Trigger_Inventory_Full = 10;
public static final int Trigger_FluidContainer_Empty = 11;
public static final int Trigger_FluidContainer_Contains = 12;
public static final int Trigger_FluidContainer_Space = 13;
public static final int Trigger_FluidContainer_Full = 14;
public static final int Trigger_Machine_Active = 15;
public static final int Trigger_Machine_Inactive = 16;
public static final int Trigger_PipeContents_Empty = 17;
public static final int Trigger_PipeContents_ContainsItems = 18;
public static final int Trigger_PipeContents_ContainsFluid = 19;
public static final int Trigger_PipeContents_ContainsEnergy = 20;
public static final int Trigger_PipeSignal_Red_Active = 21;
public static final int Trigger_PipeSignal_Blue_Active = 22;
public static final int Trigger_PipeSignal_Green_Active = 23;
public static final int Trigger_PipeSignal_Yellow_Active = 24;
public static final int Trigger_PipeSignal_Red_Inactive = 25;
public static final int Trigger_PipeSignal_Blue_Inactive = 26;
public static final int Trigger_PipeSignal_Green_Inactive = 27;
public static final int Trigger_PipeSignal_Yellow_Inactive = 28;
public static final int Trigger_RedstoneInput_Active = 29;
public static final int Trigger_RedstoneInput_Inactive = 30;
public static final int Trigger_PipeContents_RequestsEnergy = 31;
public static final int Trigger_PipeContents_TooMuchEnergy = 32;
public static final int Trigger_Inventory_Below25 = 33;
public static final int Trigger_Inventory_Below50 = 34;
public static final int Trigger_Inventory_Below75 = 35;
public static final int Trigger_Timer_Short = 36;
public static final int Trigger_Timer_Medium = 37;
public static final int Trigger_Timer_Long = 38;
public static final int MAX = 39;
public static final int Trigger_PipeSignal_Red_Active = 21;
public static final int Trigger_PipeSignal_Blue_Active = 22;
public static final int Trigger_PipeSignal_Green_Active = 23;
public static final int Trigger_PipeSignal_Yellow_Active = 24;
public static final int Trigger_PipeSignal_Red_Inactive = 25;
public static final int Trigger_PipeSignal_Blue_Inactive = 26;
public static final int Trigger_PipeSignal_Green_Inactive = 27;
public static final int Trigger_PipeSignal_Yellow_Inactive = 28;
public static final int Trigger_RedstoneInput_Active = 29;
public static final int Trigger_RedstoneInput_Inactive = 30;
public static final int Trigger_PipeContents_RequestsEnergy = 31;
public static final int Trigger_PipeContents_TooMuchEnergy = 32;
public static final int Trigger_Inventory_Below25 = 33;
public static final int Trigger_Inventory_Below50 = 34;
public static final int Trigger_Inventory_Below75 = 35;
public static final int MAX = 39;
@SideOnly(Side.CLIENT)
private final Icon[] icons = new Icon[MAX];
private ActionTriggerIconProvider(){}
private ActionTriggerIconProvider() {
}
@Override
@SideOnly(Side.CLIENT)
@ -105,9 +104,5 @@ public class ActionTriggerIconProvider implements IIconProvider {
icons[ActionTriggerIconProvider.Trigger_Inventory_Below25] = iconRegister.registerIcon("buildcraft:triggers/trigger_inventory_below25");
icons[ActionTriggerIconProvider.Trigger_Inventory_Below50] = iconRegister.registerIcon("buildcraft:triggers/trigger_inventory_below50");
icons[ActionTriggerIconProvider.Trigger_Inventory_Below75] = iconRegister.registerIcon("buildcraft:triggers/trigger_inventory_below75");
icons[ActionTriggerIconProvider.Trigger_Timer_Short] = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_short");
icons[ActionTriggerIconProvider.Trigger_Timer_Medium] = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_medium");
icons[ActionTriggerIconProvider.Trigger_Timer_Long] = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_long");
}
}

View file

@ -8,6 +8,7 @@
package buildcraft.core.triggers;
import buildcraft.api.gates.ActionManager;
import static buildcraft.api.gates.ActionManager.actions;
import buildcraft.api.gates.IAction;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -16,13 +17,20 @@ import net.minecraft.util.Icon;
public abstract class BCAction implements IAction {
protected final int legacyId;
protected final String uniqueTag;
public BCAction(int legacyId, String uniqueTag) {
this.legacyId = legacyId;
this.uniqueTag = uniqueTag;
ActionManager.registerAction(this);
/**
* UniqueTag accepts multiple possible tags, use this feature to migrate to
* more standardized tags if needed, otherwise just pass a single string.
* The first passed string will be the one used when saved to disk.
*
* @param uniqueTag
*/
public BCAction(String... uniqueTag) {
this.uniqueTag = uniqueTag[0];
for (String tag : uniqueTag) {
ActionManager.actions.put(tag, this);
}
}
@Override
@ -30,11 +38,6 @@ public abstract class BCAction implements IAction {
return uniqueTag;
}
@Override
public int getLegacyId() {
return this.legacyId;
}
public int getIconIndex() {
return 0;
}

View file

@ -23,13 +23,20 @@ import net.minecraft.util.Icon;
*/
public abstract class BCTrigger implements ITrigger {
protected final int legacyId;
protected final String uniqueTag;
public BCTrigger(int legacyId, String uniqueTag) {
this.legacyId = legacyId;
this.uniqueTag = uniqueTag;
ActionManager.registerTrigger(this);
/**
* UniqueTag accepts multiple possible tags, use this feature to migrate to
* more standardized tags if needed, otherwise just pass a single string.
* The first passed string will be the one used when saved to disk.
*
* @param uniqueTag
*/
public BCTrigger(String... uniqueTag) {
this.uniqueTag = uniqueTag[0];
for (String tag : uniqueTag) {
ActionManager.triggers.put(tag, this);
}
}
@Override
@ -37,11 +44,6 @@ public abstract class BCTrigger implements ITrigger {
return uniqueTag;
}
@Override
public int getLegacyId() {
return this.legacyId;
}
public int getIconIndex() {
return 0;
}

View file

@ -9,6 +9,7 @@ package buildcraft.core.triggers;
import buildcraft.api.gates.ITileTrigger;
import buildcraft.api.gates.ITriggerParameter;
import buildcraft.core.utils.StringUtils;
import java.util.Locale;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -25,8 +26,8 @@ public class TriggerFluidContainer extends BCTrigger implements ITileTrigger {
};
public State state;
public TriggerFluidContainer(int legacyId, State state) {
super(legacyId, "buildcraft.fluid." + state.name().toLowerCase(Locale.ENGLISH));
public TriggerFluidContainer(State state) {
super("buildcraft:fluid." + state.name().toLowerCase(Locale.ENGLISH), "buildcraft.fluid." + state.name().toLowerCase(Locale.ENGLISH));
this.state = state;
}
@ -40,16 +41,7 @@ public class TriggerFluidContainer extends BCTrigger implements ITileTrigger {
@Override
public String getDescription() {
switch (state) {
case Empty:
return "Tank Empty";
case Contains:
return "Fluid in Tank";
case Space:
return "Space for Fluid";
default:
return "Tank Full";
}
return StringUtils.localize("gate.trigger.fluid." + state.name().toLowerCase(Locale.ENGLISH));
}
@Override

View file

@ -13,6 +13,7 @@ import buildcraft.api.inventory.ISpecialInventory;
import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.StringUtils;
import java.util.Locale;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -27,8 +28,8 @@ public class TriggerInventory extends BCTrigger implements ITileTrigger {
};
public State state;
public TriggerInventory(int legacyId, State state) {
super(legacyId, "buildcraft.inventory." + state.name().toLowerCase(Locale.ENGLISH));
public TriggerInventory(State state) {
super("buildcraft:inventory." + state.name().toLowerCase(Locale.ENGLISH), "buildcraft.inventory." + state.name().toLowerCase(Locale.ENGLISH));
this.state = state;
}
@ -43,16 +44,7 @@ public class TriggerInventory extends BCTrigger implements ITileTrigger {
@Override
public String getDescription() {
switch (state) {
case Empty:
return "Inventory Empty";
case Contains:
return "Items in Inventory";
case Space:
return "Space in Inventory";
default:
return "Inventory Full";
}
return StringUtils.localize("gate.trigger.inventory." + state.name().toLowerCase(Locale.ENGLISH));
}
@Override
@ -91,13 +83,13 @@ public class TriggerInventory extends BCTrigger implements ITileTrigger {
for (IInvSlot slot : InventoryIterator.getIterable((IInventory) tile, side)) {
hasSlots = true;
ItemStack stack = slot.getStackInSlot();
foundItems |= stack != null && (searchedStack == null || StackHelper.instance().canStacksMerge(stack, searchedStack));
foundSpace |= (stack == null || (StackHelper.instance().canStacksMerge(stack, searchedStack) && stack.stackSize < stack.getMaxStackSize()))
foundSpace |= (stack == null || (StackHelper.instance().canStacksMerge(stack, searchedStack) && stack.stackSize < stack.getMaxStackSize()))
&& (searchedStack == null || slot.canPutStackInSlot(searchedStack));
}
if(!hasSlots)
if (!hasSlots)
return false;
switch (state) {

View file

@ -7,32 +7,36 @@
*/
package buildcraft.core.triggers;
import buildcraft.api.gates.ActionManager;
import buildcraft.api.gates.ITileTrigger;
import buildcraft.api.gates.ITriggerParameter;
import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.StringUtils;
import java.util.Locale;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger {
public enum TriggerType {
BELOW_25, BELOW_50, BELOW_75
BELOW_25(0.25F), BELOW_50(0.5F), BELOW_75(0.75F);
public final float level;
private TriggerType(float level) {
this.level = level;
}
};
public TriggerType type;
public TriggerInventoryLevel(TriggerType type) {
super(0, "buildcraft.inventorylevel." + type.name().toLowerCase(Locale.ENGLISH));
super("buildcraft:inventorylevel." + type.name().toLowerCase(Locale.ENGLISH),
"buildcraft.inventorylevel." + type.name().toLowerCase(Locale.ENGLISH),
"buildcraft.filteredBuffer." + type.name().toLowerCase(Locale.ENGLISH));
this.type = type;
// Legacy migration code
ActionManager.triggers.put("buildcraft.filteredBuffer." + type.name().toLowerCase(Locale.ENGLISH), this);
}
@Override
@ -47,14 +51,7 @@ public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
@Override
public String getDescription() {
switch (type) {
case BELOW_25:
return "Contains < 25%";
case BELOW_50:
return "Contains < 50%";
default:
return "Contains < 75%";
}
return String.format(StringUtils.localize("gate.trigger.inventorylevel.below"), (int) (type.level * 100));
}
@Override
@ -80,15 +77,7 @@ public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
if (stackSpace > 0) {
float percentage = (float) foundItems / ((float) stackSpace * (float) searchStack.getMaxStackSize());
switch (type) {
case BELOW_25:
return percentage < 0.25f;
case BELOW_50:
return percentage < 0.5f;
default:
return percentage < 0.75f;
}
return percentage < type.level;
}
}

View file

@ -10,6 +10,7 @@ package buildcraft.core.triggers;
import buildcraft.api.gates.ITileTrigger;
import buildcraft.api.gates.ITriggerParameter;
import buildcraft.core.IMachine;
import buildcraft.core.utils.StringUtils;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -17,18 +18,15 @@ public class TriggerMachine extends BCTrigger implements ITileTrigger {
boolean active;
public TriggerMachine(int legacyId, boolean active) {
super(legacyId, "buildcraft.work." + (active ? "scheduled" : "done"));
public TriggerMachine(boolean active) {
super("buildcraft:work." + (active ? "scheduled" : "done"), "buildcraft.work." + (active ? "scheduled" : "done"));
this.active = active;
}
@Override
public String getDescription() {
if (active)
return "Work Scheduled";
else
return "Work Done";
return StringUtils.localize("gate.trigger.machine." + (active ? "scheduled" : "done"));
}
@Override

View file

@ -0,0 +1,44 @@
/**
* Copyright (c) SpaceToad, 2011 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.core.triggers;
import buildcraft.api.gates.ITriggerParameter;
import buildcraft.core.utils.StringUtils;
import buildcraft.transport.IPipeTrigger;
import buildcraft.transport.Pipe;
public class TriggerRedstoneInput extends BCTrigger implements IPipeTrigger {
boolean active;
public TriggerRedstoneInput(boolean active) {
super("buildcraft:redstone.input." + (active ? "active" : "inactive"), active ? "buildcraft.redtone.input.active" : "buildcraft.redtone.input.inactive");
this.active = active;
}
@Override
public String getDescription() {
return StringUtils.localize("gate.trigger.redstone.input." + (active ? "active" : "inactive"));
}
@Override
public boolean isTriggerActive(Pipe pipe, ITriggerParameter parameter) {
if (active)
return isBeingPowered(pipe);
return !isBeingPowered(pipe);
}
private boolean isBeingPowered(Pipe pipe) {
return pipe.container.redstoneInput > 0;
}
@Override
public int getIconIndex() {
return active ? ActionTriggerIconProvider.Trigger_RedstoneInput_Active : ActionTriggerIconProvider.Trigger_RedstoneInput_Inactive;
}
}

View file

@ -11,9 +11,7 @@ import java.util.LinkedList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection;
@ -43,7 +41,8 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
public enum EnergyStage {
BLUE, GREEN, YELLOW, RED, OVERHEAT
BLUE, GREEN, YELLOW, RED, OVERHEAT;
public static final EnergyStage[] VALUES = values();
}
public static final float MIN_HEAT = 20;
public static final float IDEAL_HEAT = 100;
@ -51,12 +50,12 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
protected int progressPart = 0;
protected boolean lastPower = false;
protected PowerHandler powerHandler;
public float currentOutput = 0;
public double currentOutput = 0;
public boolean isRedstonePowered = false;
private boolean checkOrienation = false;
private TileBuffer[] tileCache;
public float progress;
public float energy;
public double energy;
public float heat = MIN_HEAT;
//
public @TileNetworkData
@ -85,7 +84,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
return false;
}
public float getEnergyLevel() {
public double getEnergyLevel() {
return energy / getMaxEnergy();
}
@ -119,7 +118,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
}
public void updateHeatLevel() {
heat = ((MAX_HEAT - MIN_HEAT) * getEnergyLevel()) + MIN_HEAT;
heat = (float) ((MAX_HEAT - MIN_HEAT) * getEnergyLevel()) + MIN_HEAT;
}
public float getHeatLevel() {
@ -174,7 +173,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
if (!isOrientationValid())
switchOrientation(true);
}
if (!isRedstonePowered)
if (energy > 1)
energy--;
@ -215,7 +214,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
burn();
}
private float getPowerToExtract() {
private double getPowerToExtract() {
TileEntity tile = getTileBuffer(orientation).getTile();
PowerReceiver receptor = ((IPowerReceptor) tile).getPowerReceiver(orientation.getOpposite());
return extractEnergy(receptor.getMinEnergyReceived(), receptor.getMaxEnergyReceived(), false); // Comment out for constant power
@ -227,9 +226,9 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
if (isPoweredTile(tile, orientation)) {
PowerReceiver receptor = ((IPowerReceptor) tile).getPowerReceiver(orientation.getOpposite());
float extracted = getPowerToExtract();
double extracted = getPowerToExtract();
if (extracted > 0) {
float needed = receptor.receiveEnergy(PowerHandler.Type.ENGINE, extracted, orientation.getOpposite());
double needed = receptor.receiveEnergy(PowerHandler.Type.ENGINE, extracted, orientation.getOpposite());
extractEnergy(receptor.getMinEnergyReceived(), needed, true); // Comment out for constant power
// currentOutput = extractEnergy(0, needed, true); // Uncomment for constant power
}
@ -317,10 +316,8 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
super.readFromNBT(data);
orientation = ForgeDirection.getOrientation(data.getInteger("orientation"));
progress = data.getFloat("progress");
energy = data.getFloat("energyF");
NBTBase tag = data.getTag("heat");
if (tag instanceof NBTTagFloat)
heat = data.getFloat("heat");
energy = data.getDouble("energy");
heat = data.getFloat("heat");
}
@Override
@ -328,19 +325,19 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
super.writeToNBT(data);
data.setInteger("orientation", orientation.ordinal());
data.setFloat("progress", progress);
data.setFloat("energyF", energy);
data.setDouble("energy", energy);
data.setFloat("heat", heat);
}
public void getGUINetworkData(int id, int value) {
switch (id) {
case 0:
int iEnergy = Math.round(energy * 10);
int iEnergy = (int) Math.round(energy * 10);
iEnergy = (iEnergy & 0xffff0000) | (value & 0xffff);
energy = iEnergy / 10;
break;
case 1:
iEnergy = Math.round(energy * 10);
iEnergy = (int) Math.round(energy * 10);
iEnergy = (iEnergy & 0xffff) | ((value & 0xffff) << 16);
energy = iEnergy / 10;
break;
@ -354,9 +351,9 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
}
public void sendGUINetworkData(ContainerEngine containerEngine, ICrafting iCrafting) {
iCrafting.sendProgressBarUpdate(containerEngine, 0, Math.round(energy * 10) & 0xffff);
iCrafting.sendProgressBarUpdate(containerEngine, 1, (Math.round(energy * 10) & 0xffff0000) >> 16);
iCrafting.sendProgressBarUpdate(containerEngine, 2, Math.round(currentOutput * 10));
iCrafting.sendProgressBarUpdate(containerEngine, 0, (int) Math.round(energy * 10) & 0xffff);
iCrafting.sendProgressBarUpdate(containerEngine, 1, (int) (Math.round(energy * 10) & 0xffff0000) >> 16);
iCrafting.sendProgressBarUpdate(containerEngine, 2, (int) Math.round(currentOutput * 10));
iCrafting.sendProgressBarUpdate(containerEngine, 3, Math.round(heat * 100));
}
@ -378,7 +375,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
addEnergy(powerHandler.useEnergy(1, maxEnergyReceived(), true) * 0.95F);
}
public void addEnergy(float addition) {
public void addEnergy(double addition) {
energy += addition;
if (getEnergyStage() == EnergyStage.OVERHEAT) {
@ -390,11 +387,11 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
energy = getMaxEnergy();
}
public float extractEnergy(float min, float max, boolean doExtract) {
public double extractEnergy(double min, double max, boolean doExtract) {
if (energy < min)
return 0;
float actualMax;
double actualMax;
if (max > maxEnergyExtracted())
actualMax = maxEnergyExtracted();
@ -404,7 +401,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
if (actualMax < min)
return 0;
float extracted;
double extracted;
if (energy >= actualMax) {
extracted = actualMax;
@ -426,23 +423,23 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
return false;
}
public abstract float getMaxEnergy();
public abstract double getMaxEnergy();
public float minEnergyReceived() {
public double minEnergyReceived() {
return 2;
}
public abstract float maxEnergyReceived();
public abstract double maxEnergyReceived();
public abstract float maxEnergyExtracted();
public abstract double maxEnergyExtracted();
public abstract float explosionRange();
public float getEnergyStored() {
public double getEnergyStored() {
return energy;
}
public abstract float getCurrentOutput();
public abstract double getCurrentOutput();
@Override
public LinkedList<ITrigger> getTriggers() {

View file

@ -396,22 +396,22 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
}
@Override
public float maxEnergyReceived() {
public double maxEnergyReceived() {
return 2000;
}
@Override
public float maxEnergyExtracted() {
public double maxEnergyExtracted() {
return 500;
}
@Override
public float getMaxEnergy() {
public double getMaxEnergy() {
return 10000;
}
@Override
public float getCurrentOutput() {
public double getCurrentOutput() {
if (currentFuel == null) {
return 0;
}

View file

@ -47,12 +47,12 @@ public class TileEngineLegacy extends TileEngine {
}
@Override
public float getMaxEnergy() {
public double getMaxEnergy() {
return 1;
}
@Override
public float maxEnergyReceived() {
public double maxEnergyReceived() {
return 0;
}
@ -72,12 +72,12 @@ public class TileEngineLegacy extends TileEngine {
}
@Override
public float getCurrentOutput() {
public double getCurrentOutput() {
return 1;
}
@Override
public float maxEnergyExtracted() {
public double maxEnergyExtracted() {
return 1;
}
}

View file

@ -22,7 +22,7 @@ import buildcraft.api.gates.ITrigger;
import buildcraft.core.GuiIds;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
import buildcraft.core.utils.MathUtils;
import buildcraft.energy.gui.ContainerEngine;
public class TileEngineStone extends TileEngineWithInventory {
@ -32,10 +32,10 @@ public class TileEngineStone extends TileEngineWithInventory {
final float TARGET_OUTPUT = 0.375f;
final float kp = 1f;
final float ki = 0.05f;
final float eLimit = (MAX_OUTPUT - MIN_OUTPUT) / ki;
final double eLimit = (MAX_OUTPUT - MIN_OUTPUT) / ki;
int burnTime = 0;
int totalBurnTime = 0;
float esum = 0;
double esum = 0;
public TileEngineStone() {
super(1);
@ -69,7 +69,7 @@ public class TileEngineStone extends TileEngineWithInventory {
if (burnTime > 0) {
burnTime--;
float output = getCurrentOutput();
double output = getCurrentOutput();
currentOutput = output; // Comment out for constant power
addEnergy(output);
}
@ -131,25 +131,25 @@ public class TileEngineStone extends TileEngineWithInventory {
}
@Override
public float maxEnergyReceived() {
public double maxEnergyReceived() {
return 200;
}
@Override
public float maxEnergyExtracted() {
public double maxEnergyExtracted() {
return 100;
}
@Override
public float getMaxEnergy() {
public double getMaxEnergy() {
return 1000;
}
@Override
public float getCurrentOutput() {
float e = TARGET_OUTPUT * getMaxEnergy() - energy;
esum = Math.min(Math.max(esum + e, -eLimit), eLimit);
return Math.min(Math.max(e * kp + esum * ki, MIN_OUTPUT), MAX_OUTPUT);
public double getCurrentOutput() {
double e = TARGET_OUTPUT * getMaxEnergy() - energy;
esum = MathUtils.clamp(esum + e, -eLimit, eLimit);
return MathUtils.clamp(e * kp + esum * ki, MIN_OUTPUT, MAX_OUTPUT);
}
@Override

View file

@ -28,18 +28,18 @@ public class TileEngineWood extends TileEngine {
}
@Override
public float minEnergyReceived() {
public double minEnergyReceived() {
return 0;
}
@Override
public float maxEnergyReceived() {
public double maxEnergyReceived() {
return 50;
}
@Override
protected EnergyStage computeEnergyStage() {
float energyLevel = getEnergyLevel();
double energyLevel = getEnergyLevel();
if (energyLevel < 0.25f)
return EnergyStage.BLUE;
else if (energyLevel < 0.5f)
@ -91,17 +91,17 @@ public class TileEngineWood extends TileEngine {
}
@Override
public float getMaxEnergy() {
public double getMaxEnergy() {
return 100;
}
@Override
public float getCurrentOutput() {
public double getCurrentOutput() {
return OUTPUT;
}
@Override
public float maxEnergyExtracted() {
public double maxEnergyExtracted() {
return 1 + PowerHandler.PerditionCalculator.MIN_POWERLOSS;
}
}

View file

@ -15,6 +15,7 @@ import buildcraft.energy.TileEngine;
import buildcraft.energy.TileEngine.EnergyStage;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Locale;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
@ -24,26 +25,17 @@ public class TriggerEngineHeat extends BCTrigger implements ITileTrigger {
public EnergyStage stage;
@SideOnly(Side.CLIENT)
private Icon iconBlue, iconGreen, iconYellow, iconRed;
private Icon icon;
public TriggerEngineHeat(int id, EnergyStage stage, String uniqueTag) {
super(id, uniqueTag);
public TriggerEngineHeat(EnergyStage stage) {
super("buildcraft:engine.stage." + stage.name().toLowerCase(Locale.ENGLISH), "buildcraft.engine.stage." + stage.name().toLowerCase(Locale.ENGLISH));
this.stage = stage;
}
@Override
public String getDescription() {
switch (stage) {
case BLUE:
return StringUtils.localize("gate.trigger.engine.blue");
case GREEN:
return StringUtils.localize("gate.trigger.engine.green");
case YELLOW:
return StringUtils.localize("gate.trigger.engine.yellow");
default:
return StringUtils.localize("gate.trigger.engine.red");
}
return StringUtils.localize("gate.trigger.engine." + stage.name().toLowerCase(Locale.ENGLISH));
}
@Override
@ -60,24 +52,12 @@ public class TriggerEngineHeat extends BCTrigger implements ITileTrigger {
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon() {
switch (stage) {
case BLUE:
return iconBlue;
case GREEN:
return iconGreen;
case YELLOW:
return iconYellow;
default:
return iconRed;
}
return icon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
iconBlue = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_blue");
iconGreen = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_green");
iconYellow = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_yellow");
iconRed = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_red");
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_" + stage.name().toLowerCase(Locale.ENGLISH));
}
}

View file

@ -148,9 +148,9 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
return;
}
if (inProcess) {
float energyToUse = 2 + powerHandler.getEnergyStored() / 500;
double energyToUse = 2 + powerHandler.getEnergyStored() / 500;
float energy = powerHandler.useEnergy(energyToUse, energyToUse, true);
double energy = powerHandler.useEnergy(energyToUse, energyToUse, true);
if (energy > 0) {
moveHead(0.1 + energy / 200F);

View file

@ -158,7 +158,7 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowe
if (!time.markTimeIfDelay(worldObj, currentRecipe.timeRequired))
return;
float energyUsed = powerHandler.useEnergy(currentRecipe.energyCost, currentRecipe.energyCost, true);
double energyUsed = powerHandler.useEnergy(currentRecipe.energyCost, currentRecipe.energyCost, true);
if (energyUsed != 0) {
if (consumeInput(currentRecipe.ingredient1) && consumeInput(currentRecipe.ingredient2)) {

View file

@ -19,8 +19,8 @@ import net.minecraft.world.World;
public class BlockLaserTable extends BlockContainer {
@SideOnly(Side.CLIENT)
private Icon[][] icons;
@SideOnly(Side.CLIENT)
private Icon[][] icons;
public BlockLaserTable(int i) {
super(i, Material.iron);
@ -64,14 +64,22 @@ public class BlockLaserTable extends BlockContainer {
}
@Override
public Icon getIcon(int i, int j) {
int s = i > 1 ? 2 : i;
return icons[j][s];
public Icon getIcon(int side, int meta) {
int s = side > 1 ? 2 : side;
return icons[meta][s];
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return metadata == 0 ? new TileAssemblyTable() : new TileAdvancedCraftingTable();
switch (metadata) {
case 0:
return new TileAssemblyTable();
case 1:
return new TileAdvancedCraftingTable();
case 2:
return new TileIntegrationTable();
}
return null;
}
@Override
@ -84,26 +92,33 @@ public class BlockLaserTable extends BlockContainer {
return par1;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
par3List.add(new ItemStack(this, 1, 0));
par3List.add(new ItemStack(this, 1, 1));
par3List.add(new ItemStack(this, 1, 2));
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
icons = new Icon[2][];
icons[0] = new Icon[3];
icons[1] = new Icon[3];
icons[0][0] = par1IconRegister.registerIcon("buildcraft:assemblytable_bottom");
icons[1][0] = par1IconRegister.registerIcon("buildcraft:advworkbenchtable_bottom");
icons[0][1] = par1IconRegister.registerIcon("buildcraft:assemblytable_top");
icons[1][1] = par1IconRegister.registerIcon("buildcraft:advworkbenchtable_top");
icons[0][2] = par1IconRegister.registerIcon("buildcraft:assemblytable_side");
icons[1][2] = par1IconRegister.registerIcon("buildcraft:advworkbenchtable_side");
public void registerIcons(IconRegister par1IconRegister) {
icons = new Icon[3][];
icons[0] = new Icon[3];
icons[1] = new Icon[3];
icons[2] = new Icon[3];
icons[0][0] = par1IconRegister.registerIcon("buildcraft:assemblytable_bottom");
icons[0][1] = par1IconRegister.registerIcon("buildcraft:assemblytable_top");
icons[0][2] = par1IconRegister.registerIcon("buildcraft:assemblytable_side");
icons[1][0] = par1IconRegister.registerIcon("buildcraft:advworkbenchtable_bottom");
icons[1][1] = par1IconRegister.registerIcon("buildcraft:advworkbenchtable_top");
icons[1][2] = par1IconRegister.registerIcon("buildcraft:advworkbenchtable_side");
icons[2][0] = par1IconRegister.registerIcon("buildcraft:integrationtable_bottom");
icons[2][1] = par1IconRegister.registerIcon("buildcraft:integrationtable_top");
icons[2][2] = par1IconRegister.registerIcon("buildcraft:integrationtable_side");
}
}

View file

@ -2,8 +2,10 @@ package buildcraft.silicon;
import buildcraft.silicon.gui.ContainerAdvancedCraftingTable;
import buildcraft.silicon.gui.ContainerAssemblyTable;
import buildcraft.silicon.gui.ContainerIntegrationTable;
import buildcraft.silicon.gui.GuiAdvancedCraftingTable;
import buildcraft.silicon.gui.GuiAssemblyTable;
import buildcraft.silicon.gui.GuiIntegrationTable;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
@ -21,17 +23,22 @@ public class GuiHandler implements IGuiHandler {
switch (ID) {
case 0:
if (!(tile instanceof TileAssemblyTable))
return null;
return new GuiAssemblyTable(player.inventory, (TileAssemblyTable) tile);
case 0:
if (!(tile instanceof TileAssemblyTable))
return null;
return new GuiAssemblyTable(player.inventory, (TileAssemblyTable) tile);
case 1:
if (!(tile instanceof TileAdvancedCraftingTable))
case 1:
if (!(tile instanceof TileAdvancedCraftingTable))
return null;
return new GuiAdvancedCraftingTable(player.inventory, (TileAdvancedCraftingTable) tile);
case 2:
if (!(tile instanceof TileIntegrationTable))
return null;
return new GuiIntegrationTable(player.inventory, (TileIntegrationTable) tile);
default:
return null;
return new GuiAdvancedCraftingTable(player.inventory, (TileAdvancedCraftingTable) tile);
default:
return null;
}
}
@ -45,18 +52,22 @@ public class GuiHandler implements IGuiHandler {
switch (ID) {
case 0:
if (!(tile instanceof TileAssemblyTable))
return null;
return new ContainerAssemblyTable(player.inventory, (TileAssemblyTable) tile);
case 0:
if (!(tile instanceof TileAssemblyTable))
return null;
return new ContainerAssemblyTable(player.inventory, (TileAssemblyTable) tile);
case 1:
if (!(tile instanceof TileAdvancedCraftingTable))
case 1:
if (!(tile instanceof TileAdvancedCraftingTable))
return null;
return new ContainerAdvancedCraftingTable(player.inventory, (TileAdvancedCraftingTable) tile);
case 2:
if (!(tile instanceof TileIntegrationTable))
return null;
return new ContainerIntegrationTable(player.inventory, (TileIntegrationTable) tile);
default:
return null;
return new ContainerAdvancedCraftingTable(player.inventory, (TileAdvancedCraftingTable) tile);
default:
return null;
}
}
}

View file

@ -4,6 +4,7 @@ import buildcraft.core.ItemBlockBuildCraft;
import net.minecraft.item.ItemStack;
public class ItemLaserTable extends ItemBlockBuildCraft {
public ItemLaserTable(int par1) {
super(par1);
setMaxDamage(0);
@ -11,12 +12,20 @@ public class ItemLaserTable extends ItemBlockBuildCraft {
}
@Override
public String getUnlocalizedName(ItemStack par1ItemStack) {
return par1ItemStack.getItemDamage() == 0 ? "tile.assemblyTableBlock" : "tile.assemblyWorkbenchBlock";
public String getUnlocalizedName(ItemStack stack) {
switch (stack.getItemDamage()) {
case 0:
return "tile.assemblyTableBlock";
case 1:
return "tile.assemblyWorkbenchBlock";
case 2:
return "tile.integrationTableBlock";
}
return super.getUnlocalizedName();
}
@Override
public int getMetadata(int par1) {
return par1 == 1 ? 1 : 0;
public int getMetadata(int meta) {
return meta <= 2 ? meta : 0;
}
}

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

@ -21,13 +21,13 @@ import buildcraft.core.network.PacketSlotChange;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.ActionMachineControl;
import buildcraft.core.utils.CraftingHelper;
import buildcraft.core.utils.StringUtils;
import buildcraft.core.utils.Utils;
import com.google.common.collect.Lists;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.InventoryCraftResult;
@ -48,7 +48,7 @@ import static net.minecraftforge.common.ForgeDirection.WEST;
import net.minecraftforge.oredict.OreDictionary;
import org.bouncycastle.util.Arrays;
public class TileAdvancedCraftingTable extends TileEntity implements IInventory, ILaserTarget, IMachine, IActionReceptor, ISidedInventory {
public class TileAdvancedCraftingTable extends TileLaserTableBase implements IInventory, ILaserTarget, IMachine, IActionReceptor, ISidedInventory {
private final class InternalInventoryCraftingContainer extends Container {
@ -161,75 +161,51 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
public TileAdvancedCraftingTable() {
craftingSlots = new CraftingGrid();
storageSlots = new SimpleInventory(24, "StorageSlots", 64);
storageSlots.addListener(this);
invInput = new InventoryMapper(storageSlots, 0, 15);
invOutput = new InventoryMapper(storageSlots, 15, 9);
inv.addListener(this);
invInput = new InventoryMapper(inv, 0, 15);
invOutput = new InventoryMapper(inv, 15, 9);
craftResult = new InventoryCraftResult();
}
private static final int[] SLOTS = Utils.createSlotArray(0, 24);
private static final EnumSet<ForgeDirection> SEARCH_SIDES = EnumSet.of(DOWN, NORTH, SOUTH, EAST, WEST);
private static final float REQUIRED_POWER = 500F;
private final CraftingGrid craftingSlots;
private final SimpleInventory storageSlots;
private final InventoryMapper invInput;
private final InventoryMapper invOutput;
private SlotCrafting craftSlot;
private float storedEnergy;
private float[] recentEnergy = new float[20];
private boolean craftable;
private boolean justCrafted;
private int tick;
private int recentEnergyAverage;
private InternalPlayer internalPlayer;
private IRecipe currentRecipe;
private ActionMachineControl.Mode lastMode = ActionMachineControl.Mode.Unknown;
private TileBuffer[] cache;
@Override
public int getSizeInventory() {
return storageSlots.getSizeInventory();
}
@Override
public ItemStack getStackInSlot(int slot) {
return storageSlots.getStackInSlot(slot);
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
return storageSlots.decrStackSize(slot, amount);
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
return storageSlots.getStackInSlotOnClosing(slot);
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
storageSlots.setInventorySlotContents(slot, stack);
}
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
storageSlots.writeToNBT(data, "StorageSlots");
craftingSlots.writeToNBT(data);
data.setFloat("StoredEnergy", storedEnergy);
craftingSlots.writeToNBT(data, "craftingSlots");
}
@Override
public void readFromNBT(NBTTagCompound data) {
super.readFromNBT(data);
storageSlots.readFromNBT(data, "StorageSlots");
craftingSlots.readFromNBT(data);
storedEnergy = data.getFloat("StoredEnergy");
if (data.hasKey("StorageSlots"))
inv.readFromNBT(data, "StorageSlots");
if (data.hasKey("items"))
craftingSlots.readFromNBT(data);
else
craftingSlots.readFromNBT(data, "craftingSlots");
}
@Override
public int getSizeInventory() {
return 24;
}
@Override
public String getInvName() {
return "AdvancedWorkbench";
return StringUtils.localize("tile.assemblyWorkbenchBlock");
}
@Override
@ -239,37 +215,12 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
}
@Override
public int getInventoryStackLimit() {
return storageSlots.getInventoryStackLimit();
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == this;
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
public int getRecentEnergyAverage() {
return recentEnergyAverage;
}
public float getStoredEnergy() {
return storedEnergy;
}
public float getRequiredEnergy() {
public double getRequiredEnergy() {
return craftResult.getStackInSlot(0) != null ? REQUIRED_POWER : 0f;
}
public int getProgressScaled(int i) {
return (int) ((storedEnergy * i) / REQUIRED_POWER);
return (int) ((getEnergy() * i) / REQUIRED_POWER);
}
@Override
@ -295,11 +246,8 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
locateAndBindIngredients();
updateRecipeOutputDisplay();
justCrafted = false;
tick++;
tick = tick % recentEnergy.length;
recentEnergy[tick] = 0.0f;
if (canCraftAndOutput()) {
if (storedEnergy >= getRequiredEnergy()) {
if (getEnergy() >= getRequiredEnergy()) {
craftItem();
justCrafted = true;
}
@ -307,7 +255,7 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
craftable = false;
internalInventoryCrafting.tempStacks = null;
internalInventoryCrafting.hitCount = null;
storedEnergy = 0;
setEnergy(0);
}
}
@ -321,7 +269,7 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
}
private void locateAndBindIngredients() {
internalInventoryCrafting.tempStacks = new InventoryCopy(storageSlots).getItemStacks();
internalInventoryCrafting.tempStacks = new InventoryCopy(inv).getItemStacks();
internalInventoryCrafting.hitCount = new int[internalInventoryCrafting.tempStacks.length];
ItemStack[] inputSlots = internalInventoryCrafting.tempStacks;
for (int gridSlot = 0; gridSlot < craftingSlots.getSizeInventory(); gridSlot++) {
@ -368,9 +316,9 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
if (tempStorage[i] != null && tempStorage[i].stackSize <= 0) {
tempStorage[i] = null;
}
storageSlots.getItemStacks()[i] = tempStorage[i];
inv.getItemStacks()[i] = tempStorage[i];
}
storedEnergy -= getRequiredEnergy();
subtractEnergy(getRequiredEnergy());
List<ItemStack> outputs = Lists.newArrayList(recipeOutput.copy());
for (int i = 0; i < internalPlayer.inventory.mainInventory.length; i++) {
if (internalPlayer.inventory.mainInventory[i] != null) {
@ -465,29 +413,8 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
}
@Override
public boolean requiresLaserEnergy() {
return craftable && !justCrafted && lastMode != ActionMachineControl.Mode.Off && storedEnergy < REQUIRED_POWER * 10;
}
@Override
public void receiveLaserEnergy(float energy) {
storedEnergy += energy;
recentEnergy[tick] += energy;
}
@Override
public int getXCoord() {
return xCoord;
}
@Override
public int getYCoord() {
return yCoord;
}
@Override
public int getZCoord() {
return zCoord;
public boolean canCraft() {
return craftable && !justCrafted && lastMode != ActionMachineControl.Mode.Off;
}
@Override
@ -510,38 +437,6 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
return action == BuildCraftCore.actionOn || action == BuildCraftCore.actionOff;
}
public void getGUINetworkData(int id, int data) {
int currentStored = (int) (storedEnergy * 100.0);
switch (id) {
case 1:
currentStored = (currentStored & 0xFFFF0000) | (data & 0xFFFF);
storedEnergy = (currentStored / 100.0f);
break;
case 3:
currentStored = (currentStored & 0xFFFF) | ((data & 0xFFFF) << 16);
storedEnergy = (currentStored / 100.0f);
break;
case 4:
recentEnergyAverage = recentEnergyAverage & 0xFFFF0000 | (data & 0xFFFF);
break;
case 5:
recentEnergyAverage = (recentEnergyAverage & 0xFFFF) | ((data & 0xFFFF) << 16);
break;
}
}
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
int currentStored = (int) (storedEnergy * 100.0);
int lRecentEnergy = 0;
for (int i = 0; i < recentEnergy.length; i++) {
lRecentEnergy += (int) (recentEnergy[i] * 100.0 / (recentEnergy.length - 1));
}
iCrafting.sendProgressBarUpdate(container, 1, currentStored & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 3, (currentStored >>> 16) & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 4, lRecentEnergy & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 5, (lRecentEnergy >>> 16) & 0xFFFF);
}
@Override
public boolean isInvNameLocalized() {
// TODO Auto-generated method stub
@ -576,9 +471,4 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
lastMode = ActionMachineControl.Mode.Off;
}
}
@Override
public boolean isInvalidTarget() {
return isInvalid();
}
}

View file

@ -1,16 +1,15 @@
package buildcraft.silicon;
import buildcraft.core.recipes.AssemblyRecipeManager;
import buildcraft.api.power.ILaserTarget;
import buildcraft.api.gates.IAction;
import buildcraft.core.DefaultProps;
import buildcraft.core.IMachine;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.network.PacketIds;
import buildcraft.core.network.PacketNBT;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
import buildcraft.core.recipes.AssemblyRecipeManager.AssemblyRecipe;
import buildcraft.core.utils.StringUtils;
import cpw.mods.fml.common.FMLCommonHandler;
import java.util.LinkedHashSet;
import java.util.LinkedList;
@ -18,25 +17,16 @@ import java.util.List;
import java.util.Set;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
public class TileAssemblyTable extends TileEntity implements IMachine, IInventory, ILaserTarget {
public class TileAssemblyTable extends TileLaserTableBase implements IMachine, IInventory {
ItemStack[] items = new ItemStack[12];
Set<AssemblyRecipe> plannedOutput = new LinkedHashSet<AssemblyRecipe>();
public AssemblyRecipe currentRecipe;
private double currentRequiredEnergy = 0;
private float energyStored = 0;
private double[] recentEnergy = new double[20];
private int tick = 0;
private int recentEnergyAverage;
public static class SelectionMessage {
@ -77,10 +67,6 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
@Override
public void updateEntity() { // WARNING: run only server-side, see canUpdate()
tick++;
tick = tick % recentEnergy.length;
recentEnergy[tick] = 0.0f;
if (currentRecipe == null)
return;
@ -91,8 +77,8 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
return;
}
if (energyStored >= currentRecipe.getEnergyCost()) {
energyStored = 0;
if (getEnergy() >= currentRecipe.getEnergyCost()) {
setEnergy(0);
if (currentRecipe.canBeDone(this)) {
@ -116,85 +102,30 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
}
}
public double getCompletionRatio(float ratio) {
if (currentRecipe == null)
return 0;
else if (energyStored >= currentRequiredEnergy)
return ratio;
else
return energyStored / currentRequiredEnergy * ratio;
}
/* IINVENTORY */
@Override
public int getSizeInventory() {
return items.length;
return 12;
}
@Override
public ItemStack getStackInSlot(int i) {
return items[i];
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack stack = items[i].splitStack(j);
if (items[i].stackSize == 0) {
items[i] = null;
}
return stack;
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
items[i] = itemstack;
public void setInventorySlotContents(int slot, ItemStack stack) {
super.setInventorySlotContents(slot, stack);
if (currentRecipe == null) {
setNextCurrentRecipe();
}
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
if (this.items[slot] == null)
return null;
ItemStack stackToTake = this.items[slot];
this.items[slot] = null;
return stackToTake;
}
@Override
public String getInvName() {
return "Assembly Table";
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == this;
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
return StringUtils.localize("tile.assemblyTableBlock");
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
InvUtils.readStacksFromNBT(nbt, "items", items);
energyStored = nbt.getFloat("energyStored");
NBTTagList list = nbt.getTagList("planned");
for (int i = 0; i < list.tagCount(); ++i) {
@ -226,10 +157,6 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
InvUtils.writeStacksToNBT(nbt, "items", items);
nbt.setFloat("energyStored", energyStored);
NBTTagList list = new NBTTagList();
for (AssemblyRecipe recipe : plannedOutput) {
@ -260,11 +187,14 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
private void setCurrentRecipe(AssemblyRecipe recipe) {
this.currentRecipe = recipe;
if (recipe != null) {
this.currentRequiredEnergy = recipe.getEnergyCost();
} else {
this.currentRequiredEnergy = 0;
}
@Override
public double getRequiredEnergy() {
if (currentRecipe != null) {
return currentRecipe.getEnergyCost();
}
return 0;
}
public void planOutput(AssemblyRecipe recipe) {
@ -347,51 +277,6 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
}
}
/* SMP GUI */
public void getGUINetworkData(int i, int j) {
int currentStored = (int) (energyStored * 100.0);
int requiredEnergy = (int) (currentRequiredEnergy * 100.0);
switch (i) {
case 0:
requiredEnergy = (requiredEnergy & 0xFFFF0000) | (j & 0xFFFF);
currentRequiredEnergy = (requiredEnergy / 100.0f);
break;
case 1:
currentStored = (currentStored & 0xFFFF0000) | (j & 0xFFFF);
energyStored = (currentStored / 100.0f);
break;
case 2:
requiredEnergy = (requiredEnergy & 0xFFFF) | ((j & 0xFFFF) << 16);
currentRequiredEnergy = (requiredEnergy / 100.0f);
break;
case 3:
currentStored = (currentStored & 0xFFFF) | ((j & 0xFFFF) << 16);
energyStored = (currentStored / 100.0f);
break;
case 4:
recentEnergyAverage = recentEnergyAverage & 0xFFFF0000 | (j & 0xFFFF);
break;
case 5:
recentEnergyAverage = (recentEnergyAverage & 0xFFFF) | ((j & 0xFFFF) << 16);
break;
}
}
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
int requiredEnergy = (int) (currentRequiredEnergy * 100.0);
int currentStored = (int) (energyStored * 100.0);
int lRecentEnergy = 0;
for (int i = 0; i < recentEnergy.length; i++) {
lRecentEnergy += (int) (recentEnergy[i] * 100.0 / (recentEnergy.length - 1));
}
iCrafting.sendProgressBarUpdate(container, 0, requiredEnergy & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 1, currentStored & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 2, (requiredEnergy >>> 16) & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 3, (currentStored >>> 16) & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 4, lRecentEnergy & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 5, (lRecentEnergy >>> 16) & 0xFFFF);
}
@Override
public boolean isActive() {
return currentRecipe != null;
@ -412,42 +297,9 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
return false;
}
public int getRecentEnergyAverage() {
return recentEnergyAverage;
}
public float getStoredEnergy() {
return energyStored;
}
public double getRequiredEnergy() {
return currentRequiredEnergy;
}
@Override
public boolean requiresLaserEnergy() {
return currentRecipe != null && energyStored < currentRequiredEnergy * 5F;
}
@Override
public void receiveLaserEnergy(float energy) {
energyStored += energy;
recentEnergy[tick] += energy;
}
@Override
public int getXCoord() {
return xCoord;
}
@Override
public int getYCoord() {
return yCoord;
}
@Override
public int getZCoord() {
return zCoord;
public boolean canCraft() {
return currentRecipe != null;
}
@Override
@ -457,12 +309,7 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
public boolean isItemValidForSlot(int slot, ItemStack stack) {
return true;
}
@Override
public boolean isInvalidTarget() {
return isInvalid();
}
}

View file

@ -0,0 +1,173 @@
/*
* 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;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.recipes.IIntegrationRecipeManager.IIntegrationRecipe;
import buildcraft.core.inventory.ITransactor;
import buildcraft.core.inventory.InventoryMapper;
import buildcraft.core.inventory.SimpleInventory;
import buildcraft.core.inventory.StackHelper;
import buildcraft.core.inventory.Transactor;
import buildcraft.core.utils.StringUtils;
import buildcraft.core.utils.Utils;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class TileIntegrationTable extends TileLaserTableBase implements ISidedInventory {
public static final int SLOT_INPUT_A = 0;
public static final int SLOT_INPUT_B = 1;
public static final int SLOT_OUTPUT = 2;
private static final int CYCLE_LENGTH = 32;
private static final int[] SLOTS = Utils.createSlotArray(0, 3);
private int tick = 0;
private SimpleInventory invRecipeOutput = new SimpleInventory(1, "integrationOutput", 64);
private InventoryMapper invOutput = new InventoryMapper(inv, SLOT_OUTPUT, 1, false);
private IIntegrationRecipe currentRecipe;
private boolean canCraft = false;
public IInventory getRecipeOutput() {
return invRecipeOutput;
}
@Override
public void updateEntity() {
super.updateEntity();
if (worldObj.isRemote)
return;
tick++;
if (tick % CYCLE_LENGTH != 0)
return;
canCraft = false;
currentRecipe = findMatchingRecipe();
if (currentRecipe == null) {
setEnergy(0);
return;
}
ItemStack inputA = inv.getStackInSlot(SLOT_INPUT_A);
ItemStack inputB = inv.getStackInSlot(SLOT_INPUT_B);
ItemStack output = currentRecipe.getOutputForInputs(inputA, inputB);
invRecipeOutput.setInventorySlotContents(0, output);
if (!isRoomForOutput(output)) {
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() {
ItemStack inputA = inv.getStackInSlot(SLOT_INPUT_A);
ItemStack inputB = inv.getStackInSlot(SLOT_INPUT_B);
for (IIntegrationRecipe recipe : BuildcraftRecipes.integrationTable.getRecipes()) {
if (recipe.isValidInputA(inputA) && recipe.isValidInputB(inputB))
return recipe;
}
return null;
}
private boolean isRoomForOutput(ItemStack output) {
ItemStack existingOutput = inv.getStackInSlot(SLOT_OUTPUT);
if (existingOutput == null)
return true;
if (StackHelper.instance().canStacksMerge(output, existingOutput) && output.stackSize + existingOutput.stackSize <= output.getMaxStackSize())
return true;
return false;
}
@Override
public double getRequiredEnergy() {
if (currentRecipe != null) {
return currentRecipe.getEnergyCost();
}
return 0.0;
}
@Override
public boolean canCraft() {
return canCraft;
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
switch (slot) {
case SLOT_INPUT_A:
return isValidInputA(stack);
case SLOT_INPUT_B:
return isValidInputB(stack);
}
return false;
}
private boolean isValidInputA(ItemStack stack) {
ItemStack inputB = inv.getStackInSlot(SLOT_INPUT_B);
for (IIntegrationRecipe recipe : BuildcraftRecipes.integrationTable.getRecipes()) {
if (recipe.isValidInputA(stack) && (inputB == null || recipe.isValidInputB(inputB)))
return true;
}
return false;
}
private boolean isValidInputB(ItemStack stack) {
ItemStack inputA = inv.getStackInSlot(SLOT_INPUT_A);
for (IIntegrationRecipe recipe : BuildcraftRecipes.integrationTable.getRecipes()) {
if (recipe.isValidInputB(stack) && (inputA == null || recipe.isValidInputA(inputA)))
return true;
}
return false;
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return SLOTS;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side) {
return isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side) {
return slot == SLOT_OUTPUT;
}
@Override
public int getSizeInventory() {
return 3;
}
@Override
public String getInvName() {
return StringUtils.localize("tile.integrationTableBlock");
}
}

View file

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

View file

@ -0,0 +1,199 @@
/*
* 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;
import buildcraft.api.power.ILaserTarget;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.inventory.SimpleInventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public abstract class TileLaserTableBase extends TileBuildCraft implements ILaserTarget, IInventory {
public double clientRequiredEnergy = 0;
protected SimpleInventory inv = new SimpleInventory(getSizeInventory(), "inv", 64);
private double[] recentEnergy = new double[20];
private double energy = 0;
private int tick = 0;
private int recentEnergyAverage;
@Override
public void updateEntity() {
tick++;
tick = tick % recentEnergy.length;
recentEnergy[tick] = 0.0f;
}
public double getEnergy() {
return energy;
}
public void setEnergy(double energy) {
this.energy = energy;
}
public void addEnergy(double energy) {
this.energy += energy;
}
public void subtractEnergy(double energy) {
this.energy -= energy;
}
public abstract double getRequiredEnergy();
public int getProgressScaled(int ratio) {
if (clientRequiredEnergy == 0.0)
return 0;
if (energy >= clientRequiredEnergy)
return ratio;
return (int) (energy / clientRequiredEnergy * ratio);
}
public int getRecentEnergyAverage() {
return recentEnergyAverage;
}
public abstract boolean canCraft();
@Override
public boolean requiresLaserEnergy() {
return canCraft() && energy < getRequiredEnergy() * 5F;
}
@Override
public void receiveLaserEnergy(double energy) {
this.energy += energy;
recentEnergy[tick] += energy;
}
@Override
public boolean isInvalidTarget() {
return isInvalid();
}
@Override
public int getXCoord() {
return xCoord;
}
@Override
public int getYCoord() {
return yCoord;
}
@Override
public int getZCoord() {
return zCoord;
}
@Override
public ItemStack getStackInSlot(int slot) {
return inv.getStackInSlot(slot);
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
return inv.decrStackSize(slot, amount);
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
return null;
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
inv.setInventorySlotContents(slot, stack);
}
@Override
public int getInventoryStackLimit() {
return inv.getInventoryStackLimit();
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == this && !isInvalid();
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
inv.writeToNBT(nbt, "inv");
nbt.setDouble("energy", energy);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
inv.readFromNBT(nbt, "inv");
energy = nbt.getDouble("energy");
}
public void getGUINetworkData(int id, int data) {
int currentStored = (int) (energy * 100.0);
int requiredEnergy = (int) (clientRequiredEnergy * 100.0);
switch (id) {
case 0:
requiredEnergy = (requiredEnergy & 0xFFFF0000) | (data & 0xFFFF);
clientRequiredEnergy = (requiredEnergy / 100.0f);
break;
case 1:
currentStored = (currentStored & 0xFFFF0000) | (data & 0xFFFF);
energy = (currentStored / 100.0f);
break;
case 2:
requiredEnergy = (requiredEnergy & 0xFFFF) | ((data & 0xFFFF) << 16);
clientRequiredEnergy = (requiredEnergy / 100.0f);
break;
case 3:
currentStored = (currentStored & 0xFFFF) | ((data & 0xFFFF) << 16);
energy = (currentStored / 100.0f);
break;
case 4:
recentEnergyAverage = recentEnergyAverage & 0xFFFF0000 | (data & 0xFFFF);
break;
case 5:
recentEnergyAverage = (recentEnergyAverage & 0xFFFF) | ((data & 0xFFFF) << 16);
break;
}
}
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
int requiredEnergy = (int) (getRequiredEnergy() * 100.0);
int currentStored = (int) (energy * 100.0);
int lRecentEnergy = 0;
for (int i = 0; i < recentEnergy.length; i++) {
lRecentEnergy += (int) (recentEnergy[i] * 100.0 / (recentEnergy.length - 1));
}
iCrafting.sendProgressBarUpdate(container, 0, requiredEnergy & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 1, currentStored & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 2, (requiredEnergy >>> 16) & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 3, (currentStored >>> 16) & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 4, lRecentEnergy & 0xFFFF);
iCrafting.sendProgressBarUpdate(container, 5, (lRecentEnergy >>> 16) & 0xFFFF);
}
}

View file

@ -0,0 +1,55 @@
package buildcraft.silicon.gui;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.slots.SlotOutput;
import buildcraft.core.gui.slots.SlotUntouchable;
import buildcraft.core.gui.slots.SlotValidated;
import buildcraft.silicon.TileIntegrationTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
public class ContainerIntegrationTable extends BuildCraftContainer {
private TileIntegrationTable table;
public ContainerIntegrationTable(InventoryPlayer playerInventory, TileIntegrationTable table) {
super(table.getSizeInventory());
this.table = table;
addSlot(new SlotValidated(table, TileIntegrationTable.SLOT_INPUT_A, 17, 28));
addSlot(new SlotValidated(table, TileIntegrationTable.SLOT_INPUT_B, 53, 28));
addSlot(new SlotOutput(table, TileIntegrationTable.SLOT_OUTPUT, 143, 44));
addSlot(new SlotUntouchable(table.getRecipeOutput(), 0, 116, 44));
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(playerInventory, x + y * 9 + 9, 8 + x * 18, 84 + y * 18));
}
}
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(playerInventory, x, 8 + x * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return table.isUseableByPlayer(var1);
}
@SuppressWarnings("rawtypes")
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < crafters.size(); i++) {
table.sendGUINetworkData(this, (ICrafting) crafters.get(i));
}
}
@Override
public void updateProgressBar(int par1, int par2) {
table.getGUINetworkData(par1, par2);
}
}

View file

@ -1,94 +1,33 @@
package buildcraft.silicon.gui;
import buildcraft.BuildCraftCore;
import buildcraft.core.CoreIconProvider;
import buildcraft.core.DefaultProps;
import buildcraft.core.gui.GuiBuildCraft;
import buildcraft.core.utils.StringUtils;
import buildcraft.silicon.TileAdvancedCraftingTable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiAdvancedCraftingTable extends GuiBuildCraft {
public class GuiAdvancedCraftingTable extends GuiLaserTable {
public static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/assembly_advancedworkbench.png");
class AssemblyWorkbenchLedger extends Ledger {
int headerColour = 0xe1c92f;
int subheaderColour = 0xaaafb8;
int textColour = 0x000000;
public AssemblyWorkbenchLedger() {
maxHeight = 94;
overlayColor = 0xd46c1f;
}
@Override
public void draw(int x, int y) {
// Draw background
drawBackground(x, y);
// Draw icon
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
drawIcon(BuildCraftCore.iconProvider.getIcon(CoreIconProvider.ENERGY), x + 3, y + 4);
if (!isFullyOpened())
return;
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.energy"), x + 22, y + 8, headerColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyCurrentRequired") + ":", x + 22, y + 20, subheaderColour);
fontRenderer.drawString(String.format("%2.1f MJ", workbench.getRequiredEnergy()), x + 22, y + 32, textColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
fontRenderer.drawString(String.format("%2.1f MJ", workbench.getStoredEnergy()), x + 22, y + 56, textColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyRate") + ":", x + 22, y + 68, subheaderColour);
fontRenderer.drawString(String.format("%3.2f MJ/t", workbench.getRecentEnergyAverage() / 100.0f), x + 22, y + 80, textColour);
}
@Override
public String getTooltip() {
return String.format("%3.2f MJ/t", workbench.getRecentEnergyAverage() / 100.0f);
}
}
TileAdvancedCraftingTable workbench;
private final TileAdvancedCraftingTable workbench;
public GuiAdvancedCraftingTable(InventoryPlayer playerInventory, TileAdvancedCraftingTable advancedWorkbench) {
super(new ContainerAdvancedCraftingTable(playerInventory, advancedWorkbench), advancedWorkbench, TEXTURE);
super(playerInventory, new ContainerAdvancedCraftingTable(playerInventory, advancedWorkbench), advancedWorkbench, TEXTURE);
this.workbench = advancedWorkbench;
xSize = 175;
ySize = 240;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
String title = StringUtils.localize("tile.assemblyWorkbenchBlock");
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 97, 0x404040);
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(TEXTURE);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
if (workbench.getStoredEnergy() > 0) {
if (workbench.getEnergy() > 0) {
int progress = workbench.getProgressScaled(24);
drawTexturedModalRect(cornerX + 93, cornerY + 32, 176, 0, progress + 1, 18);
}
}
@Override
protected void initLedgers(IInventory inventory) {
super.initLedgers(inventory);
ledgerManager.add(new AssemblyWorkbenchLedger());
}
}

View file

@ -21,6 +21,7 @@ import buildcraft.silicon.TileAssemblyTable;
import buildcraft.silicon.TileAssemblyTable.SelectionMessage;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -30,15 +31,14 @@ import org.lwjgl.opengl.GL11;
public class GuiAssemblyTable extends GuiAdvancedInterface {
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/assembly_table.png");
TileAssemblyTable assemblyTable;
class AssemblyLedger extends Ledger {
private class LaserTableLedger extends Ledger {
int headerColour = 0xe1c92f;
int subheaderColour = 0xaaafb8;
int textColour = 0x000000;
public AssemblyLedger() {
public LaserTableLedger() {
maxHeight = 94;
overlayColor = 0xd46c1f;
}
@ -50,7 +50,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
drawBackground(x, y);
// Draw icon
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
drawIcon(BuildCraftCore.iconProvider.getIcon(CoreIconProvider.ENERGY), x + 3, y + 4);
if (!isFullyOpened())
@ -58,19 +58,20 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.energy"), x + 22, y + 8, headerColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyCurrentRequired") + ":", x + 22, y + 20, subheaderColour);
fontRenderer.drawString(String.format("%2.1f MJ", assemblyTable.getRequiredEnergy()), x + 22, y + 32, textColour);
fontRenderer.drawString(String.format("%2.1f MJ", table.clientRequiredEnergy), x + 22, y + 32, textColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
fontRenderer.drawString(String.format("%2.1f MJ", assemblyTable.getStoredEnergy()), x + 22, y + 56, textColour);
fontRenderer.drawString(String.format("%2.1f MJ", table.getEnergy()), x + 22, y + 56, textColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyRate") + ":", x + 22, y + 68, subheaderColour);
fontRenderer.drawString(String.format("%3.2f MJ/t", assemblyTable.getRecentEnergyAverage() / 100.0f), x + 22, y + 80, textColour);
fontRenderer.drawString(String.format("%3.2f MJ/t", table.getRecentEnergyAverage() / 100.0f), x + 22, y + 80, textColour);
}
@Override
public String getTooltip() {
return String.format("%3.2f MJ/t", assemblyTable.getRecentEnergyAverage() / 100.0f);
return String.format("%3.2f MJ/t", table.getRecentEnergyAverage() / 100.0f);
}
}
private final TileAssemblyTable table;
class RecipeSlot extends AdvancedSlot {
@ -92,7 +93,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
public GuiAssemblyTable(IInventory playerInventory, TileAssemblyTable assemblyTable) {
super(new ContainerAssemblyTable(playerInventory, assemblyTable), assemblyTable, TEXTURE);
this.assemblyTable = assemblyTable;
this.table = assemblyTable;
xSize = 175;
ySize = 207;
@ -117,7 +118,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
}
public void updateRecipes() {
List<AssemblyRecipe> potentialRecipes = assemblyTable.getPotentialOutputs();
List<AssemblyRecipe> potentialRecipes = table.getPotentialOutputs();
Iterator<AssemblyRecipe> cur = potentialRecipes.iterator();
for (int p = 0; p < 8; ++p) {
@ -151,16 +152,16 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
for (int s = 0; s < slots.length; ++s) {
RecipeSlot slot = (RecipeSlot) slots[s];
if (assemblyTable.isAssembling(slot.recipe)) {
if (table.isAssembling(slot.recipe)) {
drawTexturedModalRect(cornerX + slot.x, cornerY + slot.y, 196, 1, 16, 16);
} else if (assemblyTable.isPlanned(slot.recipe)) {
} else if (table.isPlanned(slot.recipe)) {
drawTexturedModalRect(cornerX + slot.x, cornerY + slot.y, 177, 1, 16, 16);
}
}
int height = (int) assemblyTable.getCompletionRatio(70);
int h = table.getProgressScaled(70);
drawTexturedModalRect(cornerX + 95, cornerY + 36 + 70 - height, 176, 18, 4, height);
drawTexturedModalRect(cornerX + 95, cornerY + 36 + 70 - h, 176, 18, 4, h);
drawBackgroundSlots();
}
@ -182,19 +183,19 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
SelectionMessage message = new SelectionMessage();
if (assemblyTable.isPlanned(slot.recipe)) {
assemblyTable.cancelPlanOutput(slot.recipe);
if (table.isPlanned(slot.recipe)) {
table.cancelPlanOutput(slot.recipe);
message.select = false;
} else {
assemblyTable.planOutput(slot.recipe);
table.planOutput(slot.recipe);
message.select = true;
}
message.stack = slot.recipe.output;
if (CoreProxy.proxy.isRenderWorld(assemblyTable.worldObj)) {
if (CoreProxy.proxy.isRenderWorld(table.worldObj)) {
PacketNBT packet = new PacketNBT(PacketIds.SELECTION_ASSEMBLY, message.getNBT(), assemblyTable.xCoord, assemblyTable.yCoord, assemblyTable.zCoord);
PacketNBT packet = new PacketNBT(PacketIds.SELECTION_ASSEMBLY, message.getNBT(), table.xCoord, table.yCoord, table.zCoord);
CoreProxy.proxy.sendToServer(packet.getPacket());
}
@ -205,6 +206,6 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
@Override
protected void initLedgers(IInventory inventory) {
super.initLedgers(inventory);
ledgerManager.add(new AssemblyLedger());
ledgerManager.add(new LaserTableLedger());
}
}

View file

@ -0,0 +1,50 @@
package buildcraft.silicon.gui;
import buildcraft.core.DefaultProps;
import buildcraft.silicon.TileIntegrationTable;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiIntegrationTable extends GuiLaserTable {
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 boolean flash;
private int flashDelay;
public GuiIntegrationTable(InventoryPlayer playerInventory, TileIntegrationTable table) {
super(playerInventory, new ContainerIntegrationTable(playerInventory, table), table, TEXTURE);
this.integrationTable = table;
xSize = 175;
ySize = 166;
}
@Override
public void updateScreen() {
super.updateScreen();
if (flashDelay <= 0) {
flashDelay = FLASH_DELAY;
flash = !flash;
} else {
flashDelay--;
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(TEXTURE);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
if (integrationTable.getEnergy() > 0) {
if (flash)
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,77 @@
package buildcraft.silicon.gui;
import buildcraft.BuildCraftCore;
import buildcraft.core.CoreIconProvider;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.GuiBuildCraft;
import buildcraft.core.utils.StringUtils;
import buildcraft.silicon.TileLaserTableBase;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
public abstract class GuiLaserTable extends GuiBuildCraft {
private class LaserTableLedger extends Ledger {
int headerColour = 0xe1c92f;
int subheaderColour = 0xaaafb8;
int textColour = 0x000000;
public LaserTableLedger() {
maxHeight = 94;
overlayColor = 0xd46c1f;
}
@Override
public void draw(int x, int y) {
// Draw background
drawBackground(x, y);
// Draw icon
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
drawIcon(BuildCraftCore.iconProvider.getIcon(CoreIconProvider.ENERGY), x + 3, y + 4);
if (!isFullyOpened())
return;
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.energy"), x + 22, y + 8, headerColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyCurrentRequired") + ":", x + 22, y + 20, subheaderColour);
fontRenderer.drawString(String.format("%2.1f MJ", table.clientRequiredEnergy), x + 22, y + 32, textColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
fontRenderer.drawString(String.format("%2.1f MJ", table.getEnergy()), x + 22, y + 56, textColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyRate") + ":", x + 22, y + 68, subheaderColour);
fontRenderer.drawString(String.format("%3.2f MJ/t", table.getRecentEnergyAverage() / 100.0f), x + 22, y + 80, textColour);
}
@Override
public String getTooltip() {
return String.format("%3.2f MJ/t", table.getRecentEnergyAverage() / 100.0f);
}
}
protected final TileLaserTableBase table;
public GuiLaserTable(InventoryPlayer playerInventory, BuildCraftContainer container, TileLaserTableBase table, ResourceLocation texture) {
super(container, table, texture);
this.table = table;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
String title = table.getInvName();
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 97, 0x404040);
}
@Override
protected void initLedgers(IInventory inventory) {
super.initLedgers(inventory);
ledgerManager.add(new LaserTableLedger());
}
}

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

@ -264,22 +264,17 @@ public class BlockGenericPipe extends BlockBuildCraft {
}
}
private RaytraceResult doRayTrace(World world, int x, int y, int z, EntityPlayer entityPlayer) {
double pitch = Math.toRadians(entityPlayer.rotationPitch);
double yaw = Math.toRadians(entityPlayer.rotationYaw);
double dirX = -Math.sin(yaw) * Math.cos(pitch);
double dirY = -Math.sin(pitch);
double dirZ = Math.cos(yaw) * Math.cos(pitch);
private RaytraceResult doRayTrace(World world, int x, int y, int z, EntityPlayer player) {
double reachDistance = 5;
if (entityPlayer instanceof EntityPlayerMP) {
reachDistance = ((EntityPlayerMP) entityPlayer).theItemInWorldManager.getBlockReachDistance();
if (player instanceof EntityPlayerMP) {
reachDistance = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
}
Vec3 origin = Vec3.fakePool.getVecFromPool(entityPlayer.posX, entityPlayer.posY + 1.62 - entityPlayer.yOffset, entityPlayer.posZ);
Vec3 direction = origin.addVector(dirX * reachDistance, dirY * reachDistance, dirZ * reachDistance);
double eyeHeight = world.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight();
Vec3 lookVec = player.getLookVec();
Vec3 origin = world.getWorldVec3Pool().getVecFromPool(player.posX, player.posY + eyeHeight, player.posZ);
Vec3 direction = origin.addVector(lookVec.xCoord * reachDistance, lookVec.yCoord * reachDistance, lookVec.zCoord * reachDistance);
return doRayTrace(world, x, y, z, origin, direction);
}
@ -613,7 +608,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
if (isValid(pipe)) {
pipe.container.scheduleNeighborChange();
pipe.container.redstonePowered = world.isBlockIndirectlyGettingPowered(x, y, z);
pipe.container.redstoneInput = world.getBlockPowerInput(x, y, z);
}
}
@ -666,20 +661,20 @@ public class BlockGenericPipe extends BlockBuildCraft {
// Only check the instance at this point. Call the IToolWrench
// interface callbacks for the individual pipe/logic calls
return pipe.blockActivated(player);
else if (currentItem.getItem() == BuildCraftTransport.redPipeWire) {
if (addOrStripWire(player, pipe, PipeWire.Red)) {
else if (PipeWire.RED.isPipeWire(currentItem)) {
if (addOrStripWire(player, pipe, PipeWire.RED)) {
return true;
}
} else if (currentItem.getItem() == BuildCraftTransport.bluePipeWire) {
if (addOrStripWire(player, pipe, PipeWire.Blue)) {
} else if (PipeWire.BLUE.isPipeWire(currentItem)) {
if (addOrStripWire(player, pipe, PipeWire.BLUE)) {
return true;
}
} else if (currentItem.getItem() == BuildCraftTransport.greenPipeWire) {
if (addOrStripWire(player, pipe, PipeWire.Green)) {
} else if (PipeWire.GREEN.isPipeWire(currentItem)) {
if (addOrStripWire(player, pipe, PipeWire.GREEN)) {
return true;
}
} else if (currentItem.getItem() == BuildCraftTransport.yellowPipeWire) {
if (addOrStripWire(player, pipe, PipeWire.Yellow)) {
} else if (PipeWire.YELLOW.isPipeWire(currentItem)) {
if (addOrStripWire(player, pipe, PipeWire.YELLOW)) {
return true;
}
} else if (currentItem.getItem() instanceof ItemGate) {
@ -863,26 +858,10 @@ public class BlockGenericPipe extends BlockBuildCraft {
/**
* Drops a pipe wire item of the passed color.
*
* @param color
* @param pipeWire
*/
private void dropWire(PipeWire color, Pipe pipe) {
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));
private void dropWire(PipeWire pipeWire, Pipe pipe) {
pipe.dropItem(pipeWire.getStack());
}
@SuppressWarnings({"all"})

View file

@ -17,6 +17,7 @@ import buildcraft.api.gates.GateExpansionController;
import buildcraft.api.gates.IGateExpansion;
import buildcraft.api.gates.ITileTrigger;
import buildcraft.transport.gates.ItemGate;
import buildcraft.transport.triggers.ActionRedstoneFaderOutput;
import buildcraft.transport.triggers.ActionSignalOutput;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
@ -42,7 +43,7 @@ public final class Gate {
public ITriggerParameter[] triggerParameters = new ITriggerParameter[8];
public IAction[] actions = new IAction[8];
public boolean broadcastSignal[] = new boolean[4];
public boolean broadcastRedstone = false;
public int redstoneOutput = 0;
// / CONSTRUCTOR
public Gate(Pipe pipe, GateMaterial material, GateLogic logic) {
@ -110,7 +111,7 @@ public final class Gate {
for (int i = 0; i < 4; ++i) {
data.setBoolean("wireState[" + i + "]", broadcastSignal[i]);
}
data.setBoolean("redstoneState", broadcastRedstone);
data.setByte("redstoneOutput", (byte) redstoneOutput);
}
public void readFromNBT(NBTTagCompound data) {
@ -128,7 +129,7 @@ public final class Gate {
for (int i = 0; i < 4; ++i) {
broadcastSignal[i] = data.getBoolean("wireState[" + i + "]");
}
broadcastRedstone = data.getBoolean("redstoneState");
redstoneOutput = data.getByte("redstoneOutput");
}
// GUI
@ -154,8 +155,8 @@ public final class Gate {
}
public void resetGate() {
if (broadcastRedstone) {
broadcastRedstone = false;
if (redstoneOutput != 0) {
redstoneOutput = 0;
pipe.updateNeighbors(true);
}
}
@ -165,11 +166,11 @@ public final class Gate {
if (b)
return true;
}
return broadcastRedstone;
return redstoneOutput > 0;
}
public boolean isEmittingRedstone() {
return broadcastRedstone;
public int getRedstoneOutput() {
return redstoneOutput;
}
public void startResolution() {
@ -179,10 +180,10 @@ public final class Gate {
}
public void resolveActions() {
boolean oldBroadcastRedstone = broadcastRedstone;
int oldRedstoneOutput = redstoneOutput;
boolean[] oldBroadcastSignal = broadcastSignal;
broadcastRedstone = false;
redstoneOutput = 0;
broadcastSignal = new boolean[4];
// Tell the gate to prepare for resolving actions. (Disable pulser)
@ -220,7 +221,9 @@ public final class Gate {
}
if (action instanceof ActionRedstoneOutput) {
broadcastRedstone = true;
redstoneOutput = 15;
} else if (action instanceof ActionRedstoneFaderOutput) {
redstoneOutput = ((ActionRedstoneFaderOutput) action).level;
} else if (action instanceof ActionSignalOutput) {
broadcastSignal[((ActionSignalOutput) action).color.ordinal()] = true;
} else {
@ -237,8 +240,9 @@ public final class Gate {
pipe.actionsActivated(activeActions);
if (oldBroadcastRedstone != broadcastRedstone) {
pipe.container.scheduleRenderUpdate();
if (oldRedstoneOutput != redstoneOutput) {
if (redstoneOutput == 0 ^ oldRedstoneOutput == 0)
pipe.container.scheduleRenderUpdate();
pipe.updateNeighbors(true);
}
@ -288,52 +292,25 @@ public final class Gate {
// / TRIGGERS
public void addTrigger(List<ITrigger> list) {
if (pipe.wireSet[PipeWire.Red.ordinal()] && material == GateMaterial.IRON) {
list.add(BuildCraftTransport.triggerRedSignalActive);
list.add(BuildCraftTransport.triggerRedSignalInactive);
}
if (pipe.wireSet[PipeWire.Blue.ordinal()] && material == GateMaterial.IRON) {
list.add(BuildCraftTransport.triggerBlueSignalActive);
list.add(BuildCraftTransport.triggerBlueSignalInactive);
}
if (pipe.wireSet[PipeWire.Green.ordinal()] && material == GateMaterial.GOLD) {
list.add(BuildCraftTransport.triggerGreenSignalActive);
list.add(BuildCraftTransport.triggerGreenSignalInactive);
}
if (pipe.wireSet[PipeWire.Yellow.ordinal()] && material == GateMaterial.DIAMOND) {
list.add(BuildCraftTransport.triggerYellowSignalActive);
list.add(BuildCraftTransport.triggerYellowSignalInactive);
for (PipeWire wire : PipeWire.VALUES) {
if (pipe.wireSet[wire.ordinal()] && material.ordinal() >= wire.ordinal()) {
list.add(BuildCraftTransport.triggerPipeWireActive[wire.ordinal()]);
list.add(BuildCraftTransport.triggerPipeWireInactive[wire.ordinal()]);
}
}
for (GateExpansionController expansion : expansions.values()) {
expansion.addTriggers(list);
}
// if (pipe.gate.kind == GateKind.AND_5 || pipe.gate.kind == GateKind.OR_5) {
// list.add(BuildCraftTransport.triggerTimerShort);
// list.add(BuildCraftTransport.triggerTimerMedium);
// list.add(BuildCraftTransport.triggerTimerLong);
// }
}
// / ACTIONS
public void addActions(List<IAction> list) {
if (pipe.wireSet[PipeWire.Red.ordinal()] && material == GateMaterial.IRON)
list.add(BuildCraftTransport.actionRedSignal);
if (pipe.wireSet[PipeWire.Blue.ordinal()] && material == GateMaterial.IRON)
list.add(BuildCraftTransport.actionBlueSignal);
if (pipe.wireSet[PipeWire.Green.ordinal()] && material == GateMaterial.GOLD)
list.add(BuildCraftTransport.actionGreenSignal);
if (pipe.wireSet[PipeWire.Yellow.ordinal()] && material == GateMaterial.DIAMOND)
list.add(BuildCraftTransport.actionYellowSignal);
for (PipeWire wire : PipeWire.VALUES) {
if (pipe.wireSet[wire.ordinal()] && material.ordinal() >= wire.ordinal()) {
list.add(BuildCraftTransport.actionPipeWire[wire.ordinal()]);
}
}
for (GateExpansionController expansion : expansions.values()) {
expansion.addActions(list);

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

@ -11,10 +11,8 @@ import buildcraft.api.transport.PipeWire;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.api.gates.ActionManager;
import buildcraft.api.gates.IAction;
import buildcraft.api.gates.ITrigger;
import buildcraft.api.gates.TriggerParameter;
import buildcraft.core.IDropControlInventory;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.network.TilePacketWrapper;
@ -38,6 +36,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
public abstract class Pipe<T extends PipeTransport> implements IDropControlInventory {
public int[] signalStrength = new int[]{0, 0, 0, 0};
public TileGenericPipe container;
public final T transport;
@ -224,20 +223,6 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
for (int i = 0; i < 4; ++i) {
wireSet[i] = data.getBoolean("wireSet[" + i + "]");
}
// Legacy update code
if (hasGate()) {
for (int i = 0; i < 8; ++i) {
if (data.hasKey("trigger[" + i + "]"))
gate.triggers[i] = ActionManager.getTriggerFromLegacyId(data.getInteger("trigger[" + i + "]"));
if (data.hasKey("action[" + i + "]"))
gate.actions[i] = ActionManager.getActionFromLegacyId(data.getInteger("action[" + i + "]"));
if (data.hasKey("triggerParameters[" + i + "]")) {
gate.triggerParameters[i] = new TriggerParameter();
gate.triggerParameters[i].readFromNBT(data.getCompoundTag("triggerParameters[" + i + "]"));
}
}
}
}
private boolean initialized = false;
@ -360,14 +345,14 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
}
public int isPoweringTo(int side) {
if (gate != null && gate.isEmittingRedstone()) {
if (gate != null && gate.getRedstoneOutput() > 0) {
ForgeDirection o = ForgeDirection.getOrientation(side).getOpposite();
TileEntity tile = container.getTile(o);
if (tile instanceof TileGenericPipe && container.isPipeConnected(o))
return 0;
return 15;
return gate.getRedstoneOutput();
}
return 0;
}
@ -439,20 +424,9 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
}
public void onBlockRemoval() {
if (wireSet[PipeWire.Red.ordinal()]) {
dropItem(new ItemStack(BuildCraftTransport.redPipeWire));
}
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));
for (PipeWire pipeWire : PipeWire.VALUES) {
if (wireSet[pipeWire.ordinal()])
dropItem(pipeWire.getStack());
}
if (hasGate()) {

View file

@ -162,7 +162,7 @@ public class PipeTransportPower extends PipeTransport {
PowerReceiver prov = getReceiverOnSide(ForgeDirection.VALID_DIRECTIONS[j]);
if (prov != null && prov.powerRequest() > 0) {
watts = (internalPower[i] / totalPowerQuery) * powerQuery[j];
watts = prov.receiveEnergy(Type.PIPE, watts, ForgeDirection.VALID_DIRECTIONS[j].getOpposite());
watts = (float) prov.receiveEnergy(Type.PIPE, watts, ForgeDirection.VALID_DIRECTIONS[j].getOpposite());
internalPower[i] -= watts;
} else if (tiles[j] instanceof TileGenericPipe) {
watts = (internalPower[i] / totalPowerQuery) * powerQuery[j];
@ -202,7 +202,7 @@ public class PipeTransportPower extends PipeTransport {
for (int i = 0; i < 6; ++i) {
PowerReceiver prov = getReceiverOnSide(ForgeDirection.VALID_DIRECTIONS[i]);
if (prov != null) {
float request = prov.powerRequest();
float request = (float) prov.powerRequest();
if (request > 0) {
requestEnergy(ForgeDirection.VALID_DIRECTIONS[i], request);

View file

@ -1,11 +1,11 @@
package buildcraft.transport;
import buildcraft.BuildCraftTransport;
import buildcraft.api.gates.IOverrideDefaultTriggers;
import buildcraft.api.gates.ITrigger;
import buildcraft.api.gates.ITriggerProvider;
import buildcraft.api.transport.IPipeTile;
import buildcraft.transport.pipes.PipePowerWood;
import buildcraft.transport.triggers.TriggerPipeContents;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
@ -28,19 +28,19 @@ public class PipeTriggerProvider implements ITriggerProvider {
switch (tile.getPipeType()) {
case ITEM:
result.add(BuildCraftTransport.triggerPipeEmpty);
result.add(BuildCraftTransport.triggerPipeItems);
result.add(TriggerPipeContents.PipeContents.empty.trigger);
result.add(TriggerPipeContents.PipeContents.containsItems.trigger);
break;
case FLUID:
result.add(BuildCraftTransport.triggerPipeEmpty);
result.add(BuildCraftTransport.triggerPipeFluids);
result.add(TriggerPipeContents.PipeContents.empty.trigger);
result.add(TriggerPipeContents.PipeContents.containsFluids.trigger);
break;
case POWER:
result.add(BuildCraftTransport.triggerPipeEmpty);
result.add(BuildCraftTransport.triggerPipeContainsEnergy);
result.add(BuildCraftTransport.triggerPipeTooMuchEnergy);
result.add(TriggerPipeContents.PipeContents.empty.trigger);
result.add(TriggerPipeContents.PipeContents.containsEnergy.trigger);
result.add(TriggerPipeContents.PipeContents.tooMuchEnergy.trigger);
if (pipe instanceof PipePowerWood) {
result.add(BuildCraftTransport.triggerPipeRequestsEnergy);
result.add(TriggerPipeContents.PipeContents.requestsEnergy.trigger);
}
break;
}

View file

@ -105,7 +105,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
private boolean refreshRenderState = false;
private boolean pipeBound = false;
private boolean resyncGateExpansions = false;
public boolean redstonePowered = false;
public int redstoneInput = 0;
private int[] facadeBlocks = new int[ForgeDirection.VALID_DIRECTIONS.length];
private int[] facadeMeta = new int[ForgeDirection.VALID_DIRECTIONS.length];
private boolean[] plugs = new boolean[ForgeDirection.VALID_DIRECTIONS.length];
@ -116,7 +116,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setBoolean("redstonePowered", redstonePowered);
nbt.setByte("redstoneInput", (byte)redstoneInput);
if (pipe != null) {
nbt.setInteger("pipeId", pipe.itemID);
@ -135,7 +135,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
redstonePowered = nbt.getBoolean("redstonePowered");
redstoneInput = nbt.getByte("redstoneInput");
coreState.pipeId = nbt.getInteger("pipeId");
pipe = BlockGenericPipe.createPipe(coreState.pipeId);
@ -250,16 +250,16 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
boolean lit = pipe.signalStrength[color.ordinal()] > 0;
switch (color) {
case Red:
case RED:
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Red_Lit : WireIconProvider.Texture_Red_Dark);
break;
case Blue:
case BLUE:
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Blue_Lit : WireIconProvider.Texture_Blue_Dark);
break;
case Green:
case GREEN:
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Green_Lit : WireIconProvider.Texture_Green_Dark);
break;
case Yellow:
case YELLOW:
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Yellow_Lit : WireIconProvider.Texture_Yellow_Dark);
break;
default:

View file

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

View file

@ -32,7 +32,7 @@ public final class GateDefinition {
public static enum GateMaterial {
REDSTONE("gate_interface_1.png", 146, 1, false), IRON("gate_interface_2.png", 164, 2, true), GOLD("gate_interface_3.png", 200, 4, true), DIAMOND("gate_interface_4.png", 200, 8, true);
REDSTONE("gate_interface_1.png", 146, 1, false), IRON("gate_interface_2.png", 164, 2, false), GOLD("gate_interface_3.png", 200, 4, true), DIAMOND("gate_interface_4.png", 200, 8, true);
public static final GateMaterial[] VALUES = values();
public final ResourceLocation guiFile;
public final int guiHeight;

View file

@ -15,7 +15,7 @@ import buildcraft.api.gates.IAction;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.Type;
import buildcraft.transport.triggers.ActionEnergyPulser;
import buildcraft.transport.triggers.ActionEnergyPulsar;
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
@ -61,7 +61,7 @@ public class GateExpansionPulsar extends GateExpansionBuildcraft implements IGat
@Override
public boolean resolveAction(IAction action, int count) {
if (action instanceof ActionEnergyPulser) {
if (action instanceof ActionEnergyPulsar) {
enablePulse(count);
return true;
} else if (action instanceof ActionSingleEnergyPulse) {

View file

@ -0,0 +1,58 @@
/*
* 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.transport.gates;
import buildcraft.api.gates.GateExpansionController;
import buildcraft.api.gates.IGateExpansion;
import buildcraft.BuildCraftTransport;
import buildcraft.api.gates.IAction;
import buildcraft.api.gates.ITrigger;
import buildcraft.api.gates.ITriggerParameter;
import buildcraft.transport.triggers.TriggerClockTimer;
import buildcraft.transport.triggers.TriggerClockTimer.Time;
import java.util.Arrays;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class GateExpansionRedstoneFader extends GateExpansionBuildcraft implements IGateExpansion {
public static GateExpansionRedstoneFader INSTANCE = new GateExpansionRedstoneFader();
private GateExpansionRedstoneFader() {
super("fader");
}
@Override
public GateExpansionController makeController(TileEntity pipeTile) {
return new GateExpansionControllerRedstoneFader(pipeTile);
}
private class GateExpansionControllerRedstoneFader extends GateExpansionController {
public GateExpansionControllerRedstoneFader(TileEntity pipeTile) {
super(GateExpansionRedstoneFader.this, pipeTile);
}
@Override
public void addTriggers(List<ITrigger> list) {
super.addTriggers(list);
list.addAll(Arrays.asList(BuildCraftTransport.triggerRedstoneLevel));
}
@Override
public void addActions(List<IAction> list) {
super.addActions(list);
list.addAll(Arrays.asList(BuildCraftTransport.actionRedstoneLevel));
}
}
}

View file

@ -11,17 +11,12 @@ package buildcraft.transport.gates;
import buildcraft.api.gates.GateExpansionController;
import buildcraft.api.gates.IGateExpansion;
import buildcraft.BuildCraftTransport;
import buildcraft.api.gates.IAction;
import buildcraft.api.gates.ITrigger;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.Type;
import buildcraft.transport.triggers.ActionEnergyPulser;
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
import buildcraft.api.gates.ITriggerParameter;
import buildcraft.transport.triggers.TriggerClockTimer;
import buildcraft.transport.triggers.TriggerClockTimer.Time;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
/**
*
@ -42,101 +37,58 @@ public class GateExpansionTimer extends GateExpansionBuildcraft implements IGate
private class GateExpansionControllerTimer extends GateExpansionController {
private boolean isActive;
private boolean singlePulse;
private boolean hasPulsed;
private int pulseCount;
private int tick;
private class Timer {
private static final int ACTIVE_TIME = 5;
private final TriggerClockTimer.Time time;
private int clock;
public Timer(TriggerClockTimer.Time time) {
this.time = time;
}
public void tick() {
if (clock > -ACTIVE_TIME)
clock--;
else
clock = time.delay * 20 + ACTIVE_TIME;
}
public boolean isActive() {
return clock < 0;
}
}
private final Timer[] timers = new Timer[TriggerClockTimer.Time.VALUES.length];
public GateExpansionControllerTimer(TileEntity pipeTile) {
super(GateExpansionTimer.this, pipeTile);
}
@Override
public void startResolution() {
if (isActive()) {
disablePulse();
for (TriggerClockTimer.Time time : TriggerClockTimer.Time.VALUES) {
timers[time.ordinal()] = new Timer(time);
}
}
@Override
public boolean resolveAction(IAction action, int count) {
if (action instanceof ActionEnergyPulser) {
enablePulse(count);
return true;
} else if (action instanceof ActionSingleEnergyPulse) {
enableSinglePulse(count);
return true;
public boolean isTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
if (trigger instanceof TriggerClockTimer) {
TriggerClockTimer timerTrigger = (TriggerClockTimer) trigger;
return timers[timerTrigger.time.ordinal()].isActive();
}
return false;
return super.isTriggerActive(trigger, parameter);
}
@Override
public void addTriggers(List<ITrigger> list) {
super.addTriggers(list);
list.add(BuildCraftTransport.triggerTimerShort);
list.add(BuildCraftTransport.triggerTimerMedium);
list.add(BuildCraftTransport.triggerTimerLong);
for (Time time : TriggerClockTimer.Time.VALUES) {
list.add(BuildCraftTransport.triggerTimer[time.ordinal()]);
}
}
@Override
public void tick() {
if (!isActive && hasPulsed)
hasPulsed = false;
PowerHandler.PowerReceiver powerReceptor = ((IPowerReceptor) pipeTile).getPowerReceiver(ForgeDirection.UNKNOWN);
if (powerReceptor == null || !isActive || tick++ % 10 != 0)
return;
if (!singlePulse || !hasPulsed) {
powerReceptor.receiveEnergy(Type.GATE, Math.min(1 << (pulseCount - 1), 64) * 1.01f, ForgeDirection.WEST);
hasPulsed = true;
for (Timer timer : timers) {
timer.tick();
}
}
private void enableSinglePulse(int count) {
singlePulse = true;
isActive = true;
pulseCount = count;
}
private void enablePulse(int count) {
isActive = true;
singlePulse = false;
pulseCount = count;
}
private void disablePulse() {
if (!isActive) {
hasPulsed = false;
}
isActive = false;
pulseCount = 0;
}
@Override
public boolean isActive() {
return isActive;
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
nbt.setBoolean("singlePulse", singlePulse);
nbt.setBoolean("isActive", isActive);
nbt.setBoolean("hasPulsed", hasPulsed);
nbt.setInteger("pulseCount", pulseCount);
nbt.setInteger("tick", tick);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
isActive = nbt.getBoolean("isActive");
singlePulse = nbt.getBoolean("singlePulse");
hasPulsed = nbt.getBoolean("hasPulsed");
pulseCount = nbt.getInteger("pulseCount");
tick = nbt.getInteger("tick");
}
}
}

View file

@ -88,6 +88,7 @@ public class GateFactory {
}
Gate gate = makeGate(pipe, material, logic);
gate.readFromNBT(nbt);
if (nbt.hasKey("Pulser")) {
NBTTagCompound pulsarTag = nbt.getCompoundTag("Pulser");

View file

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

@ -7,12 +7,17 @@
*/
package buildcraft.transport.pipes;
import java.util.LinkedList;
import java.util.Map;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.gates.IAction;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportFluids;
import buildcraft.transport.TileGenericPipe;
import buildcraft.transport.triggers.ActionPipeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
@ -89,6 +94,28 @@ public class PipeFluidsIron extends Pipe<PipeTransportFluids> {
}
@Override
protected void actionsActivated(Map<IAction, Boolean> actions) {
super.actionsActivated(actions);
for (Map.Entry<IAction, Boolean> action : actions.entrySet()) {
if (action.getKey() instanceof ActionPipeDirection && action.getValue() != null && action.getValue()) {
logic.setFacing(((ActionPipeDirection) action.getKey()).direction);
break;
}
}
}
@Override
public LinkedList<IAction> getActions() {
LinkedList<IAction> action = super.getActions();
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
if (container.isPipeConnected(direction))
action.add(BuildCraftTransport.actionPipeDirection[direction.ordinal()]);
}
return action;
}
@Override
public boolean canConnectRedstone() {
return true;

View file

@ -207,7 +207,7 @@ public class PipeItemsObsidian extends Pipe<PipeTransportItems> implements IPowe
CoreProxy.proxy.obsidianPipePickup(container.worldObj, item, this.container);
float energyUsed = powerHandler.useEnergy(distance, contained.stackSize * distance, true);
double energyUsed = powerHandler.useEnergy(distance, contained.stackSize * distance, true);
if (distance == 0 || energyUsed / distance == contained.stackSize) {
stack = contained;

Some files were not shown because too many files have changed in this diff Show more