removed more errors and formating

This commit is contained in:
DarkGuardsman 2013-07-09 23:44:27 -04:00
parent 6f0411f1fe
commit d4b3d3585a
43 changed files with 778 additions and 964 deletions

View file

@ -4,20 +4,16 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.liquids.LiquidStack;
import dark.core.api.ColorCode;
import dark.core.api.INetworkPart;
import dark.core.tile.network.NetworkTileEntities;
import dark.fluid.api.INetworkFluidPart;
/**
* Side note: the network should act like this when done {@link http
/** Side note: the network should act like this when done {@link http
* ://www.e4training.com/hydraulic_calculators/B1.htm} as well as stay compatible with the forge
* Liquids
*
* @author Rseifert
*
*/
* @author Rseifert */
public class NetworkFluidContainers extends NetworkFluidTiles
{
@ -25,6 +21,7 @@ public class NetworkFluidContainers extends NetworkFluidTiles
{
super(color, parts);
}
@Override
public NetworkTileEntities newInstance()
{

View file

@ -1,30 +1,27 @@
package dark.core.network.fluid;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
import dark.core.api.ColorCode;
import dark.core.api.INetworkPart;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.core.tile.network.NetworkTileEntities;
import dark.fluid.api.INetworkPipe;
import dark.helpers.ConnectionHelper;
/**
* Side note: the network should act like this when done {@link http
/** Side note: the network should act like this when done {@link http
* ://www.e4training.com/hydraulic_calculators/B1.htm} as well as stay compatible with the forge
* Liquids
*
* @author Rseifert
*
*/
* @author Rseifert */
public class NetworkPipes extends NetworkFluidTiles
{
@ -54,39 +51,31 @@ public class NetworkPipes extends NetworkFluidTiles
return super.isPartOfNetwork(ent) || this.pressureLoads.containsKey(ent) || this.pressureProducers.containsKey(ent);
}
/**
* sets this tileEntity to produce a pressure and flow rate in the network
*/
/** sets this tileEntity to produce a pressure and flow rate in the network */
public void startProducingPressure(TileEntity tileEntity, FluidPressurePack fluidPack)
{
if (tileEntity != null && fluidPack.liquidStack != null)
{
if ((this.combinedStorage().getLiquid() == null || fluidPack.liquidStack.isLiquidEqual(this.combinedStorage().getLiquid())) && fluidPack.liquidStack.amount > 0)
if ((this.combinedStorage().getFluid() == null || fluidPack.liquidStack.isFluidEqual(this.combinedStorage().getFluid())) && fluidPack.liquidStack.amount > 0)
{
this.pressureProducers.put(tileEntity, fluidPack);
}
}
}
/**
* sets this tileEntity to produce a pressure and flow rate in the network
*/
public void startProducingPressure(TileEntity tileEntity, LiquidStack stack, double pressure)
/** sets this tileEntity to produce a pressure and flow rate in the network */
public void startProducingPressure(TileEntity tileEntity, FluidStack stack, double pressure)
{
this.startProducingPressure(tileEntity, new FluidPressurePack(stack, pressure));
}
/**
* is this tile entity producing a pressure
*/
/** is this tile entity producing a pressure */
public boolean isProducingPressure(TileEntity tileEntity)
{
return this.pressureProducers.containsKey(tileEntity);
}
/**
* Sets this tile entity to act as a load on the system
*/
/** Sets this tile entity to act as a load on the system */
public void addLoad(TileEntity tileEntity, FluidPressurePack fluidPack)
{
if (tileEntity != null && fluidPack.liquidStack != null && fluidPack.liquidStack.amount > 0)
@ -95,27 +84,21 @@ public class NetworkPipes extends NetworkFluidTiles
}
}
/**
* Sets this tile entity to act as a load on the system
*/
public void addLoad(TileEntity tileEntity, LiquidStack stack, double pressure)
/** Sets this tile entity to act as a load on the system */
public void addLoad(TileEntity tileEntity, FluidStack stack, double pressure)
{
this.addLoad(tileEntity, new FluidPressurePack(stack, pressure));
}
/**
* is this tileEntity a load in the network
*/
/** is this tileEntity a load in the network */
public boolean isLoad(TileEntity tileEntity)
{
return this.pressureLoads.containsKey(tileEntity);
}
/**
* @param ignoreTiles The TileEntities to ignore during this calculation. Null will make it not
/** @param ignoreTiles The TileEntities to ignore during this calculation. Null will make it not
* ignore any.
* @return The electricity produced in this electricity network
*/
* @return The electricity produced in this electricity network */
public double getPressureProduced(TileEntity... ignoreTiles)
{
// TODO pressure is not added as a sum but rather as a collective sum of the largest
@ -175,68 +158,62 @@ public class NetworkPipes extends NetworkFluidTiles
}
@Override
public void removeTile(TileEntity ent)
public boolean removeTile(TileEntity ent)
{
super.removeTile(ent);
this.pressureLoads.remove(ent);
this.pressureProducers.remove(ent);
return super.removeTile(ent) || this.pressureLoads.remove(ent) || this.pressureProducers.remove(ent);
}
/**
* Adds FLuid to this network from one of the connected Pipes
/** Adds FLuid to this network from one of the connected Pipes
*
* @param source - Were this liquid came from
* @param stack - LiquidStack to be sent
* @param doFill - actually fill the tank or just check numbers
* @return the amount of liquid consumed from the init stack
*/
public int addFluidToNetwork(TileEntity source, LiquidStack stack, boolean doFill)
* @return the amount of liquid consumed from the init stack */
public int addFluidToNetwork(TileEntity source, FluidStack stack, boolean doFill)
{
return this.addFluidToNetwork(source, stack, doFill, false);
}
/**
* Adds FLuid to this network from one of the connected Pipes
/** Adds FLuid to this network from one of the connected Pipes
*
* @param source - Were this liquid came from
* @param stack - LiquidStack to be sent
* @param doFill - actually fill the tank or just check numbers
* @param allowStore - allows the network to store this liquid in the pipes
* @return the amount of liquid consumed from the init stack
*/
public int addFluidToNetwork(TileEntity source, LiquidStack sta, boolean doFill, boolean allowStore)
* @return the amount of liquid consumed from the init stack */
public int addFluidToNetwork(TileEntity source, FluidStack sta, boolean doFill, boolean allowStore)
{
int used = 0;
LiquidStack prevCombined = this.combinedStorage().getLiquid();
LiquidStack stack = sta.copy();
FluidStack prevCombined = this.combinedStorage().getFluid();
FluidStack stack = sta.copy();
if (!this.processingRequest && stack != null && FluidRestrictionHandler.isValidLiquid(color,stack))
if (!this.processingRequest && stack != null && FluidRestrictionHandler.isValidLiquid(color, stack.getFluid()))
{
this.processingRequest = true;
if (this.combinedStorage().getLiquid() != null && !stack.isLiquidEqual(this.combinedStorage().getLiquid()))
if (this.combinedStorage().getFluid() != null && !stack.isFluidEqual(this.combinedStorage().getFluid()))
{
this.causingMixing(null,this.combinedStorage().getLiquid(), stack);
this.causingMixing(null, this.combinedStorage().getFluid(), stack);
}
if (stack.amount > this.getMaxFlow(stack))
{
stack = new LiquidStack(stack.itemID, this.getMaxFlow(stack), stack.itemMeta);
stack = FluidHelper.getStack(stack, this.getMaxFlow(stack));
}
/* Main fill target to try to fill with the stack */
ITankContainer primaryFill = null;
IFluidHandler primaryFill = null;
int volume = Integer.MAX_VALUE;
ForgeDirection fillDir = ForgeDirection.UNKNOWN;
/* Secondary fill target if the main target is not found */
ITankContainer secondayFill = null;
IFluidHandler secondayFill = null;
int mostFill = 0;
ForgeDirection otherFillDir = ForgeDirection.UNKNOWN;
boolean found = false;
/* FIND THE FILL TARGET FROM THE LIST OF FLUID RECIEVERS */
for (ITankContainer tankContainer : connectedTanks)
for (IFluidHandler tankContainer : connectedTanks)
{
if (tankContainer instanceof TileEntity && tankContainer != source && !(tankContainer instanceof INetworkPipe))
{
@ -247,13 +224,13 @@ public class NetworkPipes extends NetworkFluidTiles
if (connectedTiles[i] instanceof INetworkPipe && ((INetworkPipe) connectedTiles[i]).getTileNetwork() == this)
{
ForgeDirection dir = ForgeDirection.getOrientation(i).getOpposite();
ILiquidTank targetTank = tankContainer.getTank(dir, stack);
IFluidTank targetTank = tankContainer.getTank(dir, stack);
int fill = tankContainer.fill(dir, stack, false);
/* USE GET TANK FROM SIDE METHOD FIRST */
if (targetTank != null)
{
LiquidStack stackStored = targetTank.getLiquid();
FluidStack stackStored = targetTank.getFluid();
if (stackStored == null)
{
primaryFill = tankContainer;
@ -301,11 +278,11 @@ public class NetworkPipes extends NetworkFluidTiles
}
/* IF THE COMBINED STORAGE OF THE PIPES HAS LIQUID MOVE IT FIRST */
if (!filledMain && used > 0 && this.combinedStorage().getLiquid() != null && this.combinedStorage().getLiquid().amount > 0)
if (!filledMain && used > 0 && this.combinedStorage().getFluid() != null && this.combinedStorage().getFluid().amount > 0)
{
LiquidStack drainStack = new LiquidStack(0, 0, 0);
if (this.combinedStorage().getLiquid().amount >= used)
if (this.combinedStorage().getFluid().amount >= used)
{
drainStack = this.combinedStorage().drain(used, doFill);
used = 0;
@ -313,7 +290,7 @@ public class NetworkPipes extends NetworkFluidTiles
else
{
int pUsed = used;
used = Math.min(used, Math.max(used - this.combinedStorage().getLiquid().amount, 0));
used = Math.min(used, Math.max(used - this.combinedStorage().getFluid().amount, 0));
drainStack = this.combinedStorage().drain(pUsed - used, doFill);
}
// System.out.println("Pulling " + (drainStack != null ? drainStack.amount : 0) +
@ -321,7 +298,7 @@ public class NetworkPipes extends NetworkFluidTiles
// this.combinedStorage.getLiquid().amount : 0));
}
if (prevCombined != null && this.combinedStorage().getLiquid() != null && prevCombined.amount != this.combinedStorage().getLiquid().amount)
if (prevCombined != null && this.combinedStorage().getFluid() != null && prevCombined.amount != this.combinedStorage().getFluid().amount)
{
this.balanceColletiveTank(false);
}
@ -330,9 +307,7 @@ public class NetworkPipes extends NetworkFluidTiles
return used;
}
/**
* Gets the flow rate of the system using the lowest flow rate
*/
/** Gets the flow rate of the system using the lowest flow rate */
public int getMaxFlow(LiquidStack stack)
{
int flow = 1000;
@ -350,9 +325,7 @@ public class NetworkPipes extends NetworkFluidTiles
return flow;
}
/**
* Updates after the pressure has changed a good bit
*/
/** Updates after the pressure has changed a good bit */
public void onPresureChange()
{
this.cleanUpMembers();

View file

@ -5,38 +5,24 @@ import net.minecraftforge.common.ForgeDirection;
// mechanical
public interface IForce
{
/**
*
* @param side the rpm is coming from
* @return rpm that the block is running at
*/
/** @param side the rpm is coming from
* @return rpm that the block is running at */
public int getForceSide(ForgeDirection side);
/**
*
* @param side
* @return if mechanical force can be outputed from this side
*/
/** @param side
* @return if mechanical force can be outputed from this side */
public boolean canOutputSide(ForgeDirection side);
/**
*
* @param side
* @return if mechanical force can be inputed from this side
*/
/** @param side
* @return if mechanical force can be inputed from this side */
public boolean canInputSide(ForgeDirection side);
/**
*
* @param RPM being applied to this machine
* @return the rpm after the load has been applied
*/
/** @param RPM being applied to this machine
* @return the rpm after the load has been applied */
public int applyForce(int force);
/**
* not required but is handy to get animation position of some mechanical block
/** not required but is handy to get animation position of some mechanical block
*
* @return int between 0 -7
*/
* @return int between 0 -7 */
public int getAnimationPos();
}

View file

@ -4,11 +4,8 @@ import net.minecraftforge.common.ForgeDirection;
public interface IForceLoad
{
/**
*
* @param side
* @return if mechanical force can be inputed from this side
*/
/** @param side
* @return if mechanical force can be inputed from this side */
public boolean canInputSide(ForgeDirection side);
public int applyForce(ForgeDirection side, int force);

View file

@ -4,17 +4,11 @@ import net.minecraftforge.common.ForgeDirection;
public interface IForceProvider
{
/**
*
* @param side the rpm is coming from
* @return rpm that the block is running at
*/
/** @param side the rpm is coming from
* @return rpm that the block is running at */
public int getForceSide(ForgeDirection side);
/**
*
* @param side
* @return if mechanical force can be outputed from this side
*/
/** @param side
* @return if mechanical force can be outputed from this side */
public boolean canOutputSide(ForgeDirection side);
}

View file

@ -22,8 +22,6 @@ import dark.fluid.common.pump.TileEntityConstructionPump;
import dark.fluid.common.pump.TileEntityStarterPump;
import dark.mech.client.render.RenderGearRod;
import dark.mech.client.render.RenderGenerator;
import dark.mech.common.machines.TileEntityGenerator;
import dark.mech.common.machines.TileEntityRod;
public class ClientProxy extends CommonProxy
{

View file

@ -121,17 +121,14 @@ public class ModelTankSide extends ModelBase
setRotation(rightTopSide, 0F, 0F, 0F);
}
/**
*
* @param size - render size normal is 0.0625F
/** @param size - render size normal is 0.0625F
* @param left - is the an instance of this to the left
* @param right - "" to the right
* @param bot - "" to the bot
* @param top - "" to the top
*
* Not this only renders one side of the block. You will need to rotate it to face another
* direction then render it. If rotating up or down you will need to translate it a bit
*/
* direction then render it. If rotating up or down you will need to translate it a bit */
public void render(float size, boolean left, boolean right, boolean bot, boolean top)
{
if (!top)

View file

@ -9,8 +9,6 @@ import dark.fluid.client.model.ModelConstructionPump;
import dark.fluid.common.FluidMech;
import dark.fluid.common.pump.TileEntityConstructionPump;
public class RenderConstructionPump extends TileEntitySpecialRenderer
{
int type = 0;

View file

@ -9,7 +9,6 @@ import dark.fluid.client.model.ModelPump;
import dark.fluid.common.FluidMech;
import dark.fluid.common.pump.TileEntityStarterPump;
public class RenderPump extends TileEntitySpecialRenderer
{
int type = 0;

View file

@ -1,12 +1,12 @@
package dark.fluid.client.render;
public class RenderRotation
{
float angle;
float x;
float y;
float z;
public RenderRotation(float angle, float x, float y, float z)
{
this.angle = angle;

View file

@ -3,7 +3,6 @@ package dark.fluid.client.render;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
@ -11,7 +10,6 @@ import dark.fluid.client.model.ModelSink;
import dark.fluid.common.FluidMech;
import dark.fluid.common.machines.TileEntitySink;
public class RenderSink extends TileEntitySpecialRenderer
{
int type = 0;
@ -24,13 +22,20 @@ public class RenderSink extends TileEntitySpecialRenderer
public void renderWater(LiquidStack stack)
{
if (stack == null || stack.amount <= 1) { return; }
if (stack == null || stack.amount <= 1)
{
return;
}
bindTextureByName(Block.waterStill.getBlockTextureFromSide(0) + "blue.png");
float p = 0;
if(stack.amount > 0)p = 0.5f;
if(stack.amount > 500)p=1.5f;
if(stack.amount > 1000)p=2.5f;
if(stack.amount > 1500)p=3.5f;
if (stack.amount > 0)
p = 0.5f;
if (stack.amount > 500)
p = 1.5f;
if (stack.amount > 1000)
p = 2.5f;
if (stack.amount > 1500)
p = 3.5f;
model.renderLiquid(0.0625F, p);
}

View file

@ -3,12 +3,10 @@ package dark.fluid.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
import dark.core.api.ColorCode;
import dark.core.hydraulic.helpers.LiquidRenderer;
import dark.fluid.client.model.ModelTankSide;
import dark.fluid.common.machines.TileEntityTank;

View file

@ -4,17 +4,13 @@ import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
import dark.fluid.common.pipes.TileEntityPipe;
/**
* Class for TileEntity Renders that extend the pipe class to use instead of extending
/** Class for TileEntity Renders that extend the pipe class to use instead of extending
* TileEntitySpecialRender
*
* @author Rseifert
*
*/
* @author Rseifert */
public interface IPipeExtentionRender
{
/**
* Renders the pipe extension just like a normal tileEntity render however this is called and
/** Renders the pipe extension just like a normal tileEntity render however this is called and
* process threw the RenderPipe.class so you don't need to do all the GL11 calls for scaling,
* translation, etc
*
@ -22,7 +18,6 @@ public interface IPipeExtentionRender
* @param pipe - TileEntity this extension is attached too
* @param location - position too be rendered from the players plane
* @param size - This should be the size of the render, correct me if wrong
* @param facingDirection - Facing direction of the extension in relation to its pipe frame
*/
* @param facingDirection - Facing direction of the extension in relation to its pipe frame */
public void renderAModelAt(RenderPipe renderPipe, TileEntityPipe pipe, Vector3 location, float size, ForgeDirection facingDirection);
}

View file

@ -4,8 +4,6 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;

View file

@ -10,8 +10,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
@ -36,10 +34,8 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.core.DarkMain;
import dark.core.api.ColorCode;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.fluid.common.fluids.BlockWasteLiquid;
import dark.fluid.common.item.ItemParts;
import dark.fluid.common.item.ItemParts.Parts;
import dark.fluid.common.item.ItemTools;
@ -65,8 +61,6 @@ import dark.fluid.common.pump.TileEntityDrain;
import dark.fluid.common.pump.TileEntityStarterPump;
import dark.mech.common.machines.BlockGenerator;
import dark.mech.common.machines.BlockRod;
import dark.mech.common.machines.TileEntityGenerator;
import dark.mech.common.machines.TileEntityRod;
@ModstatInfo(prefix = "fluidmech")
@Mod(modid = FluidMech.MOD_ID, name = FluidMech.MOD_NAME, version = FluidMech.VERSION, dependencies = "after:BasicComponents", useMetadata = true)

View file

@ -6,11 +6,9 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import dark.fluid.common.TabFluidMech;
/**
* A metadata item containing parts of various machines in Liquid Mechanics Mod.
/** A metadata item containing parts of various machines in Liquid Mechanics Mod.
*
* @author Rs
*/
* @author Rs */
public class ItemParts extends ItemBasic
{
public enum Parts

View file

@ -1,6 +1,5 @@
package dark.fluid.common.item;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;

View file

@ -1,6 +1,5 @@
package dark.fluid.common.machines;
import java.util.ArrayList;
import java.util.List;
@ -8,14 +7,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import dark.core.api.ColorCode;
import dark.core.api.IColorCoded;
import dark.core.api.IToolReadOut;
import dark.core.api.ITileConnector;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.api.IToolReadOut;
import dark.core.network.fluid.NetworkPipes;
import dark.fluid.api.INetworkPipe;
import dark.fluid.common.prefab.TileEntityFluidDevice;
@ -111,11 +106,9 @@ public class TileEntityReleaseValve extends TileEntityFluidDevice implements ITi
return true;
}
/**
* if any of allowed list is true
/** if any of allowed list is true
*
* @return true
*/
* @return true */
public boolean isRestricted()
{
for (int i = 0; i < this.allowed.length; i++)
@ -128,10 +121,8 @@ public class TileEntityReleaseValve extends TileEntityFluidDevice implements ITi
return false;
}
/**
* Collects info about the surrounding 6 tiles and orders them into drain-able(ITankContainer)
* and fill-able(TileEntityPipes) instances
*/
/** Collects info about the surrounding 6 tiles and orders them into drain-able(ITankContainer)
* and fill-able(TileEntityPipes) instances */
public void validateNBuildList()
{
// cleanup

View file

@ -4,9 +4,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
@ -87,5 +84,4 @@ public class TileEntitySink extends TileEntityFluidStorage implements IPacketRec
return ColorCode.BLUE;
}
}

View file

@ -12,11 +12,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityComparator;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import org.bouncycastle.util.Arrays;

View file

@ -10,14 +10,15 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.fluids.IFluidTank;
import universalelectricity.prefab.block.BlockAdvanced;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.fluid.api.INetworkPipe;
import dark.fluid.common.FluidMech;
import dark.fluid.common.TabFluidMech;
import dark.library.machine.BlockMachine;
public class BlockPipe extends BlockAdvanced
public class BlockPipe extends BlockMachine
{
public BlockPipe(int id)
{
@ -115,7 +116,7 @@ public class BlockPipe extends BlockAdvanced
TileEntity entity = world.getBlockTileEntity(x, y, z);
if (entity instanceof TileEntityPipe)
{
ILiquidTank tank = ((TileEntityPipe) entity).getTank();
IFluidTank tank = ((TileEntityPipe) entity).getTank();
if (tank != null && tank.getLiquid() != null && tank.getLiquid().amount > 0)
{
if (tank.getLiquid().itemID == Block.waterStill.blockID)

View file

@ -2,8 +2,6 @@ package dark.fluid.common.pipes;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import dark.core.api.ColorCode;

View file

@ -13,11 +13,12 @@ import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidHandler;
import org.bouncycastle.util.Arrays;
@ -33,9 +34,8 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.core.api.ColorCode;
import dark.core.api.IColorCoded;
import dark.core.api.IToolReadOut;
import dark.core.api.ITileConnector;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.api.IToolReadOut;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.core.network.fluid.NetworkPipes;
@ -44,11 +44,11 @@ import dark.fluid.api.INetworkPipe;
import dark.fluid.common.FluidMech;
import dark.fluid.common.pipes.addon.IPipeExtention;
public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer, IToolReadOut, IColorCoded, INetworkPipe, IPacketReceiver
public class TileEntityPipe extends TileEntityAdvanced implements IFluidHandler, IToolReadOut, IColorCoded, INetworkPipe, IPacketReceiver
{
/* TANK TO FAKE OTHER TILES INTO BELIVING THIS HAS AN INTERNAL STORAGE */
protected LiquidTank fakeTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME);
protected FluidTank fakeTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
/* CURRENTLY CONNECTED TILE ENTITIES TO THIS */
private List<TileEntity> connectedBlocks = new ArrayList<TileEntity>();
public boolean[] renderConnection = new boolean[6];
@ -202,10 +202,21 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
LiquidStack liquid = LiquidStack.loadLiquidStackFromNBT(nbt.getCompoundTag("stored"));
FluidStack liquid = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("FluidTank"));
if (nbt.hasKey("stored"))
{
NBTTagCompound tag = nbt.getCompoundTag("stored");
String name = tag.getString("LiquidName");
int amount = nbt.getInteger("Amount");
Fluid fluid = FluidRegistry.getFluid(name);
if (fluid != null)
{
liquid = new FluidStack(fluid, amount);
}
}
if (liquid != null)
{
this.fakeTank.setLiquid(liquid);
this.fakeTank.setFluid(liquid);
}
for (int i = 0; i < 6; i++)
{
@ -221,9 +232,9 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
if (this.fakeTank.containsValidLiquid())
if (this.fakeTank != null)
{
nbt.setTag("stored", this.fakeTank.getLiquid().writeToNBT(new NBTTagCompound()));
nbt.setTag("FluidTank", this.fakeTank.getFluid().writeToNBT(new NBTTagCompound()));
}
for (int i = 0; i < 6; i++)
{
@ -384,9 +395,9 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer
}
@Override
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
if (resource == null || !FluidRestrictionHandler.isValidLiquid(this.getColor(), resource))
if (resource == null || !FluidRestrictionHandler.isValidLiquid(this.getColor(), resource.getFluid()))
{
return 0;
}
@ -394,16 +405,6 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer
return ((NetworkPipes) this.getTileNetwork()).addFluidToNetwork(tile, resource, doFill);
}
@Override
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
{
if (tankIndex != 0 || resource == null || !FluidRestrictionHandler.isValidLiquid(this.getColor(), resource))
{
return 0;
}
return ((NetworkPipes) this.getTileNetwork()).addFluidToNetwork(this, resource, doFill);
}
@Override
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{

View file

@ -13,25 +13,18 @@ public interface IPipeExtention extends IPacketReceiver
public void setPipe(TileEntityPipe pipe);
/**
* how many ticks before next update
*/
/** how many ticks before next update */
public int updateTick();
/**
* if this sub tile needs a packet update
* @param
*/
/** if this sub tile needs a packet update
*
* @param */
public boolean shouldSendPacket(boolean server);
/**
* data that will be sent to this extension
*/
/** data that will be sent to this extension */
public NBTTagCompound getExtentionPacketData(boolean server);
/**
* render class to be used to render this pipe extension of the face of the main pipe
*/
/** render class to be used to render this pipe extension of the face of the main pipe */
public Class<?> getExtentionRenderClass();
public void setDirection(ForgeDirection dir);

View file

@ -11,13 +11,10 @@ import com.google.common.io.ByteArrayDataInput;
import dark.fluid.common.pipes.TileEntityPipe;
/**
* Pipe Extension for the TileEntityPipe.class is a sub TileEntity and is not loaded the same way as
/** Pipe Extension for the TileEntityPipe.class is a sub TileEntity and is not loaded the same way as
* a normal TileEntity
*
* @author Rseifert
*
*/
* @author Rseifert */
public abstract class TileEntityPipeExtention extends TileEntityAdvanced implements IPipeExtention, IPacketReceiver
{

View file

@ -4,11 +4,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraftforge.liquids.LiquidStack;
import com.google.common.io.ByteArrayDataInput;
import dark.core.network.fluid.NetworkPipes;
import dark.fluid.client.render.pipe.RenderPipeWindow;
import dark.fluid.common.pipes.TileEntityPipe;
@ -18,8 +16,6 @@ public class TileEntityPipeWindow extends TileEntityPipeExtention
private TileEntityPipe pipe = null;
private boolean shouldUpdate = false;
LiquidStack stack = new LiquidStack(0, 0, 0);
@Override
public void updateEntity()
{
@ -30,8 +26,6 @@ public class TileEntityPipeWindow extends TileEntityPipeExtention
{
if (pipe != null)
{
stack = ((NetworkPipes) pipe.getTileNetwork()).combinedStorage().getLiquid();
worldObj.setBlockMetadataWithNotify(xCoord, yCoord + 1, yCoord, 0, 0);
}
}
else

View file

@ -1,33 +1,23 @@
package dark.fluid.common.pipes.tele;
import java.util.List;
import dark.fluid.api.INetworkPipe;
/**
* Used by IFluidNetworkPart to signal this block is remotely connected to another network. It will
* cause that network to seak out all other connected network and try to merge them
*
*/
/** Used by IFluidNetworkPart to signal this block is remotely connected to another network. It will
* cause that network to seak out all other connected network and try to merge them */
public interface INetworkConnector extends INetworkPipe
{
/**
* gets the pipes frequency
*/
/** gets the pipes frequency */
public int getFrequency();
public void setFrequency(int id);
/**
* gets the pipes owner
*/
/** gets the pipes owner */
public String getOwner();
public void setOwner(String username);
/**
* gets a list off all INetworkConnector this pipe shares frequency and owner with
*/
/** gets a list off all INetworkConnector this pipe shares frequency and owner with */
public List<INetworkConnector> getConnectedParts();
}

View file

@ -2,13 +2,9 @@ package dark.fluid.common.prefab;
import java.util.Random;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import dark.core.api.IToolReadOut;
import dark.core.api.ITileConnector;
import dark.core.api.IToolReadOut;
import dark.core.network.fluid.HydraulicNetworkHelper;
public abstract class TileEntityFluidDevice extends TileEntityAdvanced implements IToolReadOut, ITileConnector
@ -21,22 +17,4 @@ public abstract class TileEntityFluidDevice extends TileEntityAdvanced implement
super.invalidate();
HydraulicNetworkHelper.invalidate(this);
}
/**
* Fills an ITankContainer in the direction
*
* @param stack - LiquidStack that will be inputed in the tile
* @param side - direction to fill in
* @return the ammount filled
*/
public int fillSide(LiquidStack stack, ForgeDirection side, boolean doFill)
{
TileEntity tileEntity = worldObj.getBlockTileEntity(xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ);
if (stack != null && stack.amount > 0 && tileEntity instanceof ITankContainer)
{
return ((ITankContainer) tileEntity).fill(side.getOpposite(), stack, doFill);
}
return 0;
}
}

View file

@ -4,25 +4,23 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import dark.core.api.IColorCoded;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
public abstract class TileEntityFluidStorage extends TileEntityFluidDevice implements ITankContainer, IColorCoded
public abstract class TileEntityFluidStorage extends TileEntityFluidDevice implements IFluidHandler, IColorCoded
{
/* INTERNAL TANK */
public LiquidTank tank = new LiquidTank(this.getTankSize());
public FluidTank tank = new FluidTank(this.getTankSize());
/**
* gets the max storage limit of the tank
*/
/** gets the max storage limit of the tank */
public abstract int getTankSize();
@Override
@ -32,41 +30,27 @@ public abstract class TileEntityFluidStorage extends TileEntityFluidDevice imple
{
return null;
}
if (this.tank.getLiquid() == null)
if (this.tank.getFluid() == null)
{
return "Empty";
}
return String.format("%d/%d %S Stored", tank.getLiquid().amount / LiquidContainerRegistry.BUCKET_VOLUME, tank.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME, LiquidDictionary.findLiquidName(tank.getLiquid()));
return String.format("%d/%d %S Stored", tank.getFluid().amount / FluidContainerRegistry.BUCKET_VOLUME, tank.getCapacity() / FluidContainerRegistry.BUCKET_VOLUME, tank.getFluid().getFluid().getLocalizedName());
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
{
if (entity instanceof ITankContainer)
{
return true;
}
return false;
return entity instanceof IFluidHandler;
}
@Override
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
return this.fill(0, resource, doFill);
}
@Override
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
{
if (resource == null || tankIndex != 0)
if (resource == null || resource.getFluid() == null || !FluidRestrictionHandler.isValidLiquid(getColor(), resource.getFluid()))
{
return 0;
}
else if (!FluidRestrictionHandler.isValidLiquid(getColor(),resource))
{
return 0;
}
else if (this.tank.getLiquid() != null && !resource.isLiquidEqual(this.tank.getLiquid()))
else if (this.tank.getFluid() != null && !resource.isFluidEqual(this.tank.getFluid()))
{
return 0;
}
@ -74,19 +58,13 @@ public abstract class TileEntityFluidStorage extends TileEntityFluidDevice imple
}
@Override
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
return this.drain(0, maxDrain, doDrain);
}
@Override
public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain)
{
if (tankIndex != 0 || this.tank.getLiquid() == null)
if (this.tank.getFluid() == null)
{
return null;
}
LiquidStack stack = this.tank.getLiquid();
FluidStack stack = this.tank.getFluid();
if (maxDrain < stack.amount)
{
stack = FluidHelper.getStack(stack, maxDrain);
@ -95,23 +73,13 @@ public abstract class TileEntityFluidStorage extends TileEntityFluidDevice imple
}
@Override
public ILiquidTank[] getTanks(ForgeDirection dir)
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
return new ILiquidTank[] { this.tank };
if (this.tank != null)
{
return new FluidTankInfo[] { new FluidTankInfo(this.tank.getFluid(), this.tank.getCapacity()) };
}
@Override
public ILiquidTank getTank(ForgeDirection dir, LiquidStack type)
{
if (type == null)
{
return null;
}
if (type.isLiquidEqual(this.tank.getLiquid()))
{
return this.tank;
}
return null;
return new FluidTankInfo[1];
}
@Override
@ -119,10 +87,21 @@ public abstract class TileEntityFluidStorage extends TileEntityFluidDevice imple
{
super.readFromNBT(nbt);
LiquidStack liquid = LiquidStack.loadLiquidStackFromNBT(nbt.getCompoundTag("stored"));
FluidStack liquid = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("FluidTank"));
if (nbt.hasKey("stored"))
{
NBTTagCompound tag = nbt.getCompoundTag("stored");
String name = tag.getString("LiquidName");
int amount = nbt.getInteger("Amount");
Fluid fluid = FluidRegistry.getFluid(name);
if (fluid != null)
{
liquid = new FluidStack(fluid, amount);
}
}
if (liquid != null)
{
tank.setLiquid(liquid);
tank.setFluid(liquid);
}
}
@ -130,30 +109,26 @@ public abstract class TileEntityFluidStorage extends TileEntityFluidDevice imple
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
if (this.tank.containsValidLiquid())
if (this.tank != null)
{
nbt.setTag("stored", this.tank.getLiquid().writeToNBT(new NBTTagCompound()));
nbt.setTag("FluidTank", this.tank.getFluid().writeToNBT(new NBTTagCompound()));
}
}
/**
* Is the internal tank full
*/
/** Is the internal tank full */
public boolean isFull()
{
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount < this.tank.getCapacity())
if (this.tank.getFluid() == null || this.tank.getFluid().amount < this.tank.getCapacity())
{
return false;
}
return true;
}
/**
* gets the liquidStack stored in the internal tank
*/
public LiquidStack getStoredLiquid()
/** gets the liquidStack stored in the internal tank */
public FluidStack getStoredLiquid()
{
return this.tank.getLiquid();
return this.tank.getFluid();
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
@ -97,7 +98,7 @@ public class BlockDrain extends BlockMachine
TileEntity entity = world.getBlockTileEntity(x, y, z);
if (entity instanceof TileEntityDrain)
{
entityPlayer.sendChatToPlayer("Draining Sources? " + ((TileEntityDrain) entity).canDrainSources());
entityPlayer.sendChatToPlayer(ChatMessageComponent.func_111066_d("Draining Sources? " + ((TileEntityDrain) entity).canDrainSources()));
}
return true;

View file

@ -1,6 +1,5 @@
package dark.fluid.common.pump;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -13,9 +12,7 @@ import universalelectricity.core.vector.Vector2;
import universalelectricity.core.vector.Vector3;
import dark.core.hydraulic.helpers.FluidHelper;
/**
* A simpler pathfinder based on Calclavia's PathFinder from UE api
*/
/** A simpler pathfinder based on Calclavia's PathFinder from UE api */
public class LiquidPathFinder
{
private World world; /* MC WORLD */
@ -52,9 +49,7 @@ public class LiquidPathFinder
bn.add(ForgeDirection.SOUTH);
}
/**
* @return True on success finding, false on failure.
*/
/** @return True on success finding, false on failure. */
public boolean findNodes(Vector3 node)
{
if (node == null)
@ -74,11 +69,11 @@ public class LiquidPathFinder
int id = node.getBlockID(world);
int meta = node.getBlockID(world);
if (this.fill && (id == 0 || (FluidHelper.getBlockFluidStack(id) != null && meta != 0)))
if (this.fill && (id == 0 || (FluidHelper.isFillable(world, node))))
{
this.results.add(node);
}
else if (!this.fill && FluidHelper.isSourceBlock(world, node))
else if (!this.fill && FluidHelper.drainBlock(world, node, false) != null)
{
this.results.add(node);
}
@ -133,15 +128,7 @@ public class LiquidPathFinder
public boolean isValidNode(Vector3 pos)
{
int blockID = pos.getBlockID(world);
if (!this.fill)
{
return FluidHelper.getBlockFluidStack(pos.getBlockID(world)) != null;
}
else
{
return FluidHelper.getBlockFluidStack(pos.getBlockID(world)) != null || (blockID == 0 && FluidHelper.getConnectedSources(world, pos) > 0);
}
return FluidHelper.drainBlock(world, pos, false) != null;
}
public boolean isDone(Vector3 vec)
@ -153,9 +140,7 @@ public class LiquidPathFinder
return false;
}
/**
* Called to execute the pathfinding operation.
*/
/** Called to execute the pathfinding operation. */
public LiquidPathFinder init(final Vector3 startNode, final boolean fill)
{
this.Start = startNode.toVector2();

View file

@ -8,7 +8,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;

View file

@ -5,7 +5,6 @@ import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import dark.fluid.common.FluidMech;
import dark.mech.client.model.ModelGearRod;
public class RenderGearRod extends TileEntitySpecialRenderer

View file

@ -5,11 +5,8 @@ import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import dark.fluid.common.FluidMech;
import dark.mech.client.model.ModelGenerator;
public class RenderGenerator extends TileEntitySpecialRenderer
{
int type = 0;

View file

@ -6,7 +6,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

View file

@ -4,7 +4,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;