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;
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.BuildCraftTransport;
import buildcraft.api.core.IIconProvider;
@ -17,6 +35,7 @@ import buildcraft.api.gates.ITrigger;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.transport.IPipeConnectionForced;
import buildcraft.api.transport.IPipe;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile;
@ -32,23 +51,6 @@ import buildcraft.core.network.PacketTileState;
import buildcraft.transport.Gate.GateKind;
import cpw.mods.fml.relauncher.Side;
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,
IDropControlInventory, IPipeRenderState, ISyncedTile, ISolidSideTile {
@ -425,6 +427,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
if (!BlockGenericPipe.isValid(pipe))
return false;
if(!(pipe instanceof IPipeConnectionForced) || !((IPipeConnectionForced) pipe).ignoreConnectionOverrides(side))
if (with instanceof IPipeConnection) {
IPipeConnection.ConnectOverride override = ((IPipeConnection) with).overridePipeConnection(pipe.transport.getPipeType(), side.getOpposite());
if (override != IPipeConnection.ConnectOverride.DEFAULT)

View file

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