Fix up the redstone switching/cover blocking support a bit.
This commit is contained in:
parent
7730649ab3
commit
01818d4e26
5 changed files with 32 additions and 26 deletions
|
@ -356,10 +356,13 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
|
|||
if(!iterated.contains(obj) && !toIgnore.contains(obj))
|
||||
{
|
||||
TileEntity tileEntity = obj.getTileEntity(worldObj);
|
||||
|
||||
if(TransmissionType.checkTransmissionType(tileEntity, transmissionType, location.getTileEntity(worldObj)))
|
||||
|
||||
if(!(tileEntity instanceof IBlockableConnection) || ((IBlockableConnection)tileEntity).canConnectMutual(direction.getOpposite()))
|
||||
{
|
||||
loopAll(obj);
|
||||
if(TransmissionType.checkTransmissionType(tileEntity, transmissionType, location.getTileEntity(worldObj)))
|
||||
{
|
||||
loopAll(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package mekanism.api.transmitters;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IBlockableConnection
|
||||
{
|
||||
public boolean canConnectMutual(ForgeDirection side);
|
||||
public boolean canConnect(ForgeDirection side);
|
||||
}
|
|
@ -26,6 +26,7 @@ public class MultipartMekanism implements IPartFactory, IPartConverter
|
|||
MultipartGenerator.registerPassThroughInterface("cofh.api.energy.IEnergyHandler");
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.common.IConfigurable");
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.common.ITileNetwork");
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.IBlockableConnection");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,10 +13,7 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.transmitters.DynamicNetwork;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
||||
import mekanism.api.transmitters.*;
|
||||
import mekanism.client.render.RenderPartTransmitter;
|
||||
import mekanism.common.IConfigurable;
|
||||
import mekanism.common.ITileNetwork;
|
||||
|
@ -32,7 +29,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects, ITileNetwork
|
||||
public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects, ITileNetwork, IBlockableConnection
|
||||
{
|
||||
public static IndexedCuboid6[] smallSides = new IndexedCuboid6[7];
|
||||
public static IndexedCuboid6[] largeSides = new IndexedCuboid6[7];
|
||||
|
@ -42,6 +39,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
|||
public byte currentTransmitterConnections = 0x00;
|
||||
public boolean isActive = false;
|
||||
public boolean sendDesc;
|
||||
public boolean redstonePowered = false;
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -256,7 +254,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
|||
if(!canConnect(side)) return false;
|
||||
|
||||
TileEntity tile = Object3D.get(tile()).getFromSide(side).getTileEntity(world());
|
||||
return (!(tile instanceof ITransmitter) || ((ITransmitter<?>)tile).canConnect(side.getOpposite()));
|
||||
return (!(tile instanceof IBlockableConnection) || ((IBlockableConnection)tile).canConnect(side.getOpposite()));
|
||||
}
|
||||
|
||||
public boolean canConnect(ForgeDirection side)
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import codechicken.multipart.*;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.transmitters.DynamicNetwork;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
|
@ -33,14 +34,6 @@ import codechicken.lib.raytracer.IndexedCuboid6;
|
|||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.microblock.IHollowConnect;
|
||||
import codechicken.multipart.IconHitEffects;
|
||||
import codechicken.multipart.JIconHitEffects;
|
||||
import codechicken.multipart.JNormalOcclusion;
|
||||
import codechicken.multipart.NormalOcclusionTest;
|
||||
import codechicken.multipart.PartMap;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TSlottedPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -102,16 +95,18 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa
|
|||
|
||||
if(possibleTransmitters != currentTransmitterConnections)
|
||||
{
|
||||
//TODO @unpairedbracket, I don't think this is necessary; I couldn't tell a difference without it,
|
||||
//and it results in many extra possible recursive calls on the network
|
||||
|
||||
/*byte or = (byte)(possibleTransmitters | currentTransmitterConnections);
|
||||
|
||||
if(or != possibleTransmitters)
|
||||
boolean nowPowered = world().isBlockIndirectlyGettingPowered(x(), y(), z());
|
||||
|
||||
if(nowPowered != redstonePowered)
|
||||
{
|
||||
((DynamicNetwork<?, N>)getTransmitterNetwork()).split((ITransmitter<N>)tile());
|
||||
setTransmitterNetwork(null);
|
||||
}*/
|
||||
if(nowPowered)
|
||||
{
|
||||
getTransmitterNetwork().split((ITransmitter<N>)tile());
|
||||
setTransmitterNetwork(null);
|
||||
}
|
||||
tile().notifyPartChange(this);
|
||||
redstonePowered = nowPowered;
|
||||
}
|
||||
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue