Basic Upload before i break everything
Ok i'm going to make an attempt to change how everything works. Before i do that let backup the code.
This commit is contained in:
parent
a1ed4a5a4d
commit
6401261e19
19 changed files with 213 additions and 121 deletions
|
@ -1,6 +1,6 @@
|
|||
package liquidmechanics.api;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
|
||||
|
@ -11,7 +11,7 @@ public interface ITankOutputer extends ITankContainer
|
|||
* @param dir - direction pressure is being request to output
|
||||
* @return pressure if can output for the type or direction
|
||||
*/
|
||||
public int presureOutput(Liquid type, ForgeDirection dir);
|
||||
public int presureOutput(DefautlLiquids type, ForgeDirection dir);
|
||||
|
||||
/**
|
||||
* Quick way to check if the TE will output pressure
|
||||
|
@ -20,5 +20,5 @@ public interface ITankOutputer extends ITankContainer
|
|||
* @param dir - direction
|
||||
* @return
|
||||
*/
|
||||
public boolean canPressureToo(Liquid type, ForgeDirection dir);
|
||||
public boolean canPressureToo(DefautlLiquids type, ForgeDirection dir);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package liquidmechanics.api.helpers;
|
||||
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -8,7 +9,7 @@ import net.minecraftforge.liquids.ITankContainer;
|
|||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class MHelper
|
||||
public class TankHelper
|
||||
{
|
||||
/**
|
||||
* Used to find all tileEntities sounding the location you will have to filter for selective
|
||||
|
@ -47,8 +48,8 @@ public class MHelper
|
|||
if (resource == null)
|
||||
return 0;
|
||||
LiquidStack liquid = resource.copy();
|
||||
TileEntity[] connected = MHelper.getSourounding(world, center.intX(), center.intY(), center.intZ());
|
||||
Liquid type = Liquid.getLiquid(liquid);
|
||||
TileEntity[] connected = TankHelper.getSourounding(world, center.intX(), center.intY(), center.intZ());
|
||||
DefautlLiquids type = DefautlLiquids.getLiquid(liquid);
|
||||
ForgeDirection firstTrade = ForgeDirection.UP;
|
||||
if (!type.doesFlaot)
|
||||
firstTrade = ForgeDirection.DOWN;
|
||||
|
@ -63,7 +64,7 @@ public class MHelper
|
|||
boolean validTank = false;
|
||||
for (int t = 0; t < tanks.length; t++)
|
||||
{
|
||||
if (tanks[t].getLiquid() != null && Liquid.isStackEqual(tanks[t].getLiquid(), liquid))
|
||||
if (tanks[t].getLiquid() != null && DefautlLiquids.isStackEqual(tanks[t].getLiquid(), liquid))
|
||||
{
|
||||
validTank = true;
|
||||
break;
|
|
@ -1,9 +1,9 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.client.model.ModelLargePipe;
|
||||
import liquidmechanics.client.model.ModelPipe;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -13,7 +13,7 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
public class RenderPipe extends TileEntitySpecialRenderer
|
||||
{
|
||||
private Liquid type = Liquid.DEFUALT;
|
||||
private DefautlLiquids type = DefautlLiquids.DEFUALT;
|
||||
private ModelPipe fourPipe;
|
||||
private ModelLargePipe SixPipe;
|
||||
private TileEntity[] ents = new TileEntity[6];
|
||||
|
@ -40,7 +40,7 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
|||
|
||||
}
|
||||
|
||||
public void render(Liquid type, TileEntity[] ents)
|
||||
public void render(DefautlLiquids type, TileEntity[] ents)
|
||||
{
|
||||
|
||||
switch (type.ordinal())
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.client.model.ModelPump;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -22,7 +22,7 @@ public class RenderPump extends TileEntitySpecialRenderer
|
|||
|
||||
public void renderAModelAt(TileEntityPump tileEntity, double d, double d1, double d2, float f)
|
||||
{
|
||||
Liquid type = tileEntity.type;
|
||||
DefautlLiquids type = tileEntity.type;
|
||||
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
switch (type.ordinal())
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.api.helpers.MHelper;
|
||||
import liquidmechanics.api.helpers.TankHelper;
|
||||
import liquidmechanics.client.model.ModelLiquidTank;
|
||||
import liquidmechanics.client.model.ModelLiquidTankCorner;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -15,7 +15,7 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
public class RenderTank extends TileEntitySpecialRenderer
|
||||
{
|
||||
private Liquid type = Liquid.DEFUALT;
|
||||
private DefautlLiquids type = DefautlLiquids.DEFUALT;
|
||||
private ModelLiquidTank model;
|
||||
private ModelLiquidTankCorner modelC;
|
||||
private int pos = 0;
|
||||
|
@ -34,10 +34,10 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
if (MHelper.corner(te) > 0)
|
||||
if (TankHelper.corner(te) > 0)
|
||||
{
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "tanks/LiquidTankCorner.png");
|
||||
int corner = MHelper.corner(te);
|
||||
int corner = TankHelper.corner(te);
|
||||
switch (corner)
|
||||
{
|
||||
case 2:
|
||||
|
|
|
@ -2,13 +2,13 @@ package liquidmechanics.common;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.common.block.BlockReleaseValve;
|
||||
import liquidmechanics.common.block.BlockGenerator;
|
||||
import liquidmechanics.common.block.BlockPipe;
|
||||
import liquidmechanics.common.block.BlockMachine;
|
||||
import liquidmechanics.common.block.BlockRod;
|
||||
import liquidmechanics.common.block.BlockSteam;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import liquidmechanics.common.item.ItemEValve;
|
||||
import liquidmechanics.common.item.ItemGuage;
|
||||
import liquidmechanics.common.item.ItemMachine;
|
||||
|
@ -149,15 +149,15 @@ public class LiquidMechanics extends DummyModContainer
|
|||
GameRegistry.registerTileEntity(TileEntityGenerator.class, "Generator");
|
||||
|
||||
// Liquid Item/Block common name writer
|
||||
for (int i = 0; i < Liquid.values().length; i++)
|
||||
for (int i = 0; i < DefautlLiquids.values().length; i++)
|
||||
{
|
||||
// eValves
|
||||
LanguageRegistry.addName((new ItemStack(blockReleaseValve, 1, i)), Liquid.getLiquid(i).displayerName + " Release Valve");
|
||||
LanguageRegistry.addName((new ItemStack(blockReleaseValve, 1, i)), DefautlLiquids.getLiquid(i).displayerName + " Release Valve");
|
||||
// pipes
|
||||
LanguageRegistry.addName((new ItemStack(itemPipes, 1, i)), Liquid.getLiquid(i).displayerName + " Pipe");
|
||||
LanguageRegistry.addName((new ItemStack(itemPipes, 1, i)), DefautlLiquids.getLiquid(i).displayerName + " Pipe");
|
||||
|
||||
// Storage Tanks
|
||||
LanguageRegistry.addName((new ItemStack(itemTank, 1, i)), Liquid.getLiquid(i).displayerName + " Tank");
|
||||
LanguageRegistry.addName((new ItemStack(itemTank, 1, i)), DefautlLiquids.getLiquid(i).displayerName + " Tank");
|
||||
}
|
||||
|
||||
for (int i = 0; i < ItemParts.Parts.values().length; i++)
|
||||
|
@ -181,7 +181,7 @@ public class LiquidMechanics extends DummyModContainer
|
|||
public void PostInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
proxy.postInit();
|
||||
TabLiquidMechanics.setItemStack(new ItemStack(itemPipes, 1, Liquid.WATER.ordinal()));
|
||||
TabLiquidMechanics.setItemStack(new ItemStack(itemPipes, 1, DefautlLiquids.WATER.ordinal()));
|
||||
// generator
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(this.blockGenerator, 1), new Object[] { "@T@", "OVO", "@T@", 'T', new ItemStack(LiquidMechanics.blockRod, 1), '@', "plateSteel", 'O', "basicCircuit", 'V', "motor" }));
|
||||
// pipe gauge
|
||||
|
@ -205,11 +205,11 @@ public class LiquidMechanics extends DummyModContainer
|
|||
GameRegistry.addRecipe(new ItemStack(blockRod, 1), new Object[] { "I@I", 'I', Item.ingotIron, '@', new ItemStack(itemParts, 1, Parts.Iron.ordinal()) });
|
||||
|
||||
// steam pipe
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, Liquid.STEAM.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Iron.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, DefautlLiquids.STEAM.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Iron.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
|
||||
// water pipe
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, Liquid.WATER.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Iron.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()), new ItemStack(Item.dyePowder, 1, 4) });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, DefautlLiquids.WATER.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Iron.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()), new ItemStack(Item.dyePowder, 1, 4) });
|
||||
// lava pipe
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, Liquid.LAVA.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Obby.ordinal()), new ItemStack(Item.dyePowder, 1, 1) });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, DefautlLiquids.LAVA.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Obby.ordinal()), new ItemStack(Item.dyePowder, 1, 1) });
|
||||
/*
|
||||
* GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, Liquid.OIL.ordinal()), new
|
||||
* Object[] { new ItemStack(parts, 1, basicParts.Iron.ordinal()), new ItemStack(parts, 1,
|
||||
|
@ -219,11 +219,11 @@ public class LiquidMechanics extends DummyModContainer
|
|||
* basicParts.Seal.ordinal()), new ItemStack(Item.dyePowder, 1, 11) });
|
||||
*/
|
||||
// steam tank
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, Liquid.STEAM.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Tank.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()), new ItemStack(Item.dyePowder, 1, 15) });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, DefautlLiquids.STEAM.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Tank.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()), new ItemStack(Item.dyePowder, 1, 15) });
|
||||
// water tank
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, Liquid.WATER.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Tank.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()), new ItemStack(Item.dyePowder, 1, 4) });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, DefautlLiquids.WATER.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Tank.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()), new ItemStack(Item.dyePowder, 1, 4) });
|
||||
// lava tank
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, Liquid.LAVA.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Tank.ordinal()), Block.obsidian, Block.obsidian, Block.obsidian, Block.obsidian });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, DefautlLiquids.LAVA.ordinal()), new Object[] { new ItemStack(itemParts, 1, Parts.Tank.ordinal()), Block.obsidian, Block.obsidian, Block.obsidian, Block.obsidian });
|
||||
/*
|
||||
* GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, Liquid.OIL.ordinal()), new
|
||||
* Object[] { new ItemStack(parts, 1, basicParts.Tank.ordinal()), new ItemStack(parts, 1,
|
||||
|
@ -237,7 +237,7 @@ public class LiquidMechanics extends DummyModContainer
|
|||
GameRegistry.addRecipe(new ItemStack(blockMachine, 1, 0), new Object[] { "@T@", "BPB", "@P@", '@', new ItemStack(Item.ingotIron, 2), 'B', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), 'P', new ItemStack(Block.pistonBase), 'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()) });
|
||||
|
||||
// eVavles
|
||||
for (int i = 0; i < Liquid.values().length - 1; i++)
|
||||
for (int i = 0; i < DefautlLiquids.values().length - 1; i++)
|
||||
{
|
||||
GameRegistry.addRecipe(new ItemStack(blockMachine, 1, i), new Object[] { " P ", "PVP", " P ", 'P', new ItemStack(itemPipes, 1, i), 'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), });
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
@ -64,7 +64,7 @@ public class BlockMachine extends BlockContainer
|
|||
|
||||
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, Liquid.consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, DefautlLiquids.consumeItem(current));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -91,12 +91,12 @@ public class BlockMachine extends BlockContainer
|
|||
return false;
|
||||
else
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, Liquid.consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, DefautlLiquids.consumeItem(current));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, Liquid.consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, DefautlLiquids.consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package liquidmechanics.api.helpers;
|
||||
package liquidmechanics.common.handlers;
|
||||
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -13,7 +13,8 @@ import net.minecraftforge.liquids.LiquidStack;
|
|||
* @author Rseifert
|
||||
*
|
||||
*/
|
||||
public enum Liquid
|
||||
@Deprecated
|
||||
public enum DefautlLiquids
|
||||
{
|
||||
// -1 == null || unused
|
||||
STEAM("Steam", LiquidDictionary.getOrCreateLiquid("Steam", new LiquidStack(LiquidMechanics.blockSteamBlock, 1)), true, 100),
|
||||
|
@ -26,7 +27,7 @@ public enum Liquid
|
|||
public final int defaultPresure;
|
||||
public final LiquidStack liquid;
|
||||
|
||||
private Liquid(String name, LiquidStack stack, boolean gas, int dPressure)
|
||||
private DefautlLiquids(String name, LiquidStack stack, boolean gas, int dPressure)
|
||||
{
|
||||
this.displayerName = name;
|
||||
this.liquid = stack;
|
||||
|
@ -37,7 +38,7 @@ public enum Liquid
|
|||
/**
|
||||
* creates a new liquid stack using basic liquid type and the volume needed
|
||||
*/
|
||||
public static LiquidStack getStack(Liquid type, int vol)
|
||||
public static LiquidStack getStack(DefautlLiquids type, int vol)
|
||||
{
|
||||
return new LiquidStack(type.liquid.itemID, vol, type.liquid.itemMeta);
|
||||
}
|
||||
|
@ -45,13 +46,13 @@ public enum Liquid
|
|||
/**
|
||||
* gets a liquid type from a liquidStack
|
||||
*/
|
||||
public static Liquid getLiquid(LiquidStack stack)
|
||||
public static DefautlLiquids getLiquid(LiquidStack stack)
|
||||
{
|
||||
for (int i = 0; i < Liquid.values().length - 1; i++)
|
||||
for (int i = 0; i < DefautlLiquids.values().length - 1; i++)
|
||||
{
|
||||
if (Liquid.isStackEqual(stack, Liquid.values()[i])) { return Liquid.values()[i]; }
|
||||
if (DefautlLiquids.isStackEqual(stack, DefautlLiquids.values()[i])) { return DefautlLiquids.values()[i]; }
|
||||
}
|
||||
return Liquid.DEFUALT;
|
||||
return DefautlLiquids.DEFUALT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,9 +63,9 @@ public enum Liquid
|
|||
* of liquid
|
||||
* @return Liquid Object
|
||||
*/
|
||||
public static Liquid getLiquid(int id)
|
||||
public static DefautlLiquids getLiquid(int id)
|
||||
{
|
||||
if (id >= 0 && id < Liquid.values().length) { return Liquid.values()[id]; }
|
||||
if (id >= 0 && id < DefautlLiquids.values().length) { return DefautlLiquids.values()[id]; }
|
||||
return DEFUALT;
|
||||
}
|
||||
|
||||
|
@ -74,18 +75,18 @@ public enum Liquid
|
|||
* @param bBlock
|
||||
* @return
|
||||
*/
|
||||
public static Liquid getLiquidTypeByBlock(int bBlock)
|
||||
public static DefautlLiquids getLiquidTypeByBlock(int bBlock)
|
||||
{
|
||||
if (bBlock == Block.waterMoving.blockID)
|
||||
return Liquid.DEFUALT;
|
||||
return DefautlLiquids.DEFUALT;
|
||||
if (bBlock == Block.lavaMoving.blockID)
|
||||
return Liquid.DEFUALT;
|
||||
for (int i = 0; i < Liquid.values().length - 1; i++)
|
||||
return DefautlLiquids.DEFUALT;
|
||||
for (int i = 0; i < DefautlLiquids.values().length - 1; i++)
|
||||
{
|
||||
Liquid selected = Liquid.getLiquid(i);
|
||||
DefautlLiquids selected = DefautlLiquids.getLiquid(i);
|
||||
if (bBlock == selected.liquid.itemID) { return selected; }
|
||||
}
|
||||
return Liquid.DEFUALT;
|
||||
return DefautlLiquids.DEFUALT;
|
||||
}
|
||||
|
||||
public static LiquidStack getLiquidFromBlock(int blockId)
|
||||
|
@ -108,7 +109,7 @@ public enum Liquid
|
|||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public static boolean isStackEqual(LiquidStack stack, Liquid type)
|
||||
public static boolean isStackEqual(LiquidStack stack, DefautlLiquids type)
|
||||
{
|
||||
if (stack == null)
|
||||
return false;
|
17
minecraft/liquidmechanics/common/handlers/LiquidData.java
Normal file
17
minecraft/liquidmechanics/common/handlers/LiquidData.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package liquidmechanics.common.handlers;
|
||||
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
public class LiquidData
|
||||
{
|
||||
public final boolean isAGas;
|
||||
public final int defaultPresure;
|
||||
public final LiquidStack sampleStack;
|
||||
|
||||
public LiquidData(LiquidStack stack, boolean gas, int dPressure)
|
||||
{
|
||||
this.sampleStack = stack;
|
||||
this.isAGas = gas;
|
||||
this.defaultPresure = dPressure;
|
||||
}
|
||||
}
|
53
minecraft/liquidmechanics/common/handlers/LiquidHandler.java
Normal file
53
minecraft/liquidmechanics/common/handlers/LiquidHandler.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
package liquidmechanics.common.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.liquids.LiquidDictionary;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidDictionary.LiquidRegisterEvent;
|
||||
|
||||
public class LiquidHandler
|
||||
{
|
||||
// Active list of all Liquid that can be used//
|
||||
public static List<LiquidData> allowedLiquids = new ArrayList<LiquidData>();
|
||||
// PreDefinned Liquids//
|
||||
public static LiquidData steam;
|
||||
public static LiquidData water;
|
||||
public static LiquidData lava;
|
||||
//public static LiquidData oil; TODO add
|
||||
//public static LiquidData fuel;
|
||||
/**
|
||||
* Called to add the default liquids to the allowed list
|
||||
*/
|
||||
public static void addDefaultLiquids()
|
||||
{
|
||||
steam = new LiquidData(LiquidDictionary.getOrCreateLiquid("Steam", new LiquidStack(LiquidMechanics.blockSteamBlock, 1)), true, 100);
|
||||
allowedLiquids.add(steam);
|
||||
water = new LiquidData(LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), false, 32);
|
||||
allowedLiquids.add(water);
|
||||
lava = new LiquidData(LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), false, 20);
|
||||
allowedLiquids.add(lava);
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void liquidRegisterEvent(LiquidRegisterEvent event)
|
||||
{
|
||||
// TODO use this to add new liquid types to the data list
|
||||
// or something along the lines of IDing liquids for use
|
||||
boolean used = false;
|
||||
for (LiquidData dta : allowedLiquids)
|
||||
{
|
||||
|
||||
}
|
||||
LiquidData data = new LiquidData(event.Liquid, false, 32);
|
||||
if (!used && !allowedLiquids.contains(data))
|
||||
{
|
||||
allowedLiquids.add(data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
20
minecraft/liquidmechanics/common/handlers/PipeCreator.java
Normal file
20
minecraft/liquidmechanics/common/handlers/PipeCreator.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package liquidmechanics.common.handlers;
|
||||
|
||||
import net.minecraftforge.liquids.LiquidDictionary.LiquidRegisterEvent;
|
||||
/**
|
||||
* WIP unknown if this can actual work fully
|
||||
* @author Rseifert
|
||||
*
|
||||
*/
|
||||
public class PipeCreator
|
||||
{
|
||||
/**
|
||||
* used to create a new pipe type
|
||||
*/
|
||||
public static void createNewPipe(LiquidRegisterEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,8 +2,8 @@ package liquidmechanics.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import liquidmechanics.common.tileentity.TileEntityReleaseValve;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -38,7 +38,7 @@ public class ItemEValve extends ItemBlock
|
|||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < Liquid.values().length - 1; i++)
|
||||
for (int i = 0; i < DefautlLiquids.values().length - 1; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
@ -114,9 +114,9 @@ public class ItemEValve extends ItemBlock
|
|||
if (blockEntity instanceof TileEntityReleaseValve)
|
||||
{
|
||||
TileEntityReleaseValve pipeEntity = (TileEntityReleaseValve) blockEntity;
|
||||
Liquid dm = Liquid.getLiquid(itemstack.getItemDamage());
|
||||
DefautlLiquids dm = DefautlLiquids.getLiquid(itemstack.getItemDamage());
|
||||
pipeEntity.setType(dm);
|
||||
pipeEntity.tank.setLiquid(Liquid.getStack(dm, 1));
|
||||
pipeEntity.tank.setLiquid(DefautlLiquids.getStack(dm, 1));
|
||||
world.setBlockMetadata(x, y, z, dm.ordinal() & 15);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ package liquidmechanics.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -40,13 +40,13 @@ public class ItemPipe extends Item
|
|||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
return itemstack.getItemDamage() < Liquid.values().length ? Liquid.getLiquid(itemstack.getItemDamage()).displayerName + " Pipe" : "Empty Pipe";
|
||||
return itemstack.getItemDamage() < DefautlLiquids.values().length ? DefautlLiquids.getLiquid(itemstack.getItemDamage()).displayerName + " Pipe" : "Empty Pipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < Liquid.values().length - 1; i++)
|
||||
for (int i = 0; i < DefautlLiquids.values().length - 1; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class ItemPipe extends Item
|
|||
if (blockEntity instanceof TileEntityPipe)
|
||||
{
|
||||
TileEntityPipe pipeEntity = (TileEntityPipe) blockEntity;
|
||||
Liquid dm = Liquid.getLiquid(par1ItemStack.getItemDamage());
|
||||
DefautlLiquids dm = DefautlLiquids.getLiquid(par1ItemStack.getItemDamage());
|
||||
pipeEntity.setType(dm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ package liquidmechanics.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -40,13 +40,13 @@ public class ItemTank extends Item
|
|||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
return itemstack.getItemDamage() < Liquid.values().length ? Liquid.getLiquid(itemstack.getItemDamage()).displayerName + " Tank" : "unknown";
|
||||
return itemstack.getItemDamage() < DefautlLiquids.values().length ? DefautlLiquids.getLiquid(itemstack.getItemDamage()).displayerName + " Tank" : "unknown";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < Liquid.values().length; i++)
|
||||
for (int i = 0; i < DefautlLiquids.values().length; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class ItemTank extends Item
|
|||
if (blockEntity instanceof TileEntityTank)
|
||||
{
|
||||
TileEntityTank pipeEntity = (TileEntityTank) blockEntity;
|
||||
Liquid dm = Liquid.getLiquid(par1ItemStack.getItemDamage());
|
||||
DefautlLiquids dm = DefautlLiquids.getLiquid(par1ItemStack.getItemDamage());
|
||||
pipeEntity.setType(dm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.EnumSet;
|
|||
|
||||
import liquidmechanics.api.IForce;
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.MHelper;
|
||||
import liquidmechanics.api.helpers.TankHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroupingHelper;
|
||||
import liquidmechanics.common.block.BlockGenerator;
|
||||
|
@ -76,7 +76,7 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
|
|||
this.genAmmount = Math.abs(force / this.getVoltage());
|
||||
// wire count update
|
||||
int wireCount = 0;
|
||||
TileEntity[] ents = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
TileEntity[] ents = TankHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
this.wires = new IConductor[6];
|
||||
for (int i = 0; i < ents.length; i++)
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@ package liquidmechanics.common.tileentity;
|
|||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.ITankOutputer;
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.api.helpers.MHelper;
|
||||
import liquidmechanics.api.helpers.TankHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
|
@ -25,7 +25,7 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
|
||||
public class TileEntityPipe extends TileEntity implements ITankContainer, IPacketReceiver, IReadOut
|
||||
{
|
||||
public Liquid type = Liquid.DEFUALT;
|
||||
public DefautlLiquids type = DefautlLiquids.DEFUALT;
|
||||
private int count = 20;
|
||||
private int count2, presure = 0;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
|
|||
if (++count >= 40)
|
||||
{
|
||||
count = 0;
|
||||
this.connectedBlocks = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
this.connectedBlocks = TankHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
for (int e = 0; e < 6; e++)
|
||||
{
|
||||
if (connectedBlocks[e] instanceof ITankContainer)
|
||||
|
@ -105,13 +105,13 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
|
|||
}
|
||||
|
||||
// returns liquid type
|
||||
public Liquid getType()
|
||||
public DefautlLiquids getType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
// used by the item to set the liquid type on spawn
|
||||
public void setType(Liquid rType)
|
||||
public void setType(DefautlLiquids rType)
|
||||
{
|
||||
this.type = rType;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
|
|||
{
|
||||
try
|
||||
{
|
||||
this.setType(Liquid.getLiquid(data.readInt()));
|
||||
this.setType(DefautlLiquids.getLiquid(data.readInt()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -140,9 +140,9 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
|
|||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
this.type = Liquid.getLiquid(par1NBTTagCompound.getInteger("type"));
|
||||
this.type = DefautlLiquids.getLiquid(par1NBTTagCompound.getInteger("type"));
|
||||
int vol = par1NBTTagCompound.getInteger("liquid");
|
||||
this.stored.setLiquid(Liquid.getStack(type, vol));
|
||||
this.stored.setLiquid(DefautlLiquids.getStack(type, vol));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,8 +178,8 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
|
|||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
LiquidStack stack = stored.getLiquid();
|
||||
if (stack == null) stored.setLiquid(Liquid.getStack(this.type, 1));
|
||||
if (stack != null && Liquid.isStackEqual(resource, this.type)) return fill(0, resource, doFill);
|
||||
if (stack == null) stored.setLiquid(DefautlLiquids.getStack(this.type, 1));
|
||||
if (stack != null && DefautlLiquids.isStackEqual(resource, this.type)) return fill(0, resource, doFill);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
|
|||
{
|
||||
if (entity instanceof TileEntityPipe)
|
||||
{
|
||||
if (((TileEntityPipe) entity).type == this.type && this.type != Liquid.DEFUALT) { return true; }
|
||||
if (((TileEntityPipe) entity).type == this.type && this.type != DefautlLiquids.DEFUALT) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.EnumSet;
|
|||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.ITankOutputer;
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroupingHelper;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -39,7 +39,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
int disableTimer = 0;
|
||||
int count = 0;
|
||||
|
||||
public Liquid type = Liquid.DEFUALT;
|
||||
public DefautlLiquids type = DefautlLiquids.DEFUALT;
|
||||
public LiquidTank tank = new LiquidTank(wMax);
|
||||
|
||||
@Override
|
||||
|
@ -89,12 +89,12 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
if (count-- <= 0)
|
||||
{
|
||||
int bBlock = worldObj.getBlockId(xCoord, yCoord - 1, zCoord);
|
||||
Liquid bellow = Liquid.getLiquidTypeByBlock(bBlock);
|
||||
DefautlLiquids bellow = DefautlLiquids.getLiquidTypeByBlock(bBlock);
|
||||
if (bellow != null)
|
||||
{
|
||||
if (this.type != bellow && bellow != Liquid.DEFUALT)
|
||||
if (this.type != bellow && bellow != DefautlLiquids.DEFUALT)
|
||||
{
|
||||
this.tank.setLiquid(Liquid.getStack(bellow, 0));
|
||||
this.tank.setLiquid(DefautlLiquids.getStack(bellow, 0));
|
||||
this.type = bellow;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
}
|
||||
if (this.tank.getLiquid() == null)
|
||||
{
|
||||
this.tank.setLiquid(Liquid.getStack(this.type, 1));
|
||||
this.tank.setLiquid(DefautlLiquids.getStack(this.type, 1));
|
||||
}
|
||||
LiquidStack stack = tank.getLiquid();
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
{
|
||||
int bBlock = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ());
|
||||
int meta = worldObj.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ());
|
||||
Liquid bellow = Liquid.getLiquidTypeByBlock(bBlock);
|
||||
DefautlLiquids bellow = DefautlLiquids.getLiquidTypeByBlock(bBlock);
|
||||
if (bBlock == Block.waterMoving.blockID || (bBlock == Block.waterStill.blockID && meta != 0))
|
||||
return false;
|
||||
if (bBlock == Block.lavaMoving.blockID || (bBlock == Block.lavaStill.blockID && meta != 0))
|
||||
|
@ -202,7 +202,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
{
|
||||
// FMLLog.info("pumping " + bellow.displayerName + " blockID:" + bBlock + " Meta:" +
|
||||
// meta);
|
||||
int f = this.tank.fill(Liquid.getStack(this.type, LiquidContainerRegistry.BUCKET_VOLUME), true);
|
||||
int f = this.tank.fill(DefautlLiquids.getStack(this.type, LiquidContainerRegistry.BUCKET_VOLUME), true);
|
||||
if (f > 0)
|
||||
worldObj.setBlockWithNotify(loc.intX(), loc.intY(), loc.intZ(), 0);
|
||||
percentPumped = 0;
|
||||
|
@ -216,7 +216,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
{
|
||||
try
|
||||
{
|
||||
this.type = (Liquid.getLiquid(data.readInt()));
|
||||
this.type = (DefautlLiquids.getLiquid(data.readInt()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -233,8 +233,8 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
int stored = par1NBTTagCompound.getInteger("liquid");
|
||||
this.type = Liquid.getLiquid(par1NBTTagCompound.getInteger("type"));
|
||||
this.tank.setLiquid(Liquid.getStack(this.type, stored));
|
||||
this.type = DefautlLiquids.getLiquid(par1NBTTagCompound.getInteger("type"));
|
||||
this.tank.setLiquid(DefautlLiquids.getStack(this.type, stored));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -306,7 +306,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(Liquid type, ForgeDirection dir)
|
||||
public int presureOutput(DefautlLiquids type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.type)
|
||||
return type.defaultPresure;
|
||||
|
@ -314,7 +314,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canPressureToo(Liquid type, ForgeDirection dir)
|
||||
public boolean canPressureToo(DefautlLiquids type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.type)
|
||||
return true;
|
||||
|
@ -327,7 +327,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
*/
|
||||
private boolean isValidLiquid(Block block)
|
||||
{
|
||||
return Liquid.getLiquidFromBlock(block.blockID) != null;
|
||||
return DefautlLiquids.getLiquidFromBlock(block.blockID) != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ package liquidmechanics.common.tileentity;
|
|||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.ITankOutputer;
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.api.helpers.MHelper;
|
||||
import liquidmechanics.api.helpers.TankHelper;
|
||||
import liquidmechanics.common.block.BlockReleaseValve;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -18,7 +18,7 @@ import universalelectricity.prefab.implement.IRedstoneReceptor;
|
|||
|
||||
public class TileEntityReleaseValve extends TileEntity implements ITankOutputer, IReadOut, IRedstoneReceptor
|
||||
{
|
||||
public Liquid type = Liquid.DEFUALT;
|
||||
public DefautlLiquids type = DefautlLiquids.DEFUALT;
|
||||
public LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME);
|
||||
public TileEntity[] connected = new TileEntity[6];
|
||||
private int count = 0;
|
||||
|
@ -28,13 +28,13 @@ public class TileEntityReleaseValve extends TileEntity implements ITankOutputer,
|
|||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
this.connected = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
this.connected = TankHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
if (!this.worldObj.isRemote && count++ == 10)
|
||||
{
|
||||
BlockReleaseValve.checkForPower(worldObj, xCoord, yCoord, zCoord);
|
||||
if (tank.getLiquid() == null)
|
||||
{
|
||||
tank.setLiquid(Liquid.getStack(this.type, 1));
|
||||
tank.setLiquid(DefautlLiquids.getStack(this.type, 1));
|
||||
}
|
||||
if (tank.getLiquid() != null && tank.getLiquid().amount < tank.getCapacity() && !isPowered)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ public class TileEntityReleaseValve extends TileEntity implements ITankOutputer,
|
|||
for (int t = 0; t < tanks.length; t++)
|
||||
{
|
||||
LiquidStack ll = tanks[t].getLiquid();
|
||||
if (ll != null && Liquid.isStackEqual(ll, this.type))
|
||||
if (ll != null && DefautlLiquids.isStackEqual(ll, this.type))
|
||||
{
|
||||
int drainVol = tank.getCapacity() - tank.getLiquid().amount - 1;
|
||||
LiquidStack drained = ((ITankContainer) connected[i]).drain(t, drainVol, true);
|
||||
|
@ -112,14 +112,14 @@ public class TileEntityReleaseValve extends TileEntity implements ITankOutputer,
|
|||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(Liquid type, ForgeDirection dir)
|
||||
public int presureOutput(DefautlLiquids type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.type) { return type.defaultPresure; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPressureToo(Liquid type, ForgeDirection dir)
|
||||
public boolean canPressureToo(DefautlLiquids type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.type)
|
||||
return true;
|
||||
|
@ -143,9 +143,9 @@ public class TileEntityReleaseValve extends TileEntity implements ITankOutputer,
|
|||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
this.type = Liquid.getLiquid(par1NBTTagCompound.getInteger("type"));
|
||||
this.type = DefautlLiquids.getLiquid(par1NBTTagCompound.getInteger("type"));
|
||||
int vol = par1NBTTagCompound.getInteger("liquid");
|
||||
this.tank.setLiquid(Liquid.getStack(type, vol));
|
||||
this.tank.setLiquid(DefautlLiquids.getStack(type, vol));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,7 +163,7 @@ public class TileEntityReleaseValve extends TileEntity implements ITankOutputer,
|
|||
par1NBTTagCompound.setInteger("type", this.type.ordinal());
|
||||
}
|
||||
|
||||
public void setType(Liquid dm)
|
||||
public void setType(DefautlLiquids dm)
|
||||
{
|
||||
this.type = dm;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ package liquidmechanics.common.tileentity;
|
|||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.ITankOutputer;
|
||||
import liquidmechanics.api.helpers.Liquid;
|
||||
import liquidmechanics.api.helpers.MHelper;
|
||||
import liquidmechanics.api.helpers.TankHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.DefautlLiquids;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
|
@ -26,7 +26,7 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
public class TileEntityTank extends TileEntity implements IPacketReceiver, IReadOut, ITankOutputer
|
||||
{
|
||||
public TileEntity[] cc = { null, null, null, null, null, null };
|
||||
public Liquid type = Liquid.DEFUALT;
|
||||
public DefautlLiquids type = DefautlLiquids.DEFUALT;
|
||||
public static final int LMax = 4;
|
||||
private int count = 0;
|
||||
private int count2 = 0;
|
||||
|
@ -38,14 +38,14 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
{
|
||||
if (tank.getLiquid() == null)
|
||||
{
|
||||
tank.setLiquid(Liquid.getStack(this.type, 1));
|
||||
tank.setLiquid(DefautlLiquids.getStack(this.type, 1));
|
||||
}
|
||||
LiquidStack liquid = tank.getLiquid();
|
||||
|
||||
if (++count >= 20 && liquid != null)
|
||||
{
|
||||
count = 0;
|
||||
this.cc = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
this.cc = TankHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
this.tradeDown();
|
||||
|
@ -75,9 +75,9 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
this.type = Liquid.getLiquid(par1NBTTagCompound.getInteger("type"));
|
||||
this.type = DefautlLiquids.getLiquid(par1NBTTagCompound.getInteger("type"));
|
||||
int vol = par1NBTTagCompound.getInteger("liquid");
|
||||
this.tank.setLiquid(Liquid.getStack(type, vol));
|
||||
this.tank.setLiquid(DefautlLiquids.getStack(type, vol));
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
|
@ -96,8 +96,8 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
{
|
||||
try
|
||||
{
|
||||
this.type = Liquid.getLiquid(data.readInt());
|
||||
this.tank.setLiquid(Liquid.getStack(this.type, data.readInt()));
|
||||
this.type = DefautlLiquids.getLiquid(data.readInt());
|
||||
this.tank.setLiquid(DefautlLiquids.getStack(this.type, data.readInt()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -110,13 +110,13 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
// ----------------------------
|
||||
// Liquid stuff
|
||||
// ----------------------------
|
||||
public void setType(Liquid dm)
|
||||
public void setType(DefautlLiquids dm)
|
||||
{
|
||||
this.type = dm;
|
||||
|
||||
}
|
||||
|
||||
public Liquid getType()
|
||||
public DefautlLiquids getType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
@Override
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (!Liquid.isStackEqual(resource, type))
|
||||
if (!DefautlLiquids.isStackEqual(resource, type))
|
||||
return 0;
|
||||
return this.fill(0, resource, doFill);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
if (this.isFull())
|
||||
{
|
||||
int change = 1;
|
||||
if (Liquid.getLiquid(resource).doesFlaot)
|
||||
if (DefautlLiquids.getLiquid(resource).doesFlaot)
|
||||
change = -1;
|
||||
TileEntity tank = worldObj.getBlockTileEntity(xCoord, yCoord + change, zCoord);
|
||||
if (tank instanceof TileEntityTank) { return ((TileEntityTank) tank).tank.fill(resource, doFill); }
|
||||
|
@ -203,7 +203,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
LiquidStack stack = this.tank.getLiquid();
|
||||
if(maxDrain <= this.tank.getLiquid().amount)
|
||||
{
|
||||
stack = Liquid.getStack(type, maxDrain);
|
||||
stack = DefautlLiquids.getStack(type, maxDrain);
|
||||
}
|
||||
if(doDrain)
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(Liquid type, ForgeDirection dir)
|
||||
public int presureOutput(DefautlLiquids type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.type)
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canPressureToo(Liquid type, ForgeDirection dir)
|
||||
public boolean canPressureToo(DefautlLiquids type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.type)
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
{
|
||||
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= 0)
|
||||
return;
|
||||
TileEntity[] ents = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
TileEntity[] ents = TankHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
int commonVol = this.tank.getLiquid().amount;
|
||||
int tanks = 1;
|
||||
for (int i = 2; i < 6; i++)
|
||||
|
@ -299,11 +299,11 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
|
|||
LiquidStack filling = this.tank.getLiquid();
|
||||
if (stack == null)
|
||||
{
|
||||
filling = Liquid.getStack(this.type, equalVol);
|
||||
filling = DefautlLiquids.getStack(this.type, equalVol);
|
||||
}
|
||||
else if (stack.amount < equalVol)
|
||||
{
|
||||
filling = Liquid.getStack(this.type, equalVol - stack.amount);
|
||||
filling = DefautlLiquids.getStack(this.type, equalVol - stack.amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue