Skip to content

Commit

Permalink
Add bluepower to gate provider update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed Mar 20, 2015
1 parent e4defc7 commit 99a417d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
modVersion = 0.8r31
modVersion = 0.8r32

mcVersion = 1.7.10
forgeVersion = 10.13.2.1235
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public IConnectionCache<? extends IRedstoneDevice> getRedstoneConnectionCache()
@Override
public byte getRedstonePower(ForgeDirection side)
{
return (byte) (gate.getRedstoneOutput(gate.getSideRel(side.ordinal())) != 0 ? -1 : 0);
return (byte)(gate.getRedstoneOutput(gate.getSideRel(side.ordinal())) != 0 ? -1 : 0);
}

@Override
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/vic/mod/integratedcircuits/gate/GateProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.IRedNetNetworkContainer;
import vic.mod.integratedcircuits.IntegratedCircuits;
import vic.mod.integratedcircuits.tile.TileEntityGate;
Expand All @@ -19,6 +20,11 @@
import codechicken.multipart.RedstoneInteractions;
import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart;

import com.bluepowermod.api.BPApi;
import com.bluepowermod.api.wire.redstone.IBundledDevice;
import com.bluepowermod.api.wire.redstone.IRedstoneApi;

import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.ComputerCraftAPI;

Expand Down Expand Up @@ -101,6 +107,7 @@ public static byte[] calculateBundledInput(IGateProvider provider, int side)

input = calculateBundledInputNative(provider, side, pos, abs);
if(input == null && IntegratedCircuits.isPRLoaded) input = calculateBundledInputProjectRed(provider, side);
if(input == null && IntegratedCircuits.isBPLoaded) input = calculateBundledInputBluePower(provider, side, pos, abs);

if(!provider.isMultipart())
{
Expand All @@ -120,6 +127,15 @@ private static byte[] calculateBundledInputNative(IGateProvider provider, int si
return null;
}

@Method(modid = "bluepower")
private static byte[] calculateBundledInputBluePower(IGateProvider provider, int side, BlockCoord pos, int abs)
{
IRedstoneApi redstoneAPI = BPApi.getInstance().getRedstoneApi();
IBundledDevice device = redstoneAPI.getBundledDevice(provider.getWorld(), pos.x, pos.y, pos.z, ForgeDirection.getOrientation(provider.getGate().getSide()), ForgeDirection.UNKNOWN);
if(device != null) return device.getBundledOutput(ForgeDirection.getOrientation(abs ^ 1));
return null;
}

private static byte[] calculateBundledInputComputercraft(IGateProvider provider, int side, BlockCoord pos, int abs)
{
int input = ComputerCraftAPI.getBundledRedstoneOutput(provider.getWorld(), pos.x, pos.y, pos.z, abs ^ 1);
Expand Down

0 comments on commit 99a417d

Please sign in to comment.