improvements in APIs, threaded packet sending, light sensor expansion, highly optimized pipe code
This commit is contained in:
parent
082cda0653
commit
f3d14f105a
33 changed files with 477 additions and 136 deletions
5
api/buildcraft/api/facades/FacadeAPI.java
Normal file
5
api/buildcraft/api/facades/FacadeAPI.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package buildcraft.api.facades;
|
||||||
|
|
||||||
|
public class FacadeAPI {
|
||||||
|
public static IFacadeItem facadeItem;
|
||||||
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
* Please check the contents of the license, which should be located
|
* Please check the contents of the license, which should be located
|
||||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||||
*/
|
*/
|
||||||
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|facades")
|
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|facades")
|
||||||
package buildcraft.api.facades;
|
package buildcraft.api.facades;
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,13 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public final class GateExpansions {
|
public final class GateExpansions {
|
||||||
|
|
||||||
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();
|
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();
|
||||||
private static final ArrayList<IGateExpansion> expansionIDs = new ArrayList<IGateExpansion>();
|
private static final ArrayList<IGateExpansion> expansionIDs = new ArrayList<IGateExpansion>();
|
||||||
|
private static final Map<IGateExpansion, ItemStack> recipes = new HashMap<IGateExpansion, ItemStack>();
|
||||||
|
|
||||||
private GateExpansions() {
|
private GateExpansions() {
|
||||||
}
|
}
|
||||||
|
@ -31,6 +33,11 @@ public final class GateExpansions {
|
||||||
expansionIDs.add(expansion);
|
expansionIDs.add(expansion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void registerExpansion(IGateExpansion expansion, ItemStack addedRecipe) {
|
||||||
|
registerExpansion(expansion.getUniqueIdentifier(), expansion);
|
||||||
|
recipes.put(expansion, addedRecipe);
|
||||||
|
}
|
||||||
|
|
||||||
public static IGateExpansion getExpansion(String identifier) {
|
public static IGateExpansion getExpansion(String identifier) {
|
||||||
return expansions.get(identifier);
|
return expansions.get(identifier);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +47,10 @@ public final class GateExpansions {
|
||||||
set.addAll(expansionIDs);
|
set.addAll(expansionIDs);
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<IGateExpansion, ItemStack> getRecipesForPostInit() {
|
||||||
|
return recipes;
|
||||||
|
}
|
||||||
|
|
||||||
// The code below is used by networking.
|
// The code below is used by networking.
|
||||||
|
|
||||||
|
|
|
@ -8,15 +8,12 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.api.gates;
|
package buildcraft.api.gates;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import buildcraft.api.statements.containers.ISidedStatementContainer;
|
||||||
|
|
||||||
import buildcraft.api.transport.IPipe;
|
import buildcraft.api.transport.IPipe;
|
||||||
|
|
||||||
public interface IGate {
|
public interface IGate extends ISidedStatementContainer {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void setPulsing(boolean pulse);
|
void setPulsing(boolean pulse);
|
||||||
|
|
||||||
ForgeDirection getSide();
|
|
||||||
|
|
||||||
IPipe getPipe();
|
IPipe getPipe();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Please check the contents of the license, which should be located
|
* Please check the contents of the license, which should be located
|
||||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||||
*/
|
*/
|
||||||
@API(apiVersion = "4.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates")
|
@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates")
|
||||||
package buildcraft.api.gates;
|
package buildcraft.api.gates;
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
|
|
5
api/buildcraft/api/robots/IDockingStationPluggable.java
Normal file
5
api/buildcraft/api/robots/IDockingStationPluggable.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package buildcraft.api.robots;
|
||||||
|
|
||||||
|
public interface IDockingStationPluggable {
|
||||||
|
IDockingStation getStation();
|
||||||
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
* Please check the contents of the license, which should be located
|
* Please check the contents of the license, which should be located
|
||||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||||
*/
|
*/
|
||||||
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics")
|
@API(apiVersion = "1.2", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics")
|
||||||
package buildcraft.api.robots;
|
package buildcraft.api.robots;
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package buildcraft.api.statements.containers;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
public interface IRedstoneStatementContainer {
|
||||||
|
/**
|
||||||
|
* Get the redstone input from a given side.
|
||||||
|
* @param side The side - use "UNKNOWN" for maximum input.
|
||||||
|
* @return The redstone input, from 0 to 15.
|
||||||
|
*/
|
||||||
|
int getRedstoneInput(ForgeDirection side);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the redstone input for a given side.
|
||||||
|
* @param side The side - use "UNKNOWN" for all sides.
|
||||||
|
* @return Whether the set was successful.
|
||||||
|
*/
|
||||||
|
boolean setRedstoneOutput(ForgeDirection side, int value);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package buildcraft.api.statements.containers;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import buildcraft.api.statements.IStatementContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by asie on 3/14/15.
|
||||||
|
*/
|
||||||
|
public interface ISidedStatementContainer extends IStatementContainer {
|
||||||
|
ForgeDirection getSide();
|
||||||
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
* Please check the contents of the license, which should be located
|
* Please check the contents of the license, which should be located
|
||||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||||
*/
|
*/
|
||||||
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements")
|
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements")
|
||||||
package buildcraft.api.statements;
|
package buildcraft.api.statements;
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
|
|
|
@ -31,20 +31,118 @@ import buildcraft.core.lib.network.Packet;
|
||||||
public class BuildCraftMod {
|
public class BuildCraftMod {
|
||||||
public EnumMap<Side, FMLEmbeddedChannel> channels;
|
public EnumMap<Side, FMLEmbeddedChannel> channels;
|
||||||
|
|
||||||
public void sendToPlayers(Packet packet, World world, int x, int y, int z, int maxDistance) {
|
static abstract class SendRequest {
|
||||||
try {
|
final Packet packet;
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
final BuildCraftMod source;
|
||||||
.set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
|
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
SendRequest(BuildCraftMod source, Packet packet) {
|
||||||
.set(new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, maxDistance));
|
this.packet = packet;
|
||||||
channels.get(Side.SERVER).writeOutbound(packet);
|
this.source = source;
|
||||||
} catch (Throwable t) {
|
}
|
||||||
BCLog.logger.log(Level.WARN, "sendToPlayers crash", t);
|
|
||||||
|
abstract void send();
|
||||||
|
|
||||||
|
void run() {
|
||||||
|
try {
|
||||||
|
send();
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PlayerSendRequest extends SendRequest {
|
||||||
|
EntityPlayer player;
|
||||||
|
|
||||||
|
PlayerSendRequest(BuildCraftMod source, Packet packet, EntityPlayer player) {
|
||||||
|
super(source, packet);
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
void send() {
|
||||||
|
source.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||||
|
.set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||||
|
source.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
|
||||||
|
source.channels.get(Side.SERVER).writeOutbound(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class WorldSendRequest extends SendRequest {
|
||||||
|
final int dimensionId;
|
||||||
|
|
||||||
|
WorldSendRequest(BuildCraftMod source, Packet packet, int dimensionId) {
|
||||||
|
super(source, packet);
|
||||||
|
this.dimensionId = dimensionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void send() {
|
||||||
|
source.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||||
|
.set(FMLOutboundHandler.OutboundTarget.DIMENSION);
|
||||||
|
source.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
||||||
|
.set(dimensionId);
|
||||||
|
source.channels.get(Side.SERVER).writeOutbound(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocationSendRequest extends SendRequest {
|
||||||
|
final int dimensionId;
|
||||||
|
final int x, y, z, md;
|
||||||
|
|
||||||
|
LocationSendRequest(BuildCraftMod source, Packet packet, int dimensionId, int x, int y, int z, int md) {
|
||||||
|
super(source, packet);
|
||||||
|
this.dimensionId = dimensionId;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.md = md;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void send() {
|
||||||
|
source.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||||
|
.set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
|
||||||
|
source.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
||||||
|
.set(new NetworkRegistry.TargetPoint(dimensionId, x, y, z, md));
|
||||||
|
source.channels.get(Side.SERVER).writeOutbound(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class PacketSender implements Runnable {
|
||||||
|
private Queue<SendRequest> packets = new ConcurrentLinkedDeque<SendRequest>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
while(true) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(20);
|
||||||
|
} catch(Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!packets.isEmpty()) {
|
||||||
|
packets.remove().run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean add(SendRequest r) {
|
||||||
|
return packets.offer(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PacketSender sender = new PacketSender();
|
||||||
|
private static Thread senderThread = new Thread(sender);
|
||||||
|
|
||||||
|
static {
|
||||||
|
senderThread.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendToPlayers(Packet packet, World world, int x, int y, int z, int maxDistance) {
|
||||||
|
sender.add(new LocationSendRequest(this, packet, world.provider.dimensionId, x, y, z, maxDistance));
|
||||||
|
}
|
||||||
|
|
||||||
public void sendToPlayersNear(Packet packet, TileEntity tileEntity, int maxDistance) {
|
public void sendToPlayersNear(Packet packet, TileEntity tileEntity, int maxDistance) {
|
||||||
sendToPlayers(packet, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, maxDistance);
|
sender.add(new LocationSendRequest(this, packet, tileEntity.getWorldObj().provider.dimensionId, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, maxDistance));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendToPlayersNear(Packet packet, TileEntity tileEntity) {
|
public void sendToPlayersNear(Packet packet, TileEntity tileEntity) {
|
||||||
|
@ -52,35 +150,14 @@ public class BuildCraftMod {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendToWorld(Packet packet, World world) {
|
public void sendToWorld(Packet packet, World world) {
|
||||||
try {
|
sender.add(new WorldSendRequest(this, packet, world.provider.dimensionId));
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
|
||||||
.set(FMLOutboundHandler.OutboundTarget.DIMENSION);
|
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
|
||||||
.set(world.provider.dimensionId);
|
|
||||||
channels.get(Side.SERVER).writeOutbound(packet);
|
|
||||||
} catch (Throwable t) {
|
|
||||||
BCLog.logger.log(Level.WARN, "sendToWorld crash", t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendToPlayer(EntityPlayer entityplayer, Packet packet) {
|
public void sendToPlayer(EntityPlayer entityplayer, Packet packet) {
|
||||||
try {
|
sender.add(new PlayerSendRequest(this, packet, entityplayer));
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
|
||||||
.set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(entityplayer);
|
|
||||||
channels.get(Side.SERVER).writeOutbound(packet);
|
|
||||||
} catch (Throwable t) {
|
|
||||||
String name = entityplayer.getDisplayName();
|
|
||||||
|
|
||||||
if (name == null) {
|
|
||||||
name = "<no name>";
|
|
||||||
}
|
|
||||||
|
|
||||||
BCLog.logger.log(Level.WARN, "sendToPlayer \"" + name + "\" crash", t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendToAll(Packet packet) {
|
/* public void sendToAll(Packet packet) {
|
||||||
try {
|
try {
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||||
.set(FMLOutboundHandler.OutboundTarget.ALL);
|
.set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||||
|
@ -88,14 +165,14 @@ public class BuildCraftMod {
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
BCLog.logger.log(Level.WARN, "sendToAll crash", t);
|
BCLog.logger.log(Level.WARN, "sendToAll crash", t);
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
public void sendToServer(Packet packet) {
|
public void sendToServer(Packet packet) {
|
||||||
try {
|
try {
|
||||||
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);
|
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);
|
||||||
channels.get(Side.CLIENT).writeOutbound(packet);
|
channels.get(Side.CLIENT).writeOutbound(packet);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
BCLog.logger.log(Level.WARN, "sendToServer crash", t);
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,7 @@ import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -41,7 +42,9 @@ import buildcraft.api.core.BCLog;
|
||||||
import buildcraft.api.core.EnumColor;
|
import buildcraft.api.core.EnumColor;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.JavaTools;
|
import buildcraft.api.core.JavaTools;
|
||||||
|
import buildcraft.api.facades.FacadeAPI;
|
||||||
import buildcraft.api.gates.GateExpansions;
|
import buildcraft.api.gates.GateExpansions;
|
||||||
|
import buildcraft.api.gates.IGateExpansion;
|
||||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||||
import buildcraft.api.statements.IActionInternal;
|
import buildcraft.api.statements.IActionInternal;
|
||||||
import buildcraft.api.statements.ITriggerInternal;
|
import buildcraft.api.statements.ITriggerInternal;
|
||||||
|
@ -79,6 +82,7 @@ import buildcraft.transport.TransportProxy;
|
||||||
import buildcraft.transport.WireIconProvider;
|
import buildcraft.transport.WireIconProvider;
|
||||||
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
||||||
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
||||||
|
import buildcraft.transport.gates.GateExpansionLightSensor;
|
||||||
import buildcraft.transport.gates.GateExpansionPulsar;
|
import buildcraft.transport.gates.GateExpansionPulsar;
|
||||||
import buildcraft.transport.gates.GateExpansionRedstoneFader;
|
import buildcraft.transport.gates.GateExpansionRedstoneFader;
|
||||||
import buildcraft.transport.gates.GateExpansionTimer;
|
import buildcraft.transport.gates.GateExpansionTimer;
|
||||||
|
@ -150,6 +154,7 @@ import buildcraft.transport.statements.ActionValve;
|
||||||
import buildcraft.transport.statements.ActionValve.ValveState;
|
import buildcraft.transport.statements.ActionValve.ValveState;
|
||||||
import buildcraft.transport.statements.TriggerClockTimer;
|
import buildcraft.transport.statements.TriggerClockTimer;
|
||||||
import buildcraft.transport.statements.TriggerClockTimer.Time;
|
import buildcraft.transport.statements.TriggerClockTimer.Time;
|
||||||
|
import buildcraft.transport.statements.TriggerLightSensor;
|
||||||
import buildcraft.transport.statements.TriggerParameterSignal;
|
import buildcraft.transport.statements.TriggerParameterSignal;
|
||||||
import buildcraft.transport.statements.TriggerPipeContents;
|
import buildcraft.transport.statements.TriggerPipeContents;
|
||||||
import buildcraft.transport.statements.TriggerPipeContents.PipeContents;
|
import buildcraft.transport.statements.TriggerPipeContents.PipeContents;
|
||||||
|
@ -227,6 +232,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
public static int groupItemsTrigger;
|
public static int groupItemsTrigger;
|
||||||
public static String[] facadeBlacklist;
|
public static String[] facadeBlacklist;
|
||||||
|
|
||||||
|
public static ITriggerInternal triggerLightSensorBright, triggerLightSensorDark;
|
||||||
public static ITriggerInternal[] triggerPipe = new ITriggerInternal[PipeContents.values().length];
|
public static ITriggerInternal[] triggerPipe = new ITriggerInternal[PipeContents.values().length];
|
||||||
public static ITriggerInternal[] triggerPipeWireActive = new ITriggerInternal[PipeWire.values().length];
|
public static ITriggerInternal[] triggerPipeWireActive = new ITriggerInternal[PipeWire.values().length];
|
||||||
public static ITriggerInternal[] triggerPipeWireInactive = new ITriggerInternal[PipeWire.values().length];
|
public static ITriggerInternal[] triggerPipeWireInactive = new ITriggerInternal[PipeWire.values().length];
|
||||||
|
@ -265,6 +271,9 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
public void preInit(FMLPreInitializationEvent evt) {
|
public void preInit(FMLPreInitializationEvent evt) {
|
||||||
new BCCreativeTab("pipes");
|
new BCCreativeTab("pipes");
|
||||||
new BCCreativeTab("facades");
|
new BCCreativeTab("facades");
|
||||||
|
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||||
|
new BCCreativeTab("gates");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Property durability = BuildCraftCore.mainConfiguration.get("general", "pipes.durability", DefaultProps.PIPES_DURABILITY);
|
Property durability = BuildCraftCore.mainConfiguration.get("general", "pipes.durability", DefaultProps.PIPES_DURABILITY);
|
||||||
|
@ -286,10 +295,6 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
filteredBufferBlock = new BlockFilteredBuffer();
|
filteredBufferBlock = new BlockFilteredBuffer();
|
||||||
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
|
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
|
||||||
|
|
||||||
GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
|
|
||||||
GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
|
|
||||||
GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE);
|
|
||||||
|
|
||||||
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get("general", "pipes.groupItemsTrigger", 32);
|
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get("general", "pipes.groupItemsTrigger", 32);
|
||||||
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
|
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
|
||||||
groupItemsTrigger = groupItemsTriggerProp.getInt();
|
groupItemsTrigger = groupItemsTriggerProp.getInt();
|
||||||
|
@ -387,6 +392,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
facadeItem = new ItemFacade();
|
facadeItem = new ItemFacade();
|
||||||
facadeItem.setUnlocalizedName("pipeFacade");
|
facadeItem.setUnlocalizedName("pipeFacade");
|
||||||
CoreProxy.proxy.registerItem(facadeItem);
|
CoreProxy.proxy.registerItem(facadeItem);
|
||||||
|
FacadeAPI.facadeItem = facadeItem;
|
||||||
|
|
||||||
plugItem = new ItemPlug();
|
plugItem = new ItemPlug();
|
||||||
plugItem.setUnlocalizedName("pipePlug");
|
plugItem.setUnlocalizedName("pipePlug");
|
||||||
|
@ -437,6 +443,9 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
for (PowerMode limit : PowerMode.VALUES) {
|
for (PowerMode limit : PowerMode.VALUES) {
|
||||||
actionPowerLimiter[limit.ordinal()] = new ActionPowerLimiter(limit);
|
actionPowerLimiter[limit.ordinal()] = new ActionPowerLimiter(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
triggerLightSensorBright = new TriggerLightSensor(true);
|
||||||
|
triggerLightSensorDark = new TriggerLightSensor(false);
|
||||||
} finally {
|
} finally {
|
||||||
BuildCraftCore.mainConfiguration.save();
|
BuildCraftCore.mainConfiguration.save();
|
||||||
}
|
}
|
||||||
|
@ -474,6 +483,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
|
|
||||||
BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1));
|
BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1));
|
||||||
BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block, 0));
|
BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block, 0));
|
||||||
|
BCCreativeTab.get("gates").setIcon(ItemGate.makeGateItem(GateMaterial.DIAMOND, GateLogic.AND));
|
||||||
|
|
||||||
StatementManager.registerParameterClass(TriggerParameterSignal.class);
|
StatementManager.registerParameterClass(TriggerParameterSignal.class);
|
||||||
StatementManager.registerParameterClass(ActionParameterSignal.class);
|
StatementManager.registerParameterClass(ActionParameterSignal.class);
|
||||||
|
@ -493,7 +503,12 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
PipeManager.registerPipePluggable(GatePluggable.class, "gate");
|
PipeManager.registerPipePluggable(GatePluggable.class, "gate");
|
||||||
PipeManager.registerPipePluggable(LensPluggable.class, "lens");
|
PipeManager.registerPipePluggable(LensPluggable.class, "lens");
|
||||||
PipeManager.registerPipePluggable(PlugPluggable.class, "plug");
|
PipeManager.registerPipePluggable(PlugPluggable.class, "plug");
|
||||||
|
|
||||||
|
GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE, Chipset.PULSATING.getStack());
|
||||||
|
GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE, Chipset.QUARTZ.getStack());
|
||||||
|
GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE, Chipset.COMP.getStack());
|
||||||
|
GateExpansions.registerExpansion(GateExpansionLightSensor.INSTANCE, new ItemStack(Blocks.daylight_detector));
|
||||||
|
|
||||||
if (BuildCraftCore.loadDefaultRecipes) {
|
if (BuildCraftCore.loadDefaultRecipes) {
|
||||||
loadRecipes();
|
loadRecipes();
|
||||||
}
|
}
|
||||||
|
@ -506,6 +521,10 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
public void postInit(FMLPostInitializationEvent evt) {
|
public void postInit(FMLPostInitializationEvent evt) {
|
||||||
facadeItem.initialize();
|
facadeItem.initialize();
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||||
|
postInitSilicon();
|
||||||
|
}
|
||||||
|
|
||||||
if (debugPrintFacadeList) {
|
if (debugPrintFacadeList) {
|
||||||
try {
|
try {
|
||||||
PrintWriter writer = new PrintWriter("FacadeDebug.txt", "UTF-8");
|
PrintWriter writer = new PrintWriter("FacadeDebug.txt", "UTF-8");
|
||||||
|
@ -522,6 +541,17 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void postInitSilicon() {
|
||||||
|
Map<IGateExpansion, ItemStack> recipes = GateExpansions.getRecipesForPostInit();
|
||||||
|
int recipeId = 0;
|
||||||
|
|
||||||
|
for (IGateExpansion expansion : recipes.keySet()) {
|
||||||
|
BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateExpansionRecipe("buildcraft:expansion_" + recipeId,
|
||||||
|
expansion, recipes.get(expansion)));
|
||||||
|
recipeId++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void loadRecipes() {
|
public void loadRecipes() {
|
||||||
// Add base recipe for pipe waterproof.
|
// Add base recipe for pipe waterproof.
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.dye, 1, 2));
|
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.dye, 1, 2));
|
||||||
|
@ -622,14 +652,6 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
// REVERSAL RECIPE
|
// REVERSAL RECIPE
|
||||||
BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateLogicSwapRecipe("buildcraft:gateSwap"));
|
BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateLogicSwapRecipe("buildcraft:gateSwap"));
|
||||||
|
|
||||||
// EXPANSIONS
|
|
||||||
BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateExpansionRecipe("buildcraft:expansionPulsar",
|
|
||||||
GateExpansionPulsar.INSTANCE, Chipset.PULSATING.getStack()));
|
|
||||||
BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateExpansionRecipe("buildcraft:expansionQuartz",
|
|
||||||
GateExpansionTimer.INSTANCE, Chipset.QUARTZ.getStack()));
|
|
||||||
BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateExpansionRecipe("buildcraft:expansionComp",
|
|
||||||
GateExpansionRedstoneFader.INSTANCE, Chipset.COMP.getStack()));
|
|
||||||
|
|
||||||
// FACADE
|
// FACADE
|
||||||
BuildcraftRecipeRegistry.integrationTable.addRecipe(new AdvancedFacadeRecipe("buildcraft:advancedFacade"));
|
BuildcraftRecipeRegistry.integrationTable.addRecipe(new AdvancedFacadeRecipe("buildcraft:advancedFacade"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,12 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.api.statements.IActionInternal;
|
import buildcraft.api.statements.IActionInternal;
|
||||||
import buildcraft.api.statements.IStatementContainer;
|
import buildcraft.api.statements.IStatementContainer;
|
||||||
import buildcraft.api.statements.IStatementParameter;
|
import buildcraft.api.statements.IStatementParameter;
|
||||||
|
import buildcraft.api.statements.containers.IRedstoneStatementContainer;
|
||||||
|
import buildcraft.api.statements.containers.ISidedStatementContainer;
|
||||||
import buildcraft.core.lib.utils.StringUtils;
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.transport.Gate;
|
import buildcraft.transport.Gate;
|
||||||
|
|
||||||
|
@ -62,8 +65,12 @@ public class ActionRedstoneOutput extends BCStatement implements IActionInternal
|
||||||
@Override
|
@Override
|
||||||
public void actionActivate(IStatementContainer source,
|
public void actionActivate(IStatementContainer source,
|
||||||
IStatementParameter[] parameters) {
|
IStatementParameter[] parameters) {
|
||||||
if (source instanceof Gate) {
|
if (source instanceof IRedstoneStatementContainer) {
|
||||||
((Gate) source).setRedstoneOutput(isSideOnly(parameters), getSignalLevel());
|
ForgeDirection side = ForgeDirection.UNKNOWN;
|
||||||
|
if (source instanceof ISidedStatementContainer && isSideOnly(parameters)) {
|
||||||
|
side = ((ISidedStatementContainer) source).getSide();
|
||||||
|
}
|
||||||
|
((IRedstoneStatementContainer) source).setRedstoneOutput(side, getSignalLevel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import buildcraft.api.statements.IActionExternal;
|
||||||
import buildcraft.api.statements.IActionInternal;
|
import buildcraft.api.statements.IActionInternal;
|
||||||
import buildcraft.api.statements.IActionProvider;
|
import buildcraft.api.statements.IActionProvider;
|
||||||
import buildcraft.api.statements.IStatementContainer;
|
import buildcraft.api.statements.IStatementContainer;
|
||||||
|
import buildcraft.api.statements.containers.IRedstoneStatementContainer;
|
||||||
import buildcraft.api.tiles.IControllable;
|
import buildcraft.api.tiles.IControllable;
|
||||||
import buildcraft.api.transport.IPipeTile;
|
import buildcraft.api.transport.IPipeTile;
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ public class DefaultActionProvider implements IActionProvider {
|
||||||
public Collection<IActionInternal> getInternalActions(IStatementContainer container) {
|
public Collection<IActionInternal> getInternalActions(IStatementContainer container) {
|
||||||
LinkedList<IActionInternal> res = new LinkedList<IActionInternal>();
|
LinkedList<IActionInternal> res = new LinkedList<IActionInternal>();
|
||||||
|
|
||||||
if (container.getTile() instanceof IPipeTile) {
|
if (container instanceof IRedstoneStatementContainer) {
|
||||||
res.add(BuildCraftCore.actionRedstone);
|
res.add(BuildCraftCore.actionRedstone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import buildcraft.api.statements.IStatementContainer;
|
||||||
import buildcraft.api.statements.ITriggerExternal;
|
import buildcraft.api.statements.ITriggerExternal;
|
||||||
import buildcraft.api.statements.ITriggerInternal;
|
import buildcraft.api.statements.ITriggerInternal;
|
||||||
import buildcraft.api.statements.ITriggerProvider;
|
import buildcraft.api.statements.ITriggerProvider;
|
||||||
|
import buildcraft.api.statements.containers.IRedstoneStatementContainer;
|
||||||
import buildcraft.api.tiles.IHasWork;
|
import buildcraft.api.tiles.IHasWork;
|
||||||
|
|
||||||
public class DefaultTriggerProvider implements ITriggerProvider {
|
public class DefaultTriggerProvider implements ITriggerProvider {
|
||||||
|
@ -65,6 +66,11 @@ public class DefaultTriggerProvider implements ITriggerProvider {
|
||||||
public LinkedList<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
public LinkedList<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||||
LinkedList<ITriggerInternal> res = new LinkedList<ITriggerInternal>();
|
LinkedList<ITriggerInternal> res = new LinkedList<ITriggerInternal>();
|
||||||
|
|
||||||
|
if (container instanceof IRedstoneStatementContainer) {
|
||||||
|
res.add(BuildCraftCore.triggerRedstoneActive);
|
||||||
|
res.add(BuildCraftCore.triggerRedstoneInactive);
|
||||||
|
}
|
||||||
|
|
||||||
if (TriggerEnergy.isTriggeringPipe(container.getTile()) || TriggerEnergy.getTriggeringNeighbor(container.getTile()) != null) {
|
if (TriggerEnergy.isTriggeringPipe(container.getTile()) || TriggerEnergy.getTriggeringNeighbor(container.getTile()) != null) {
|
||||||
res.add((ITriggerInternal) BuildCraftCore.triggerEnergyHigh);
|
res.add((ITriggerInternal) BuildCraftCore.triggerEnergyHigh);
|
||||||
res.add((ITriggerInternal) BuildCraftCore.triggerEnergyLow);
|
res.add((ITriggerInternal) BuildCraftCore.triggerEnergyLow);
|
||||||
|
|
|
@ -10,10 +10,13 @@ package buildcraft.core.statements;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.api.gates.IGate;
|
import buildcraft.api.gates.IGate;
|
||||||
import buildcraft.api.statements.IStatementContainer;
|
import buildcraft.api.statements.IStatementContainer;
|
||||||
import buildcraft.api.statements.IStatementParameter;
|
import buildcraft.api.statements.IStatementParameter;
|
||||||
import buildcraft.api.statements.ITriggerInternal;
|
import buildcraft.api.statements.ITriggerInternal;
|
||||||
|
import buildcraft.api.statements.containers.IRedstoneStatementContainer;
|
||||||
|
import buildcraft.api.statements.containers.ISidedStatementContainer;
|
||||||
import buildcraft.core.lib.utils.StringUtils;
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.TileGenericPipe;
|
||||||
|
|
||||||
|
@ -49,18 +52,18 @@ public class TriggerRedstoneInput extends BCStatement implements ITriggerInterna
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
|
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
|
||||||
if (!(container.getTile() instanceof TileGenericPipe)) {
|
if (container instanceof IRedstoneStatementContainer) {
|
||||||
|
int level = ((IRedstoneStatementContainer) container).getRedstoneInput(ForgeDirection.UNKNOWN);
|
||||||
|
if (parameters.length > 0 && parameters[0] instanceof StatementParameterRedstoneGateSideOnly &&
|
||||||
|
((StatementParameterRedstoneGateSideOnly) parameters[0]).isOn &&
|
||||||
|
container instanceof ISidedStatementContainer) {
|
||||||
|
level = ((IRedstoneStatementContainer) container).getRedstoneInput(((ISidedStatementContainer) container).getSide());
|
||||||
|
}
|
||||||
|
|
||||||
|
return active ? level > 0 : level == 0;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileGenericPipe tile = (TileGenericPipe) container.getTile();
|
|
||||||
int level = tile.redstoneInput;
|
|
||||||
if (parameters.length > 0 && parameters[0] instanceof StatementParameterRedstoneGateSideOnly &&
|
|
||||||
((StatementParameterRedstoneGateSideOnly) parameters[0]).isOn) {
|
|
||||||
level = tile.redstoneInputSide[((IGate) container).getSide().ordinal()];
|
|
||||||
}
|
|
||||||
|
|
||||||
return active ? level > 0 : level == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import buildcraft.BuildCraftRobotics;
|
import buildcraft.BuildCraftRobotics;
|
||||||
import buildcraft.api.recipes.CraftingResult;
|
import buildcraft.api.recipes.CraftingResult;
|
||||||
import buildcraft.silicon.TileIntegrationTable;
|
import buildcraft.silicon.TileIntegrationTable;
|
||||||
import buildcraft.transport.recipes.IntegrationTableRecipe;
|
import buildcraft.silicon.recipes.IntegrationTableRecipe;
|
||||||
|
|
||||||
public class RobotIntegrationRecipe extends IntegrationTableRecipe {
|
public class RobotIntegrationRecipe extends IntegrationTableRecipe {
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import cofh.api.energy.IEnergyReceiver;
|
||||||
import buildcraft.BuildCraftRobotics;
|
import buildcraft.BuildCraftRobotics;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.render.ITextureStates;
|
import buildcraft.api.core.render.ITextureStates;
|
||||||
|
import buildcraft.api.robots.IDockingStationPluggable;
|
||||||
import buildcraft.api.robots.RobotManager;
|
import buildcraft.api.robots.RobotManager;
|
||||||
import buildcraft.api.tiles.IDebuggable;
|
import buildcraft.api.tiles.IDebuggable;
|
||||||
import buildcraft.api.transport.IPipe;
|
import buildcraft.api.transport.IPipe;
|
||||||
|
@ -26,7 +27,8 @@ import buildcraft.core.lib.utils.MatrixTranformations;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.TileGenericPipe;
|
||||||
|
|
||||||
public class RobotStationPluggable extends PipePluggable implements IPipePluggableItem, IEnergyReceiver, IDebuggable {
|
public class RobotStationPluggable extends PipePluggable implements IPipePluggableItem, IEnergyReceiver, IDebuggable,
|
||||||
|
IDockingStationPluggable {
|
||||||
public class RobotStationPluggableRenderer implements IPipePluggableRenderer {
|
public class RobotStationPluggableRenderer implements IPipePluggableRenderer {
|
||||||
private float zFightOffset = 1 / 4096.0F;
|
private float zFightOffset = 1 / 4096.0F;
|
||||||
|
|
||||||
|
@ -175,6 +177,7 @@ public class RobotStationPluggable extends PipePluggable implements IPipePluggab
|
||||||
return new ItemStack[] { new ItemStack(BuildCraftRobotics.robotStationItem) };
|
return new ItemStack[] { new ItemStack(BuildCraftRobotics.robotStationItem) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public DockingStation getStation() {
|
public DockingStation getStation() {
|
||||||
return station;
|
return station;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* License 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.recipes;
|
package buildcraft.silicon.recipes;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -31,8 +31,9 @@ import buildcraft.api.gates.IGateExpansion;
|
||||||
import buildcraft.api.statements.IActionExternal;
|
import buildcraft.api.statements.IActionExternal;
|
||||||
import buildcraft.api.statements.IActionInternal;
|
import buildcraft.api.statements.IActionInternal;
|
||||||
import buildcraft.api.statements.IActionReceptor;
|
import buildcraft.api.statements.IActionReceptor;
|
||||||
|
import buildcraft.api.statements.containers.IRedstoneStatementContainer;
|
||||||
|
import buildcraft.api.statements.containers.ISidedStatementContainer;
|
||||||
import buildcraft.api.statements.IStatement;
|
import buildcraft.api.statements.IStatement;
|
||||||
import buildcraft.api.statements.IStatementContainer;
|
|
||||||
import buildcraft.api.statements.IStatementParameter;
|
import buildcraft.api.statements.IStatementParameter;
|
||||||
import buildcraft.api.statements.ITriggerExternal;
|
import buildcraft.api.statements.ITriggerExternal;
|
||||||
import buildcraft.api.statements.ITriggerInternal;
|
import buildcraft.api.statements.ITriggerInternal;
|
||||||
|
@ -48,7 +49,7 @@ import buildcraft.transport.gates.StatementSlot;
|
||||||
import buildcraft.transport.gui.ContainerGateInterface;
|
import buildcraft.transport.gui.ContainerGateInterface;
|
||||||
import buildcraft.transport.statements.ActionValve;
|
import buildcraft.transport.statements.ActionValve;
|
||||||
|
|
||||||
public final class Gate implements IGate, IStatementContainer {
|
public final class Gate implements IGate, ISidedStatementContainer, IRedstoneStatementContainer {
|
||||||
|
|
||||||
public static int MAX_STATEMENTS = 8;
|
public static int MAX_STATEMENTS = 8;
|
||||||
public static int MAX_PARAMETERS = 3;
|
public static int MAX_PARAMETERS = 3;
|
||||||
|
@ -641,4 +642,19 @@ public final class Gate implements IGate, IStatementContainer {
|
||||||
public TileEntity getTile() {
|
public TileEntity getTile() {
|
||||||
return pipe.container;
|
return pipe.container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRedstoneInput(ForgeDirection side) {
|
||||||
|
return side == ForgeDirection.UNKNOWN ? pipe.container.redstoneInput : pipe.container.redstoneInputSide[side.ordinal()];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setRedstoneOutput(ForgeDirection side, int value) {
|
||||||
|
if (side != this.getSide() && side != ForgeDirection.UNKNOWN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRedstoneOutput(side != ForgeDirection.UNKNOWN, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,10 +253,6 @@ public class PipeTransportItems extends PipeTransport implements IDebuggable {
|
||||||
private void moveSolids() {
|
private void moveSolids() {
|
||||||
items.flush();
|
items.flush();
|
||||||
|
|
||||||
if (!container.getWorldObj().isRemote) {
|
|
||||||
items.purgeCorruptedItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
items.iterating = true;
|
items.iterating = true;
|
||||||
for (TravelingItem item : items) {
|
for (TravelingItem item : items) {
|
||||||
if (item.getContainer() != this.container) {
|
if (item.getContainer() != this.container) {
|
||||||
|
@ -270,6 +266,11 @@ public class PipeTransportItems extends PipeTransport implements IDebuggable {
|
||||||
item.movePosition(motion.x, motion.y, motion.z);
|
item.movePosition(motion.x, motion.y, motion.z);
|
||||||
|
|
||||||
if ((item.toCenter && middleReached(item)) || outOfBounds(item)) {
|
if ((item.toCenter && middleReached(item)) || outOfBounds(item)) {
|
||||||
|
if (item.isCorrupted()) {
|
||||||
|
items.remove(item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
item.toCenter = false;
|
item.toCenter = false;
|
||||||
|
|
||||||
// Reajusting to the middle
|
// Reajusting to the middle
|
||||||
|
@ -285,6 +286,11 @@ public class PipeTransportItems extends PipeTransport implements IDebuggable {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!item.toCenter && endReached(item)) {
|
} else if (!item.toCenter && endReached(item)) {
|
||||||
|
if (item.isCorrupted()) {
|
||||||
|
items.remove(item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
TileEntity tile = container.getTile(item.output);
|
TileEntity tile = container.getTile(item.output);
|
||||||
|
|
||||||
PipeEventItem.ReachedEnd event = new PipeEventItem.ReachedEnd(item, tile);
|
PipeEventItem.ReachedEnd event = new PipeEventItem.ReachedEnd(item, tile);
|
||||||
|
|
|
@ -43,9 +43,6 @@ public class PipeTriggerProvider implements ITriggerProvider {
|
||||||
gate.addTriggers(result);
|
gate.addTriggers(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.add(BuildCraftCore.triggerRedstoneActive);
|
|
||||||
result.add(BuildCraftCore.triggerRedstoneInactive);
|
|
||||||
|
|
||||||
switch (((TileGenericPipe) tile).getPipeType()) {
|
switch (((TileGenericPipe) tile).getPipeType()) {
|
||||||
case ITEM:
|
case ITEM:
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class TravelerSet extends ForwardingSet<TravelingItem> {
|
||||||
|
|
||||||
public boolean iterating;
|
public boolean iterating;
|
||||||
|
|
||||||
private final BiMap<Integer, TravelingItem> items = HashBiMap.create();
|
private final Set<TravelingItem> items = new HashSet<TravelingItem>();
|
||||||
private final Set<TravelingItem> toLoad = new HashSet<TravelingItem>();
|
private final Set<TravelingItem> toLoad = new HashSet<TravelingItem>();
|
||||||
private final Set<TravelingItem> toAdd = new HashSet<TravelingItem>();
|
private final Set<TravelingItem> toAdd = new HashSet<TravelingItem>();
|
||||||
private final Set<TravelingItem> toRemove = new HashSet<TravelingItem>();
|
private final Set<TravelingItem> toRemove = new HashSet<TravelingItem>();
|
||||||
|
@ -34,7 +34,7 @@ public class TravelerSet extends ForwardingSet<TravelingItem> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<TravelingItem> delegate() {
|
protected Set<TravelingItem> delegate() {
|
||||||
return items.values();
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,11 +42,8 @@ public class TravelerSet extends ForwardingSet<TravelingItem> {
|
||||||
if (iterating) {
|
if (iterating) {
|
||||||
return toAdd.add(item);
|
return toAdd.add(item);
|
||||||
}
|
}
|
||||||
if (items.containsValue(item)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
item.setContainer(transport.container);
|
item.setContainer(transport.container);
|
||||||
items.put(item.id, item);
|
items.add(item);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +73,6 @@ public class TravelerSet extends ForwardingSet<TravelingItem> {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TravelingItem get(int id) {
|
|
||||||
return items.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void scheduleLoad(TravelingItem item) {
|
void scheduleLoad(TravelingItem item) {
|
||||||
delay = 10;
|
delay = 10;
|
||||||
toLoad.add(item);
|
toLoad.add(item);
|
||||||
|
@ -108,20 +101,10 @@ public class TravelerSet extends ForwardingSet<TravelingItem> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeScheduledItems() {
|
void removeScheduledItems() {
|
||||||
items.values().removeAll(toRemove);
|
items.removeAll(toRemove);
|
||||||
toRemove.clear();
|
toRemove.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void purgeCorruptedItems() {
|
|
||||||
Iterator<TravelingItem> it = items.values().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
TravelingItem item = it.next();
|
|
||||||
if (item.isCorrupted()) {
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void flush() {
|
void flush() {
|
||||||
loadScheduledItems();
|
loadScheduledItems();
|
||||||
addScheduledItems();
|
addScheduledItems();
|
||||||
|
@ -130,7 +113,7 @@ public class TravelerSet extends ForwardingSet<TravelingItem> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<TravelingItem> iterator() {
|
public Iterator<TravelingItem> iterator() {
|
||||||
return items.values().iterator();
|
return items.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -285,9 +285,7 @@ public class TravelingItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return this.id;
|
||||||
hash = 67 * hash + this.id;
|
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
|
||||||
|
* 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 java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import buildcraft.BuildCraftTransport;
|
||||||
|
import buildcraft.api.gates.GateExpansionController;
|
||||||
|
import buildcraft.api.gates.IGateExpansion;
|
||||||
|
import buildcraft.api.statements.IActionInternal;
|
||||||
|
import buildcraft.api.statements.ITriggerInternal;
|
||||||
|
|
||||||
|
public final class GateExpansionLightSensor extends GateExpansionBuildcraft implements IGateExpansion {
|
||||||
|
|
||||||
|
public static GateExpansionLightSensor INSTANCE = new GateExpansionLightSensor();
|
||||||
|
|
||||||
|
private GateExpansionLightSensor() {
|
||||||
|
super("light_sensor");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GateExpansionController makeController(TileEntity pipeTile) {
|
||||||
|
return new GateExpansionControllerLightSensor(pipeTile);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GateExpansionControllerLightSensor extends GateExpansionController {
|
||||||
|
|
||||||
|
public GateExpansionControllerLightSensor(TileEntity pipeTile) {
|
||||||
|
super(GateExpansionLightSensor.this, pipeTile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTriggers(List<ITriggerInternal> list) {
|
||||||
|
super.addTriggers(list);
|
||||||
|
list.add(BuildCraftTransport.triggerLightSensorBright);
|
||||||
|
list.add(BuildCraftTransport.triggerLightSensorDark);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,6 +37,7 @@ import buildcraft.api.statements.StatementManager;
|
||||||
import buildcraft.api.transport.IPipe;
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.api.transport.pluggable.IPipePluggableItem;
|
import buildcraft.api.transport.pluggable.IPipePluggableItem;
|
||||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||||
|
import buildcraft.core.BCCreativeTab;
|
||||||
import buildcraft.core.lib.items.ItemBuildCraft;
|
import buildcraft.core.lib.items.ItemBuildCraft;
|
||||||
import buildcraft.core.lib.inventory.InvUtils;
|
import buildcraft.core.lib.inventory.InvUtils;
|
||||||
import buildcraft.core.lib.utils.StringUtils;
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
|
@ -50,12 +51,14 @@ public class ItemGate extends ItemBuildCraft implements IPipePluggableItem {
|
||||||
protected static final String NBT_TAG_MAT = "mat";
|
protected static final String NBT_TAG_MAT = "mat";
|
||||||
protected static final String NBT_TAG_LOGIC = "logic";
|
protected static final String NBT_TAG_LOGIC = "logic";
|
||||||
protected static final String NBT_TAG_EX = "ex";
|
protected static final String NBT_TAG_EX = "ex";
|
||||||
|
private static ArrayList<ItemStack> allGates;
|
||||||
|
|
||||||
public ItemGate() {
|
public ItemGate() {
|
||||||
super();
|
super();
|
||||||
setHasSubtypes(false);
|
setHasSubtypes(false);
|
||||||
setMaxDamage(0);
|
setMaxDamage(0);
|
||||||
setPassSneakClick(true);
|
setPassSneakClick(true);
|
||||||
|
setCreativeTab(BCCreativeTab.get("gates"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NBTTagCompound getNBT(ItemStack stack) {
|
private static NBTTagCompound getNBT(ItemStack stack) {
|
||||||
|
@ -207,22 +210,6 @@ public class ItemGate extends ItemBuildCraft implements IPipePluggableItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack[] getGateVarients() {
|
|
||||||
ArrayList<ItemStack> gates = new ArrayList<ItemStack>();
|
|
||||||
|
|
||||||
for (GateMaterial material : GateMaterial.VALUES) {
|
|
||||||
for (GateLogic logic : GateLogic.VALUES) {
|
|
||||||
if (material == GateMaterial.REDSTONE && logic == GateLogic.OR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
gates.add(makeGateItem(material, logic));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return gates.toArray(new ItemStack[gates.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) {
|
||||||
super.addInformation(stack, player, list, adv);
|
super.addInformation(stack, player, list, adv);
|
||||||
|
@ -269,4 +256,20 @@ public class ItemGate extends ItemBuildCraft implements IPipePluggableItem {
|
||||||
|
|
||||||
return new GatePluggable(GateFactory.makeGate(realPipe, stack, side));
|
return new GatePluggable(GateFactory.makeGate(realPipe, stack, side));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ArrayList<ItemStack> getAllGates() {
|
||||||
|
if (allGates == null) {
|
||||||
|
allGates = new ArrayList<ItemStack>();
|
||||||
|
for (GateDefinition.GateMaterial m : GateDefinition.GateMaterial.VALUES) {
|
||||||
|
for (GateDefinition.GateLogic l : GateDefinition.GateLogic.VALUES) {
|
||||||
|
if (m == GateMaterial.REDSTONE && l == GateLogic.OR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
allGates.add(ItemGate.makeGateItem(m, l));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allGates;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,8 +131,12 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISerializable, IG
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doRemove) {
|
if (doRemove) {
|
||||||
int stackSize = (int) Math.floor(battery.useEnergy(10, 10 * stack.stackSize, false) / 10);
|
int maxStackSize = stack.stackSize;
|
||||||
|
int stackSize = Math.min(maxStackSize, battery.getEnergyStored() / 10);
|
||||||
|
speedMultiplier = Math.min(4.0F, battery.getEnergyStored() * 10 / stackSize);
|
||||||
|
int energyUsed = (int) (stackSize * 10 * speedMultiplier);
|
||||||
|
battery.useEnergy(energyUsed, energyUsed, false);
|
||||||
|
|
||||||
stack = inventory.decrStackSize(k, stackSize);
|
stack = inventory.decrStackSize(k, stackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +169,9 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISerializable, IG
|
||||||
// In Round Robin mode, extract only 1 item regardless of power level.
|
// In Round Robin mode, extract only 1 item regardless of power level.
|
||||||
stack = inventory.decrStackSize(i, 1);
|
stack = inventory.decrStackSize(i, 1);
|
||||||
incrementFilter();
|
incrementFilter();
|
||||||
|
} else {
|
||||||
|
stack = stack.copy();
|
||||||
|
stack.stackSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ItemStack[]{ stack };
|
return new ItemStack[]{ stack };
|
||||||
|
|
|
@ -35,10 +35,11 @@ import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
|
|
||||||
public class PipeItemsWood extends Pipe<PipeTransportItems> implements IEnergyHandler {
|
public class PipeItemsWood extends Pipe<PipeTransportItems> implements IEnergyHandler {
|
||||||
protected RFBattery battery = new RFBattery(640, 80, 0);
|
protected RFBattery battery = new RFBattery(2560, 2560 / 8, 0);
|
||||||
|
|
||||||
protected int standardIconIndex = PipeIconProvider.TYPE.PipeItemsWood_Standard.ordinal();
|
protected int standardIconIndex = PipeIconProvider.TYPE.PipeItemsWood_Standard.ordinal();
|
||||||
protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal();
|
protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal();
|
||||||
|
protected float speedMultiplier = 1.0F;
|
||||||
|
|
||||||
private int ticksSincePull = 0;
|
private int ticksSincePull = 0;
|
||||||
|
|
||||||
|
@ -114,15 +115,40 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IEnergyHa
|
||||||
|
|
||||||
battery.setEnergy(0);
|
battery.setEnergy(0);
|
||||||
ticksSincePull = 0;
|
ticksSincePull = 0;
|
||||||
|
speedMultiplier = 1.0F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldTick() {
|
private boolean shouldTick() {
|
||||||
if (battery.getEnergyStored() >= 64 * 10) {
|
if (ticksSincePull < 8) {
|
||||||
return true;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return ticksSincePull >= 16 && battery.getEnergyStored() >= 10;
|
// Check if we have just enough energy for the next stack.
|
||||||
|
int meta = container.getBlockMetadata();
|
||||||
|
|
||||||
|
if (meta <= 5) {
|
||||||
|
ForgeDirection side = ForgeDirection.getOrientation(meta);
|
||||||
|
TileEntity tile = container.getTile(side);
|
||||||
|
|
||||||
|
if (tile instanceof IInventory) {
|
||||||
|
int stackSize = 0;
|
||||||
|
IInventory inventory = (IInventory) tile;
|
||||||
|
ItemStack[] extracted = checkExtract(inventory, false, side.getOpposite());
|
||||||
|
if (extracted != null) {
|
||||||
|
for (ItemStack s : extracted) {
|
||||||
|
stackSize += s.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (battery.getEnergyStored() >= stackSize * 10) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ticksSincePull >= 16 && battery.getEnergyStored() >= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extractItems() {
|
private void extractItems() {
|
||||||
|
@ -157,7 +183,7 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IEnergyHa
|
||||||
entityPos.moveForwards(0.6);
|
entityPos.moveForwards(0.6);
|
||||||
|
|
||||||
TravelingItem entity = makeItem(entityPos.x, entityPos.y, entityPos.z, stack);
|
TravelingItem entity = makeItem(entityPos.x, entityPos.y, entityPos.z, stack);
|
||||||
|
entity.setSpeed(entity.getSpeed() * speedMultiplier);
|
||||||
transport.injectItem(entity, entityPos.orientation);
|
transport.injectItem(entity, entityPos.orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,8 +223,12 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IEnergyHa
|
||||||
|
|
||||||
if (slot != null && slot.stackSize > 0 && inventory.canExtractItem(k, slot, from.ordinal())) {
|
if (slot != null && slot.stackSize > 0 && inventory.canExtractItem(k, slot, from.ordinal())) {
|
||||||
if (doRemove) {
|
if (doRemove) {
|
||||||
int stackSize = (int) Math.floor(battery.useEnergy(10, slot.stackSize * 10, false) / 10);
|
int maxStackSize = slot.stackSize;
|
||||||
|
int stackSize = Math.min(maxStackSize, battery.getEnergyStored() / 10);
|
||||||
|
speedMultiplier = Math.min(4.0F, battery.getEnergyStored() * 10 / stackSize);
|
||||||
|
int energyUsed = (int) (stackSize * 10 * speedMultiplier);
|
||||||
|
battery.useEnergy(energyUsed, energyUsed, false);
|
||||||
|
|
||||||
return inventory.decrStackSize(k, stackSize);
|
return inventory.decrStackSize(k, stackSize);
|
||||||
} else {
|
} else {
|
||||||
return slot;
|
return slot;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import buildcraft.api.recipes.CraftingResult;
|
||||||
import buildcraft.api.transport.PipeWire;
|
import buildcraft.api.transport.PipeWire;
|
||||||
import buildcraft.silicon.ItemRedstoneChipset;
|
import buildcraft.silicon.ItemRedstoneChipset;
|
||||||
import buildcraft.silicon.TileIntegrationTable;
|
import buildcraft.silicon.TileIntegrationTable;
|
||||||
|
import buildcraft.silicon.recipes.IntegrationTableRecipe;
|
||||||
import buildcraft.transport.ItemFacade;
|
import buildcraft.transport.ItemFacade;
|
||||||
import buildcraft.transport.ItemFacade.FacadeState;
|
import buildcraft.transport.ItemFacade.FacadeState;
|
||||||
import buildcraft.transport.ItemPipeWire;
|
import buildcraft.transport.ItemPipeWire;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.transport.recipes;
|
package buildcraft.transport.recipes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
|
@ -15,6 +17,7 @@ import buildcraft.api.gates.IGateExpansion;
|
||||||
import buildcraft.api.recipes.CraftingResult;
|
import buildcraft.api.recipes.CraftingResult;
|
||||||
import buildcraft.core.lib.inventory.StackHelper;
|
import buildcraft.core.lib.inventory.StackHelper;
|
||||||
import buildcraft.silicon.TileIntegrationTable;
|
import buildcraft.silicon.TileIntegrationTable;
|
||||||
|
import buildcraft.silicon.recipes.IntegrationTableRecipe;
|
||||||
import buildcraft.transport.gates.ItemGate;
|
import buildcraft.transport.gates.ItemGate;
|
||||||
|
|
||||||
public class GateExpansionRecipe extends IntegrationTableRecipe {
|
public class GateExpansionRecipe extends IntegrationTableRecipe {
|
||||||
|
@ -68,4 +71,26 @@ public class GateExpansionRecipe extends IntegrationTableRecipe {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Object> getInputs() {
|
||||||
|
ArrayList<Object> inputs = new ArrayList<Object>();
|
||||||
|
|
||||||
|
inputs.add(ItemGate.getAllGates());
|
||||||
|
inputs.add(chipset);
|
||||||
|
|
||||||
|
return inputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public Collection<Object> getOutput() {
|
||||||
|
ArrayList<Object> gates = new ArrayList<Object>();
|
||||||
|
for (ItemStack stack : ItemGate.getAllGates()) {
|
||||||
|
ItemStack newStack = stack.copy();
|
||||||
|
ItemGate.addGateExpansion(stack, expansion);
|
||||||
|
gates.add(newStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gates;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.transport.recipes;
|
package buildcraft.transport.recipes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
|
@ -15,6 +17,7 @@ import buildcraft.api.recipes.CraftingResult;
|
||||||
import buildcraft.core.lib.inventory.StackHelper;
|
import buildcraft.core.lib.inventory.StackHelper;
|
||||||
import buildcraft.silicon.ItemRedstoneChipset;
|
import buildcraft.silicon.ItemRedstoneChipset;
|
||||||
import buildcraft.silicon.TileIntegrationTable;
|
import buildcraft.silicon.TileIntegrationTable;
|
||||||
|
import buildcraft.silicon.recipes.IntegrationTableRecipe;
|
||||||
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
||||||
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
||||||
import buildcraft.transport.gates.ItemGate;
|
import buildcraft.transport.gates.ItemGate;
|
||||||
|
@ -53,4 +56,14 @@ public class GateLogicSwapRecipe extends IntegrationTableRecipe {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Object> getInputs() {
|
||||||
|
ArrayList<Object> inputs = new ArrayList<Object>();
|
||||||
|
|
||||||
|
inputs.add(ItemGate.getAllGates());
|
||||||
|
inputs.add(ItemRedstoneChipset.Chipset.RED.getStack());
|
||||||
|
|
||||||
|
return inputs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -796,7 +796,7 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
||||||
Position motion = new Position(0, 0, 0, item.toCenter ? item.input : item.output);
|
Position motion = new Position(0, 0, 0, item.toCenter ? item.input : item.output);
|
||||||
motion.moveForwards(item.getSpeed() * f);
|
motion.moveForwards(item.getSpeed() * f);
|
||||||
|
|
||||||
doRenderItem(item, x + item.xCoord - pipe.container.xCoord + motion.x,y + item.yCoord - pipe.container.yCoord, z + item.zCoord - pipe.container.zCoord, light, item.color);
|
doRenderItem(item, x + item.xCoord - pipe.container.xCoord + motion.x, y + item.yCoord - pipe.container.yCoord + motion.y, z + item.zCoord - pipe.container.zCoord + motion.z, light, item.color);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package buildcraft.transport.statements;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import buildcraft.api.core.Position;
|
||||||
|
import buildcraft.api.statements.containers.ISidedStatementContainer;
|
||||||
|
import buildcraft.api.statements.IStatementContainer;
|
||||||
|
import buildcraft.api.statements.IStatementParameter;
|
||||||
|
import buildcraft.api.statements.ITriggerInternal;
|
||||||
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
|
import buildcraft.core.statements.BCStatement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by asie on 3/14/15.
|
||||||
|
*/
|
||||||
|
public class TriggerLightSensor extends BCStatement implements ITriggerInternal {
|
||||||
|
private final boolean bright;
|
||||||
|
|
||||||
|
public TriggerLightSensor(boolean bright) {
|
||||||
|
super("buildcraft:light_" + (bright ? "bright" : "dark"));
|
||||||
|
this.bright = bright;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return StringUtils.localize("gate.trigger.light." + (bright ? "bright" : "dark"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters) {
|
||||||
|
TileEntity tile = source.getTile();
|
||||||
|
Position pos = new Position(tile);
|
||||||
|
pos.orientation = ((ISidedStatementContainer) source).getSide();
|
||||||
|
pos.moveForwards(1.0);
|
||||||
|
|
||||||
|
int lightLevel = tile.getWorldObj().getBlockLightValue((int) pos.x, (int) pos.y, (int) pos.z);
|
||||||
|
|
||||||
|
return (lightLevel < 8) ^ bright;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerIcons(IIconRegister iconRegister) {
|
||||||
|
icon = iconRegister.registerIcon("buildcrafttransport:triggers/trigger_light_" + (bright ? "bright" : "dark"));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue