Fix for sandstone pipes

This commit is contained in:
ganymedes01 2013-09-15 21:40:27 +01:00
parent 2d65129722
commit 08c4bc3f47
4 changed files with 58 additions and 29 deletions

View file

@ -0,0 +1,14 @@
package buildcraft.transport;
import net.minecraftforge.common.ForgeDirection;
public interface IPipeConnectionForced {
/**
* Allows you to block connection overrides.
*
* @param with
* @return TRUE to block an override. FALSE to allow overrides.
*/
public boolean ignoreConnectionOverrides(ForgeDirection with);
}

View file

@ -7,6 +7,24 @@
*/ */
package buildcraft.transport; package buildcraft.transport;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.logging.Level;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.BuildCraftCore; import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftTransport; import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider; import buildcraft.api.core.IIconProvider;
@ -17,6 +35,7 @@ import buildcraft.api.gates.ITrigger;
import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler; import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver; import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.transport.IPipeConnectionForced;
import buildcraft.api.transport.IPipe; import buildcraft.api.transport.IPipe;
import buildcraft.api.transport.IPipeConnection; import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.IPipeTile;
@ -32,23 +51,6 @@ import buildcraft.core.network.PacketTileState;
import buildcraft.transport.Gate.GateKind; import buildcraft.transport.Gate.GateKind;
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 java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.logging.Level;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFluidHandler, IPipeTile, IOverrideDefaultTriggers, ITileBufferHolder, public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFluidHandler, IPipeTile, IOverrideDefaultTriggers, ITileBufferHolder,
IDropControlInventory, IPipeRenderState, ISyncedTile, ISolidSideTile { IDropControlInventory, IPipeRenderState, ISyncedTile, ISolidSideTile {
@ -425,11 +427,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
if (!BlockGenericPipe.isValid(pipe)) if (!BlockGenericPipe.isValid(pipe))
return false; return false;
if (with instanceof IPipeConnection) { if(!(pipe instanceof IPipeConnectionForced) || !((IPipeConnectionForced) pipe).ignoreConnectionOverrides(side))
IPipeConnection.ConnectOverride override = ((IPipeConnection) with).overridePipeConnection(pipe.transport.getPipeType(), side.getOpposite()); if (with instanceof IPipeConnection) {
if (override != IPipeConnection.ConnectOverride.DEFAULT) IPipeConnection.ConnectOverride override = ((IPipeConnection) with).overridePipeConnection(pipe.transport.getPipeType(), side.getOpposite());
return override == IPipeConnection.ConnectOverride.CONNECT ? true : false; if (override != IPipeConnection.ConnectOverride.DEFAULT)
} return override == IPipeConnection.ConnectOverride.CONNECT ? true : false;
}
if (with instanceof TileGenericPipe) { if (with instanceof TileGenericPipe) {
if (((TileGenericPipe) with).hasPlug(side.getOpposite())) if (((TileGenericPipe) with).hasPlug(side.getOpposite()))

View file

@ -7,8 +7,12 @@
*/ */
package buildcraft.transport.pipes; package buildcraft.transport.pipes;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.BuildCraftTransport; import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider; import buildcraft.api.core.IIconProvider;
import buildcraft.transport.IPipeConnectionForced;
import buildcraft.transport.IPipeTransportFluidsHook; import buildcraft.transport.IPipeTransportFluidsHook;
import buildcraft.transport.Pipe; import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeIconProvider;
@ -16,11 +20,8 @@ import buildcraft.transport.PipeTransportFluids;
import buildcraft.transport.TileGenericPipe; import buildcraft.transport.TileGenericPipe;
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.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
public class PipeFluidsSandstone extends Pipe<PipeTransportFluids> implements IPipeTransportFluidsHook { public class PipeFluidsSandstone extends Pipe<PipeTransportFluids> implements IPipeTransportFluidsHook, IPipeConnectionForced {
public PipeFluidsSandstone(int itemID) { public PipeFluidsSandstone(int itemID) {
super(new PipeTransportFluids(), itemID); super(new PipeTransportFluids(), itemID);
@ -49,4 +50,9 @@ public class PipeFluidsSandstone extends Pipe<PipeTransportFluids> implements IP
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) { public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
return (tile instanceof TileGenericPipe) && super.canPipeConnect(tile, side); return (tile instanceof TileGenericPipe) && super.canPipeConnect(tile, side);
} }
@Override
public boolean ignoreConnectionOverrides(ForgeDirection with) {
return true;
}
} }

View file

@ -7,18 +7,19 @@
*/ */
package buildcraft.transport.pipes; package buildcraft.transport.pipes;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import buildcraft.BuildCraftTransport; import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider; import buildcraft.api.core.IIconProvider;
import buildcraft.transport.IPipeConnectionForced;
import buildcraft.transport.Pipe; import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportItems; import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.TileGenericPipe; import buildcraft.transport.TileGenericPipe;
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.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
public class PipeItemsSandstone extends Pipe { public class PipeItemsSandstone extends Pipe implements IPipeConnectionForced {
public PipeItemsSandstone(int itemID) { public PipeItemsSandstone(int itemID) {
super(new PipeTransportItems(), itemID); super(new PipeTransportItems(), itemID);
@ -39,4 +40,9 @@ public class PipeItemsSandstone extends Pipe {
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) { public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
return (tile instanceof TileGenericPipe) && super.canPipeConnect(tile, side); return (tile instanceof TileGenericPipe) && super.canPipeConnect(tile, side);
} }
@Override
public boolean ignoreConnectionOverrides(ForgeDirection with) {
return true;
}
} }