Power Pipe rework
Explosions are gone, loss over distance is gone. Added two new Power pipes, Cobble and Diamond. All pipes have much smaller max throughput: Cobble = 8 MJ/t Stone = 16 MJ/t Gold = 64 MJ/t Diamond = 256 MJ/t The power display will turn red if a pipe has hit its max capacity. You can use smaller pipes to throttle certain parts of your power net. Machines are more lossy now to make up for the lossless pipes. Expect low power draws even when idle. Also added on/off Gate action support to lasers and ACTs.
This commit is contained in:
parent
6dd4287945
commit
8f7292ec06
27 changed files with 372 additions and 283 deletions
|
@ -64,8 +64,10 @@ item.PipeLiquidsIron=Iron Waterproof Pipe
|
||||||
item.PipeLiquidsGold=Golden Waterproof Pipe
|
item.PipeLiquidsGold=Golden Waterproof Pipe
|
||||||
item.PipeLiquidsEmerald=Emerald Waterproof Pipe
|
item.PipeLiquidsEmerald=Emerald Waterproof Pipe
|
||||||
item.PipePowerWood=Wooden Conductive Pipe
|
item.PipePowerWood=Wooden Conductive Pipe
|
||||||
|
item.PipePowerCobblestone=Cobblestone Conductive Pipe
|
||||||
item.PipePowerStone=Stone Conductive Pipe
|
item.PipePowerStone=Stone Conductive Pipe
|
||||||
item.PipePowerGold=Golden Conductive Pipe
|
item.PipePowerGold=Golden Conductive Pipe
|
||||||
|
item.PipePowerDiamond=Diamond Conductive Pipe
|
||||||
item.PipeItemsStripes=Stripes Transport Pipe
|
item.PipeItemsStripes=Stripes Transport Pipe
|
||||||
item.PipeStructureCobblestone=Cobblestone Structure Pipe
|
item.PipeStructureCobblestone=Cobblestone Structure Pipe
|
||||||
item.PipeItemsVoid=Void Transport Pipe
|
item.PipeItemsVoid=Void Transport Pipe
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 250 B |
Binary file not shown.
After Width: | Height: | Size: 250 B |
|
@ -67,6 +67,8 @@ import buildcraft.transport.pipes.PipeLiquidsSandstone;
|
||||||
import buildcraft.transport.pipes.PipeLiquidsStone;
|
import buildcraft.transport.pipes.PipeLiquidsStone;
|
||||||
import buildcraft.transport.pipes.PipeLiquidsVoid;
|
import buildcraft.transport.pipes.PipeLiquidsVoid;
|
||||||
import buildcraft.transport.pipes.PipeLiquidsWood;
|
import buildcraft.transport.pipes.PipeLiquidsWood;
|
||||||
|
import buildcraft.transport.pipes.PipePowerCobblestone;
|
||||||
|
import buildcraft.transport.pipes.PipePowerDiamond;
|
||||||
import buildcraft.transport.pipes.PipePowerGold;
|
import buildcraft.transport.pipes.PipePowerGold;
|
||||||
import buildcraft.transport.pipes.PipePowerStone;
|
import buildcraft.transport.pipes.PipePowerStone;
|
||||||
import buildcraft.transport.pipes.PipePowerWood;
|
import buildcraft.transport.pipes.PipePowerWood;
|
||||||
|
@ -103,7 +105,6 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
public class BuildCraftTransport {
|
public class BuildCraftTransport {
|
||||||
public static BlockGenericPipe genericPipeBlock;
|
public static BlockGenericPipe genericPipeBlock;
|
||||||
|
|
||||||
public static boolean usePipeLoss;
|
|
||||||
public static int maxItemsInPipes;
|
public static int maxItemsInPipes;
|
||||||
public static float pipeDurability;
|
public static float pipeDurability;
|
||||||
|
|
||||||
|
@ -136,8 +137,10 @@ public class BuildCraftTransport {
|
||||||
public static Item pipeLiquidsEmerald;
|
public static Item pipeLiquidsEmerald;
|
||||||
|
|
||||||
public static Item pipePowerWood;
|
public static Item pipePowerWood;
|
||||||
|
public static Item pipePowerCobblestone;
|
||||||
public static Item pipePowerStone;
|
public static Item pipePowerStone;
|
||||||
public static Item pipePowerGold;
|
public static Item pipePowerGold;
|
||||||
|
public static Item pipePowerDiamond;
|
||||||
|
|
||||||
public static Item facadeItem;
|
public static Item facadeItem;
|
||||||
public static Item plugItem;
|
public static Item plugItem;
|
||||||
|
@ -223,10 +226,6 @@ public class BuildCraftTransport {
|
||||||
@PreInit
|
@PreInit
|
||||||
public void preInitialize(FMLPreInitializationEvent evt) {
|
public void preInitialize(FMLPreInitializationEvent evt) {
|
||||||
try {
|
try {
|
||||||
Property pipeLoss = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "power.usePipeLoss", DefaultProps.USE_PIPELOSS);
|
|
||||||
pipeLoss.comment = "Set to false to turn off energy loss over distance on all power pipes";
|
|
||||||
usePipeLoss = pipeLoss.getBoolean(DefaultProps.USE_PIPELOSS);
|
|
||||||
|
|
||||||
Property durability = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.durability", DefaultProps.PIPES_DURABILITY);
|
Property durability = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.durability", DefaultProps.PIPES_DURABILITY);
|
||||||
durability.comment = "How long a pipe will take to break";
|
durability.comment = "How long a pipe will take to break";
|
||||||
pipeDurability = (float) durability.getDouble(DefaultProps.PIPES_DURABILITY);
|
pipeDurability = (float) durability.getDouble(DefaultProps.PIPES_DURABILITY);
|
||||||
|
@ -293,8 +292,10 @@ public class BuildCraftTransport {
|
||||||
pipeLiquidsEmerald = createPipe(DefaultProps.PIPE_LIQUIDS_EMERALD_ID, PipeLiquidsEmerald.class, "Emerald Waterproof Pipe", pipeWaterproof, pipeItemsEmerald, null);
|
pipeLiquidsEmerald = createPipe(DefaultProps.PIPE_LIQUIDS_EMERALD_ID, PipeLiquidsEmerald.class, "Emerald Waterproof Pipe", pipeWaterproof, pipeItemsEmerald, null);
|
||||||
|
|
||||||
pipePowerWood = createPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Conductive Pipe", Item.redstone, pipeItemsWood, null);
|
pipePowerWood = createPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Conductive Pipe", Item.redstone, pipeItemsWood, null);
|
||||||
|
pipePowerCobblestone = createPipe(DefaultProps.PIPE_POWER_COBBLESTONE_ID, PipePowerCobblestone.class, "Cobblestone Conductive Pipe", Item.redstone, pipeItemsCobblestone, null);
|
||||||
pipePowerStone = createPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Conductive Pipe", Item.redstone, pipeItemsStone, null);
|
pipePowerStone = createPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Conductive Pipe", Item.redstone, pipeItemsStone, null);
|
||||||
pipePowerGold = createPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Conductive Pipe", Item.redstone, pipeItemsGold, null);
|
pipePowerGold = createPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Conductive Pipe", Item.redstone, pipeItemsGold, null);
|
||||||
|
pipePowerDiamond = createPipe(DefaultProps.PIPE_POWER_DIAMOND_ID, PipePowerDiamond.class, "Diamond Conductive Pipe", Item.redstone, pipeItemsDiamond, null);
|
||||||
|
|
||||||
pipeStructureCobblestone = createPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe", Block.gravel, pipeItemsCobblestone, null);
|
pipeStructureCobblestone = createPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe", Block.gravel, pipeItemsCobblestone, null);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
import buildcraft.BuildCraftBuilders;
|
import buildcraft.BuildCraftBuilders;
|
||||||
import buildcraft.api.core.LaserKind;
|
import buildcraft.api.core.LaserKind;
|
||||||
import buildcraft.api.core.Position;
|
import buildcraft.api.core.Position;
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.power.IPowerProvider;
|
import buildcraft.api.power.IPowerProvider;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerFramework;
|
import buildcraft.api.power.PowerFramework;
|
||||||
|
@ -639,7 +640,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActions() {
|
public boolean allowAction(IAction action) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,19 +23,17 @@ import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerFramework;
|
import buildcraft.api.power.PowerFramework;
|
||||||
import buildcraft.core.Box;
|
import buildcraft.core.Box;
|
||||||
import buildcraft.core.IMachine;
|
import buildcraft.core.IMachine;
|
||||||
import buildcraft.core.TileBuildCraft;
|
|
||||||
import buildcraft.core.network.PacketUpdate;
|
import buildcraft.core.network.PacketUpdate;
|
||||||
import buildcraft.core.network.TileNetworkData;
|
import buildcraft.core.network.TileNetworkData;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.triggers.ActionMachineControl;
|
import buildcraft.core.triggers.ActionMachineControl;
|
||||||
import buildcraft.core.triggers.ActionMachineControl.Mode;
|
import buildcraft.core.triggers.ActionMachineControl.Mode;
|
||||||
import buildcraft.core.utils.Utils;
|
import buildcraft.core.utils.Utils;
|
||||||
|
import buildcraft.factory.TileMachine;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
|
|
||||||
public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowerReceptor, IMachine, IActionReceptor {
|
public class TileFiller extends TileMachine implements ISidedInventory, IPowerReceptor, IMachine, IActionReceptor {
|
||||||
|
|
||||||
private static int[] SLOTS_GRID = Utils.createSlotArray(0, 9);
|
private static int[] SLOTS_GRID = Utils.createSlotArray(0, 9);
|
||||||
private static int[] SLOTS_INPUT = Utils.createSlotArray(9, 27);
|
private static int[] SLOTS_INPUT = Utils.createSlotArray(9, 27);
|
||||||
|
@ -54,8 +52,12 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
||||||
public TileFiller() {
|
public TileFiller() {
|
||||||
contents = new ItemStack[getSizeInventory()];
|
contents = new ItemStack[getSizeInventory()];
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
|
initPowerProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPowerProvider() {
|
||||||
powerProvider.configure(20, 25, 50, 25, 100);
|
powerProvider.configure(20, 25, 50, 25, 100);
|
||||||
powerProvider.configurePowerPerdition(25, 40);
|
powerProvider.configurePowerPerdition(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -353,14 +355,6 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
||||||
public void closeChest() {
|
public void closeChest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int powerRequest(ForgeDirection from) {
|
|
||||||
if (isActive())
|
|
||||||
return powerProvider.getMaxEnergyReceived();
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionActivated(IAction action) {
|
public void actionActivated(IAction action) {
|
||||||
if (action == BuildCraftCore.actionOn) {
|
if (action == BuildCraftCore.actionOn) {
|
||||||
|
@ -373,14 +367,15 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActions() {
|
public boolean allowAction(IAction action) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isStackValidForSlot(int slot, ItemStack stack) {
|
public boolean isStackValidForSlot(int slot, ItemStack stack) {
|
||||||
if (slot < 9) {
|
if (slot < 9) {
|
||||||
if(getStackInSlot(slot) != null) return false;
|
if (getStackInSlot(slot) != null)
|
||||||
|
return false;
|
||||||
return stack.itemID == Block.brick.blockID || stack.itemID == Block.glass.blockID;
|
return stack.itemID == Block.brick.blockID || stack.itemID == Block.glass.blockID;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -116,7 +116,6 @@ public class DefaultProps {
|
||||||
public static boolean CURRENT_CONTINUOUS = false;
|
public static boolean CURRENT_CONTINUOUS = false;
|
||||||
public static double PIPES_DURABILITY = 0.25D;
|
public static double PIPES_DURABILITY = 0.25D;
|
||||||
public static boolean FILLER_DESTROY = false;
|
public static boolean FILLER_DESTROY = false;
|
||||||
public static boolean USE_PIPELOSS = true;
|
|
||||||
|
|
||||||
public static int TRIGGER_REDSTONE_ACTIVE = 1;
|
public static int TRIGGER_REDSTONE_ACTIVE = 1;
|
||||||
public static int TRIGGER_REDSTONE_INACTIVE = 2;
|
public static int TRIGGER_REDSTONE_INACTIVE = 2;
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
package buildcraft.core;
|
package buildcraft.core;
|
||||||
|
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
|
|
||||||
public interface IMachine {
|
public interface IMachine {
|
||||||
|
|
||||||
public boolean isActive();
|
public boolean isActive();
|
||||||
|
@ -17,6 +19,6 @@ public interface IMachine {
|
||||||
|
|
||||||
public boolean manageSolids();
|
public boolean manageSolids();
|
||||||
|
|
||||||
public boolean allowActions();
|
public boolean allowAction(IAction action);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.api.gates.IAction;
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.gates.IActionProvider;
|
import buildcraft.api.gates.IActionProvider;
|
||||||
import buildcraft.core.IMachine;
|
import buildcraft.core.IMachine;
|
||||||
|
import cpw.mods.fml.common.FMLLog;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class DefaultActionProvider implements IActionProvider {
|
public class DefaultActionProvider implements IActionProvider {
|
||||||
|
|
||||||
|
@ -17,13 +19,20 @@ public class DefaultActionProvider implements IActionProvider {
|
||||||
|
|
||||||
res.add(BuildCraftCore.actionRedstone);
|
res.add(BuildCraftCore.actionRedstone);
|
||||||
|
|
||||||
if (tile instanceof IMachine && ((IMachine) tile).allowActions()) {
|
try {
|
||||||
|
if (tile instanceof IMachine) {
|
||||||
|
IMachine machine = (IMachine) tile;
|
||||||
|
if (machine.allowAction(BuildCraftCore.actionOn))
|
||||||
res.add(BuildCraftCore.actionOn);
|
res.add(BuildCraftCore.actionOn);
|
||||||
|
if (machine.allowAction(BuildCraftCore.actionOff))
|
||||||
res.add(BuildCraftCore.actionOff);
|
res.add(BuildCraftCore.actionOff);
|
||||||
|
if (machine.allowAction(BuildCraftCore.actionLoop))
|
||||||
res.add(BuildCraftCore.actionLoop);
|
res.add(BuildCraftCore.actionLoop);
|
||||||
}
|
}
|
||||||
|
} catch (Throwable error) {
|
||||||
|
FMLLog.log("Buildcraft", Level.SEVERE, "Outdated API detected, please update your mods!");
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.factory;
|
package buildcraft.factory;
|
||||||
|
|
||||||
|
import buildcraft.api.power.IPowerProvider;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.core.IMachine;
|
import buildcraft.core.IMachine;
|
||||||
|
@ -18,11 +17,8 @@ public abstract class TileMachine extends TileBuildCraft implements IMachine, IP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int powerRequest(ForgeDirection from) {
|
public int powerRequest(ForgeDirection from) {
|
||||||
if (isActive())
|
IPowerProvider p = getPowerProvider();
|
||||||
return (int) Math.ceil(Math.min(getPowerProvider().getMaxEnergyReceived(), getPowerProvider().getMaxEnergyStored()
|
float needed = p.getMaxEnergyStored() - p.getEnergyStored();
|
||||||
- getPowerProvider().getEnergyStored()));
|
return (int) Math.ceil(Math.min(p.getMaxEnergyReceived(), needed));
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftFactory;
|
import buildcraft.BuildCraftFactory;
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.power.IPowerProvider;
|
import buildcraft.api.power.IPowerProvider;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerFramework;
|
import buildcraft.api.power.PowerFramework;
|
||||||
|
@ -34,6 +35,7 @@ public class TileMiningWell extends TileMachine implements IMachine, IPowerRecep
|
||||||
public TileMiningWell() {
|
public TileMiningWell() {
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
powerProvider.configure(50, 1, 25, 25, 1000);
|
powerProvider.configure(50, 1, 25, 25, 1000);
|
||||||
|
powerProvider.configurePowerPerdition(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,7 +133,7 @@ public class TileMiningWell extends TileMachine implements IMachine, IPowerRecep
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActions() {
|
public boolean allowAction(IAction action) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.factory;
|
package buildcraft.factory;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -27,6 +25,7 @@ import net.minecraftforge.liquids.LiquidTank;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftFactory;
|
import buildcraft.BuildCraftFactory;
|
||||||
import buildcraft.api.core.Position;
|
import buildcraft.api.core.Position;
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.power.IPowerProvider;
|
import buildcraft.api.power.IPowerProvider;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerFramework;
|
import buildcraft.api.power.PowerFramework;
|
||||||
|
@ -41,25 +40,24 @@ import buildcraft.core.utils.Utils;
|
||||||
public class TilePump extends TileMachine implements IMachine, IPowerReceptor, ITankContainer {
|
public class TilePump extends TileMachine implements IMachine, IPowerReceptor, ITankContainer {
|
||||||
|
|
||||||
public static int MAX_LIQUID = LiquidContainerRegistry.BUCKET_VOLUME;
|
public static int MAX_LIQUID = LiquidContainerRegistry.BUCKET_VOLUME;
|
||||||
|
|
||||||
EntityBlock tube;
|
EntityBlock tube;
|
||||||
|
|
||||||
private TreeMap<Integer, LinkedList<BlockIndex>> blocksToPump = new TreeMap<Integer, LinkedList<BlockIndex>>();
|
private TreeMap<Integer, LinkedList<BlockIndex>> blocksToPump = new TreeMap<Integer, LinkedList<BlockIndex>>();
|
||||||
|
|
||||||
LiquidTank tank;
|
LiquidTank tank;
|
||||||
double tubeY = Double.NaN;
|
double tubeY = Double.NaN;
|
||||||
int aimY = 0;
|
int aimY = 0;
|
||||||
|
|
||||||
private IPowerProvider powerProvider;
|
private IPowerProvider powerProvider;
|
||||||
|
|
||||||
public TilePump() {
|
public TilePump() {
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
powerProvider.configure(20, 1, 10, 10, 100);
|
initPowerProvider();
|
||||||
tank = new LiquidTank(MAX_LIQUID);
|
tank = new LiquidTank(MAX_LIQUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO, manage this by different levels (pump what's above first...)
|
private void initPowerProvider() {
|
||||||
|
powerProvider.configure(20, 1, 8, 10, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO, manage this by different levels (pump what's above first...)
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -233,7 +231,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor, I
|
||||||
|
|
||||||
addToPumpIfLiquid(new BlockIndex(index.i, index.j + 1, index.k), markedBlocks, lastFound, pumpList, liquidId);
|
addToPumpIfLiquid(new BlockIndex(index.i, index.j + 1, index.k), markedBlocks, lastFound, pumpList, liquidId);
|
||||||
|
|
||||||
if(System.currentTimeMillis() > timeoutTime)
|
if (System.currentTimeMillis() > timeoutTime)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,11 +262,11 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor, I
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLiquid(BlockIndex index) {
|
private boolean isLiquid(BlockIndex index) {
|
||||||
if(index == null)
|
if (index == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LiquidStack liquid = Utils.liquidFromBlockId(worldObj.getBlockId(index.i, index.j, index.k));
|
LiquidStack liquid = Utils.liquidFromBlockId(worldObj.getBlockId(index.i, index.j, index.k));
|
||||||
if(liquid == null)
|
if (liquid == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return BuildCraftFactory.pumpDimensionList.isLiquidAllowed(liquid, worldObj.provider.dimensionId);
|
return BuildCraftFactory.pumpDimensionList.isLiquidAllowed(liquid, worldObj.provider.dimensionId);
|
||||||
|
@ -288,8 +286,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor, I
|
||||||
tubeY = nbttagcompound.getFloat("tubeY");
|
tubeY = nbttagcompound.getFloat("tubeY");
|
||||||
|
|
||||||
PowerFramework.currentFramework.loadPowerProvider(this, nbttagcompound);
|
PowerFramework.currentFramework.loadPowerProvider(this, nbttagcompound);
|
||||||
powerProvider.configure(20, 1, 10, 10, 100);
|
initPowerProvider();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -405,12 +402,11 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor, I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActions() {
|
public boolean allowAction(IAction action) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ITankContainer implementation.
|
// ITankContainer implementation.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill) {
|
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill) {
|
||||||
// not acceptable
|
// not acceptable
|
||||||
|
@ -438,7 +434,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor, I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILiquidTank[] getTanks(ForgeDirection direction) {
|
public ILiquidTank[] getTanks(ForgeDirection direction) {
|
||||||
return new ILiquidTank[] { tank };
|
return new ILiquidTank[]{tank};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.factory;
|
package buildcraft.factory;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -28,6 +26,7 @@ import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftFactory;
|
import buildcraft.BuildCraftFactory;
|
||||||
import buildcraft.api.core.IAreaProvider;
|
import buildcraft.api.core.IAreaProvider;
|
||||||
import buildcraft.api.core.LaserKind;
|
import buildcraft.api.core.LaserKind;
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.power.IPowerProvider;
|
import buildcraft.api.power.IPowerProvider;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerFramework;
|
import buildcraft.api.power.PowerFramework;
|
||||||
|
@ -53,6 +52,7 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
|
||||||
public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor, IPipeConnection, IBuilderInventory {
|
public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor, IPipeConnection, IBuilderInventory {
|
||||||
|
|
||||||
public @TileNetworkData
|
public @TileNetworkData
|
||||||
Box box = new Box();
|
Box box = new Box();
|
||||||
public @TileNetworkData
|
public @TileNetworkData
|
||||||
|
@ -65,21 +65,21 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
double speed = 0.03;
|
double speed = 0.03;
|
||||||
public @TileNetworkData
|
public @TileNetworkData
|
||||||
boolean builderDone = false;
|
boolean builderDone = false;
|
||||||
|
|
||||||
public EntityRobot builder;
|
public EntityRobot builder;
|
||||||
BptBuilderBase bluePrintBuilder;
|
BptBuilderBase bluePrintBuilder;
|
||||||
|
|
||||||
public EntityMechanicalArm arm;
|
public EntityMechanicalArm arm;
|
||||||
|
|
||||||
public IPowerProvider powerProvider;
|
public IPowerProvider powerProvider;
|
||||||
|
|
||||||
boolean isDigging = false;
|
boolean isDigging = false;
|
||||||
|
|
||||||
public static final int MAX_ENERGY = 15000;
|
public static final int MAX_ENERGY = 15000;
|
||||||
|
|
||||||
public TileQuarry() {
|
public TileQuarry() {
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
|
initPowerProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPowerProvider() {
|
||||||
powerProvider.configure(20, 25, 100, 25, MAX_ENERGY);
|
powerProvider.configure(20, 25, 100, 25, MAX_ENERGY);
|
||||||
|
powerProvider.configurePowerPerdition(2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createUtilsIfNeeded() {
|
public void createUtilsIfNeeded() {
|
||||||
|
@ -113,7 +113,6 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
isDigging = true;
|
isDigging = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean loadDefaultBoundaries = false;
|
private boolean loadDefaultBoundaries = false;
|
||||||
private boolean movingHorizontally;
|
private boolean movingHorizontally;
|
||||||
private boolean movingVertically;
|
private boolean movingVertically;
|
||||||
|
@ -233,7 +232,6 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
int[] target = getTarget();
|
int[] target = getTarget();
|
||||||
headTrajectory = Math.atan2(target[2] - head[2], target[0] - head[0]);
|
headTrajectory = Math.atan2(target[2] - head[2], target[0] - head[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final LinkedList<int[]> visitList = Lists.newLinkedList();
|
private final LinkedList<int[]> visitList = Lists.newLinkedList();
|
||||||
|
|
||||||
public boolean findTarget(boolean doSet) {
|
public boolean findTarget(boolean doSet) {
|
||||||
|
@ -323,7 +321,7 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
if (!BlockUtil.canChangeBlock(blockID, worldObj, bx, by, bz)) {
|
if (!BlockUtil.canChangeBlock(blockID, worldObj, bx, by, bz)) {
|
||||||
blockedColumns[searchX][searchZ] = true;
|
blockedColumns[searchX][searchZ] = true;
|
||||||
} else if (!BlockUtil.isSoftBlock(blockID, worldObj, bx, by, bz)) {
|
} else if (!BlockUtil.isSoftBlock(blockID, worldObj, bx, by, bz)) {
|
||||||
visitList.add(new int[] { bx, by, bz });
|
visitList.add(new int[]{bx, by, bz});
|
||||||
}
|
}
|
||||||
// Stop at two planes - generally any obstructions will have been found and will force a recompute prior to this
|
// Stop at two planes - generally any obstructions will have been found and will force a recompute prior to this
|
||||||
if (visitList.size() > bluePrintBuilder.bluePrint.sizeZ * bluePrintBuilder.bluePrint.sizeX * 2)
|
if (visitList.size() > bluePrintBuilder.bluePrint.sizeZ * bluePrintBuilder.bluePrint.sizeX * 2)
|
||||||
|
@ -339,6 +337,7 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
super.readFromNBT(nbttagcompound);
|
super.readFromNBT(nbttagcompound);
|
||||||
|
|
||||||
PowerFramework.currentFramework.loadPowerProvider(this, nbttagcompound);
|
PowerFramework.currentFramework.loadPowerProvider(this, nbttagcompound);
|
||||||
|
initPowerProvider();
|
||||||
|
|
||||||
if (nbttagcompound.hasKey("box")) {
|
if (nbttagcompound.hasKey("box")) {
|
||||||
box.initialize(nbttagcompound.getCompoundTag("box"));
|
box.initialize(nbttagcompound.getCompoundTag("box"));
|
||||||
|
@ -710,7 +709,6 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -752,7 +750,7 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActions() {
|
public boolean allowAction(IAction action) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,11 +813,11 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
}
|
}
|
||||||
|
|
||||||
private double[] getHead() {
|
private double[] getHead() {
|
||||||
return new double[] { headPosX, headPosY, headPosZ };
|
return new double[]{headPosX, headPosY, headPosZ};
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] getTarget() {
|
private int[] getTarget() {
|
||||||
return new int[] { targetX, targetY, targetZ };
|
return new int[]{targetX, targetY, targetZ};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTarget(int x, int y, int z) {
|
private void setTarget(int x, int y, int z) {
|
||||||
|
@ -853,5 +851,4 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
||||||
}
|
}
|
||||||
sendNetworkUpdate();
|
sendNetworkUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.factory;
|
package buildcraft.factory;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -23,6 +21,7 @@ import net.minecraftforge.liquids.LiquidStack;
|
||||||
import net.minecraftforge.liquids.LiquidTank;
|
import net.minecraftforge.liquids.LiquidTank;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.api.core.SafeTimeTracker;
|
import buildcraft.api.core.SafeTimeTracker;
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.power.IPowerProvider;
|
import buildcraft.api.power.IPowerProvider;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerFramework;
|
import buildcraft.api.power.PowerFramework;
|
||||||
|
@ -36,26 +35,19 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
||||||
|
|
||||||
private int[] filters = new int[2];
|
private int[] filters = new int[2];
|
||||||
private int[] filtersMeta = new int[2];
|
private int[] filtersMeta = new int[2];
|
||||||
|
|
||||||
public static int LIQUID_PER_SLOT = LiquidContainerRegistry.BUCKET_VOLUME * 4;
|
public static int LIQUID_PER_SLOT = LiquidContainerRegistry.BUCKET_VOLUME * 4;
|
||||||
|
|
||||||
public LiquidTank ingredient1 = new LiquidTank(LIQUID_PER_SLOT);
|
public LiquidTank ingredient1 = new LiquidTank(LIQUID_PER_SLOT);
|
||||||
public LiquidTank ingredient2 = new LiquidTank(LIQUID_PER_SLOT);
|
public LiquidTank ingredient2 = new LiquidTank(LIQUID_PER_SLOT);
|
||||||
public LiquidTank result = new LiquidTank(LIQUID_PER_SLOT);
|
public LiquidTank result = new LiquidTank(LIQUID_PER_SLOT);
|
||||||
public float animationSpeed = 1;
|
public float animationSpeed = 1;
|
||||||
private int animationStage = 0;
|
private int animationStage = 0;
|
||||||
|
|
||||||
SafeTimeTracker time = new SafeTimeTracker();
|
SafeTimeTracker time = new SafeTimeTracker();
|
||||||
|
|
||||||
SafeTimeTracker updateNetworkTime = new SafeTimeTracker();
|
SafeTimeTracker updateNetworkTime = new SafeTimeTracker();
|
||||||
|
|
||||||
IPowerProvider powerProvider;
|
IPowerProvider powerProvider;
|
||||||
|
|
||||||
private boolean isActive;
|
private boolean isActive;
|
||||||
|
|
||||||
public TileRefinery() {
|
public TileRefinery() {
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
powerProvider.configure(20, 25, 100, 25, 1000);
|
|
||||||
|
|
||||||
filters[0] = 0;
|
filters[0] = 0;
|
||||||
filters[1] = 0;
|
filters[1] = 0;
|
||||||
|
@ -63,6 +55,11 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
||||||
filtersMeta[1] = 0;
|
filtersMeta[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initPowerProvider() {
|
||||||
|
powerProvider.configure(20, 25, 100, 25, 1000);
|
||||||
|
powerProvider.configurePowerPerdition(1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory() {
|
public int getSizeInventory() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -80,7 +77,6 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,7 +116,6 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doWork() {
|
public void doWork() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -260,7 +255,7 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
||||||
animationSpeed = nbttagcompound.getFloat("animationSpeed");
|
animationSpeed = nbttagcompound.getFloat("animationSpeed");
|
||||||
|
|
||||||
PowerFramework.currentFramework.loadPowerProvider(this, nbttagcompound);
|
PowerFramework.currentFramework.loadPowerProvider(this, nbttagcompound);
|
||||||
powerProvider.configure(20, 25, 100, 25, 1000);
|
initPowerProvider();
|
||||||
|
|
||||||
filters[0] = nbttagcompound.getInteger("filters_0");
|
filters[0] = nbttagcompound.getInteger("filters_0");
|
||||||
filters[1] = nbttagcompound.getInteger("filters_1");
|
filters[1] = nbttagcompound.getInteger("filters_1");
|
||||||
|
@ -365,7 +360,7 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActions() {
|
public boolean allowAction(IAction action) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +444,7 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILiquidTank[] getTanks(ForgeDirection direction) {
|
public ILiquidTank[] getTanks(ForgeDirection direction) {
|
||||||
return new ILiquidTank[] { ingredient1, ingredient2, result };
|
return new ILiquidTank[]{ingredient1, ingredient2, result};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -501,7 +496,6 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
||||||
}
|
}
|
||||||
|
|
||||||
// Network
|
// Network
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PacketPayload getPacketPayload() {
|
public PacketPayload getPacketPayload() {
|
||||||
PacketPayload payload = new PacketPayload(9, 1, 0);
|
PacketPayload payload = new PacketPayload(9, 1, 0);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package buildcraft.silicon;
|
package buildcraft.silicon;
|
||||||
|
|
||||||
|
import buildcraft.BuildCraftCore;
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
|
import buildcraft.api.gates.IActionReceptor;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -23,12 +26,13 @@ import buildcraft.core.network.PacketSlotChange;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.utils.CraftingHelper;
|
import buildcraft.core.utils.CraftingHelper;
|
||||||
import buildcraft.core.inventory.SimpleInventory;
|
import buildcraft.core.inventory.SimpleInventory;
|
||||||
|
import buildcraft.core.triggers.ActionMachineControl;
|
||||||
import buildcraft.core.utils.Utils;
|
import buildcraft.core.utils.Utils;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class TileAdvancedCraftingTable extends TileEntity implements IInventory, ILaserTarget, IMachine {
|
public class TileAdvancedCraftingTable extends TileEntity implements IInventory, ILaserTarget, IMachine, IActionReceptor {
|
||||||
|
|
||||||
private final class InternalInventoryCraftingContainer extends Container {
|
private final class InternalInventoryCraftingContainer extends Container {
|
||||||
|
|
||||||
|
@ -139,6 +143,7 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
||||||
private int recentEnergyAverage;
|
private int recentEnergyAverage;
|
||||||
private InternalPlayer internalPlayer;
|
private InternalPlayer internalPlayer;
|
||||||
private IRecipe currentRecipe;
|
private IRecipe currentRecipe;
|
||||||
|
private ActionMachineControl.Mode lastMode = ActionMachineControl.Mode.Unknown;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory() {
|
public int getSizeInventory() {
|
||||||
|
@ -295,6 +300,9 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
||||||
if (!CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!CoreProxy.proxy.isSimulating(worldObj)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (lastMode == ActionMachineControl.Mode.Off) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
updateCraftingResults();
|
updateCraftingResults();
|
||||||
tick++;
|
tick++;
|
||||||
tick = tick % recentEnergy.length;
|
tick = tick % recentEnergy.length;
|
||||||
|
@ -393,7 +401,7 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCurrentWork() {
|
public boolean hasCurrentWork() {
|
||||||
return craftable;
|
return craftable && lastMode != ActionMachineControl.Mode.Off;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -433,8 +441,8 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActions() {
|
public boolean allowAction(IAction action) {
|
||||||
return true;
|
return action == BuildCraftCore.actionOn || action == BuildCraftCore.actionOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getGUINetworkData(int id, int data) {
|
public void getGUINetworkData(int id, int data) {
|
||||||
|
@ -479,4 +487,13 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
||||||
public boolean isStackValidForSlot(int slot, ItemStack stack) {
|
public boolean isStackValidForSlot(int slot, ItemStack stack) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionActivated(IAction action) {
|
||||||
|
if (action == BuildCraftCore.actionOn) {
|
||||||
|
lastMode = ActionMachineControl.Mode.On;
|
||||||
|
} else if (action == BuildCraftCore.actionOff) {
|
||||||
|
lastMode = ActionMachineControl.Mode.Off;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package buildcraft.silicon;
|
package buildcraft.silicon;
|
||||||
|
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
@ -458,7 +459,7 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActions() {
|
public boolean allowAction(IAction action) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.silicon;
|
package buildcraft.silicon;
|
||||||
|
|
||||||
|
import buildcraft.BuildCraftCore;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -16,37 +15,43 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import buildcraft.api.core.Position;
|
import buildcraft.api.core.Position;
|
||||||
import buildcraft.api.core.SafeTimeTracker;
|
import buildcraft.api.core.SafeTimeTracker;
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
|
import buildcraft.api.gates.IActionReceptor;
|
||||||
import buildcraft.api.power.IPowerProvider;
|
import buildcraft.api.power.IPowerProvider;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerFramework;
|
import buildcraft.api.power.PowerFramework;
|
||||||
import buildcraft.core.BlockIndex;
|
import buildcraft.core.BlockIndex;
|
||||||
import buildcraft.core.EntityEnergyLaser;
|
import buildcraft.core.EntityEnergyLaser;
|
||||||
import buildcraft.core.TileBuildCraft;
|
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
|
import buildcraft.core.triggers.ActionMachineControl;
|
||||||
|
import buildcraft.factory.TileMachine;
|
||||||
|
|
||||||
public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
public class TileLaser extends TileMachine implements IPowerReceptor, IActionReceptor {
|
||||||
|
|
||||||
private EntityEnergyLaser laser = null;
|
private EntityEnergyLaser laser = null;
|
||||||
|
|
||||||
private final SafeTimeTracker laserTickTracker = new SafeTimeTracker();
|
private final SafeTimeTracker laserTickTracker = new SafeTimeTracker();
|
||||||
private final SafeTimeTracker searchTracker = new SafeTimeTracker();
|
private final SafeTimeTracker searchTracker = new SafeTimeTracker();
|
||||||
private final SafeTimeTracker networkTracker = new SafeTimeTracker();
|
private final SafeTimeTracker networkTracker = new SafeTimeTracker();
|
||||||
|
|
||||||
private ILaserTarget laserTarget;
|
private ILaserTarget laserTarget;
|
||||||
|
|
||||||
public IPowerProvider powerProvider;
|
public IPowerProvider powerProvider;
|
||||||
|
|
||||||
private int nextNetworkUpdate = 3;
|
private int nextNetworkUpdate = 3;
|
||||||
private int nextLaserUpdate = 10;
|
private int nextLaserUpdate = 10;
|
||||||
private int nextLaserSearch = 100;
|
private int nextLaserSearch = 100;
|
||||||
|
private ActionMachineControl.Mode lastMode = ActionMachineControl.Mode.Unknown;
|
||||||
|
|
||||||
public TileLaser() {
|
public TileLaser() {
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
|
initPowerProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPowerProvider() {
|
||||||
powerProvider.configure(20, 25, 25, 25, 1000);
|
powerProvider.configure(20, 25, 25, 25, 1000);
|
||||||
|
powerProvider.configurePowerPerdition(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
super.updateEntity();
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isSimulating(worldObj))
|
if (!CoreProxy.proxy.isSimulating(worldObj))
|
||||||
return;
|
return;
|
||||||
|
@ -57,6 +62,12 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a gate disabled us, remove laser and do nothing.
|
||||||
|
if (lastMode == ActionMachineControl.Mode.Off) {
|
||||||
|
removeLaser();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for available tables if none is linked to this laser.
|
// Check for available tables if none is linked to this laser.
|
||||||
if (!isValidTable())
|
if (!isValidTable())
|
||||||
if (canFindTable()) {
|
if (canFindTable()) {
|
||||||
|
@ -65,10 +76,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
||||||
|
|
||||||
// If we still don't have a valid table or the existing has
|
// If we still don't have a valid table or the existing has
|
||||||
// become invalid, we disable the laser and do nothing.
|
// become invalid, we disable the laser and do nothing.
|
||||||
// Also bleed some energy from the provider which will result that a
|
|
||||||
// laser will eventually run out of power and stop searching
|
|
||||||
if (!isValidTable()) {
|
if (!isValidTable()) {
|
||||||
powerProvider.useEnergy(0F, 0.1F, true);
|
|
||||||
removeLaser();
|
removeLaser();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -236,27 +244,19 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
||||||
public void doWork() {
|
public void doWork() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int powerRequest(ForgeDirection from) {
|
|
||||||
if (powerProvider.getEnergyStored() < 200 || laser != null)
|
|
||||||
return 25;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendNetworkUpdate() {
|
public void sendNetworkUpdate() {
|
||||||
if (networkTracker.markTimeIfDelay(worldObj, nextNetworkUpdate)) {
|
if (networkTracker.markTimeIfDelay(worldObj, nextNetworkUpdate)) {
|
||||||
super.sendNetworkUpdate();
|
super.sendNetworkUpdate();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
super.readFromNBT(nbttagcompound);
|
super.readFromNBT(nbttagcompound);
|
||||||
|
|
||||||
PowerFramework.currentFramework.loadPowerProvider(this, nbttagcompound);
|
PowerFramework.currentFramework.loadPowerProvider(this, nbttagcompound);
|
||||||
powerProvider.configure(20, 25, 25, 25, 1000);
|
initPowerProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -272,4 +272,32 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
||||||
removeLaser();
|
removeLaser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isActive() {
|
||||||
|
return laser != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean manageLiquids() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean manageSolids() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean allowAction(IAction action) {
|
||||||
|
return action == BuildCraftCore.actionOn || action == BuildCraftCore.actionOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionActivated(IAction action) {
|
||||||
|
if (action == BuildCraftCore.actionOn) {
|
||||||
|
lastMode = ActionMachineControl.Mode.On;
|
||||||
|
} else if (action == BuildCraftCore.actionOff) {
|
||||||
|
lastMode = ActionMachineControl.Mode.Off;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,11 @@ public class PipeIconProvider implements IIconProvider {
|
||||||
|
|
||||||
public static final int Stripes = 33;
|
public static final int Stripes = 33;
|
||||||
|
|
||||||
public static final int MAX = 34;
|
public static final int PipePowerCobblestone = 34;
|
||||||
|
public static final int PipePowerDiamond = 35;
|
||||||
|
|
||||||
|
public static final int MAX = 36;
|
||||||
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private Icon[] _icons;
|
private Icon[] _icons;
|
||||||
|
@ -99,12 +103,14 @@ public class PipeIconProvider implements IIconProvider {
|
||||||
_icons[PipeIconProvider.PipeLiquidsStone] = iconRegister.registerIcon("buildcraft:pipeLiquidsStone");
|
_icons[PipeIconProvider.PipeLiquidsStone] = iconRegister.registerIcon("buildcraft:pipeLiquidsStone");
|
||||||
_icons[PipeIconProvider.PipeLiquidsVoid] = iconRegister.registerIcon("buildcraft:pipeLiquidsVoid");
|
_icons[PipeIconProvider.PipeLiquidsVoid] = iconRegister.registerIcon("buildcraft:pipeLiquidsVoid");
|
||||||
|
|
||||||
|
_icons[PipeIconProvider.PipePowerDiamond] = iconRegister.registerIcon("buildcraft:pipePowerDiamond");
|
||||||
_icons[PipeIconProvider.PipePowerGold] = iconRegister.registerIcon("buildcraft:pipePowerGold");
|
_icons[PipeIconProvider.PipePowerGold] = iconRegister.registerIcon("buildcraft:pipePowerGold");
|
||||||
_icons[PipeIconProvider.PipePowerStone] = iconRegister.registerIcon("buildcraft:pipePowerStone");
|
_icons[PipeIconProvider.PipePowerStone] = iconRegister.registerIcon("buildcraft:pipePowerStone");
|
||||||
|
_icons[PipeIconProvider.PipePowerCobblestone] = iconRegister.registerIcon("buildcraft:pipePowerCobblestone");
|
||||||
_icons[PipeIconProvider.PipePowerWood_Standard] = iconRegister.registerIcon("buildcraft:pipePowerWood_standard");
|
_icons[PipeIconProvider.PipePowerWood_Standard] = iconRegister.registerIcon("buildcraft:pipePowerWood_standard");
|
||||||
|
|
||||||
_icons[PipeIconProvider.Power_Normal] = iconRegister.registerIcon("buildcraft:texture_cyan");
|
_icons[PipeIconProvider.Power_Normal] = iconRegister.registerIcon("buildcraft:texture_cyan");
|
||||||
_icons[PipeIconProvider.Power_Overload] = iconRegister.registerIcon("buildcraft:texture_red_dark");
|
_icons[PipeIconProvider.Power_Overload] = iconRegister.registerIcon("buildcraft:texture_red_lit");
|
||||||
_icons[PipeIconProvider.Stripes] = iconRegister.registerIcon("buildcraft:pipeStripes");
|
_icons[PipeIconProvider.Stripes] = iconRegister.registerIcon("buildcraft:pipeStripes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.transport;
|
package buildcraft.transport;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftTransport;
|
|
||||||
import buildcraft.api.core.SafeTimeTracker;
|
import buildcraft.api.core.SafeTimeTracker;
|
||||||
import buildcraft.api.gates.ITrigger;
|
import buildcraft.api.gates.ITrigger;
|
||||||
import buildcraft.api.power.IPowerProvider;
|
import buildcraft.api.power.IPowerProvider;
|
||||||
|
@ -28,33 +23,25 @@ import buildcraft.transport.network.PacketPowerUpdate;
|
||||||
|
|
||||||
public class PipeTransportPower extends PipeTransport {
|
public class PipeTransportPower extends PipeTransport {
|
||||||
|
|
||||||
private static final int MAX_POWER_INTERNAL = 10000;
|
|
||||||
private static final int OVERLOAD_LIMIT = 7500;
|
|
||||||
private static final short MAX_DISPLAY = 100;
|
private static final short MAX_DISPLAY = 100;
|
||||||
private static final float DISPLAY_POWER_FACTOR = 0.1f;
|
private static final double DISPLAY_SMOOTHING = 5.0;
|
||||||
|
|
||||||
private boolean needsInit = true;
|
private boolean needsInit = true;
|
||||||
|
|
||||||
private TileEntity[] tiles = new TileEntity[6];
|
private TileEntity[] tiles = new TileEntity[6];
|
||||||
|
public double[] displayPower = new double[6];
|
||||||
public short[] displayPower = new short[] { 0, 0, 0, 0, 0, 0 };
|
public short[] clientDisplayPower = new short[6];
|
||||||
public boolean overload;
|
public boolean overload;
|
||||||
|
|
||||||
public int[] powerQuery = new int[6];
|
public int[] powerQuery = new int[6];
|
||||||
public int[] nextPowerQuery = new int[6];
|
public int[] nextPowerQuery = new int[6];
|
||||||
public long currentDate;
|
public long currentDate;
|
||||||
|
public double[] internalPower = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
||||||
public double[] internalPower = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
public double[] internalNextPower = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
||||||
public double[] internalNextPower = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
public int maxPower = 8;
|
||||||
|
|
||||||
public double powerResistance = 0.05;
|
|
||||||
|
|
||||||
public PipeTransportPower() {
|
public PipeTransportPower() {
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
powerQuery[i] = 0;
|
powerQuery[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SafeTimeTracker tracker = new SafeTimeTracker();
|
SafeTimeTracker tracker = new SafeTimeTracker();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,7 +90,7 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
|
|
||||||
// Send the power to nearby pipes who requested it
|
// Send the power to nearby pipes who requested it
|
||||||
|
|
||||||
Arrays.fill(displayPower, (short) 0);
|
double highestPower = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
if (internalPower[i] > 0) {
|
if (internalPower[i] > 0) {
|
||||||
|
@ -117,6 +104,9 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
double totalWatt = internalPower[i];
|
double totalWatt = internalPower[i];
|
||||||
|
if (totalWatt > highestPower) {
|
||||||
|
highestPower = totalWatt;
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 6; ++j) {
|
for (int j = 0; j < 6; ++j) {
|
||||||
if (j != i && powerQuery[j] > 0) {
|
if (j != i && powerQuery[j] > 0) {
|
||||||
|
@ -129,8 +119,8 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
|
|
||||||
nearbyTransport.receiveEnergy(ForgeDirection.VALID_DIRECTIONS[j].getOpposite(), watts);
|
nearbyTransport.receiveEnergy(ForgeDirection.VALID_DIRECTIONS[j].getOpposite(), watts);
|
||||||
|
|
||||||
displayPower[j] += (short) (watts * DISPLAY_POWER_FACTOR + .9999);
|
displayPower[j] = (displayPower[j] * (DISPLAY_SMOOTHING - 1.0) + watts) / DISPLAY_SMOOTHING;
|
||||||
displayPower[i] += (short) (watts * DISPLAY_POWER_FACTOR + .9999);
|
displayPower[i] = (displayPower[i] * (DISPLAY_SMOOTHING - 1.0) + watts) / DISPLAY_SMOOTHING;
|
||||||
|
|
||||||
internalPower[i] -= watts;
|
internalPower[i] -= watts;
|
||||||
} else if (tiles[j] instanceof IPowerReceptor) {
|
} else if (tiles[j] instanceof IPowerReceptor) {
|
||||||
|
@ -141,8 +131,8 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
if (prov != null) {
|
if (prov != null) {
|
||||||
prov.receiveEnergy((float) watts, ForgeDirection.VALID_DIRECTIONS[j].getOpposite());
|
prov.receiveEnergy((float) watts, ForgeDirection.VALID_DIRECTIONS[j].getOpposite());
|
||||||
|
|
||||||
displayPower[j] += (short) (watts * DISPLAY_POWER_FACTOR + .9999);
|
displayPower[j] = (displayPower[j] * (DISPLAY_SMOOTHING - 1.0) + watts) / DISPLAY_SMOOTHING;
|
||||||
displayPower[i] += (short) (watts * DISPLAY_POWER_FACTOR + .9999);
|
displayPower[i] = (displayPower[i] * (DISPLAY_SMOOTHING - 1.0) + watts) / DISPLAY_SMOOTHING;
|
||||||
|
|
||||||
internalPower[i] -= watts;
|
internalPower[i] -= watts;
|
||||||
}
|
}
|
||||||
|
@ -152,15 +142,7 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double highestPower = 0;
|
overload = highestPower > maxPower * 0.9;
|
||||||
for (int i = 0; i < 6; i++) {
|
|
||||||
if (internalPower[i] > highestPower) {
|
|
||||||
highestPower = internalPower[i];
|
|
||||||
}
|
|
||||||
displayPower[i] = (short) Math.max(displayPower[i], Math.ceil(internalPower[i] * DISPLAY_POWER_FACTOR));
|
|
||||||
displayPower[i] = (short) Math.min(displayPower[i], MAX_DISPLAY);
|
|
||||||
}
|
|
||||||
overload = highestPower > OVERLOAD_LIMIT;
|
|
||||||
|
|
||||||
// Compute the tiles requesting energy that are not pipes
|
// Compute the tiles requesting energy that are not pipes
|
||||||
|
|
||||||
|
@ -177,7 +159,7 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
|
|
||||||
// Sum the amount of energy requested on each side
|
// Sum the amount of energy requested on each side
|
||||||
|
|
||||||
int transferQuery[] = { 0, 0, 0, 0, 0, 0 };
|
int transferQuery[] = {0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
transferQuery[i] = 0;
|
transferQuery[i] = 0;
|
||||||
|
@ -212,7 +194,13 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
|
|
||||||
if (tracker.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
|
if (tracker.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
|
||||||
PacketPowerUpdate packet = new PacketPowerUpdate(xCoord, yCoord, zCoord);
|
PacketPowerUpdate packet = new PacketPowerUpdate(xCoord, yCoord, zCoord);
|
||||||
packet.displayPower = displayPower;
|
|
||||||
|
double displayFactor = MAX_DISPLAY / 256.0;
|
||||||
|
for (int i = 0; i < clientDisplayPower.length; i++) {
|
||||||
|
clientDisplayPower[i] = (short) (displayPower[i] * displayFactor + .9999);
|
||||||
|
}
|
||||||
|
|
||||||
|
packet.displayPower = clientDisplayPower;
|
||||||
packet.overload = overload;
|
packet.overload = overload;
|
||||||
CoreProxy.proxy.sendToPlayers(packet.getPacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST);
|
CoreProxy.proxy.sendToPlayers(packet.getPacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST);
|
||||||
}
|
}
|
||||||
|
@ -224,11 +212,10 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
currentDate = worldObj.getWorldTime();
|
currentDate = worldObj.getWorldTime();
|
||||||
|
|
||||||
powerQuery = nextPowerQuery;
|
powerQuery = nextPowerQuery;
|
||||||
nextPowerQuery = new int[] { 0, 0, 0, 0, 0, 0 };
|
nextPowerQuery = new int[]{0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
double[] next = Arrays.copyOf(internalPower, 6);
|
|
||||||
internalPower = internalNextPower;
|
internalPower = internalNextPower;
|
||||||
internalNextPower = next;
|
internalNextPower = new double[6];
|
||||||
for (int i = 0; i < nextPowerQuery.length; i++) {
|
for (int i = 0; i < nextPowerQuery.length; i++) {
|
||||||
if (powerQuery[i] == 0.0d && internalNextPower[i] > 0) {
|
if (powerQuery[i] == 0.0d && internalNextPower[i] > 0) {
|
||||||
internalNextPower[i] -= 1;
|
internalNextPower[i] -= 1;
|
||||||
|
@ -241,16 +228,11 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
step();
|
step();
|
||||||
if (this.container.pipe instanceof IPipeTransportPowerHook) {
|
if (this.container.pipe instanceof IPipeTransportPowerHook) {
|
||||||
((IPipeTransportPowerHook) this.container.pipe).receiveEnergy(from, val);
|
((IPipeTransportPowerHook) this.container.pipe).receiveEnergy(from, val);
|
||||||
} else {
|
|
||||||
if (BuildCraftTransport.usePipeLoss) {
|
|
||||||
internalNextPower[from.ordinal()] += val * (1 - powerResistance);
|
|
||||||
} else {
|
} else {
|
||||||
internalNextPower[from.ordinal()] += val;
|
internalNextPower[from.ordinal()] += val;
|
||||||
}
|
|
||||||
|
|
||||||
if (internalNextPower[from.ordinal()] >= MAX_POWER_INTERNAL) {
|
if (internalNextPower[from.ordinal()] >= maxPower) {
|
||||||
worldObj.createExplosion(null, xCoord, yCoord, zCoord, 3, false);
|
internalNextPower[from.ordinal()] = maxPower;
|
||||||
worldObj.setBlock(xCoord, yCoord, zCoord, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,8 +287,7 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
* @param packetPower
|
* @param packetPower
|
||||||
*/
|
*/
|
||||||
public void handlePowerPacket(PacketPowerUpdate packetPower) {
|
public void handlePowerPacket(PacketPowerUpdate packetPower) {
|
||||||
displayPower = packetPower.displayPower;
|
clientDisplayPower = packetPower.displayPower;
|
||||||
overload = packetPower.overload;
|
overload = packetPower.overload;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,10 @@ public class TransportProxyClient extends TransportProxy {
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsEmerald.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsEmerald.itemID, pipeItemRenderer);
|
||||||
|
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerWood.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerWood.itemID, pipeItemRenderer);
|
||||||
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerCobblestone.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerStone.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerStone.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerGold.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerGold.itemID, pipeItemRenderer);
|
||||||
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerDiamond.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeStructureCobblestone.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeStructureCobblestone.itemID, pipeItemRenderer);
|
||||||
// MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsStipes.shiftedIndex, pipeItemRenderer);
|
// MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsStipes.shiftedIndex, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsVoid.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsVoid.itemID, pipeItemRenderer);
|
||||||
|
|
37
common/buildcraft/transport/pipes/PipePowerCobblestone.java
Normal file
37
common/buildcraft/transport/pipes/PipePowerCobblestone.java
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* BuildCraft is open-source. It is distributed under the terms of the
|
||||||
|
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
||||||
|
* or run the code. It does *NOT* grant the right to redistribute this software
|
||||||
|
* or its modifications in any form, binary or source, except if expressively
|
||||||
|
* granted by the copyright holder.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package buildcraft.transport.pipes;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import buildcraft.BuildCraftTransport;
|
||||||
|
import buildcraft.api.core.IIconProvider;
|
||||||
|
import buildcraft.transport.Pipe;
|
||||||
|
import buildcraft.transport.PipeIconProvider;
|
||||||
|
import buildcraft.transport.PipeTransportPower;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class PipePowerCobblestone extends Pipe {
|
||||||
|
|
||||||
|
public PipePowerCobblestone(int itemID) {
|
||||||
|
super(new PipeTransportPower(), new PipeLogicStone(), itemID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIconProvider getIconProvider() {
|
||||||
|
return BuildCraftTransport.instance.pipeIconProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIconIndex(ForgeDirection direction) {
|
||||||
|
return PipeIconProvider.PipePowerCobblestone;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
39
common/buildcraft/transport/pipes/PipePowerDiamond.java
Normal file
39
common/buildcraft/transport/pipes/PipePowerDiamond.java
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
* BuildCraft is open-source. It is distributed under the terms of the
|
||||||
|
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
||||||
|
* or run the code. It does *NOT* grant the right to redistribute this software
|
||||||
|
* or its modifications in any form, binary or source, except if expressively
|
||||||
|
* granted by the copyright holder.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package buildcraft.transport.pipes;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import buildcraft.BuildCraftTransport;
|
||||||
|
import buildcraft.api.core.IIconProvider;
|
||||||
|
import buildcraft.transport.Pipe;
|
||||||
|
import buildcraft.transport.PipeIconProvider;
|
||||||
|
import buildcraft.transport.PipeTransportPower;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class PipePowerDiamond extends Pipe {
|
||||||
|
|
||||||
|
public PipePowerDiamond(int itemID) {
|
||||||
|
super(new PipeTransportPower(), new PipeLogicGold(), itemID);
|
||||||
|
|
||||||
|
((PipeTransportPower) transport).maxPower = 256;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIconProvider getIconProvider() {
|
||||||
|
return BuildCraftTransport.instance.pipeIconProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIconIndex(ForgeDirection direction) {
|
||||||
|
return PipeIconProvider.PipePowerDiamond;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ public class PipePowerGold extends Pipe {
|
||||||
public PipePowerGold(int itemID) {
|
public PipePowerGold(int itemID) {
|
||||||
super(new PipeTransportPower(), new PipeLogicGold(), itemID);
|
super(new PipeTransportPower(), new PipeLogicGold(), itemID);
|
||||||
|
|
||||||
((PipeTransportPower) transport).powerResistance = 0.005;
|
((PipeTransportPower) transport).maxPower = 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,6 +21,8 @@ public class PipePowerStone extends Pipe {
|
||||||
|
|
||||||
public PipePowerStone(int itemID) {
|
public PipePowerStone(int itemID) {
|
||||||
super(new PipeTransportPower(), new PipeLogicStone(), itemID);
|
super(new PipeTransportPower(), new PipeLogicStone(), itemID);
|
||||||
|
|
||||||
|
((PipeTransportPower) transport).maxPower = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* BuildCraft is open-source. It is distributed under the terms of the
|
* BuildCraft is open-source. It is distributed under the terms of the
|
||||||
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
* BuildCraft Open Source License. It grants rights to read, modify, compile or
|
||||||
* or run the code. It does *NOT* grant the right to redistribute this software
|
* run the code. It does *NOT* grant the right to redistribute this software or
|
||||||
* or its modifications in any form, binary or source, except if expressively
|
* its modifications in any form, binary or source, except if expressively
|
||||||
* granted by the copyright holder.
|
* granted by the copyright holder.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.transport.pipes;
|
package buildcraft.transport.pipes;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -25,22 +24,16 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class PipePowerWood extends Pipe implements IPowerReceptor {
|
public class PipePowerWood extends Pipe implements IPowerReceptor {
|
||||||
|
|
||||||
private static final int MAX_OVERHEAT_TICKS = 100;
|
|
||||||
|
|
||||||
private IPowerProvider powerProvider;
|
private IPowerProvider powerProvider;
|
||||||
|
|
||||||
protected int standardIconIndex = PipeIconProvider.PipePowerWood_Standard;
|
protected int standardIconIndex = PipeIconProvider.PipePowerWood_Standard;
|
||||||
protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid;
|
protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid;
|
||||||
|
|
||||||
|
|
||||||
private int overheatTicks;
|
|
||||||
|
|
||||||
public PipePowerWood(int itemID) {
|
public PipePowerWood(int itemID) {
|
||||||
super(new PipeTransportPower(), new PipeLogicWood(), itemID);
|
super(new PipeTransportPower(), new PipeLogicWood(), itemID);
|
||||||
|
|
||||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||||
powerProvider.configure(50, 2, 1000, 1, 1000);
|
powerProvider.configure(50, 2, 1000, 1, 1000);
|
||||||
powerProvider.configurePowerPerdition(1, 100);
|
powerProvider.configurePowerPerdition(1, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,15 +63,12 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPowerProvider getPowerProvider() {
|
public IPowerProvider getPowerProvider() {
|
||||||
if (overheatTicks > 0)
|
|
||||||
return null;
|
|
||||||
return powerProvider;
|
return powerProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doWork() {
|
public void doWork() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,12 +77,6 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
|
||||||
if (worldObj.isRemote)
|
if (worldObj.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (powerProvider.getEnergyStored() == powerProvider.getMaxEnergyStored()) {
|
|
||||||
overheatTicks += overheatTicks < MAX_OVERHEAT_TICKS ? 1 : 0;
|
|
||||||
} else {
|
|
||||||
overheatTicks -= overheatTicks > 0 ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
if (Utils.checkPipesConnections(container, container.getTile(o))) {
|
if (Utils.checkPipesConnections(container, container.getTile(o))) {
|
||||||
TileEntity tile = container.getTile(o);
|
TileEntity tile = container.getTile(o);
|
||||||
|
@ -116,9 +100,8 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
|
||||||
|
|
||||||
float energyUsable = powerProvider.useEnergy(1, energyToRemove, false);
|
float energyUsable = powerProvider.useEnergy(1, energyToRemove, false);
|
||||||
|
|
||||||
float energySend = Math.min(energyUsable, ((PipeTransportPower)transport).powerQuery[o.ordinal()]);
|
float energySend = Math.min(energyUsable, ((PipeTransportPower) transport).powerQuery[o.ordinal()]);
|
||||||
if(energySend > 0)
|
if (energySend > 0) {
|
||||||
{
|
|
||||||
trans.receiveEnergy(o.getOpposite(), energySend);
|
trans.receiveEnergy(o.getOpposite(), energySend);
|
||||||
powerProvider.useEnergy(1, energySend, true);
|
powerProvider.useEnergy(1, energySend, true);
|
||||||
}
|
}
|
||||||
|
@ -131,5 +114,4 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
|
||||||
public int powerRequest(ForgeDirection from) {
|
public int powerRequest(ForgeDirection from) {
|
||||||
return getPowerProvider().getMaxEnergyReceived();
|
return getPowerProvider().getMaxEnergyReceived();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,8 +292,8 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
||||||
GL11.glRotatef(angleZ[i], 0, 0, 1);
|
GL11.glRotatef(angleZ[i], 0, 0, 1);
|
||||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||||
|
|
||||||
if (pow.displayPower[i] >= 1.0) {
|
if (pow.clientDisplayPower[i] >= 1.0) {
|
||||||
short stage = pow.displayPower[i];
|
short stage = pow.clientDisplayPower[i];
|
||||||
|
|
||||||
if (stage < displayList.length) {
|
if (stage < displayList.length) {
|
||||||
GL11.glCallList(displayList[stage]);
|
GL11.glCallList(displayList[stage]);
|
||||||
|
|
|
@ -106,14 +106,14 @@ public class TriggerPipeContents extends BCTrigger implements ITriggerPipe {
|
||||||
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
|
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
|
||||||
|
|
||||||
if (kind == Kind.Empty) {
|
if (kind == Kind.Empty) {
|
||||||
for (short s : transportPower.displayPower)
|
for (double s : transportPower.displayPower)
|
||||||
if (s != 0)
|
if (s > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
for (short s : transportPower.displayPower)
|
for (double s : transportPower.displayPower)
|
||||||
if (s != 0)
|
if (s > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue