Auto-Sync

This commit is contained in:
DarkGuardsman 2013-09-16 08:01:14 -04:00
parent 9a10f8be31
commit 7cef9abb1e
40 changed files with 58 additions and 54 deletions

View file

@ -1,13 +1,10 @@
package dark.api.fluid;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
import dark.api.parts.INetworkPart;
import dark.core.interfaces.ColorCode.IColorCoded;
import dark.core.prefab.helpers.Pair;
public interface INetworkFluidPart extends IColorCoded, IFluidHandler, INetworkPart
{

View file

@ -8,16 +8,16 @@ import dark.api.parts.ITileConnector;
* input for force for the tile, and should return the actually force the machine is using. Supply
* is when the code asks for your tile to output force on the side, just return the force value
* don't try to apply the force to other machines.
*
*
* Tip Supply should never equal load as everything will stop moving since your need more force to
* move an object than it creates as a load, 100Power - 100Load = 0Force/0Movement. The supply of
* force should be greater than the load required to do the work
*
*
* @author DarkGuardsman */
public interface IForceDevice extends ITileConnector
{
/** Applies force to this tile
*
*
* @param side - side its coming from
* @param force - amount of force
* @return amount of force actually loaded down */

View file

@ -17,7 +17,7 @@ import dark.core.prefab.tilenetwork.fluid.FluidRecipeInfo.SimpleFluidRecipe;
/** Handles all kinds of process involving mixing Fluids with other fluids and/or Items, Blocks,
* ItemStack, or Liquids
*
*
* @author DarkGuardsman */
public class FluidCraftingHandler
{
@ -66,7 +66,7 @@ public class FluidCraftingHandler
/** Does the fluid recipe crafting for the crafter object. Requires that the object fully use all
* methods from the #IFluidRecipeCrafter
*
*
* @param crafter - crafting object, recommend it be a tile but can be anything as long as the
* method are used correctly. In some recipe cases when the setRecipeObjectContent nothing will
* be used. If result is null assume not crafting was performed. If there is a result the
@ -266,7 +266,7 @@ public class FluidCraftingHandler
/** Gets the result of the merge of the two fluids, order of merge does matter and will produce
* different results.
*
*
* @param stackOne - Receiving fluid, eg the one that is not moving
* @param stackTwo - Flowing fluid, eg the one moving into the first fluid
* @return Object result of the merge, can be anything from string, ItemStack, Item, Block, or

View file

@ -8,7 +8,7 @@ import dark.core.prefab.helpers.Pair;
import dark.core.prefab.helpers.Triple;
/** Used to store more complex info, than A + B = C, on two FluidStack mixing behavior
*
*
* @author DarkGuardsman */
public class FluidRecipeInfo
{
@ -53,7 +53,7 @@ public class FluidRecipeInfo
/** receiving & input object must be either be an instance of a class extending Item,
* ItemStack, Block, Fluid, FluidStack, or OreNames. Anything else and the mixing will never
* work
*
*
* @param receiving - receiving object that is waiting to be mixed
* @param input - object being added to the receiving object
* @param output - result of mixing the object together. Can be anything but not all
@ -86,7 +86,7 @@ public class FluidRecipeInfo
/** Can the mixing be complete in anyway. Does a basic volume check but does not check for
* volume wasted in mixing
*
*
* @param receiving - Object stored and waiting for mixing
* @param input - Object being added to the receiving object
* @return true if the process can be completed */
@ -142,7 +142,7 @@ public class FluidRecipeInfo
* later, However to prevent 4 different methods be created for mixing this is the best
* output design. As well this doesn't consume the object but does the calculations of the
* recipe out at the given object volumes
*
*
* First value is amount of the first object used. Second value is the amount of the second
* object used. Third value Pair containing object output then amount of output */
public Triple<Integer, Integer, Pair<Object, Integer>> mix(Object receiving, Object input)

View file

@ -2,7 +2,7 @@ package dark.core.prefab.tilenetwork.fluid;
/** Use this if you want to take advantage of the {@link #FluidCraftingHandler} 's auto crafting
* methods to do as little as work as possible to create recipe results
*
*
* @author DarkGuardsman */
public interface IFluidRecipeCrafter
{

View file

@ -3,7 +3,6 @@ package dark.core.prefab.tilenetwork.fluid;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
@ -16,7 +15,7 @@ import dark.core.prefab.tilenetwork.NetworkTileEntities;
/** 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 */
public class NetworkFluidContainers extends NetworkFluidTiles
{

View file

@ -19,7 +19,7 @@ import dark.core.prefab.tilenetwork.NetworkTileEntities;
/** 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 */
public class NetworkPipes extends NetworkFluidTiles
{
@ -163,7 +163,7 @@ public class NetworkPipes extends NetworkFluidTiles
}
/** 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
@ -174,7 +174,7 @@ public class NetworkPipes extends NetworkFluidTiles
}
/** 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

View file

@ -22,6 +22,7 @@ import dark.fluid.common.pipes.TileEntityGenericPipe;
import dark.fluid.common.pipes.TileEntityPipe;
import dark.fluid.common.pump.TileEntityConstructionPump;
import dark.fluid.common.pump.TileEntityStarterPump;
@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelCenterTank extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelCornerTank extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelEngine extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelFurnace extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelGearPiston extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelGenerator extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelLargePipe extends ModelBase
{

View file

@ -12,6 +12,7 @@ import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.common.machines.TileEntityTank;
@SideOnly(Side.CLIENT)
public class ModelLiquidTank extends ModelBase
{

View file

@ -4,6 +4,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelLiquidTankCorner extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelPump extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelReleaseValve extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelSink extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelTank extends ModelBase
{

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelTankSide extends ModelBase
{
@ -128,7 +129,7 @@ public class ModelTankSide extends ModelBase
* @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 */
public void render(float size, boolean left, boolean right, boolean bot, boolean top)

View file

@ -14,6 +14,7 @@ import dark.fluid.client.model.ModelCornerTank;
import dark.fluid.client.model.ModelTank;
import dark.fluid.common.FluidMech;
import dark.fluid.common.machines.TileEntityBoiler;
@SideOnly(Side.CLIENT)
public class RenderBoiler extends RenderTileMachine
{

View file

@ -10,6 +10,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import dark.core.client.renders.RenderTileMachine;
import dark.fluid.client.model.ModelFurnace;
import dark.fluid.common.FluidMech;
@SideOnly(Side.CLIENT)
public class RenderFurnace extends RenderTileMachine
{

View file

@ -11,6 +11,7 @@ import dark.core.client.renders.RenderTileMachine;
import dark.fluid.client.model.ModelGearPiston;
import dark.fluid.common.FluidMech;
import dark.mech.common.machines.TileEntitySteamPiston;
@SideOnly(Side.CLIENT)
public class RenderGearPiston extends RenderTileMachine
{

View file

@ -10,11 +10,9 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.core.client.renders.RenderBlockFluid;
import dark.core.client.renders.RenderBlockFluid;
import dark.core.client.renders.RenderTileMachine;
import dark.core.interfaces.ColorCode;
import dark.fluid.client.model.ModelTankSide;
import dark.fluid.common.FluidMech;
import dark.fluid.common.machines.TileEntityTank;
@SideOnly(Side.CLIENT)

View file

@ -1,13 +1,9 @@
package dark.fluid.common;
import java.util.Set;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.Configuration;
import dark.core.prefab.BlockMachine;
import dark.core.prefab.IExtraObjectInfo;
import dark.core.prefab.helpers.Pair;
public abstract class BlockFM extends BlockMachine implements IExtraObjectInfo
{

View file

@ -36,24 +36,14 @@ import dark.fluid.common.machines.BlockFluid;
import dark.fluid.common.machines.BlockReleaseValve;
import dark.fluid.common.machines.BlockSink;
import dark.fluid.common.machines.BlockTank;
import dark.fluid.common.machines.TileEntityBoiler;
import dark.fluid.common.machines.TileEntityReleaseValve;
import dark.fluid.common.machines.TileEntitySink;
import dark.fluid.common.machines.TileEntityTank;
import dark.fluid.common.pipes.BlockPipe;
import dark.fluid.common.pipes.ItemBlockPipe;
import dark.fluid.common.pipes.TileEntityGenericPipe;
import dark.fluid.common.pipes.TileEntityPipe;
import dark.fluid.common.pump.BlockConstructionPump;
import dark.fluid.common.pump.BlockDrain;
import dark.fluid.common.pump.BlockPumpMachine;
import dark.fluid.common.pump.TileEntityConstructionPump;
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.BlockSteamPiston;
import dark.mech.common.machines.TileEntitySteamPiston;
@ModstatInfo(prefix = "fluidmech")
@Mod(modid = FluidMech.MOD_ID, name = FluidMech.MOD_NAME, version = FluidMech.VERSION, dependencies = "after:DarkCore", useMetadata = true)
@ -78,7 +68,6 @@ public class FluidMech extends ModPrefab
public static Fluid fmWaste, fmOil, fmFuel, fmBio;
public static Fluid waste, oil, fuel, bio;
@Metadata(FluidMech.MOD_ID)
public static ModMetadata meta;

View file

@ -22,7 +22,8 @@ public class BlockFluid extends BlockFluidFinite
}
@Override @SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
this.flowing = par1IconRegister.registerIcon(FluidMech.instance.PREFIX + this.getUnlocalizedName().replace("tile.", "") + "_flowing");
@ -30,7 +31,8 @@ public class BlockFluid extends BlockFluidFinite
fluid.setIcons(still, flowing);
}
@Override @SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2)
{
return still;

View file

@ -27,6 +27,7 @@ import dark.fluid.common.BlockFM;
public class BlockTank extends BlockFM
{
public static int tankVolume = 8;
public BlockTank(int id)
{
super("FluidTank", id, Material.rock);

View file

@ -47,7 +47,7 @@ public class TileEntitySink extends TileEntityFluidStorage implements IPacketRec
{
stack = this.getTank().getFluid();
}
return PacketHandler.instance().getPacket(DarkMain.CHANNEL, this, stack.writeToNBT(new NBTTagCompound()));
return PacketHandler.instance().getPacket(DarkMain.CHANNEL, this, stack.writeToNBT(new NBTTagCompound()));
}
@Override
@ -55,7 +55,7 @@ public class TileEntitySink extends TileEntityFluidStorage implements IPacketRec
{
try
{
this.getTank().setFluid(FluidStack.loadFluidStackFromNBT( PacketHandler.instance().readNBTTagCompound(data)));
this.getTank().setFluid(FluidStack.loadFluidStackFromNBT(PacketHandler.instance().readNBTTagCompound(data)));
}
catch (Exception e)
{

View file

@ -124,7 +124,7 @@ public class TileEntityTank extends TileEntityFluidStorage implements IFluidHand
public Packet getDescriptionPacket()
{
FluidStack stack = null;
if (this.getTank().getFluid() != null)
if (this.getTank().getFluid() != null && this.getTank().getFluid().getFluid() != null)
{
stack = this.getTank().getFluid();
}
@ -202,7 +202,7 @@ public class TileEntityTank extends TileEntityFluidStorage implements IFluidHand
}
/** Checks to make sure the connection is valid to the tileEntity
*
*
* @param tileEntity - the tileEntity being checked
* @param side - side the connection is too */
public void validateConnectionSide(TileEntity tileEntity, ForgeDirection side)

View file

@ -418,7 +418,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements IFluidHandler,
}
/** Checks to make sure the connection is valid to the tileEntity
*
*
* @param tileEntity - the tileEntity being checked
* @param side - side the connection is too
* @return */

View file

@ -16,7 +16,7 @@ import universalelectricity.core.vector.Vector3;
import dark.core.prefab.helpers.FluidHelper;
/** A simpler path Finder used to find drainable or fillable tiles
*
*
* @author DarkGuardsman */
public class LiquidPathFinder
{
@ -80,7 +80,7 @@ public class LiquidPathFinder
}
/** Searches for nodes attached to the given node
*
*
* @return True on success finding, false on failure. */
public boolean findNodes(Vector3 node)
{
@ -132,7 +132,7 @@ public class LiquidPathFinder
}
/** Find all node attached to the origin mode in the given direction
*
*
* Note: Calls findNode if the next code is valid */
public boolean find(ForgeDirection direction, Vector3 origin)
{
@ -262,12 +262,12 @@ public class LiquidPathFinder
/** Used to sort a list of vector3 locations using the vector3's distance from one point and
* elevation in the y axis
*
*
* @param start - start location to measure distance from
* @param results2 - list of vectors to sort
* @param closest - sort closest distance to the top
* @param highest - sort highest y value to the top.
*
*
* Note: highest takes priority over closest */
public void sortBlockList(final Vector3 start, final Set<Vector3> set, final boolean closest, final boolean highest)
{

View file

@ -37,7 +37,7 @@ public class TileEntityConstructionPump extends TileEntityStarterPump implements
}
/** Gets the facing direction
*
*
* @param input true for input side, false for output side
* @return */
public ForgeDirection getFacing(boolean input)
@ -79,7 +79,7 @@ public class TileEntityConstructionPump extends TileEntityStarterPump implements
}
/** Gets the nextDrain in the list
*
*
* @param inputTile - input tile must be an instance of INetworkPipe
* @param outputTile - output tile must be an instance of IFluidHandler
* @param ignoreList - list of drains to ignore so that the next one is selected

View file

@ -91,7 +91,7 @@ public class TileEntityStarterPump extends TileEntityMachine implements IToolRea
}
/** Drains an area starting at the given location
*
*
* @param world - world to drain in, most cases will be the TileEntities world
* @param loc - origin to start the path finder with. If this is an instance of IDrain this
* method will act different */
@ -205,9 +205,9 @@ public class TileEntityStarterPump extends TileEntityMachine implements IToolRea
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
if(tool == EnumTools.PIPE_GUAGE)
if (tool == EnumTools.PIPE_GUAGE)
{
return "Source Blocks: "+this.getLiquidFinder().results.size();
return "Source Blocks: " + this.getLiquidFinder().results.size();
}
return null;
}

View file

@ -10,6 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelGearRod extends ModelBase
{

View file

@ -11,6 +11,7 @@ import net.minecraft.client.model.ModelRenderer;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelGenerator extends ModelBase
{

View file

@ -8,6 +8,7 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.mech.client.model.ModelGearRod;
@SideOnly(Side.CLIENT)
public class RenderGearRod extends TileEntitySpecialRenderer
{

View file

@ -8,6 +8,7 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.mech.client.model.ModelGenerator;
@SideOnly(Side.CLIENT)
public class RenderGenerator extends TileEntitySpecialRenderer
{