connection changes

This commit is contained in:
DarkGuardsman 2013-09-04 18:46:56 -04:00
parent e4261ab264
commit 5ff388a888
16 changed files with 43 additions and 35 deletions

View file

@ -3,7 +3,7 @@ package dark.api.fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
import dark.core.interfaces.INetworkPart;
import dark.api.parts.INetworkPart;
import dark.core.interfaces.ColorCode.IColorCoded;
public interface INetworkFluidPart extends IColorCoded, IFluidHandler, INetworkPart

View file

@ -4,7 +4,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import dark.core.interfaces.INetworkPart;
import dark.api.parts.INetworkPart;
import dark.core.prefab.tilenetwork.NetworkTileEntities;
public class HydraulicNetworkHelper

View file

@ -8,8 +8,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import dark.api.fluid.INetworkFluidPart;
import dark.api.parts.INetworkPart;
import dark.core.interfaces.ColorCode;
import dark.core.interfaces.INetworkPart;
import dark.core.prefab.tilenetwork.NetworkTileEntities;
/** Side note: the network should act like this when done {@link http

View file

@ -21,8 +21,8 @@ import universalelectricity.core.vector.Vector3;
import dark.api.fluid.AdvancedFluidEvent;
import dark.api.fluid.AdvancedFluidEvent.FluidMergeEvent;
import dark.api.fluid.INetworkFluidPart;
import dark.api.parts.INetworkPart;
import dark.core.interfaces.ColorCode;
import dark.core.interfaces.INetworkPart;
import dark.core.prefab.helpers.FluidHelper;
import dark.core.prefab.helpers.Pair;
import dark.core.prefab.tilenetwork.NetworkTileEntities;

View file

@ -10,8 +10,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import dark.api.fluid.INetworkPipe;
import dark.api.parts.INetworkPart;
import dark.core.interfaces.ColorCode;
import dark.core.interfaces.INetworkPart;
import dark.core.prefab.helpers.ConnectionHelper;
import dark.core.prefab.helpers.FluidHelper;
import dark.core.prefab.tilenetwork.NetworkTileEntities;

View file

@ -32,13 +32,11 @@ public class BlockSink extends BlockFM
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
int meta = par1World.getBlockMetadata(x, y, z);
int g = MetaGroup.getGrouping(meta);
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int metaGroup = MetaGroup.getGrouping(meta);
if (meta == (g * 4) + 3)
if (meta == (metaGroup * 4) + 3)
{
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4), 3);
par1World.setBlockMetadataWithNotify(x, y, z, (metaGroup * 4), 3);
return true;
}
else

View file

@ -13,7 +13,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import dark.core.interfaces.INetworkPart;
import dark.api.parts.INetworkPart;
import dark.core.prefab.helpers.AutoCraftingManager;
import dark.core.prefab.helpers.FluidHelper;
import dark.fluid.client.render.BlockRenderHelper;

View file

@ -3,6 +3,8 @@ package dark.fluid.common.machines;
import java.util.ArrayList;
import java.util.List;
import universalelectricity.core.vector.Vector3;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -10,10 +12,10 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import dark.api.IToolReadOut;
import dark.api.fluid.INetworkPipe;
import dark.api.parts.ITileConnector;
import dark.core.interfaces.ColorCode;
import dark.core.interfaces.ITileConnector;
import dark.core.interfaces.IToolReadOut;
import dark.core.interfaces.ColorCode.IColorCoded;
import dark.core.network.fluid.NetworkPipes;
import dark.core.prefab.helpers.ConnectionHelper;
@ -159,8 +161,9 @@ public class TileEntityReleaseValve extends TileEntityFluidDevice implements ITi
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
TileEntity entity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj);
return entity != null && entity instanceof IFluidHandler && entity instanceof IColorCoded && this.canConnect(((IColorCoded) entity).getColor());
}

View file

@ -22,6 +22,7 @@ import net.minecraftforge.fluids.IFluidTank;
import org.bouncycastle.util.Arrays;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
@ -29,10 +30,10 @@ import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.api.IToolReadOut;
import dark.api.fluid.INetworkFluidPart;
import dark.api.fluid.INetworkPipe;
import dark.core.interfaces.ColorCode;
import dark.core.interfaces.IToolReadOut;
import dark.core.interfaces.ColorCode.IColorCoded;
import dark.core.network.fluid.NetworkFluidContainers;
import dark.core.network.fluid.NetworkFluidTiles;
@ -250,8 +251,9 @@ public class TileEntityTank extends TileEntityFluidStorage implements IFluidHand
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
TileEntity entity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj);
return entity != null && entity instanceof IFluidHandler;
}

View file

@ -24,8 +24,9 @@ public class TileEntityGenericPipe extends TileEntityPipe
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
TileEntity entity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj);
Vector3 vec = new Vector3(entity);
int meta = vec.getBlockMetadata(this.worldObj);
int blockID = vec.getBlockID(this.worldObj);
@ -35,7 +36,7 @@ public class TileEntityGenericPipe extends TileEntityPipe
return meta == this.getBlockMetadata();
}
return super.canTileConnect(entity, dir);
return super.canTileConnect(type, dir);
}
@Override

View file

@ -33,10 +33,10 @@ import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.api.IToolReadOut;
import dark.api.fluid.INetworkPipe;
import dark.api.parts.ITileConnector;
import dark.core.interfaces.ColorCode;
import dark.core.interfaces.ITileConnector;
import dark.core.interfaces.IToolReadOut;
import dark.core.interfaces.ColorCode.IColorCoded;
import dark.core.network.fluid.NetworkPipes;
import dark.core.prefab.helpers.FluidHelper;
@ -432,7 +432,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements IFluidHandler,
}
if (tileEntity instanceof ITileConnector)
{
if (((ITileConnector) tileEntity).canTileConnect(this, side.getOpposite()))
if (((ITileConnector) tileEntity).canTileConnect(Connection.NETWORK, side.getOpposite()))
{
if (tileEntity instanceof INetworkPipe)
{
@ -505,8 +505,9 @@ public class TileEntityPipe extends TileEntityAdvanced implements IFluidHandler,
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
TileEntity entity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj);
return entity != null && this.subEntities[dir.ordinal()] == null;
}

View file

@ -5,8 +5,8 @@ import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import dark.core.interfaces.ITileConnector;
import dark.core.interfaces.IToolReadOut;
import dark.api.IToolReadOut;
import dark.api.parts.ITileConnector;
import dark.core.network.fluid.HydraulicNetworkHelper;
public abstract class TileEntityFluidDevice extends TileEntityAdvanced implements IToolReadOut, ITileConnector

View file

@ -1,5 +1,6 @@
package dark.fluid.common.prefab;
import universalelectricity.core.vector.Vector3;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -34,8 +35,9 @@ public abstract class TileEntityFluidStorage extends TileEntityFluidDevice imple
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
TileEntity entity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj);
return entity instanceof IFluidHandler;
}

View file

@ -16,7 +16,7 @@ import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import dark.api.fluid.IDrain;
import dark.api.fluid.INetworkPipe;
import dark.core.interfaces.ITileConnector;
import dark.api.parts.ITileConnector;
import dark.core.network.fluid.HydraulicNetworkHelper;
import dark.core.network.fluid.NetworkFluidTiles;
import dark.core.prefab.helpers.MetaGroup;
@ -162,8 +162,9 @@ public class TileEntityConstructionPump extends TileEntityStarterPump implements
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
TileEntity entity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj);
return entity instanceof IFluidHandler && (dir == this.getFacing(false) || dir == this.getFacing(true));
}

View file

@ -188,7 +188,7 @@ public class TileEntityDrain extends TileEntityFluidDevice implements IFluidHand
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
return dir != this.getDirection();
}

View file

@ -11,9 +11,9 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import universalelectricity.core.vector.Vector3;
import dark.api.IToolReadOut;
import dark.api.fluid.IDrain;
import dark.core.interfaces.ITileConnector;
import dark.core.interfaces.IToolReadOut;
import dark.api.parts.ITileConnector;
import dark.core.prefab.TileEntityMachine;
import dark.core.prefab.helpers.FluidHelper;
import dark.core.prefab.helpers.Pair;
@ -212,7 +212,7 @@ public class TileEntityStarterPump extends TileEntityMachine implements IToolRea
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection direction)
public boolean canTileConnect(Connection type, ForgeDirection direction)
{
return direction != ForgeDirection.DOWN;
}