reformated + fixed pipe dropping
turns out the damage drop method was deleted a few version back which told minecraft to drop this item in meta form.
|
@ -1,15 +0,0 @@
|
|||
package liquidmechanics.api;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
|
||||
public interface IColorCoded
|
||||
{
|
||||
/**
|
||||
* Returns the ColorCode of the object
|
||||
*/
|
||||
public ColorCode getColor();
|
||||
/**
|
||||
* Sets the ColorCode of the Object
|
||||
*/
|
||||
public void setColor(Object obj);
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package liquidmechanics.api;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IHeatCreator
|
||||
{
|
||||
/**
|
||||
* @param dir - direction
|
||||
* @return Can create heat in this direction
|
||||
*/
|
||||
public boolean canOutputHeat(ForgeDirection dir);
|
||||
|
||||
/**
|
||||
* @param dir - direction
|
||||
* @return ammount of heat created in joules
|
||||
*/
|
||||
public int outputHeat(ForgeDirection dir);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package liquidmechanics.api;
|
||||
|
||||
public interface IPipe extends IColorCoded
|
||||
{
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package liquidmechanics.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IReadOut
|
||||
{
|
||||
/**
|
||||
* Grabs the message displayed to the user on right click of the machine with the pipe gauge
|
||||
*
|
||||
* @param user
|
||||
* @param side - may not work correctly yet but should give you a side
|
||||
* @return - a string to be displayed to the player for a reading. automatically adds ReadOut:
|
||||
* to the beginning
|
||||
*/
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side);
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package liquidmechanics.api.helpers;
|
||||
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
|
||||
|
||||
public enum ColorCode
|
||||
{
|
||||
BLACK("Black"),
|
||||
RED("Red"),
|
||||
GREEN("Green"),
|
||||
BROWN("Brown"),
|
||||
BLUE("Blue"),
|
||||
PURPLE("Purple"),
|
||||
CYAN("Cyan"),
|
||||
SILVER("Silver"),
|
||||
GREY("Grey"),
|
||||
PINK("Pink"),
|
||||
LIME("Lime"),
|
||||
YELLOW("Yellow"),
|
||||
LIGHTBLUE("LightBlue"),
|
||||
WHITE("White"),
|
||||
ORANGE("Orange"),
|
||||
NONE("");
|
||||
|
||||
String name;
|
||||
|
||||
private ColorCode(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** gets a ColorCode from any of the following
|
||||
*
|
||||
* @param obj
|
||||
* - Integer,String,LiquidData,ColorCode
|
||||
* @return Color NONE if it can't find it */
|
||||
public static ColorCode get(Object obj)
|
||||
{
|
||||
if (obj instanceof Integer && ((Integer) obj) < ColorCode.values().length)
|
||||
{
|
||||
return ColorCode.values()[((Integer) obj)];
|
||||
} else if (obj instanceof LiquidData)
|
||||
{
|
||||
return ((LiquidData) obj).getColor();
|
||||
} else if (obj instanceof ColorCode)
|
||||
{
|
||||
return (ColorCode) obj;
|
||||
} else if (obj instanceof String)
|
||||
{
|
||||
for (int i = 0; i < ColorCode.values().length; i++)
|
||||
{
|
||||
if (((String) obj).equalsIgnoreCase(ColorCode.get(i).getName())) { return ColorCode.get(i); }
|
||||
}
|
||||
}
|
||||
return NONE;
|
||||
}
|
||||
|
||||
/** gets the liquidData linked with this color. in rare cases there could be
|
||||
* more than one, but first instance will be returned */
|
||||
public LiquidData getLiquidData()
|
||||
{
|
||||
for (LiquidData data : LiquidHandler.allowedLiquids)
|
||||
{
|
||||
if (data.getColor() == this) { return data; }
|
||||
}
|
||||
return LiquidHandler.unkown;
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package liquidmechanics.api.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class connectionHelper
|
||||
{
|
||||
/** Used to find all tileEntities sounding the location you will have to
|
||||
* filter for selective tileEntities
|
||||
*
|
||||
* @param world
|
||||
* - the world being searched threw
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return an array of up to 6 tileEntities */
|
||||
public static TileEntity[] getSurroundingTileEntities(TileEntity ent)
|
||||
{
|
||||
return getSurroundingTileEntities(ent.worldObj, ent.xCoord, ent.yCoord, ent.zCoord);
|
||||
|
||||
}
|
||||
|
||||
public static TileEntity[] getSurroundingTileEntities(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity[] list = new TileEntity[] { null, null, null, null, null, null };
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection d = ForgeDirection.getOrientation(i);
|
||||
TileEntity aEntity = world.getBlockTileEntity(x + d.offsetX, y + d.offsetY, z + d.offsetZ);
|
||||
if (aEntity instanceof TileEntity)
|
||||
{
|
||||
list[i] = aEntity;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public static int[] getSurroundingBlocks(TileEntity ent)
|
||||
{
|
||||
return getSurroundingBlocks(ent.worldObj, ent.xCoord, ent.yCoord, ent.zCoord);
|
||||
}
|
||||
public static int[] getSurroundingBlocks(World world, int x, int y, int z)
|
||||
{
|
||||
int[] list = new int[6];
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection d = ForgeDirection.getOrientation(i);
|
||||
int id = world.getBlockId(x + d.offsetX, y + d.offsetY, z + d.offsetZ);
|
||||
list[i] = id;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/** Used to find which of 4 Corners this block is in a group of blocks 0 =
|
||||
* not a corner 1-4 = a corner of some direction */
|
||||
public static int corner(TileEntity entity)
|
||||
{
|
||||
TileEntity[] en = getSurroundingTileEntities(entity.worldObj, entity.xCoord, entity.yCoord, entity.zCoord);
|
||||
if (en[4] != null && en[2] != null && en[5] == null && en[3] == null) { return 3; }
|
||||
if (en[2] != null && en[5] != null && en[3] == null && en[4] == null) { return 4; }
|
||||
if (en[5] != null && en[3] != null && en[4] == null && en[2] == null) { return 1; }
|
||||
if (en[3] != null && en[4] != null && en[2] == null && en[5] == null) { return 2; }
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package liquidmechanics.api.liquids;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IPressure
|
||||
{
|
||||
/**
|
||||
* @param type - Liquid type
|
||||
* @param dir - direction pressure is being request to output
|
||||
* @return pressure if can output for the type or direction
|
||||
*/
|
||||
public int presureOutput(LiquidData type, ForgeDirection dir);
|
||||
|
||||
/**
|
||||
* Quick way to check if the TE will output pressure
|
||||
*
|
||||
* @param type - Liquid type
|
||||
* @param dir - direction
|
||||
* @return
|
||||
*/
|
||||
public boolean canPressureToo(LiquidData type, ForgeDirection dir);
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package liquidmechanics.api.liquids;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
public class LiquidData
|
||||
{
|
||||
private boolean isAGas;
|
||||
private int defaultPressure;
|
||||
private LiquidStack sampleStack;
|
||||
private String name;
|
||||
private ColorCode color;
|
||||
|
||||
public LiquidData(String name, LiquidStack stack,ColorCode color, boolean gas, int dPressure)
|
||||
{
|
||||
this.sampleStack = stack;
|
||||
this.isAGas = gas;
|
||||
this.defaultPressure = dPressure;
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
if (name != null || !name.equalsIgnoreCase("")) { return name; }
|
||||
return "unknown";
|
||||
}
|
||||
public int getPressure()
|
||||
{
|
||||
return defaultPressure;
|
||||
}
|
||||
public LiquidStack getStack()
|
||||
{
|
||||
if (sampleStack != null) { return sampleStack; }
|
||||
return new LiquidStack(0,1);
|
||||
}
|
||||
public boolean getCanFloat()
|
||||
{
|
||||
return isAGas;
|
||||
}
|
||||
public ColorCode getColor()
|
||||
{
|
||||
if (color != null) { return color; }
|
||||
return ColorCode.NONE;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,244 +0,0 @@
|
|||
package liquidmechanics.api.liquids;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowing;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.liquids.ILiquid;
|
||||
|
||||
|
||||
public class LiquidFiniteFlowing extends BlockFlowing implements ILiquid {
|
||||
|
||||
int numAdjacentSources = 0;
|
||||
int[] flowCost = new int[4];
|
||||
boolean[] isOptimalFlowDirection = new boolean[4];
|
||||
|
||||
public LiquidFiniteFlowing(int blockId)
|
||||
{
|
||||
super(blockId, Material.water);
|
||||
this.disableStats();
|
||||
this.setHardness(100);
|
||||
this.setTextureFile("");
|
||||
}
|
||||
|
||||
private void updateFlow(World world, int i, int j, int k) {
|
||||
world.markBlockRangeForRenderUpdate(i, j, k, i, j, k);
|
||||
world.markBlockForUpdate(i, j, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int i, int j, int k, Random random) {
|
||||
int l = getFlowDecay(world, i, j, k);
|
||||
byte byte0 = 1;
|
||||
boolean flag = true;
|
||||
if (l > 0) {
|
||||
int i1 = -100;
|
||||
numAdjacentSources = 0;
|
||||
i1 = getSmallestFlowDecay(world, i - 1, j, k, i1);
|
||||
i1 = getSmallestFlowDecay(world, i + 1, j, k, i1);
|
||||
i1 = getSmallestFlowDecay(world, i, j, k - 1, i1);
|
||||
i1 = getSmallestFlowDecay(world, i, j, k + 1, i1);
|
||||
int j1 = i1 + byte0;
|
||||
if (j1 >= 8 || i1 < 0) {
|
||||
j1 = -1;
|
||||
}
|
||||
if (getFlowDecay(world, i, j + 1, k) >= 0) {
|
||||
int l1 = getFlowDecay(world, i, j + 1, k);
|
||||
if (l1 >= 8) {
|
||||
j1 = l1;
|
||||
} else {
|
||||
j1 = l1 + 8;
|
||||
}
|
||||
}
|
||||
if (j1 != l) {
|
||||
l = j1;
|
||||
if (l < 0) {
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
} else {
|
||||
world.setBlockMetadataWithNotify(i, j, k, l);
|
||||
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
|
||||
world.notifyBlocksOfNeighborChange(i, j, k, blockID);
|
||||
}
|
||||
} else if (flag) {
|
||||
updateFlow(world, i, j, k);
|
||||
}
|
||||
} else {
|
||||
updateFlow(world, i, j, k);
|
||||
}
|
||||
if (liquidCanDisplaceBlock(world, i, j - 1, k)) {
|
||||
if (l >= 8) {
|
||||
world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l);
|
||||
} else {
|
||||
world.setBlockAndMetadataWithNotify(i, j - 1, k, blockID, l + 8);
|
||||
}
|
||||
} else if (l >= 0 && (l == 0 || blockBlocksFlow(world, i, j - 1, k))) {
|
||||
boolean aflag[] = getOptimalFlowDirections(world, i, j, k);
|
||||
int k1 = l + byte0;
|
||||
if (l >= 8) {
|
||||
k1 = 1;
|
||||
}
|
||||
if (k1 >= 8)
|
||||
return;
|
||||
if (aflag[0]) {
|
||||
flowIntoBlock(world, i - 1, j, k, k1);
|
||||
}
|
||||
if (aflag[1]) {
|
||||
flowIntoBlock(world, i + 1, j, k, k1);
|
||||
}
|
||||
if (aflag[2]) {
|
||||
flowIntoBlock(world, i, j, k - 1, k1);
|
||||
}
|
||||
if (aflag[3]) {
|
||||
flowIntoBlock(world, i, j, k + 1, k1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void flowIntoBlock(World world, int i, int j, int k, int l) {
|
||||
if (liquidCanDisplaceBlock(world, i, j, k)) {
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
if (i1 > 0) {
|
||||
Block.blocksList[i1].dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
|
||||
}
|
||||
world.setBlockAndMetadataWithNotify(i, j, k, blockID, l);
|
||||
}
|
||||
}
|
||||
|
||||
private int calculateFlowCost(World world, int i, int j, int k, int l, int i1) {
|
||||
int j1 = 1000;
|
||||
for (int k1 = 0; k1 < 4; k1++) {
|
||||
if (k1 == 0 && i1 == 1 || k1 == 1 && i1 == 0 || k1 == 2 && i1 == 3 || k1 == 3 && i1 == 2) {
|
||||
continue;
|
||||
}
|
||||
int l1 = i;
|
||||
int i2 = j;
|
||||
int j2 = k;
|
||||
if (k1 == 0) {
|
||||
l1--;
|
||||
}
|
||||
if (k1 == 1) {
|
||||
l1++;
|
||||
}
|
||||
if (k1 == 2) {
|
||||
j2--;
|
||||
}
|
||||
if (k1 == 3) {
|
||||
j2++;
|
||||
}
|
||||
if (blockBlocksFlow(world, l1, i2, j2) || world.getBlockMaterial(l1, i2, j2) == blockMaterial && world.getBlockMetadata(l1, i2, j2) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (!blockBlocksFlow(world, l1, i2 - 1, j2))
|
||||
return l;
|
||||
if (l >= 4) {
|
||||
continue;
|
||||
}
|
||||
int k2 = calculateFlowCost(world, l1, i2, j2, l + 1, k1);
|
||||
if (k2 < j1) {
|
||||
j1 = k2;
|
||||
}
|
||||
}
|
||||
|
||||
return j1;
|
||||
}
|
||||
|
||||
private boolean[] getOptimalFlowDirections(World world, int i, int j, int k) {
|
||||
for (int l = 0; l < 4; l++) {
|
||||
flowCost[l] = 1000;
|
||||
int j1 = i;
|
||||
int i2 = j;
|
||||
int j2 = k;
|
||||
if (l == 0) {
|
||||
j1--;
|
||||
}
|
||||
if (l == 1) {
|
||||
j1++;
|
||||
}
|
||||
if (l == 2) {
|
||||
j2--;
|
||||
}
|
||||
if (l == 3) {
|
||||
j2++;
|
||||
}
|
||||
if (blockBlocksFlow(world, j1, i2, j2) || world.getBlockMaterial(j1, i2, j2) == blockMaterial && world.getBlockMetadata(j1, i2, j2) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (!blockBlocksFlow(world, j1, i2 - 1, j2)) {
|
||||
flowCost[l] = 0;
|
||||
} else {
|
||||
flowCost[l] = calculateFlowCost(world, j1, i2, j2, 1, l);
|
||||
}
|
||||
}
|
||||
|
||||
int i1 = flowCost[0];
|
||||
for (int k1 = 1; k1 < 4; k1++) {
|
||||
if (flowCost[k1] < i1) {
|
||||
i1 = flowCost[k1];
|
||||
}
|
||||
}
|
||||
|
||||
for (int l1 = 0; l1 < 4; l1++) {
|
||||
isOptimalFlowDirection[l1] = flowCost[l1] == i1;
|
||||
}
|
||||
|
||||
return isOptimalFlowDirection;
|
||||
}
|
||||
|
||||
private boolean blockBlocksFlow(World world, int i, int j, int k) {
|
||||
int l = world.getBlockId(i, j, k);
|
||||
if (l == Block.doorWood.blockID || l == Block.doorSteel.blockID || l == Block.signPost.blockID || l == Block.ladder.blockID || l == Block.reed.blockID)
|
||||
return true;
|
||||
if (l == 0)
|
||||
return false;
|
||||
Material material = Block.blocksList[l].blockMaterial;
|
||||
return material.isSolid();
|
||||
}
|
||||
|
||||
protected int getSmallestFlowDecay(World world, int i, int j, int k, int l) {
|
||||
int i1 = getFlowDecay(world, i, j, k);
|
||||
if (i1 < 0)
|
||||
return l;
|
||||
if (i1 >= 8) {
|
||||
i1 = 0;
|
||||
}
|
||||
return l >= 0 && i1 >= l ? l : i1;
|
||||
}
|
||||
|
||||
private boolean liquidCanDisplaceBlock(World world, int i, int j, int k) {
|
||||
Material material = world.getBlockMaterial(i, j, k);
|
||||
if (material == blockMaterial)
|
||||
return false;
|
||||
else
|
||||
return !blockBlocksFlow(world, i, j, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int i, int j, int k) {
|
||||
super.onBlockAdded(world, i, j, k);
|
||||
if (world.getBlockId(i, j, k) == blockID) {
|
||||
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stillLiquidId() {
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMetaSensitive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stillLiquidMeta() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockReplaceable(World world, int i, int j, int k) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package liquidmechanics.api.liquids;
|
||||
|
||||
import net.minecraft.block.BlockStationary;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.liquids.ILiquid;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class LiquidFiniteStill extends BlockStationary implements ILiquid
|
||||
{
|
||||
|
||||
public LiquidFiniteStill(int blockId)
|
||||
{
|
||||
super(blockId, Material.water);
|
||||
this.setHardness(100);
|
||||
this.disableStats();
|
||||
this.setTextureFile("");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockColor()
|
||||
{
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stillLiquidId()
|
||||
{
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMetaSensitive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stillLiquidMeta()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockReplaceable(World world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,205 +0,0 @@
|
|||
package liquidmechanics.api.liquids;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.liquids.LiquidDictionary;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
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 unkown;
|
||||
public static LiquidData waste;
|
||||
public static LiquidData milk;
|
||||
|
||||
public static Logger FMLog = Logger.getLogger("LiquidHandler");
|
||||
|
||||
/**
|
||||
* Called to add the default liquids to the allowed list
|
||||
*/
|
||||
public static void addDefaultLiquids()
|
||||
{
|
||||
FMLog.setParent(FMLLog.getLogger());
|
||||
water = new LiquidData("water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), ColorCode.BLUE, false, 60);
|
||||
allowedLiquids.add(water);
|
||||
|
||||
lava = new LiquidData("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), ColorCode.RED, false, 40);
|
||||
allowedLiquids.add(lava);
|
||||
|
||||
unkown = new LiquidData("Unknown", LiquidDictionary.getOrCreateLiquid("Unknown", new LiquidStack(20, 1)), ColorCode.NONE, false, 32);
|
||||
allowedLiquids.add(unkown);
|
||||
|
||||
FMLog.setParent(FMLLog.getLogger());
|
||||
for (LiquidData data : allowedLiquids)
|
||||
{
|
||||
FMLog.info(data.getName() + " registered as a liquid");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void liquidRegisterEvent(LiquidDictionary.LiquidRegisterEvent event)
|
||||
{
|
||||
if (event.Name.equalsIgnoreCase("methane"))
|
||||
{
|
||||
allowedLiquids.add(new LiquidData("methane", event.Liquid, ColorCode.LIME, true, 100));
|
||||
}
|
||||
else if (event.Name.equalsIgnoreCase("oil"))
|
||||
{
|
||||
allowedLiquids.add(new LiquidData("oil", event.Liquid, ColorCode.BLACK, true, 50));
|
||||
}
|
||||
else if (event.Name.equalsIgnoreCase("fuel"))
|
||||
{
|
||||
allowedLiquids.add(new LiquidData("fuel", event.Liquid, ColorCode.YELLOW, true, 50));
|
||||
}
|
||||
else if (event.Name.equalsIgnoreCase("steam"))
|
||||
{
|
||||
steam = new LiquidData("steam", event.Liquid, ColorCode.ORANGE, true, 100);
|
||||
allowedLiquids.add(steam);
|
||||
}
|
||||
else if (event.Name.equalsIgnoreCase("Waste"))
|
||||
{
|
||||
waste = new LiquidData("Waste", event.Liquid, ColorCode.BROWN, false, 40);
|
||||
allowedLiquids.add(waste);
|
||||
}
|
||||
else if (event.Name.equalsIgnoreCase("Milk"))
|
||||
{
|
||||
milk = new LiquidData("Milk", event.Liquid, ColorCode.WHITE, false, 50);
|
||||
allowedLiquids.add(milk);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the LiquidData linked to the liquid by name
|
||||
*
|
||||
* @param name
|
||||
* - String name, not case sensitive
|
||||
*/
|
||||
public static LiquidData get(String name)
|
||||
{
|
||||
for (LiquidData data : LiquidHandler.allowedLiquids)
|
||||
{
|
||||
if (data.getName().equalsIgnoreCase(name)) { return data; }
|
||||
}
|
||||
return unkown;
|
||||
}
|
||||
|
||||
public static LiquidData get(LiquidStack stack)
|
||||
{
|
||||
for (LiquidData data : LiquidHandler.allowedLiquids)
|
||||
{
|
||||
if (isEqual(stack, data)) { return data; }
|
||||
}
|
||||
return unkown;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the name of the liquidStack using either LiquidData or running threw
|
||||
* the LiquidDirectory mapping
|
||||
*/
|
||||
public static String getName(LiquidStack stack)
|
||||
{
|
||||
if (get(stack) != unkown)
|
||||
{
|
||||
return get(stack).getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
Map<String, LiquidStack> l = LiquidDictionary.getLiquids();
|
||||
for (Entry<String, LiquidStack> liquid : l.entrySet())
|
||||
{
|
||||
LiquidStack t = liquid.getValue();
|
||||
if (isEqual(t, stack)) { return liquid.getKey(); }
|
||||
}
|
||||
}
|
||||
return "unkown";
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a new LiquidStack using type and vol
|
||||
*/
|
||||
public static LiquidStack getStack(LiquidData type, int vol)
|
||||
{
|
||||
if (type == null) return null;
|
||||
return new LiquidStack(type.getStack().itemID, vol, type.getStack().itemMeta);
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a new LiquidStack using a liquidStack and vol
|
||||
*/
|
||||
public static LiquidStack getStack(LiquidStack stack, int vol)
|
||||
{
|
||||
if (stack == null) { return null; }
|
||||
return new LiquidStack(stack.itemID, vol, stack.itemMeta);
|
||||
}
|
||||
|
||||
public static int getMeta(LiquidData stack)
|
||||
{
|
||||
if (stack != null && stack != unkown) { return stack.getColor().ordinal(); }
|
||||
return 15;
|
||||
}
|
||||
|
||||
public static LiquidData getFromMeta(int meta)
|
||||
{
|
||||
return ColorCode.get(meta).getLiquidData();
|
||||
}
|
||||
|
||||
public static LiquidData getFromBlockID(int id)
|
||||
{
|
||||
for (LiquidData data : allowedLiquids)
|
||||
{
|
||||
if (data.getStack().itemID == id) { return data; }
|
||||
}
|
||||
return unkown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares a liquidStack to a sample stack stored in the LiquidData
|
||||
*/
|
||||
public static boolean isEqual(LiquidStack stack, LiquidData type)
|
||||
{
|
||||
if (stack == null || type == null) { return false; }
|
||||
if (type.getStack().itemID == stack.itemID && type.getStack().itemMeta == stack.itemMeta) { return true; }
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Compares one liquidStack to another LiquidStack
|
||||
*/
|
||||
public static boolean isEqual(LiquidStack stack, LiquidStack stack2)
|
||||
{
|
||||
if (stack == null || stack2 == null)
|
||||
return false;
|
||||
if (stack2.itemID == stack.itemID && stack2.itemMeta == stack.itemMeta) { return true; }
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Consumes one item of a the ItemStack
|
||||
*/
|
||||
public static ItemStack consumeItem(ItemStack stack)
|
||||
{
|
||||
if (stack.stackSize == 1)
|
||||
{
|
||||
if (stack.getItem().hasContainerItem()) return stack.getItem().getContainerItemStack(stack);
|
||||
else return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
stack.splitStack(1);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package liquidmechanics.api.mech;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
// mechanical
|
||||
public interface IForce
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param side the rpm is coming from
|
||||
* @return rpm that the block is running at
|
||||
*/
|
||||
public int getForceSide(ForgeDirection side);
|
||||
|
||||
public int getForce();
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public boolean canInputSide(ForgeDirection side);
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @return int between 0 -7
|
||||
*/
|
||||
public int getAnimationPos();
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package liquidmechanics.client;
|
||||
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.client.render.ItemRenderHelper;
|
||||
import liquidmechanics.client.render.RenderGearRod;
|
||||
import liquidmechanics.client.render.RenderGenerator;
|
||||
import liquidmechanics.client.render.RenderPipe;
|
||||
import liquidmechanics.client.render.RenderPump;
|
||||
import liquidmechanics.client.render.RenderReleaseValve;
|
||||
import liquidmechanics.client.render.RenderSink;
|
||||
import liquidmechanics.client.render.RenderTank;
|
||||
import liquidmechanics.common.CommonProxy;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityGenerator;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
import liquidmechanics.common.tileentity.TileEntityReleaseValve;
|
||||
import liquidmechanics.common.tileentity.TileEntityRod;
|
||||
import liquidmechanics.common.tileentity.TileEntitySink;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
@Override
|
||||
public void preInit()
|
||||
{
|
||||
MinecraftForgeClient.preloadTexture(LiquidMechanics.BLOCK_TEXTURE_FILE);
|
||||
MinecraftForgeClient.preloadTexture(LiquidMechanics.ITEM_TEXTURE_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Init()
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPipe.class, new RenderPipe());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPump.class, new RenderPump());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRod.class, new RenderGearRod());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGenerator.class, new RenderGenerator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityReleaseValve.class, new RenderReleaseValve());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySink.class, new RenderSink());
|
||||
MinecraftForgeClient.registerItemRenderer(LiquidMechanics.blockPipe.blockID, new ItemRenderHelper());
|
||||
MinecraftForgeClient.registerItemRenderer(LiquidMechanics.blockReleaseValve.blockID, new ItemRenderHelper());
|
||||
RenderingRegistry.registerBlockHandler(new BlockRenderHelper());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
package liquidmechanics.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ContainerRepair;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiReleaseValve extends GuiContainer
|
||||
{
|
||||
private ContainerRepair field_82327_o;
|
||||
private InventoryPlayer field_82325_q;
|
||||
|
||||
public GuiReleaseValve(InventoryPlayer par1, World par2World, int par3, int par4, int par5)
|
||||
{
|
||||
super(new ContainerRepair(par1, par2World, par3, par4, par5, Minecraft.getMinecraft().thePlayer));
|
||||
this.field_82325_q = par1;
|
||||
this.field_82327_o = (ContainerRepair)this.inventorySlots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the buttons (and other controls) to the screen in question.
|
||||
*/
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
int width = (this.width - this.xSize) / 2;
|
||||
int height = (this.height - this.ySize) / 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the screen is unloaded. Used to disable keyboard repeat events
|
||||
*/
|
||||
public void onGuiClosed()
|
||||
{
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.fontRenderer.drawString("Release Valve", 60, 6, 4210752);
|
||||
|
||||
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
|
||||
*/
|
||||
protected void keyTyped(char par1, int par2)
|
||||
{
|
||||
super.keyTyped(par1, par2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
protected void mouseClicked(int par1, int par2, int par3)
|
||||
{
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
public void drawScreen(int par1, int par2, float par3)
|
||||
{
|
||||
super.drawScreen(par1, par2, par3);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the items)
|
||||
*/
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
int tID = this.mc.renderEngine.getTexture("/gui/repair.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(tID);
|
||||
int width = (this.width - this.xSize) / 2;
|
||||
int height = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(width, height, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
// Date: 9/25/2012 4:29:17 PM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package liquidmechanics.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelGearRod extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Rod;
|
||||
ModelRenderer front;
|
||||
ModelRenderer back;
|
||||
ModelRenderer f2;
|
||||
ModelRenderer b2;
|
||||
ModelRenderer b3;
|
||||
ModelRenderer b4;
|
||||
ModelRenderer b1;
|
||||
ModelRenderer f1;
|
||||
ModelRenderer f4;
|
||||
ModelRenderer f3;
|
||||
ModelRenderer Rod2;
|
||||
|
||||
public ModelGearRod()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
Rod = new ModelRenderer(this, 0, 0);
|
||||
Rod.addBox(-1.5F, -1.5F, 0F, 3, 3, 12);
|
||||
Rod.setRotationPoint(0F, 16F, -6F);
|
||||
Rod.setTextureSize(64, 32);
|
||||
Rod.mirror = true;
|
||||
setRotation(Rod, 0F, 0F, 0F);
|
||||
front = new ModelRenderer(this, 35, 0);
|
||||
front.addBox(-2F, -2F, -2F, 4, 4, 2);
|
||||
front.setRotationPoint(0F, 16F, -6F);
|
||||
front.setTextureSize(64, 32);
|
||||
front.mirror = true;
|
||||
setRotation(front, 0F, 0F, 0F);
|
||||
back = new ModelRenderer(this, 35, 0);
|
||||
back.addBox(-2F, -2F, 0F, 4, 4, 2);
|
||||
back.setRotationPoint(0F, 16F, 6F);
|
||||
back.setTextureSize(64, 32);
|
||||
back.mirror = true;
|
||||
setRotation(back, 0F, 0F, 0.7853982F);
|
||||
f2 = new ModelRenderer(this, 0, 17);
|
||||
f2.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
f2.setRotationPoint(1F, 17F, -10F);
|
||||
f2.setTextureSize(64, 32);
|
||||
f2.mirror = true;
|
||||
setRotation(f2, 0F, 0F, 0F);
|
||||
b2 = new ModelRenderer(this, 0, 17);
|
||||
b2.addBox(-0.5F, -0.5F, 0F, 1, 1, 2);
|
||||
b2.setRotationPoint(0F, 18F, 8F);
|
||||
b2.setTextureSize(64, 32);
|
||||
b2.mirror = true;
|
||||
setRotation(b2, 0F, 0F, 0.7853982F);
|
||||
b3 = new ModelRenderer(this, 0, 17);
|
||||
b3.addBox(-0.5F, -0.5F, 0F, 1, 1, 2);
|
||||
b3.setRotationPoint(-2F, 16F, 8F);
|
||||
b3.setTextureSize(64, 32);
|
||||
b3.mirror = true;
|
||||
setRotation(b3, 0F, 0F, 0.7853982F);
|
||||
b4 = new ModelRenderer(this, 0, 17);
|
||||
b4.addBox(-0.5F, -0.5F, 0F, 1, 1, 2);
|
||||
b4.setRotationPoint(2F, 16F, 8F);
|
||||
b4.setTextureSize(64, 32);
|
||||
b4.mirror = true;
|
||||
setRotation(b4, 0F, 0F, 0.7853982F);
|
||||
b1 = new ModelRenderer(this, 0, 17);
|
||||
b1.addBox(-0.5F, -0.5F, 0F, 1, 1, 2);
|
||||
b1.setRotationPoint(0F, 14F, 8F);
|
||||
b1.setTextureSize(64, 32);
|
||||
b1.mirror = true;
|
||||
setRotation(b1, 0F, 0F, 0.7853982F);
|
||||
f1 = new ModelRenderer(this, 0, 17);
|
||||
f1.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
f1.setRotationPoint(1F, 14F, -10F);
|
||||
f1.setTextureSize(64, 32);
|
||||
f1.mirror = true;
|
||||
setRotation(f1, 0F, 0F, 0F);
|
||||
f4 = new ModelRenderer(this, 0, 17);
|
||||
f4.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
f4.setRotationPoint(-2F, 17F, -10F);
|
||||
f4.setTextureSize(64, 32);
|
||||
f4.mirror = true;
|
||||
setRotation(f4, 0F, 0F, 0F);
|
||||
f3 = new ModelRenderer(this, 0, 17);
|
||||
f3.addBox(0F, 0F, 0F, 1, 1, 2);
|
||||
f3.setRotationPoint(-2F, 14F, -10F);
|
||||
f3.setTextureSize(64, 32);
|
||||
f3.mirror = true;
|
||||
setRotation(f3, 0F, 0F, 0F);
|
||||
Rod2 = new ModelRenderer(this, 0, 0);
|
||||
Rod2.addBox(-1.5F, -1.5F, 0F, 3, 3, 12);
|
||||
Rod2.setRotationPoint(0F, 16F, -6F);
|
||||
Rod2.setTextureSize(64, 32);
|
||||
Rod2.mirror = true;
|
||||
setRotation(Rod2, 0F, 0F, 0.7853982F);
|
||||
}
|
||||
|
||||
public void render(float f5, int r)
|
||||
{
|
||||
|
||||
Rod.rotateAngleZ = 45 * r;
|
||||
Rod2.rotateAngleZ = Rod.rotateAngleZ + 45;
|
||||
|
||||
Rod.render(f5);
|
||||
Rod2.render(f5);
|
||||
// TODO add rotation to rods
|
||||
front.render(f5);
|
||||
back.render(f5);
|
||||
f2.render(f5);
|
||||
b2.render(f5);
|
||||
b3.render(f5);
|
||||
b4.render(f5);
|
||||
b1.render(f5);
|
||||
f1.render(f5);
|
||||
f4.render(f5);
|
||||
f3.render(f5);
|
||||
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,193 +0,0 @@
|
|||
// Date: 12/23/2012 8:44:55 PM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package liquidmechanics.client.model;
|
||||
|
||||
import liquidmechanics.common.tileentity.TileEntityGenerator;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class ModelGenerator extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Bottom;
|
||||
ModelRenderer Left;
|
||||
ModelRenderer CenterRod;
|
||||
ModelRenderer Right;
|
||||
ModelRenderer RightTopCorner;
|
||||
ModelRenderer LeftTopCorner;
|
||||
ModelRenderer LeftBottomCorner;
|
||||
ModelRenderer RightBottomCorner;
|
||||
ModelRenderer BottomCase;
|
||||
ModelRenderer TopCase;
|
||||
ModelRenderer LeftBrace;
|
||||
ModelRenderer RightBrace;
|
||||
ModelRenderer BackBracer;
|
||||
ModelRenderer FrontBracer;
|
||||
ModelRenderer FrontDisc;
|
||||
ModelRenderer FrontDisc2;
|
||||
ModelRenderer BackDisc;
|
||||
ModelRenderer BackDisc2;
|
||||
|
||||
public ModelGenerator()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
Bottom = new ModelRenderer(this, 0, 74);
|
||||
Bottom.addBox(-7F, -1F, -7F, 14, 2, 14);
|
||||
Bottom.setRotationPoint(0F, 23F, 0F);
|
||||
Bottom.setTextureSize(128, 128);
|
||||
Bottom.mirror = true;
|
||||
setRotation(Bottom, 0F, 0F, 0F);
|
||||
Left = new ModelRenderer(this, 17, 49);
|
||||
Left.addBox(-1F, -4F, -3F, 2, 8, 6);
|
||||
Left.setRotationPoint(7F, 15F, 0F);
|
||||
Left.setTextureSize(128, 128);
|
||||
Left.mirror = true;
|
||||
setRotation(Left, 0F, 0F, 0F);
|
||||
CenterRod = new ModelRenderer(this, 62, 0);
|
||||
CenterRod.addBox(-1.5F, -1.5F, -8F, 3, 3, 16);
|
||||
CenterRod.setRotationPoint(0F, 15F, 0F);
|
||||
CenterRod.setTextureSize(128, 128);
|
||||
CenterRod.mirror = true;
|
||||
setRotation(CenterRod, 0F, 0F, 0F);
|
||||
Right = new ModelRenderer(this, 0, 49);
|
||||
Right.addBox(-1F, -4F, -3F, 2, 8, 6);
|
||||
Right.setRotationPoint(-7F, 15F, 0F);
|
||||
Right.setTextureSize(128, 128);
|
||||
Right.mirror = true;
|
||||
setRotation(Right, 0F, 0F, 0F);
|
||||
RightTopCorner = new ModelRenderer(this, 0, 35);
|
||||
RightTopCorner.addBox(-2F, -6F, -3F, 2, 6, 6);
|
||||
RightTopCorner.setRotationPoint(-7F, 13F, 0F);
|
||||
RightTopCorner.setTextureSize(128, 128);
|
||||
RightTopCorner.mirror = true;
|
||||
setRotation(RightTopCorner, 0F, 0F, 1.047198F);
|
||||
LeftTopCorner = new ModelRenderer(this, 17, 35);
|
||||
LeftTopCorner.addBox(0F, -6F, -3F, 2, 6, 6);
|
||||
LeftTopCorner.setRotationPoint(7F, 13F, 0F);
|
||||
LeftTopCorner.setTextureSize(128, 128);
|
||||
LeftTopCorner.mirror = true;
|
||||
setRotation(LeftTopCorner, 0F, 0F, -1.047198F);
|
||||
LeftBottomCorner = new ModelRenderer(this, 17, 91);
|
||||
LeftBottomCorner.addBox(0F, 0F, -3F, 2, 6, 6);
|
||||
LeftBottomCorner.setRotationPoint(7F, 17F, 0F);
|
||||
LeftBottomCorner.setTextureSize(128, 128);
|
||||
LeftBottomCorner.mirror = true;
|
||||
setRotation(LeftBottomCorner, 0F, 0F, 1.047198F);
|
||||
RightBottomCorner = new ModelRenderer(this, 0, 91);
|
||||
RightBottomCorner.addBox(-2F, 0F, -3F, 2, 6, 6);
|
||||
RightBottomCorner.setRotationPoint(-7F, 17F, 0F);
|
||||
RightBottomCorner.setTextureSize(128, 128);
|
||||
RightBottomCorner.mirror = true;
|
||||
setRotation(RightBottomCorner, 0F, 0F, -1.047198F);
|
||||
BottomCase = new ModelRenderer(this, 3, 64);
|
||||
BottomCase.addBox(0F, 0F, -3F, 6, 2, 6);
|
||||
BottomCase.setRotationPoint(-3F, 20F, 0F);
|
||||
BottomCase.setTextureSize(128, 128);
|
||||
BottomCase.mirror = true;
|
||||
setRotation(BottomCase, 0F, 0F, 0F);
|
||||
TopCase = new ModelRenderer(this, 3, 26);
|
||||
TopCase.addBox(0F, 0F, -3F, 6, 2, 6);
|
||||
TopCase.setRotationPoint(-3F, 8F, 0F);
|
||||
TopCase.setTextureSize(128, 128);
|
||||
TopCase.mirror = true;
|
||||
setRotation(TopCase, 0F, 0F, 0F);
|
||||
LeftBrace = new ModelRenderer(this, 44, 64);
|
||||
LeftBrace.addBox(0F, 0F, -1.5F, 3, 6, 3);
|
||||
LeftBrace.setRotationPoint(3F, 17F, 0F);
|
||||
LeftBrace.setTextureSize(128, 128);
|
||||
LeftBrace.mirror = true;
|
||||
setRotation(LeftBrace, 0F, 0F, 0F);
|
||||
RightBrace = new ModelRenderer(this, 31, 64);
|
||||
RightBrace.addBox(0F, 0F, -1.5F, 3, 6, 3);
|
||||
RightBrace.setRotationPoint(-6F, 17F, 0F);
|
||||
RightBrace.setTextureSize(128, 128);
|
||||
RightBrace.mirror = true;
|
||||
setRotation(RightBrace, 0F, 0F, 0F);
|
||||
BackBracer = new ModelRenderer(this, 50, 0);
|
||||
BackBracer.addBox(-2F, -3F, 5F, 4, 10, 1);
|
||||
BackBracer.setRotationPoint(0F, 15F, 0F);
|
||||
BackBracer.setTextureSize(128, 128);
|
||||
BackBracer.mirror = true;
|
||||
setRotation(BackBracer, 0F, 0F, 0F);
|
||||
FrontBracer = new ModelRenderer(this, 50, 0);
|
||||
FrontBracer.addBox(-2F, -3F, -6F, 4, 10, 1);
|
||||
FrontBracer.setRotationPoint(0F, 15F, 0F);
|
||||
FrontBracer.setTextureSize(128, 128);
|
||||
FrontBracer.mirror = true;
|
||||
setRotation(FrontBracer, 0F, 0F, 0F);
|
||||
FrontDisc = new ModelRenderer(this, 65, 25);
|
||||
FrontDisc.addBox(-5F, -5F, -5F, 10, 10, 2);
|
||||
FrontDisc.setRotationPoint(0F, 15F, 0F);
|
||||
FrontDisc.setTextureSize(128, 128);
|
||||
FrontDisc.mirror = true;
|
||||
setRotation(FrontDisc, 0F, 0F, 0.7853982F);
|
||||
FrontDisc2 = new ModelRenderer(this, 65, 25);
|
||||
FrontDisc2.addBox(-5F, -5F, -5F, 10, 10, 2);
|
||||
FrontDisc2.setRotationPoint(0F, 15F, 0F);
|
||||
FrontDisc2.setTextureSize(128, 128);
|
||||
FrontDisc2.mirror = true;
|
||||
setRotation(FrontDisc2, 0F, 0F, 0F);
|
||||
BackDisc = new ModelRenderer(this, 65, 25);
|
||||
BackDisc.addBox(-5F, -5F, 3F, 10, 10, 2);
|
||||
BackDisc.setRotationPoint(0F, 15F, 0F);
|
||||
BackDisc.setTextureSize(128, 128);
|
||||
BackDisc.mirror = true;
|
||||
setRotation(BackDisc, 0F, 0F, 0.7853982F);
|
||||
BackDisc2 = new ModelRenderer(this, 65, 25);
|
||||
BackDisc2.addBox(-5F, -5F, 3F, 10, 10, 2);
|
||||
BackDisc2.setRotationPoint(0F, 15F, 0F);
|
||||
BackDisc2.setTextureSize(128, 128);
|
||||
BackDisc2.mirror = true;
|
||||
setRotation(BackDisc2, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(TileEntity ent)
|
||||
{
|
||||
float f5 = 0.0625F;
|
||||
// noMoving renderParts
|
||||
Bottom.render(f5);
|
||||
Left.render(f5);
|
||||
CenterRod.render(f5);
|
||||
Right.render(f5);
|
||||
RightTopCorner.render(f5);
|
||||
LeftTopCorner.render(f5);
|
||||
LeftBottomCorner.render(f5);
|
||||
RightBottomCorner.render(f5);
|
||||
BottomCase.render(f5);
|
||||
TopCase.render(f5);
|
||||
LeftBrace.render(f5);
|
||||
RightBrace.render(f5);
|
||||
BackBracer.render(f5);
|
||||
FrontBracer.render(f5);
|
||||
// Moving parts
|
||||
float pos = 0;
|
||||
if (ent instanceof TileEntityGenerator)
|
||||
pos = 45 * ((TileEntityGenerator) ent).getAnimationPos();
|
||||
|
||||
// change
|
||||
FrontDisc.rotateAngleZ = (float) Math.toRadians(pos);
|
||||
FrontDisc2.rotateAngleZ = (float) Math.toRadians(pos + 45);
|
||||
BackDisc.rotateAngleZ = (float) Math.toRadians(pos);
|
||||
BackDisc2.rotateAngleZ = (float) Math.toRadians(pos + 45);
|
||||
|
||||
FrontDisc.render(f5);
|
||||
FrontDisc2.render(f5);
|
||||
BackDisc.render(f5);
|
||||
BackDisc2.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,210 +0,0 @@
|
|||
// Date: 9/20/2012 12:00:21 AM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package liquidmechanics.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelLargePipe extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Mid;
|
||||
ModelRenderer RightPipe;
|
||||
ModelRenderer RightInter;
|
||||
ModelRenderer RightConnect;
|
||||
ModelRenderer LeftInter;
|
||||
ModelRenderer LeftPipe;
|
||||
ModelRenderer LeftConnect;
|
||||
ModelRenderer TopInter;
|
||||
ModelRenderer TopPipe;
|
||||
ModelRenderer TopConnect;
|
||||
ModelRenderer BottomPipe;
|
||||
ModelRenderer BottomInter;
|
||||
ModelRenderer BottomConnect;
|
||||
ModelRenderer BackPipe;
|
||||
ModelRenderer BackInter;
|
||||
ModelRenderer BackConnect;
|
||||
ModelRenderer FrontInter;
|
||||
ModelRenderer FrontPipe;
|
||||
ModelRenderer FrontConnect;
|
||||
|
||||
public ModelLargePipe()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 32;
|
||||
|
||||
Mid = new ModelRenderer(this, 50, 13);
|
||||
Mid.addBox(-3F, -3F, -3F, 6, 6, 6);
|
||||
Mid.setRotationPoint(0F, 16F, 0F);
|
||||
Mid.setTextureSize(128, 32);
|
||||
Mid.mirror = true;
|
||||
setRotation(Mid, 0F, 0F, 0F);
|
||||
RightPipe = new ModelRenderer(this, 25, 0);
|
||||
RightPipe.addBox(0F, -3F, -3F, 4, 6, 6);
|
||||
RightPipe.setRotationPoint(3F, 16F, 0F);
|
||||
RightPipe.setTextureSize(128, 32);
|
||||
RightPipe.mirror = true;
|
||||
setRotation(RightPipe, 0F, 0F, 0F);
|
||||
RightInter = new ModelRenderer(this, 98, 0);
|
||||
RightInter.addBox(0F, -4F, -4F, 1, 8, 8);
|
||||
RightInter.setRotationPoint(2F, 16F, 0F);
|
||||
RightInter.setTextureSize(128, 32);
|
||||
RightInter.mirror = true;
|
||||
setRotation(RightInter, 0F, 0F, 0F);
|
||||
RightConnect = new ModelRenderer(this, 98, 0);
|
||||
RightConnect.addBox(0F, -4F, -4F, 1, 8, 8);
|
||||
RightConnect.setRotationPoint(7F, 16F, 0F);
|
||||
RightConnect.setTextureSize(128, 32);
|
||||
RightConnect.mirror = true;
|
||||
setRotation(RightConnect, 0F, 0F, 0F);
|
||||
LeftInter = new ModelRenderer(this, 98, 0);
|
||||
LeftInter.addBox(-1F, -4F, -4F, 1, 8, 8);
|
||||
LeftInter.setRotationPoint(-2F, 16F, 0F);
|
||||
LeftInter.setTextureSize(128, 32);
|
||||
LeftInter.mirror = true;
|
||||
setRotation(LeftInter, 0F, 0F, 0F);
|
||||
LeftPipe = new ModelRenderer(this, 25, 0);
|
||||
LeftPipe.addBox(-4F, -3F, -3F, 4, 6, 6);
|
||||
LeftPipe.setRotationPoint(-3F, 16F, 0F);
|
||||
LeftPipe.setTextureSize(128, 32);
|
||||
LeftPipe.mirror = true;
|
||||
setRotation(LeftPipe, 0F, 0F, 0F);
|
||||
LeftConnect = new ModelRenderer(this, 98, 0);
|
||||
LeftConnect.addBox(-1F, -4F, -4F, 1, 8, 8);
|
||||
LeftConnect.setRotationPoint(-7F, 16F, 0F);
|
||||
LeftConnect.setTextureSize(128, 32);
|
||||
LeftConnect.mirror = true;
|
||||
setRotation(LeftConnect, 0F, 0F, 0F);
|
||||
TopInter = new ModelRenderer(this, 77, 17);
|
||||
TopInter.addBox(-4F, -1F, -4F, 8, 1, 8);
|
||||
TopInter.setRotationPoint(0F, 14F, 0F);
|
||||
TopInter.setTextureSize(128, 32);
|
||||
TopInter.mirror = true;
|
||||
setRotation(TopInter, 0F, 0F, 0F);
|
||||
TopPipe = new ModelRenderer(this, 50, 0);
|
||||
TopPipe.addBox(-3F, -4F, -3F, 6, 4, 6);
|
||||
TopPipe.setRotationPoint(0F, 13F, 0F);
|
||||
TopPipe.setTextureSize(128, 32);
|
||||
TopPipe.mirror = true;
|
||||
setRotation(TopPipe, 0F, 0F, 0F);
|
||||
TopConnect = new ModelRenderer(this, 77, 17);
|
||||
TopConnect.addBox(-4F, -1F, -4F, 8, 1, 8);
|
||||
TopConnect.setRotationPoint(0F, 9F, 0F);
|
||||
TopConnect.setTextureSize(128, 32);
|
||||
TopConnect.mirror = true;
|
||||
setRotation(TopConnect, 0F, 0F, 0F);
|
||||
BottomPipe = new ModelRenderer(this, 50, 0);
|
||||
BottomPipe.addBox(-3F, 0F, -3F, 6, 4, 6);
|
||||
BottomPipe.setRotationPoint(0F, 19F, 0F);
|
||||
BottomPipe.setTextureSize(128, 32);
|
||||
BottomPipe.mirror = true;
|
||||
setRotation(BottomPipe, 0F, 0F, 0F);
|
||||
BottomInter = new ModelRenderer(this, 77, 17);
|
||||
BottomInter.addBox(-4F, 0F, -4F, 8, 1, 8);
|
||||
BottomInter.setRotationPoint(0F, 18F, 0F);
|
||||
BottomInter.setTextureSize(128, 32);
|
||||
BottomInter.mirror = true;
|
||||
setRotation(BottomInter, 0F, 0F, 0F);
|
||||
BottomConnect = new ModelRenderer(this, 77, 17);
|
||||
BottomConnect.addBox(-4F, 0F, -4F, 8, 1, 8);
|
||||
BottomConnect.setRotationPoint(0F, 23F, 0F);
|
||||
BottomConnect.setTextureSize(128, 32);
|
||||
BottomConnect.mirror = true;
|
||||
setRotation(BottomConnect, 0F, 0F, 0F);
|
||||
BackPipe = new ModelRenderer(this, 0, 0);
|
||||
BackPipe.addBox(-3F, -3F, 0F, 6, 6, 4);
|
||||
BackPipe.setRotationPoint(0F, 16F, 3F);
|
||||
BackPipe.setTextureSize(128, 32);
|
||||
BackPipe.mirror = true;
|
||||
setRotation(BackPipe, 0F, 0F, 0F);
|
||||
BackInter = new ModelRenderer(this, 0, 23);
|
||||
BackInter.addBox(-4F, -4F, 0F, 8, 8, 1);
|
||||
BackInter.setRotationPoint(0F, 16F, 2F);
|
||||
BackInter.setTextureSize(128, 32);
|
||||
BackInter.mirror = true;
|
||||
setRotation(BackInter, 0F, 0F, 0F);
|
||||
BackConnect = new ModelRenderer(this, 0, 23);
|
||||
BackConnect.addBox(-4F, -4F, 0F, 8, 8, 1);
|
||||
BackConnect.setRotationPoint(0F, 16F, 7F);
|
||||
BackConnect.setTextureSize(128, 32);
|
||||
BackConnect.mirror = true;
|
||||
setRotation(BackConnect, 0F, 0F, 0F);
|
||||
FrontInter = new ModelRenderer(this, 0, 23);
|
||||
FrontInter.addBox(-4F, -4F, -1F, 8, 8, 1);
|
||||
FrontInter.setRotationPoint(0F, 16F, -2F);
|
||||
FrontInter.setTextureSize(128, 32);
|
||||
FrontInter.mirror = true;
|
||||
setRotation(FrontInter, 0F, 0F, 0F);
|
||||
FrontPipe = new ModelRenderer(this, 0, 0);
|
||||
FrontPipe.addBox(-3F, -3F, -4F, 6, 6, 4);
|
||||
FrontPipe.setRotationPoint(0F, 16F, -3F);
|
||||
FrontPipe.setTextureSize(128, 32);
|
||||
FrontPipe.mirror = true;
|
||||
setRotation(FrontPipe, 0F, 0F, 0F);
|
||||
FrontConnect = new ModelRenderer(this, 0, 23);
|
||||
FrontConnect.addBox(-4F, -4F, -1F, 8, 8, 1);
|
||||
FrontConnect.setRotationPoint(0F, 16F, -7F);
|
||||
FrontConnect.setTextureSize(128, 32);
|
||||
FrontConnect.mirror = true;
|
||||
setRotation(FrontConnect, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void renderMiddle()
|
||||
{
|
||||
Mid.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderBottom()
|
||||
{
|
||||
BottomPipe.render(0.0625F);
|
||||
BottomConnect.render(0.0625F);
|
||||
BottomInter.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderTop()
|
||||
{
|
||||
TopPipe.render(0.0625F);
|
||||
TopConnect.render(0.0625F);
|
||||
TopInter.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderLeft()
|
||||
{
|
||||
LeftPipe.render(0.0625F);
|
||||
LeftConnect.render(0.0625F);
|
||||
LeftInter.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderRight()
|
||||
{
|
||||
RightPipe.render(0.0625F);
|
||||
RightConnect.render(0.0625F);
|
||||
RightInter.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderBack()
|
||||
{
|
||||
BackPipe.render(0.0625F);
|
||||
BackConnect.render(0.0625F);
|
||||
BackInter.render(0.0625F);
|
||||
}
|
||||
|
||||
public void renderFront()
|
||||
{
|
||||
FrontPipe.render(0.0625F);
|
||||
FrontConnect.render(0.0625F);
|
||||
FrontInter.render(0.0625F);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,431 +0,0 @@
|
|||
// Date: 10/8/2012 7:31:40 PM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package liquidmechanics.client.model;
|
||||
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class ModelLiquidTank extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Mid;
|
||||
ModelRenderer Corner;
|
||||
ModelRenderer Corner2;
|
||||
ModelRenderer Corner3;
|
||||
ModelRenderer Corner4;
|
||||
ModelRenderer C8;
|
||||
ModelRenderer C7;
|
||||
ModelRenderer C6;
|
||||
ModelRenderer C5;
|
||||
ModelRenderer C4;
|
||||
ModelRenderer C;
|
||||
ModelRenderer C3;
|
||||
ModelRenderer C2;
|
||||
ModelRenderer GuageT;
|
||||
ModelRenderer GuageB;
|
||||
ModelRenderer Guage;
|
||||
ModelRenderer GuageR;
|
||||
// ModelRenderer GuageGlass;
|
||||
ModelRenderer GuageL;
|
||||
|
||||
ModelRenderer GuageT2;
|
||||
ModelRenderer GuageB2;
|
||||
ModelRenderer Guage2;
|
||||
ModelRenderer GuageR2;
|
||||
// ModelRenderer GuageGlass2;
|
||||
ModelRenderer GuageL2;
|
||||
|
||||
ModelRenderer GuageT3;
|
||||
ModelRenderer GuageB3;
|
||||
ModelRenderer Guage3;
|
||||
ModelRenderer GuageR3;
|
||||
// ModelRenderer GuageGlass3;
|
||||
ModelRenderer GuageL3;
|
||||
|
||||
ModelRenderer GuageT4;
|
||||
ModelRenderer GuageB4;
|
||||
ModelRenderer Guage4;
|
||||
ModelRenderer GuageR4;
|
||||
// ModelRenderer GuageGlass4;
|
||||
ModelRenderer GuageL4;
|
||||
|
||||
ModelRenderer CCBottom;
|
||||
ModelRenderer CCRight;
|
||||
ModelRenderer CCLeft;
|
||||
ModelRenderer CCFront;
|
||||
ModelRenderer CCBack;
|
||||
ModelRenderer CCTop;
|
||||
|
||||
public ModelLiquidTank()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
Mid = new ModelRenderer(this, 0, 50);
|
||||
Mid.addBox(-6F, 0F, -6F, 12, 14, 12);
|
||||
Mid.setRotationPoint(0F, 9F, 0F);
|
||||
Mid.setTextureSize(128, 128);
|
||||
Mid.mirror = true;
|
||||
setRotation(Mid, 0F, 0F, 0F);
|
||||
Corner = new ModelRenderer(this, 0, 30);
|
||||
Corner.addBox(-1F, 0F, -1F, 2, 16, 2);
|
||||
Corner.setRotationPoint(-7F, 8F, 7F);
|
||||
Corner.setTextureSize(128, 128);
|
||||
Corner.mirror = true;
|
||||
setRotation(Corner, 0F, 0F, 0F);
|
||||
Corner2 = new ModelRenderer(this, 0, 30);
|
||||
Corner2.addBox(-1F, 0F, -1F, 2, 16, 2);
|
||||
Corner2.setRotationPoint(-7F, 8F, -7F);
|
||||
Corner2.setTextureSize(128, 128);
|
||||
Corner2.mirror = true;
|
||||
setRotation(Corner2, 0F, 0F, 0F);
|
||||
Corner3 = new ModelRenderer(this, 0, 30);
|
||||
Corner3.addBox(-1F, 0F, -1F, 2, 16, 2);
|
||||
Corner3.setRotationPoint(7F, 8F, -7F);
|
||||
Corner3.setTextureSize(128, 128);
|
||||
Corner3.mirror = true;
|
||||
setRotation(Corner3, 0F, 0F, 0F);
|
||||
Corner4 = new ModelRenderer(this, 0, 30);
|
||||
Corner4.addBox(-1F, 0F, -1F, 2, 16, 2);
|
||||
Corner4.setRotationPoint(7F, 8F, 7F);
|
||||
Corner4.setTextureSize(128, 128);
|
||||
Corner4.mirror = true;
|
||||
setRotation(Corner4, 0F, 0F, 0F);
|
||||
C8 = new ModelRenderer(this, 9, 35);
|
||||
C8.addBox(-1F, 0F, -1F, 2, 2, 12);
|
||||
C8.setRotationPoint(6F, 22F, -5F);
|
||||
C8.setTextureSize(128, 128);
|
||||
C8.mirror = true;
|
||||
setRotation(C8, 0F, 0F, 0F);
|
||||
C7 = new ModelRenderer(this, 9, 35);
|
||||
C7.addBox(-1F, 0F, -1F, 2, 2, 12);
|
||||
C7.setRotationPoint(-6F, 8F, -5F);
|
||||
C7.setTextureSize(128, 128);
|
||||
C7.mirror = true;
|
||||
setRotation(C7, 0F, 0F, 0F);
|
||||
C6 = new ModelRenderer(this, 9, 35);
|
||||
C6.addBox(-1F, 0F, -1F, 2, 2, 12);
|
||||
C6.setRotationPoint(6F, 8F, -5F);
|
||||
C6.setTextureSize(128, 128);
|
||||
C6.mirror = true;
|
||||
setRotation(C6, 0F, 0F, 0F);
|
||||
C5 = new ModelRenderer(this, 9, 30);
|
||||
C5.addBox(-1F, 0F, -1F, 12, 2, 2);
|
||||
C5.setRotationPoint(-5F, 8F, 6F);
|
||||
C5.setTextureSize(128, 128);
|
||||
C5.mirror = true;
|
||||
setRotation(C5, 0F, 0F, 0F);
|
||||
C4 = new ModelRenderer(this, 9, 35);
|
||||
C4.addBox(-1F, 0F, -1F, 2, 2, 12);
|
||||
C4.setRotationPoint(-6F, 22F, -5F);
|
||||
C4.setTextureSize(128, 128);
|
||||
C4.mirror = true;
|
||||
setRotation(C4, 0F, 0F, 0F);
|
||||
C = new ModelRenderer(this, 9, 30);
|
||||
C.addBox(-1F, 0F, -1F, 12, 2, 2);
|
||||
C.setRotationPoint(-5F, 22F, 6F);
|
||||
C.setTextureSize(128, 128);
|
||||
C.mirror = true;
|
||||
setRotation(C, 0F, 0F, 0F);
|
||||
C3 = new ModelRenderer(this, 9, 30);
|
||||
C3.addBox(-1F, 0F, -1F, 12, 2, 2);
|
||||
C3.setRotationPoint(-5F, 8F, -6F);
|
||||
C3.setTextureSize(128, 128);
|
||||
C3.mirror = true;
|
||||
setRotation(C3, 0F, 0F, 0F);
|
||||
C2 = new ModelRenderer(this, 9, 30);
|
||||
C2.addBox(-1F, 0F, -1F, 12, 2, 2);
|
||||
C2.setRotationPoint(-5F, 22F, -6F);
|
||||
C2.setTextureSize(128, 128);
|
||||
C2.mirror = true;
|
||||
setRotation(C2, 0F, 0F, 0F);
|
||||
// G1--------------------------------------
|
||||
GuageT = new ModelRenderer(this, 54, 42);
|
||||
GuageT.addBox(-1F, -1F, 0F, 2, 1, 2);
|
||||
GuageT.setRotationPoint(0F, 12F, -8F);
|
||||
GuageT.setTextureSize(128, 128);
|
||||
GuageT.mirror = true;
|
||||
setRotation(GuageT, 0F, 0F, 0F);
|
||||
GuageB = new ModelRenderer(this, 54, 42);
|
||||
GuageB.addBox(-1F, 8F, 0F, 2, 1, 2);
|
||||
GuageB.setRotationPoint(0F, 12F, -8F);
|
||||
GuageB.setTextureSize(128, 128);
|
||||
GuageB.mirror = true;
|
||||
setRotation(GuageB, 0F, 0F, 0F);
|
||||
Guage = new ModelRenderer(this, 54, 32);
|
||||
Guage.addBox(-1F, 0F, 0F, 2, 8, 1);
|
||||
Guage.setRotationPoint(0F, 12F, -7F);
|
||||
Guage.setTextureSize(128, 128);
|
||||
Guage.mirror = true;
|
||||
setRotation(Guage, 0F, 0F, 0F);
|
||||
GuageR = new ModelRenderer(this, 44, 32);
|
||||
GuageR.addBox(1F, -1F, -1F, 2, 10, 2);
|
||||
GuageR.setRotationPoint(0F, 12F, -7F);
|
||||
GuageR.setTextureSize(128, 128);
|
||||
GuageR.mirror = true;
|
||||
setRotation(GuageR, 0F, 0F, 0F);
|
||||
// GuageGlass = new ModelRenderer(this, 60, 32);
|
||||
// GuageGlass.addBox(-1F, 0F, 0F, 2, 8, 1);
|
||||
// GuageGlass.setRotationPoint(0F, 12F, -8F);
|
||||
// GuageGlass.setTextureSize(128, 128);
|
||||
// GuageGlass.mirror = true;
|
||||
// setRotation(GuageGlass, 0F, 0F, 0F);
|
||||
GuageL = new ModelRenderer(this, 44, 32);
|
||||
GuageL.addBox(-3F, -1F, -1F, 2, 10, 2);
|
||||
GuageL.setRotationPoint(0F, 12F, -7F);
|
||||
GuageL.setTextureSize(128, 128);
|
||||
GuageL.mirror = true;
|
||||
setRotation(GuageL, 0F, 0F, 0F);
|
||||
// G2----------------------------------
|
||||
GuageT2 = new ModelRenderer(this, 54, 42);
|
||||
GuageT2.addBox(-1F, -1F, 0F, 2, 1, 2);
|
||||
GuageT2.setRotationPoint(-8F, 12F, 0F);
|
||||
GuageT2.setTextureSize(128, 128);
|
||||
GuageT2.mirror = true;
|
||||
setRotation(GuageT2, 0F, 1.570796F, 0F);
|
||||
GuageB2 = new ModelRenderer(this, 54, 42);
|
||||
GuageB2.addBox(-1F, 8F, 0F, 2, 1, 2);
|
||||
GuageB2.setRotationPoint(-8F, 12F, 0F);
|
||||
GuageB2.setTextureSize(128, 128);
|
||||
GuageB2.mirror = true;
|
||||
setRotation(GuageB2, 0F, 1.570796F, 0F);
|
||||
Guage2 = new ModelRenderer(this, 54, 32);
|
||||
Guage2.addBox(-1F, 0F, 0F, 2, 8, 1);
|
||||
Guage2.setRotationPoint(-7F, 12F, 0F);
|
||||
Guage2.setTextureSize(128, 128);
|
||||
Guage2.mirror = true;
|
||||
setRotation(Guage2, 0F, 1.570796F, 0F);
|
||||
GuageR2 = new ModelRenderer(this, 44, 32);
|
||||
GuageR2.addBox(1F, -1F, -1F, 2, 10, 2);
|
||||
GuageR2.setRotationPoint(-7F, 12F, 0F);
|
||||
GuageR2.setTextureSize(128, 128);
|
||||
GuageR2.mirror = true;
|
||||
setRotation(GuageR2, 0F, 1.570796F, 0F);
|
||||
// GuageGlass2 = new ModelRenderer(this, 60, 32);
|
||||
// GuageGlass2.addBox(-1F, 0F, 0F, 2, 8, 1);
|
||||
// GuageGlass2.setRotationPoint(-8F, 12F, 0F);
|
||||
// GuageGlass2.setTextureSize(128, 128);
|
||||
// GuageGlass2.mirror = true;
|
||||
// setRotation(GuageGlass2, 0F, 1.570796F, 0F);
|
||||
GuageL2 = new ModelRenderer(this, 44, 32);
|
||||
GuageL2.addBox(-3F, -1F, -1F, 2, 10, 2);
|
||||
GuageL2.setRotationPoint(-7F, 12F, 0F);
|
||||
GuageL2.setTextureSize(128, 128);
|
||||
GuageL2.mirror = true;
|
||||
setRotation(GuageL2, 0F, 1.570796F, 0F);
|
||||
// G3--------------------------------------
|
||||
GuageT3 = new ModelRenderer(this, 54, 42);
|
||||
GuageT3.addBox(-1F, -1F, 0F, 2, 1, 2);
|
||||
GuageT3.setRotationPoint(0F, 12F, 8F);
|
||||
GuageT3.setTextureSize(128, 128);
|
||||
GuageT3.mirror = true;
|
||||
setRotation(GuageT3, 0F, 3.141593F, 0F);
|
||||
GuageB3 = new ModelRenderer(this, 54, 42);
|
||||
GuageB3.addBox(-1F, 8F, 0F, 2, 1, 2);
|
||||
GuageB3.setRotationPoint(0F, 12F, 8F);
|
||||
GuageB3.setTextureSize(128, 128);
|
||||
GuageB3.mirror = true;
|
||||
setRotation(GuageB3, 0F, 3.141593F, 0F);
|
||||
Guage3 = new ModelRenderer(this, 54, 32);
|
||||
Guage3.addBox(-1F, 0F, 0F, 2, 8, 1);
|
||||
Guage3.setRotationPoint(0F, 12F, 7F);
|
||||
Guage3.setTextureSize(128, 128);
|
||||
Guage3.mirror = true;
|
||||
setRotation(Guage3, 0F, 3.141593F, 0F);
|
||||
GuageR3 = new ModelRenderer(this, 44, 32);
|
||||
GuageR3.addBox(1F, -1F, -1F, 2, 10, 2);
|
||||
GuageR3.setRotationPoint(0F, 12F, 7F);
|
||||
GuageR3.setTextureSize(128, 128);
|
||||
GuageR3.mirror = true;
|
||||
setRotation(GuageR3, 0F, 3.141593F, 0F);
|
||||
// GuageGlass3 = new ModelRenderer(this, 60, 32);
|
||||
// GuageGlass3.addBox(-1F, 0F, 0F, 2, 8, 1);
|
||||
// GuageGlass3.setRotationPoint(0F, 12F, 8F);
|
||||
// GuageGlass3.setTextureSize(128, 128);
|
||||
// GuageGlass3.mirror = true;
|
||||
// setRotation(GuageGlass3, 0F, 3.141593F, 0F);
|
||||
GuageL3 = new ModelRenderer(this, 44, 32);
|
||||
GuageL3.addBox(-3F, -1F, -1F, 2, 10, 2);
|
||||
GuageL3.setRotationPoint(0F, 12F, 7F);
|
||||
GuageL3.setTextureSize(128, 128);
|
||||
GuageL3.mirror = true;
|
||||
setRotation(GuageL3, 0F, 3.141593F, 0F);
|
||||
// G4-------------------------------
|
||||
GuageT4 = new ModelRenderer(this, 54, 42);
|
||||
GuageT4.addBox(-1F, -1F, 0F, 2, 1, 2);
|
||||
GuageT4.setRotationPoint(8F, 12F, 0F);
|
||||
GuageT4.setTextureSize(128, 128);
|
||||
GuageT4.mirror = true;
|
||||
setRotation(GuageT4, 0F, -1.570796F, 0F);
|
||||
GuageB4 = new ModelRenderer(this, 54, 42);
|
||||
GuageB4.addBox(-1F, 8F, 0F, 2, 1, 2);
|
||||
GuageB4.setRotationPoint(8F, 12F, 0F);
|
||||
GuageB4.setTextureSize(128, 128);
|
||||
GuageB4.mirror = true;
|
||||
setRotation(GuageB4, 0F, -1.570796F, 0F);
|
||||
Guage4 = new ModelRenderer(this, 54, 32);
|
||||
Guage4.addBox(-1F, 0F, 0F, 2, 8, 1);
|
||||
Guage4.setRotationPoint(7F, 12F, 0F);
|
||||
Guage4.setTextureSize(128, 128);
|
||||
Guage4.mirror = true;
|
||||
setRotation(Guage4, 0F, -1.570796F, 0F);
|
||||
GuageR4 = new ModelRenderer(this, 44, 32);
|
||||
GuageR4.addBox(1F, -1F, -1F, 2, 10, 2);
|
||||
GuageR4.setRotationPoint(7F, 12F, 0F);
|
||||
GuageR4.setTextureSize(128, 128);
|
||||
GuageR4.mirror = true;
|
||||
setRotation(GuageR4, 0F, -1.570796F, 0F);
|
||||
// GuageGlass4 = new ModelRenderer(this, 60, 32);
|
||||
// GuageGlass4.addBox(-1F, 0F, 0F, 2, 8, 1);
|
||||
// GuageGlass4.setRotationPoint(8F, 12F, 0F);
|
||||
// GuageGlass4.setTextureSize(128, 128);
|
||||
// GuageGlass4.mirror = true;
|
||||
// setRotation(GuageGlass4, 0F, -1.570796F, 0F);
|
||||
GuageL4 = new ModelRenderer(this, 44, 32);
|
||||
GuageL4.addBox(-3F, -1F, -1F, 2, 10, 2);
|
||||
GuageL4.setRotationPoint(7F, 12F, 0F);
|
||||
GuageL4.setTextureSize(128, 128);
|
||||
GuageL4.mirror = true;
|
||||
setRotation(GuageL4, 0F, -1.570796F, 0F);
|
||||
// Pipe Connectors
|
||||
CCBottom = new ModelRenderer(this, 0, 0);
|
||||
CCBottom.addBox(-3F, -9F, -3F, 6, 1, 6);
|
||||
CCBottom.setRotationPoint(0F, 15F, 0F);
|
||||
CCBottom.setTextureSize(128, 128);
|
||||
CCBottom.mirror = true;
|
||||
setRotation(CCBottom, 3.141593F, 0F, 0F);
|
||||
CCRight = new ModelRenderer(this, 0, 0);
|
||||
CCRight.addBox(-3F, -8F, -3F, 6, 2, 6);
|
||||
CCRight.setRotationPoint(0F, 15F, 0F);
|
||||
CCRight.setTextureSize(128, 128);
|
||||
CCRight.mirror = true;
|
||||
setRotation(CCRight, 0F, 0F, -1.570796F);
|
||||
CCLeft = new ModelRenderer(this, 0, 0);
|
||||
CCLeft.addBox(-3F, -8F, -3F, 6, 2, 6);
|
||||
CCLeft.setRotationPoint(0F, 15F, 0F);
|
||||
CCLeft.setTextureSize(128, 128);
|
||||
CCLeft.mirror = true;
|
||||
setRotation(CCLeft, 0F, 0F, 1.570796F);
|
||||
CCFront = new ModelRenderer(this, 0, 0);
|
||||
CCFront.addBox(-3F, -8F, -3F, 6, 2, 6);
|
||||
CCFront.setRotationPoint(0F, 15F, 0F);
|
||||
CCFront.setTextureSize(128, 128);
|
||||
CCFront.mirror = true;
|
||||
setRotation(CCFront, 1.570796F, 0F, 0F);
|
||||
CCBack = new ModelRenderer(this, 0, 0);
|
||||
CCBack.addBox(-3F, -8F, -3F, 6, 2, 6);
|
||||
CCBack.setRotationPoint(0F, 15F, 0F);
|
||||
CCBack.setTextureSize(128, 128);
|
||||
CCBack.mirror = true;
|
||||
setRotation(CCBack, -1.570796F, 0F, 0F);
|
||||
CCTop = new ModelRenderer(this, 0, 0);
|
||||
CCTop.addBox(-3F, -7F, -3F, 6, 1, 6);
|
||||
CCTop.setRotationPoint(0F, 15F, 0F);
|
||||
CCTop.setTextureSize(128, 128);
|
||||
CCTop.mirror = true;
|
||||
setRotation(CCTop, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void renderMain(float f5)
|
||||
{
|
||||
|
||||
// render regardless of sides
|
||||
Mid.render(f5);
|
||||
Corner.render(f5);
|
||||
Corner2.render(f5);
|
||||
Corner3.render(f5);
|
||||
Corner4.render(f5);
|
||||
C8.render(f5);
|
||||
C7.render(f5);
|
||||
C6.render(f5);
|
||||
C5.render(f5);
|
||||
C4.render(f5);
|
||||
C.render(f5);
|
||||
C3.render(f5);
|
||||
C2.render(f5);
|
||||
CCTop.render(f5);
|
||||
CCBottom.render(f5);
|
||||
|
||||
}
|
||||
|
||||
public void renderMeter(TileEntity tee, float f5)
|
||||
{
|
||||
TileEntity[] ents = new TileEntity[6];
|
||||
if (tee instanceof TileEntityTank)
|
||||
{
|
||||
ents = ((TileEntityTank) tee).cc;
|
||||
}
|
||||
// Front
|
||||
if (ents[2] instanceof TileEntityPipe)
|
||||
{
|
||||
CCFront.render(f5);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuageT.render(f5);
|
||||
GuageB.render(f5);
|
||||
Guage.render(f5);
|
||||
GuageR.render(f5);
|
||||
// GuageGlass.render(f5);
|
||||
GuageL.render(f5);
|
||||
}
|
||||
// back
|
||||
if (ents[3] instanceof TileEntityPipe)
|
||||
{
|
||||
CCBack.render(f5);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuageT3.render(f5);
|
||||
Guage3.render(f5);
|
||||
Guage3.render(f5);
|
||||
GuageR3.render(f5);
|
||||
// GuageGlass3.render(f5);
|
||||
GuageL3.render(f5);
|
||||
}
|
||||
// right
|
||||
if (ents[4] instanceof TileEntityPipe)
|
||||
{
|
||||
CCRight.render(f5);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuageT4.render(f5);
|
||||
Guage4.render(f5);
|
||||
Guage4.render(f5);
|
||||
GuageR4.render(f5);
|
||||
// GuageGlass4.render(f5);
|
||||
GuageL4.render(f5);
|
||||
}
|
||||
// left
|
||||
if (ents[5] instanceof TileEntityPipe)
|
||||
{
|
||||
CCLeft.render(f5);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuageT2.render(f5);
|
||||
Guage2.render(f5);
|
||||
Guage2.render(f5);
|
||||
GuageR2.render(f5);
|
||||
// GuageGlass2.render(f5);
|
||||
GuageL2.render(f5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
package liquidmechanics.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelLiquidTankCorner extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer sOne;
|
||||
ModelRenderer sTwo;
|
||||
ModelRenderer d7;
|
||||
ModelRenderer d5;
|
||||
ModelRenderer d3;
|
||||
ModelRenderer d4;
|
||||
ModelRenderer d1;
|
||||
ModelRenderer d6;
|
||||
ModelRenderer d2;
|
||||
ModelRenderer d8;
|
||||
ModelRenderer d9;
|
||||
ModelRenderer d10;
|
||||
ModelRenderer face;
|
||||
|
||||
public ModelLiquidTankCorner()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
sOne = new ModelRenderer(this, 0, 30);
|
||||
sOne.addBox(-1F, 0F, -1F, 2, 16, 2);
|
||||
sOne.setRotationPoint(-7F, 8F, 7F);
|
||||
sOne.setTextureSize(128, 128);
|
||||
sOne.mirror = true;
|
||||
setRotation(sOne, 0F, 0F, 0F);
|
||||
sTwo = new ModelRenderer(this, 0, 30);
|
||||
sTwo.addBox(-1F, 0F, -1F, 2, 16, 2);
|
||||
sTwo.setRotationPoint(-7F, 8F, -7F);
|
||||
sTwo.setTextureSize(128, 128);
|
||||
sTwo.mirror = true;
|
||||
setRotation(sTwo, 0F, 0F, 0F);
|
||||
d7 = new ModelRenderer(this, 43, 2);
|
||||
d7.addBox(-1F, 0F, -1F, 2, 16, 12);
|
||||
d7.setRotationPoint(-7F, 8F, -5F);
|
||||
d7.setTextureSize(128, 128);
|
||||
d7.mirror = true;
|
||||
setRotation(d7, 0F, 0F, 0F);
|
||||
d5 = new ModelRenderer(this, 9, 12);
|
||||
d5.addBox(-1F, 0F, -1F, 14, 16, 2);
|
||||
d5.setRotationPoint(-5F, 8F, 7F);
|
||||
d5.setTextureSize(128, 128);
|
||||
d5.mirror = true;
|
||||
setRotation(d5, 0F, 0F, 0F);
|
||||
d3 = new ModelRenderer(this, 9, 67);
|
||||
d3.addBox(-1.5F, 0F, -1.3F, 20, 2, 2);
|
||||
d3.setRotationPoint(-6F, 22F, -6F);
|
||||
d3.setTextureSize(128, 128);
|
||||
d3.mirror = true;
|
||||
setRotation(d3, 0F, -0.7853982F, 0F);
|
||||
d4 = new ModelRenderer(this, 9, 88);
|
||||
d4.addBox(0F, 0F, -9F, 5, 2, 4);
|
||||
d4.setRotationPoint(-6F, 22F, 6F);
|
||||
d4.setTextureSize(128, 128);
|
||||
d4.mirror = true;
|
||||
setRotation(d4, 0F, 0F, 0F);
|
||||
d1 = new ModelRenderer(this, 9, 67);
|
||||
d1.addBox(-1.5F, 0F, -1.3F, 20, 2, 2);
|
||||
d1.setRotationPoint(-6F, 8F, -6F);
|
||||
d1.setTextureSize(128, 128);
|
||||
d1.mirror = true;
|
||||
setRotation(d1, 0F, -0.7853982F, 0F);
|
||||
d6 = new ModelRenderer(this, 9, 75);
|
||||
d6.addBox(-1.5F, 0F, -1.3F, 17, 2, 2);
|
||||
d6.setRotationPoint(-6F, 22F, -4F);
|
||||
d6.setTextureSize(128, 128);
|
||||
d6.mirror = true;
|
||||
setRotation(d6, 0F, -0.7853982F, 0F);
|
||||
d2 = new ModelRenderer(this, 9, 80);
|
||||
d2.addBox(0F, 0F, -5F, 9, 2, 5);
|
||||
d2.setRotationPoint(-6F, 22F, 6F);
|
||||
d2.setTextureSize(128, 128);
|
||||
d2.mirror = true;
|
||||
setRotation(d2, 0F, 0F, 0F);
|
||||
d8 = new ModelRenderer(this, 9, 75);
|
||||
d8.addBox(-1.5F, 0F, -1.3F, 17, 2, 2);
|
||||
d8.setRotationPoint(-6F, 8F, -4F);
|
||||
d8.setTextureSize(128, 128);
|
||||
d8.mirror = true;
|
||||
setRotation(d8, 0F, -0.7853982F, 0F);
|
||||
d9 = new ModelRenderer(this, 9, 88);
|
||||
d9.addBox(0F, 0F, -9F, 5, 2, 4);
|
||||
d9.setRotationPoint(-6F, 8F, 6F);
|
||||
d9.setTextureSize(128, 128);
|
||||
d9.mirror = true;
|
||||
setRotation(d9, 0F, 0F, 0F);
|
||||
d10 = new ModelRenderer(this, 9, 80);
|
||||
d10.addBox(0F, 0F, -5F, 9, 2, 5);
|
||||
d10.setRotationPoint(-6F, 8F, 6F);
|
||||
d10.setTextureSize(128, 128);
|
||||
d10.mirror = true;
|
||||
setRotation(d10, 0F, 0F, 0F);
|
||||
face = new ModelRenderer(this, 0, 50);
|
||||
face.addBox(-8.5F, 0F, 0F, 17, 14, 2);
|
||||
face.setRotationPoint(0F, 9F, 0F);
|
||||
face.setTextureSize(128, 128);
|
||||
face.mirror = true;
|
||||
setRotation(face, 0F, -0.7853982F, 0F);
|
||||
}
|
||||
|
||||
public void render(float f5)
|
||||
{
|
||||
sOne.render(f5);
|
||||
sTwo.render(f5);
|
||||
d7.render(f5);
|
||||
d5.render(f5);
|
||||
d3.render(f5);
|
||||
d4.render(f5);
|
||||
d1.render(f5);
|
||||
d6.render(f5);
|
||||
d2.render(f5);
|
||||
d8.render(f5);
|
||||
d9.render(f5);
|
||||
d10.render(f5);
|
||||
face.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,291 +0,0 @@
|
|||
// Date: 1/22/2013 9:59:56 AM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package liquidmechanics.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelPump extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Body;
|
||||
ModelRenderer pipecc1;
|
||||
ModelRenderer pipecc3;
|
||||
ModelRenderer wheelcenter;
|
||||
ModelRenderer wheelcenter2;
|
||||
ModelRenderer joint;
|
||||
ModelRenderer wheelcc0;
|
||||
ModelRenderer wheelcc1;
|
||||
ModelRenderer wheelcc2;
|
||||
ModelRenderer wheelcc3;
|
||||
ModelRenderer wheelcc4;
|
||||
ModelRenderer wheelcc5;
|
||||
ModelRenderer wheelcc6;
|
||||
ModelRenderer wheelcc7;
|
||||
ModelRenderer wheelBrace;
|
||||
ModelRenderer piston_top;
|
||||
ModelRenderer piston;
|
||||
ModelRenderer wheelBrace2;
|
||||
ModelRenderer joint2;
|
||||
ModelRenderer w2;
|
||||
ModelRenderer w22;
|
||||
ModelRenderer w2cc;
|
||||
ModelRenderer w2cc1;
|
||||
ModelRenderer w2cc2;
|
||||
ModelRenderer w2cc3;
|
||||
ModelRenderer w2cc4;
|
||||
ModelRenderer w2cc5;
|
||||
ModelRenderer w2cc6;
|
||||
ModelRenderer w2cc7;
|
||||
ModelRenderer side7;
|
||||
ModelRenderer side8;
|
||||
|
||||
public ModelPump()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
Body = new ModelRenderer(this, 0, 109);
|
||||
Body.addBox(-3F, 0F, -3F, 6, 12, 6);
|
||||
Body.setRotationPoint(0F, 12F, 0F);
|
||||
Body.setTextureSize(128, 128);
|
||||
Body.mirror = true;
|
||||
setRotation(Body, 0F, 0F, 0F);
|
||||
pipecc1 = new ModelRenderer(this, 21, 92);
|
||||
pipecc1.addBox(-3.5F, -3.5F, 3F, 7, 7, 5);
|
||||
pipecc1.setRotationPoint(0F, 16F, 0F);
|
||||
pipecc1.setTextureSize(128, 128);
|
||||
pipecc1.mirror = true;
|
||||
setRotation(pipecc1, 0F, 1.570796F, 0F);
|
||||
pipecc3 = new ModelRenderer(this, 8, 50);
|
||||
pipecc3.addBox(-3.5F, -4F, 3F, 7, 5, 5);
|
||||
pipecc3.setRotationPoint(0F, 16F, 0F);
|
||||
pipecc3.setTextureSize(128, 128);
|
||||
pipecc3.mirror = true;
|
||||
setRotation(pipecc3, 0F, 3.141593F, 0F);
|
||||
wheelcenter = new ModelRenderer(this, 0, 25);
|
||||
wheelcenter.addBox(0F, -2.5F, -2.5F, 1, 5, 5);
|
||||
wheelcenter.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcenter.setTextureSize(128, 128);
|
||||
wheelcenter.mirror = true;
|
||||
setRotation(wheelcenter, 0F, 0F, 0F);
|
||||
wheelcenter2 = new ModelRenderer(this, 0, 25);
|
||||
wheelcenter2.addBox(0F, -2.5F, -2.5F, 1, 5, 5);
|
||||
wheelcenter2.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcenter2.setTextureSize(128, 128);
|
||||
wheelcenter2.mirror = true;
|
||||
setRotation(wheelcenter2, 0.7853982F, 0F, 0F);
|
||||
joint = new ModelRenderer(this, 0, 18);
|
||||
joint.addBox(0F, -1.5F, -1.5F, 1, 3, 3);
|
||||
joint.setRotationPoint(-4F, 18F, 0F);
|
||||
joint.setTextureSize(128, 128);
|
||||
joint.mirror = true;
|
||||
setRotation(joint, 0F, 0F, 0F);
|
||||
wheelcc0 = new ModelRenderer(this, 0, 0);
|
||||
wheelcc0.addBox(0F, -4.5F, -2F, 1, 1, 4);
|
||||
wheelcc0.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcc0.setTextureSize(128, 128);
|
||||
wheelcc0.mirror = true;
|
||||
setRotation(wheelcc0, 1.570796F, 0F, 0F);
|
||||
wheelcc1 = new ModelRenderer(this, 0, 0);
|
||||
wheelcc1.addBox(0F, -4.5F, -2F, 1, 1, 4);
|
||||
wheelcc1.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcc1.setTextureSize(128, 128);
|
||||
wheelcc1.mirror = true;
|
||||
setRotation(wheelcc1, 0F, 0F, 0F);
|
||||
wheelcc2 = new ModelRenderer(this, 0, 0);
|
||||
wheelcc2.addBox(0F, -4.5F, -2F, 1, 1, 4);
|
||||
wheelcc2.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcc2.setTextureSize(128, 128);
|
||||
wheelcc2.mirror = true;
|
||||
setRotation(wheelcc2, -1.570796F, 0F, 0F);
|
||||
wheelcc3 = new ModelRenderer(this, 0, 0);
|
||||
wheelcc3.addBox(0F, -4.5F, -2F, 1, 1, 4);
|
||||
wheelcc3.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcc3.setTextureSize(128, 128);
|
||||
wheelcc3.mirror = true;
|
||||
setRotation(wheelcc3, 3.141593F, 0F, 0F);
|
||||
wheelcc4 = new ModelRenderer(this, 0, 0);
|
||||
wheelcc4.addBox(0F, -4.5F, -2F, 1, 1, 4);
|
||||
wheelcc4.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcc4.setTextureSize(128, 128);
|
||||
wheelcc4.mirror = true;
|
||||
setRotation(wheelcc4, 0.7853982F, 0F, 0F);
|
||||
wheelcc5 = new ModelRenderer(this, 0, 0);
|
||||
wheelcc5.addBox(0F, -4.5F, -2F, 1, 1, 4);
|
||||
wheelcc5.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcc5.setTextureSize(128, 128);
|
||||
wheelcc5.mirror = true;
|
||||
setRotation(wheelcc5, -2.356194F, 0F, 0F);
|
||||
wheelcc6 = new ModelRenderer(this, 0, 0);
|
||||
wheelcc6.addBox(0F, -4.5F, -2F, 1, 1, 4);
|
||||
wheelcc6.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcc6.setTextureSize(128, 128);
|
||||
wheelcc6.mirror = true;
|
||||
setRotation(wheelcc6, -0.7853982F, 0F, 0F);
|
||||
wheelcc7 = new ModelRenderer(this, 0, 0);
|
||||
wheelcc7.addBox(0F, -4.5F, -2F, 1, 1, 4);
|
||||
wheelcc7.setRotationPoint(-5F, 18F, 0F);
|
||||
wheelcc7.setTextureSize(128, 128);
|
||||
wheelcc7.mirror = true;
|
||||
setRotation(wheelcc7, 2.356194F, 0F, 0F);
|
||||
wheelBrace = new ModelRenderer(this, 27, 5);
|
||||
wheelBrace.addBox(0F, -1.5F, -1.5F, 1, 8, 3);
|
||||
wheelBrace.setRotationPoint(-6F, 18F, 0F);
|
||||
wheelBrace.setTextureSize(128, 128);
|
||||
wheelBrace.mirror = true;
|
||||
setRotation(wheelBrace, 0F, 0F, 0F);
|
||||
piston_top = new ModelRenderer(this, 0, 81);
|
||||
piston_top.addBox(-3F, 0F, -3F, 6, 1, 6);
|
||||
piston_top.setRotationPoint(0F, 10F, 0F);
|
||||
piston_top.setTextureSize(128, 128);
|
||||
piston_top.mirror = true;
|
||||
setRotation(piston_top, 0F, 0F, 0F);
|
||||
piston = new ModelRenderer(this, 0, 90);
|
||||
piston.addBox(-2.5F, 0F, -2.5F, 5, 12, 5);
|
||||
piston.setRotationPoint(0F, 11F, 0F);
|
||||
piston.setTextureSize(128, 128);
|
||||
piston.mirror = true;
|
||||
setRotation(piston, 0F, 0F, 0F);
|
||||
wheelBrace2 = new ModelRenderer(this, 26, 18);
|
||||
wheelBrace2.addBox(0F, 0F, -1.5F, 2, 1, 3);
|
||||
wheelBrace2.setRotationPoint(-5F, 23F, 0F);
|
||||
wheelBrace2.setTextureSize(128, 128);
|
||||
wheelBrace2.mirror = true;
|
||||
setRotation(wheelBrace2, 0F, 0F, 0F);
|
||||
joint2 = new ModelRenderer(this, 0, 14);
|
||||
joint2.addBox(0F, -0.5F, -0.5F, 1, 1, 1);
|
||||
joint2.setRotationPoint(-4F, 14F, -6F);
|
||||
joint2.setTextureSize(128, 128);
|
||||
joint2.mirror = true;
|
||||
setRotation(joint2, 0F, 0F, 0F);
|
||||
w2 = new ModelRenderer(this, 0, 55);
|
||||
w2.addBox(0F, -1F, -1F, 1, 2, 2);
|
||||
w2.setRotationPoint(-5F, 14F, -6F);
|
||||
w2.setTextureSize(128, 128);
|
||||
w2.mirror = true;
|
||||
setRotation(w2, 0.7853982F, 0F, 0F);
|
||||
w22 = new ModelRenderer(this, 0, 55);
|
||||
w22.addBox(0F, -1F, -1F, 1, 2, 2);
|
||||
w22.setRotationPoint(-5F, 14F, -6F);
|
||||
w22.setTextureSize(128, 128);
|
||||
w22.mirror = true;
|
||||
setRotation(w22, 0F, 0F, 0F);
|
||||
w2cc = new ModelRenderer(this, 0, 50);
|
||||
w2cc.addBox(0F, 1.3F, -1F, 1, 1, 2);
|
||||
w2cc.setRotationPoint(-5F, 14F, -6F);
|
||||
w2cc.setTextureSize(128, 128);
|
||||
w2cc.mirror = true;
|
||||
setRotation(w2cc, 1.570796F, 0F, 0F);
|
||||
w2cc1 = new ModelRenderer(this, 0, 50);
|
||||
w2cc1.addBox(0F, 1.3F, -1F, 1, 1, 2);
|
||||
w2cc1.setRotationPoint(-5F, 14F, -6F);
|
||||
w2cc1.setTextureSize(128, 128);
|
||||
w2cc1.mirror = true;
|
||||
setRotation(w2cc1, 0.7853982F, 0F, 0F);
|
||||
w2cc2 = new ModelRenderer(this, 0, 50);
|
||||
w2cc2.addBox(0F, 1.3F, -1F, 1, 1, 2);
|
||||
w2cc2.setRotationPoint(-5F, 14F, -6F);
|
||||
w2cc2.setTextureSize(128, 128);
|
||||
w2cc2.mirror = true;
|
||||
setRotation(w2cc2, 0F, 0F, 0F);
|
||||
w2cc3 = new ModelRenderer(this, 0, 50);
|
||||
w2cc3.addBox(0F, 1.3F, -1F, 1, 1, 2);
|
||||
w2cc3.setRotationPoint(-5F, 14F, -6F);
|
||||
w2cc3.setTextureSize(128, 128);
|
||||
w2cc3.mirror = true;
|
||||
setRotation(w2cc3, -0.7853982F, 0F, 0F);
|
||||
w2cc4 = new ModelRenderer(this, 0, 50);
|
||||
w2cc4.addBox(0F, 1.3F, -1F, 1, 1, 2);
|
||||
w2cc4.setRotationPoint(-5F, 14F, -6F);
|
||||
w2cc4.setTextureSize(128, 128);
|
||||
w2cc4.mirror = true;
|
||||
setRotation(w2cc4, -1.570796F, 0F, 0F);
|
||||
w2cc5 = new ModelRenderer(this, 0, 50);
|
||||
w2cc5.addBox(0F, 1.3F, -1F, 1, 1, 2);
|
||||
w2cc5.setRotationPoint(-5F, 14F, -6F);
|
||||
w2cc5.setTextureSize(128, 128);
|
||||
w2cc5.mirror = true;
|
||||
setRotation(w2cc5, -2.356194F, 0F, 0F);
|
||||
w2cc6 = new ModelRenderer(this, 0, 50);
|
||||
w2cc6.addBox(0F, 1.3F, -1F, 1, 1, 2);
|
||||
w2cc6.setRotationPoint(-5F, 14F, -6F);
|
||||
w2cc6.setTextureSize(128, 128);
|
||||
w2cc6.mirror = true;
|
||||
setRotation(w2cc6, 3.141593F, 0F, 0F);
|
||||
w2cc7 = new ModelRenderer(this, 0, 50);
|
||||
w2cc7.addBox(0F, 1.3F, -1F, 1, 1, 2);
|
||||
w2cc7.setRotationPoint(-5F, 14F, -6F);
|
||||
w2cc7.setTextureSize(128, 128);
|
||||
w2cc7.mirror = true;
|
||||
setRotation(w2cc7, -3.926991F, 0F, 0F);
|
||||
side7 = new ModelRenderer(this, 0, 65);
|
||||
side7.addBox(-2.5F, -4F, 3F, 5, 7, 4);
|
||||
side7.setRotationPoint(0F, 21F, 0F);
|
||||
side7.setTextureSize(128, 128);
|
||||
side7.mirror = true;
|
||||
setRotation(side7, 0F, 3.141593F, 0F);
|
||||
side8 = new ModelRenderer(this, 25, 111);
|
||||
side8.addBox(-2.5F, 0F, 3F, 5, 11, 3);
|
||||
side8.setRotationPoint(0F, 13F, 0F);
|
||||
side8.setTextureSize(128, 128);
|
||||
side8.mirror = true;
|
||||
setRotation(side8, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float f5)
|
||||
{
|
||||
Body.render(f5);
|
||||
pipecc1.render(f5);
|
||||
pipecc3.render(f5);
|
||||
|
||||
joint.render(f5);
|
||||
|
||||
wheelBrace.render(f5);
|
||||
piston_top.render(f5);
|
||||
piston.render(f5);
|
||||
wheelBrace2.render(f5);
|
||||
joint2.render(f5);
|
||||
|
||||
side7.render(f5);
|
||||
side8.render(f5);
|
||||
}
|
||||
|
||||
public void renderMotion(float f5, int i)
|
||||
{
|
||||
//wheel 1
|
||||
wheelcenter.render(f5);
|
||||
wheelcenter2.render(f5);
|
||||
wheelcc0.render(f5);
|
||||
wheelcc1.render(f5);
|
||||
wheelcc2.render(f5);
|
||||
wheelcc3.render(f5);
|
||||
wheelcc4.render(f5);
|
||||
wheelcc5.render(f5);
|
||||
wheelcc6.render(f5);
|
||||
wheelcc7.render(f5);
|
||||
// wheel 2
|
||||
w2.render(f5);
|
||||
w22.render(f5);
|
||||
w2cc.render(f5);
|
||||
w2cc1.render(f5);
|
||||
w2cc2.render(f5);
|
||||
w2cc3.render(f5);
|
||||
w2cc4.render(f5);
|
||||
w2cc5.render(f5);
|
||||
w2cc6.render(f5);
|
||||
w2cc7.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
// Date: 1/7/2013 12:20:13 PM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package liquidmechanics.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelReleaseValve extends ModelBase
|
||||
{
|
||||
|
||||
// fields
|
||||
ModelRenderer ValveStem;
|
||||
ModelRenderer ValveWheelCenter;
|
||||
ModelRenderer ValveRest;
|
||||
ModelRenderer WheelBar3;
|
||||
ModelRenderer WheelBar4;
|
||||
ModelRenderer Wheel;
|
||||
ModelRenderer Wheel2;
|
||||
ModelRenderer Wheel3;
|
||||
ModelRenderer Wheel4;
|
||||
ModelRenderer WheelB;
|
||||
ModelRenderer WheelB2;
|
||||
ModelRenderer WheelB3;
|
||||
ModelRenderer WheelB4;
|
||||
ModelRenderer[] renders;
|
||||
|
||||
public ModelReleaseValve()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 32;
|
||||
|
||||
ValveStem = new ModelRenderer(this, 50, 21);
|
||||
ValveStem.addBox(-1F, -6F, -1F, 2, 3, 2);
|
||||
ValveStem.setRotationPoint(0F, 16F, 0F);
|
||||
ValveStem.setTextureSize(128, 32);
|
||||
ValveStem.mirror = true;
|
||||
setRotation(ValveStem, 0F, 0F, 0F);
|
||||
ValveWheelCenter = new ModelRenderer(this, 50, 17);
|
||||
ValveWheelCenter.addBox(-0.5F, -7.5F, -0.5F, 1, 2, 1);
|
||||
ValveWheelCenter.setRotationPoint(0F, 16F, 0F);
|
||||
ValveWheelCenter.setTextureSize(128, 32);
|
||||
ValveWheelCenter.mirror = true;
|
||||
setRotation(ValveWheelCenter, 0F, 0F, 0F);
|
||||
ValveRest = new ModelRenderer(this, 50, 27);
|
||||
ValveRest.addBox(-1.5F, -4F, -1.5F, 3, 1, 3);
|
||||
ValveRest.setRotationPoint(0F, 16F, 0F);
|
||||
ValveRest.setTextureSize(128, 32);
|
||||
ValveRest.mirror = true;
|
||||
setRotation(ValveRest, 0F, 0F, 0F);
|
||||
WheelBar3 = new ModelRenderer(this, 85, 15);
|
||||
WheelBar3.addBox(-3F, -7F, -0.5F, 6, 1, 1);
|
||||
WheelBar3.setRotationPoint(0F, 16F, 0F);
|
||||
WheelBar3.setTextureSize(128, 32);
|
||||
WheelBar3.mirror = true;
|
||||
setRotation(WheelBar3, 0F, 0.7853982F, 0F);
|
||||
WheelBar4 = new ModelRenderer(this, 85, 18);
|
||||
WheelBar4.addBox(-3F, -7F, -0.5F, 6, 1, 1);
|
||||
WheelBar4.setRotationPoint(0F, 16F, 0F);
|
||||
WheelBar4.setTextureSize(128, 32);
|
||||
WheelBar4.mirror = true;
|
||||
setRotation(WheelBar4, 0F, -0.7853982F, 0F);
|
||||
Wheel = new ModelRenderer(this, 50, 13);
|
||||
Wheel.addBox(-1.5F, -7.5F, -3.5F, 3, 1, 1);
|
||||
Wheel.setRotationPoint(0F, 16F, 0F);
|
||||
Wheel.setTextureSize(128, 32);
|
||||
Wheel.mirror = true;
|
||||
setRotation(Wheel, 0F, -0.7853982F, 0F);
|
||||
Wheel2 = new ModelRenderer(this, 50, 13);
|
||||
Wheel2.addBox(-1.5F, -7.5F, -3.5F, 3, 1, 1);
|
||||
Wheel2.setRotationPoint(0F, 16F, 0F);
|
||||
Wheel2.setTextureSize(128, 32);
|
||||
Wheel2.mirror = true;
|
||||
setRotation(Wheel2, 0F, 2.356194F, 0F);
|
||||
Wheel3 = new ModelRenderer(this, 50, 13);
|
||||
Wheel3.addBox(-1.5F, -7.5F, -3.5F, 3, 1, 1);
|
||||
Wheel3.setRotationPoint(0F, 16F, 0F);
|
||||
Wheel3.setTextureSize(128, 32);
|
||||
Wheel3.mirror = true;
|
||||
setRotation(Wheel3, 0F, -2.356194F, 0F);
|
||||
Wheel4 = new ModelRenderer(this, 50, 13);
|
||||
Wheel4.addBox(-1.5F, -7.5F, -3.5F, 3, 1, 1);
|
||||
Wheel4.setRotationPoint(0F, 16F, 0F);
|
||||
Wheel4.setTextureSize(128, 32);
|
||||
Wheel4.mirror = true;
|
||||
setRotation(Wheel4, 0F, 0.7853982F, 0F);
|
||||
WheelB = new ModelRenderer(this, 50, 13);
|
||||
WheelB.addBox(-1.5F, -7.5F, 2.5F, 3, 1, 1);
|
||||
WheelB.setRotationPoint(0F, 16F, 0F);
|
||||
WheelB.setTextureSize(128, 32);
|
||||
WheelB.mirror = true;
|
||||
setRotation(WheelB, 0F, -3.141593F, 0F);
|
||||
WheelB2 = new ModelRenderer(this, 50, 13);
|
||||
WheelB2.addBox(-1.5F, -7.5F, 2.5F, 3, 1, 1);
|
||||
WheelB2.setRotationPoint(0F, 16F, 0F);
|
||||
WheelB2.setTextureSize(128, 32);
|
||||
WheelB2.mirror = true;
|
||||
setRotation(WheelB2, 0F, 0F, 0F);
|
||||
WheelB3 = new ModelRenderer(this, 50, 13);
|
||||
WheelB3.addBox(-1.5F, -7.5F, 2.5F, 3, 1, 1);
|
||||
WheelB3.setRotationPoint(0F, 16F, 0F);
|
||||
WheelB3.setTextureSize(128, 32);
|
||||
WheelB3.mirror = true;
|
||||
setRotation(WheelB3, 0F, 1.570796F, 0F);
|
||||
WheelB4 = new ModelRenderer(this, 50, 13);
|
||||
WheelB4.addBox(-1.5F, -7.5F, 2.5F, 3, 1, 1);
|
||||
WheelB4.setRotationPoint(0F, 16F, 0F);
|
||||
WheelB4.setTextureSize(128, 32);
|
||||
WheelB4.mirror = true;
|
||||
setRotation(WheelB4, 0F, -1.570796F, 0F);
|
||||
renders = new ModelRenderer[] { ValveStem, ValveWheelCenter, ValveRest, WheelBar3, WheelBar4, Wheel, Wheel2, Wheel3, Wheel4, WheelB, WheelB2, WheelB3, WheelB4 };
|
||||
|
||||
}
|
||||
|
||||
public void render()
|
||||
{
|
||||
ModelRenderer[] renderSet = renders;
|
||||
for(int i = 0; i < renders.length;i++)
|
||||
{
|
||||
renderSet[i].render(0.0625F);
|
||||
}
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
// Date: 1/22/2013 12:21:32 AM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package liquidmechanics.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelSink extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Base;
|
||||
ModelRenderer FrontLip;
|
||||
ModelRenderer BottomLip;
|
||||
ModelRenderer RightLip;
|
||||
ModelRenderer LeftLip;
|
||||
ModelRenderer BLip;
|
||||
ModelRenderer Edge;
|
||||
ModelRenderer Edge2;
|
||||
ModelRenderer Water;
|
||||
|
||||
public ModelSink()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
Base = new ModelRenderer(this, 0, 0);
|
||||
Base.addBox(-7F, 0F, -7F, 14, 12, 14);
|
||||
Base.setRotationPoint(0F, 12F, 0F);
|
||||
Base.setTextureSize(128, 128);
|
||||
Base.mirror = true;
|
||||
setRotation(Base, 0F, 0F, 0F);
|
||||
FrontLip = new ModelRenderer(this, 10, 62);
|
||||
FrontLip.addBox(-8F, -4F, -8F, 16, 4, 2);
|
||||
FrontLip.setRotationPoint(0F, 12F, 0F);
|
||||
FrontLip.setTextureSize(128, 128);
|
||||
FrontLip.mirror = true;
|
||||
setRotation(FrontLip, 0F, 0F, 0F);
|
||||
BottomLip = new ModelRenderer(this, 5, 37);
|
||||
BottomLip.addBox(-8F, -4F, 4F, 16, 4, 4);
|
||||
BottomLip.setRotationPoint(0F, 12F, 0F);
|
||||
BottomLip.setTextureSize(128, 128);
|
||||
BottomLip.mirror = true;
|
||||
setRotation(BottomLip, 0F, 0F, 0F);
|
||||
RightLip = new ModelRenderer(this, 0, 47);
|
||||
RightLip.addBox(-8F, -4F, -6F, 2, 4, 10);
|
||||
RightLip.setRotationPoint(0F, 12F, 0F);
|
||||
RightLip.setTextureSize(128, 128);
|
||||
RightLip.mirror = true;
|
||||
setRotation(RightLip, 0F, 0F, 0F);
|
||||
LeftLip = new ModelRenderer(this, 25, 47);
|
||||
LeftLip.addBox(6F, -4F, -6F, 2, 4, 10);
|
||||
LeftLip.setRotationPoint(0F, 12F, 0F);
|
||||
LeftLip.setTextureSize(128, 128);
|
||||
LeftLip.mirror = true;
|
||||
setRotation(LeftLip, 0F, 0F, 0F);
|
||||
BLip = new ModelRenderer(this, 9, 32);
|
||||
BLip.addBox(-1F, -1F, 4F, 2, 2, 2);
|
||||
BLip.setRotationPoint(0F, 12F, 0F);
|
||||
BLip.setTextureSize(128, 128);
|
||||
BLip.mirror = true;
|
||||
setRotation(BLip, 0.5061455F, 0F, 0F);
|
||||
Edge = new ModelRenderer(this, 5, 64);
|
||||
Edge.addBox(0F, 0F, 0F, 1, 12, 1);
|
||||
Edge.setRotationPoint(7F, 12F, 7F);
|
||||
Edge.setTextureSize(128, 128);
|
||||
Edge.mirror = true;
|
||||
setRotation(Edge, 0F, 0F, 0F);
|
||||
Edge2 = new ModelRenderer(this, 0, 64);
|
||||
Edge2.addBox(0F, 0F, 0F, 1, 12, 1);
|
||||
Edge2.setRotationPoint(-8F, 12F, 7F);
|
||||
Edge2.setTextureSize(128, 128);
|
||||
Edge2.mirror = true;
|
||||
setRotation(Edge2, 0F, 0F, 0F);
|
||||
Water = new ModelRenderer(this, 0, 0);
|
||||
Water.addBox(-6F, 0F, -6F, 12, 0, 10);
|
||||
Water.setRotationPoint(0F, 12F, 0F);
|
||||
Water.setTextureSize(128, 128);
|
||||
Water.mirror = true;
|
||||
setRotation(Water, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float f5)
|
||||
{
|
||||
Base.render(f5);
|
||||
FrontLip.render(f5);
|
||||
BottomLip.render(f5);
|
||||
RightLip.render(f5);
|
||||
LeftLip.render(f5);
|
||||
BLip.render(f5);
|
||||
Edge.render(f5);
|
||||
Edge2.render(f5);
|
||||
|
||||
}
|
||||
|
||||
public void renderLiquid(float f5,float level)
|
||||
{
|
||||
Water.setRotationPoint(0F, 12F - level, 0F);
|
||||
Water.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.client.model.ModelGearRod;
|
||||
import liquidmechanics.client.model.ModelGenerator;
|
||||
import liquidmechanics.client.model.ModelLargePipe;
|
||||
import liquidmechanics.client.model.ModelLiquidTank;
|
||||
import liquidmechanics.client.model.ModelPump;
|
||||
import liquidmechanics.client.model.ModelReleaseValve;
|
||||
import liquidmechanics.client.model.ModelSink;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockRenderHelper implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static BlockRenderHelper instance = new BlockRenderHelper();
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
private ModelPump modelPump = new ModelPump();
|
||||
private ModelGearRod modelRod = new ModelGearRod();
|
||||
private ModelGenerator modelGen = new ModelGenerator();
|
||||
private ModelLargePipe SixPipe = new ModelLargePipe();
|
||||
private ModelLiquidTank tank = new ModelLiquidTank();
|
||||
private ModelReleaseValve valve = new ModelReleaseValve();
|
||||
private ModelSink sink = new ModelSink();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (block.blockID == LiquidMechanics.blockMachine.blockID && metadata < 4)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float) 1.1F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png"));
|
||||
modelPump.render(0.0725F);
|
||||
modelPump.renderMotion(0.0725F,0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (block.blockID == LiquidMechanics.blockSink.blockID)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float) .8F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(LiquidMechanics.RESOURCE_PATH + "Sink.png"));
|
||||
sink.render(0.0565F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (block.blockID == LiquidMechanics.blockTank.blockID)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float) 1.0F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderTank.getTankTexture(metadata)));
|
||||
tank.renderMain(0.0625F);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderTank.getGuageTexture(metadata,4)));
|
||||
tank.renderMeter(null, 0.0565F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (block.blockID == LiquidMechanics.blockRod.blockID)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float) 1.5F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(LiquidMechanics.RESOURCE_PATH + "mechanical/GearRod.png"));
|
||||
modelRod.render(0.0825F, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (block.blockID == LiquidMechanics.blockGenerator.blockID)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float) 1.0F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(LiquidMechanics.RESOURCE_PATH + "mechanical/Generator.png"));
|
||||
modelGen.render(null);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldRender3DInInventory()
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getRenderId()
|
||||
{
|
||||
return renderID;
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.client.model.ModelGearRod;
|
||||
import liquidmechanics.client.model.ModelGenerator;
|
||||
import liquidmechanics.client.model.ModelLargePipe;
|
||||
import liquidmechanics.client.model.ModelLiquidTank;
|
||||
import liquidmechanics.client.model.ModelReleaseValve;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
/** special tanks to Mekanism github */
|
||||
public class ItemRenderHelper implements IItemRenderer
|
||||
{
|
||||
private ModelGearRod modelRod = new ModelGearRod();
|
||||
private ModelGenerator modelGen = new ModelGenerator();
|
||||
private ModelLargePipe SixPipe = new ModelLargePipe();
|
||||
private ModelLiquidTank tank = new ModelLiquidTank();
|
||||
private ModelReleaseValve valve = new ModelReleaseValve();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
if (item.itemID == LiquidMechanics.blockPipe.blockID)
|
||||
{
|
||||
this.renderPipeItem((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED);
|
||||
}
|
||||
if (item.itemID == LiquidMechanics.blockReleaseValve.blockID)
|
||||
{
|
||||
this.renderReleaseValve((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void renderPipeItem(RenderBlocks renderer, int meta, boolean equ)
|
||||
{
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderPipe.getPipeTexture(meta)));
|
||||
|
||||
if (!equ)
|
||||
{
|
||||
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
|
||||
SixPipe.renderRight();
|
||||
SixPipe.renderLeft();
|
||||
SixPipe.renderMiddle();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
|
||||
SixPipe.renderFront();
|
||||
SixPipe.renderBack();
|
||||
SixPipe.renderMiddle();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderReleaseValve(RenderBlocks renderer, int meta, boolean equ)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderPipe.getPipeTexture(15)));
|
||||
if (!equ)
|
||||
{
|
||||
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
|
||||
SixPipe.renderRight();
|
||||
SixPipe.renderLeft();
|
||||
SixPipe.renderMiddle();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
|
||||
SixPipe.renderFront();
|
||||
SixPipe.renderBack();
|
||||
SixPipe.renderMiddle();
|
||||
}
|
||||
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(LiquidMechanics.RESOURCE_PATH + "ReleaseValve.png"));
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
if (!equ)
|
||||
{
|
||||
GL11.glTranslatef(0, -2.0F, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(0, -2.0F, 0);
|
||||
}
|
||||
valve.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.client.model.ModelGearRod;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityRod;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class RenderGearRod extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelGearRod model;
|
||||
|
||||
public RenderGearRod()
|
||||
{
|
||||
model = new ModelGearRod();
|
||||
}
|
||||
|
||||
public void renderAModelAt(TileEntityRod tileEntity, double d, double d1, double d2, float f)
|
||||
{
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "mechanical/GearRod.png");
|
||||
GL11.glPushMatrix();
|
||||
|
||||
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
if (meta == 0)
|
||||
{
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 0.5F, (float) d2 + 1.5F);
|
||||
}
|
||||
else if (meta == 1)
|
||||
{
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 0.5F, (float) d2 - 0.5F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
}
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
GL11.glRotatef(90f, 1f, 0f, 0f);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(-90f, 1f, 0f, 0f);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 5:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 4:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
model.render(0.0625F, tileEntity.pos);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.renderAModelAt((TileEntityRod) tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.client.model.ModelGenerator;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class RenderGenerator extends TileEntitySpecialRenderer
|
||||
{
|
||||
int type = 0;
|
||||
private ModelGenerator model;
|
||||
|
||||
public RenderGenerator()
|
||||
{
|
||||
model = new ModelGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3)
|
||||
{
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "mechanical/Generator.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.45F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
model.render(tileEntity);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.client.model.ModelLargePipe;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderPipe extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelLargePipe SixPipe;
|
||||
private TileEntity[] ents = new TileEntity[6];
|
||||
|
||||
public RenderPipe()
|
||||
{
|
||||
SixPipe = new ModelLargePipe();
|
||||
}
|
||||
|
||||
public void renderAModelAt(TileEntity te, double d, double d1, double d2, float f)
|
||||
{
|
||||
// Texture file
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
int meta = 0;
|
||||
if (te instanceof TileEntityPipe)
|
||||
{
|
||||
meta = te.getBlockMetadata();
|
||||
ents = ((TileEntityPipe) te).connectedBlocks;
|
||||
}
|
||||
this.render(meta, ents);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
public static String getPipeTexture(int meta)
|
||||
{
|
||||
return LiquidMechanics.RESOURCE_PATH + "pipes/"+ColorCode.get(meta).getName()+"Pipe.png";
|
||||
}
|
||||
public void render(int meta, TileEntity[] ents)
|
||||
{
|
||||
bindTextureByName(this.getPipeTexture(meta));
|
||||
if (ents[0] != null)
|
||||
SixPipe.renderBottom();
|
||||
if (ents[1] != null)
|
||||
SixPipe.renderTop();
|
||||
if (ents[3] != null)
|
||||
SixPipe.renderFront();
|
||||
if (ents[2] != null)
|
||||
SixPipe.renderBack();
|
||||
if (ents[5] != null)
|
||||
SixPipe.renderRight();
|
||||
if (ents[4] != null)
|
||||
SixPipe.renderLeft();
|
||||
SixPipe.renderMiddle();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.renderAModelAt((TileEntityPipe) tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.client.model.ModelPump;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderPump extends TileEntitySpecialRenderer
|
||||
{
|
||||
int type = 0;
|
||||
private ModelPump model;
|
||||
|
||||
public RenderPump()
|
||||
{
|
||||
model = new ModelPump();
|
||||
}
|
||||
|
||||
public void renderAModelAt(TileEntityPump te, double d, double d1, double d2, float f)
|
||||
{
|
||||
int meta = te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
|
||||
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
switch (meta)
|
||||
{
|
||||
case 2:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 0:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
model.render(0.0625F);
|
||||
model.renderMotion(0.0625F, te.pos);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.renderAModelAt((TileEntityPump) tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.client.model.ModelLargePipe;
|
||||
import liquidmechanics.client.model.ModelReleaseValve;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityReleaseValve;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderReleaseValve extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelLargePipe SixPipe;
|
||||
private ModelReleaseValve valve;
|
||||
private TileEntity[] ents = new TileEntity[6];
|
||||
|
||||
public RenderReleaseValve()
|
||||
{
|
||||
SixPipe = new ModelLargePipe();
|
||||
valve = new ModelReleaseValve();
|
||||
}
|
||||
|
||||
public void renderAModelAt(TileEntity te, double d, double d1, double d2, float f)
|
||||
{
|
||||
// Texture file
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
ForgeDirection dir = ForgeDirection.UNKNOWN;
|
||||
if (te instanceof TileEntityReleaseValve)
|
||||
{
|
||||
ents = ((TileEntityReleaseValve) te).connected;
|
||||
}
|
||||
bindTextureByName(this.getPipeTexture(15));
|
||||
if (ents[0] != null)
|
||||
SixPipe.renderBottom();
|
||||
if (ents[1] != null)
|
||||
SixPipe.renderTop();
|
||||
if (ents[3] != null)
|
||||
SixPipe.renderFront();
|
||||
if (ents[2] != null)
|
||||
SixPipe.renderBack();
|
||||
if (ents[5] != null)
|
||||
SixPipe.renderRight();
|
||||
if (ents[4] != null)
|
||||
SixPipe.renderLeft();
|
||||
SixPipe.renderMiddle();
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "ReleaseValve.png");
|
||||
if(ents[1] == null)valve.render();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
public static String getPipeTexture(int meta)
|
||||
{
|
||||
return LiquidMechanics.RESOURCE_PATH + "pipes/" + ColorCode.get(meta).getName() + "Pipe.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.renderAModelAt(tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package liquidmechanics.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;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.client.model.ModelSink;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntitySink;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderSink extends TileEntitySpecialRenderer
|
||||
{
|
||||
int type = 0;
|
||||
private ModelSink model;
|
||||
|
||||
public RenderSink()
|
||||
{
|
||||
model = new ModelSink();
|
||||
}
|
||||
|
||||
public void renderWater(LiquidStack stack)
|
||||
{
|
||||
if (stack == null || stack.amount <= 1) { return; }
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "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;
|
||||
|
||||
model.renderLiquid(0.0625F, p);
|
||||
}
|
||||
|
||||
public void renderAModelAt(TileEntitySink te, double d, double d1, double d2, float f)
|
||||
{
|
||||
int meta = te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
|
||||
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "Sink.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
switch (meta)
|
||||
{
|
||||
case 3:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 0:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
model.render(0.0625F);
|
||||
renderWater(te.getStack());
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.renderAModelAt((TileEntitySink) tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.client.model.ModelLiquidTank;
|
||||
import liquidmechanics.client.model.ModelLiquidTankCorner;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderTank extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelLiquidTank model;
|
||||
private ModelLiquidTankCorner modelC;
|
||||
|
||||
public RenderTank()
|
||||
{
|
||||
model = new ModelLiquidTank();
|
||||
modelC = new ModelLiquidTankCorner();
|
||||
}
|
||||
|
||||
public void renderAModelAt(TileEntityTank te, double d, double d1, double d2, float f)
|
||||
{
|
||||
int meta = te.getBlockMetadata();
|
||||
int guageMeta = meta;
|
||||
LiquidStack stack = te.getStack();
|
||||
int pos = 0;
|
||||
if (stack != null)
|
||||
{
|
||||
pos = Math.min((stack.amount / LiquidContainerRegistry.BUCKET_VOLUME), 4);
|
||||
if (meta == ColorCode.NONE.ordinal())
|
||||
{
|
||||
guageMeta = ColorCode.get(stack).ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
||||
if (connectionHelper.corner(te) > 0)
|
||||
{
|
||||
bindTextureByName(this.getCornerTexture(meta));
|
||||
int corner = connectionHelper.corner(te);
|
||||
switch (corner)
|
||||
{
|
||||
case 2:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 4:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
modelC.render(0.0625F);
|
||||
}
|
||||
else
|
||||
{
|
||||
bindTextureByName(this.getTankTexture(meta));
|
||||
model.renderMain(0.0625F);
|
||||
bindTextureByName(this.getGuageTexture(guageMeta, pos));
|
||||
model.renderMeter(te, 0.0625F);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
public static String getTankTexture(int meta)
|
||||
{
|
||||
String type = "";
|
||||
switch (meta)
|
||||
{
|
||||
case 1:
|
||||
type = "Lava";
|
||||
break;
|
||||
case 4:
|
||||
type = "Water";
|
||||
break;
|
||||
case 13:
|
||||
type = "Milk";
|
||||
break;
|
||||
case 14:
|
||||
type = "Steam";
|
||||
break;
|
||||
default:
|
||||
type = "";
|
||||
break;
|
||||
}
|
||||
|
||||
return LiquidMechanics.RESOURCE_PATH + "tanks/" + type + "Tank.png";
|
||||
|
||||
}
|
||||
|
||||
public static String getGuageTexture(int meta, int pos)
|
||||
{
|
||||
String type = "";
|
||||
switch (meta)
|
||||
{
|
||||
case 1:
|
||||
type = "Lava";
|
||||
break;
|
||||
case 12:
|
||||
type = "Fuel";
|
||||
break;
|
||||
default:
|
||||
type = "";
|
||||
break;
|
||||
}
|
||||
|
||||
return LiquidMechanics.RESOURCE_PATH + "tanks/guage/" + pos + type + ".png";
|
||||
}
|
||||
|
||||
public static String getCornerTexture(int meta)
|
||||
{
|
||||
String type = "";
|
||||
switch (meta)
|
||||
{
|
||||
case 1:
|
||||
type = "Lava";
|
||||
break;
|
||||
case 4:
|
||||
type = "Water";
|
||||
break;
|
||||
case 13:
|
||||
type = "Milk";
|
||||
break;
|
||||
default:
|
||||
type = "";
|
||||
break;
|
||||
}
|
||||
return LiquidMechanics.RESOURCE_PATH + "tanks/Corner" + type + ".png";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.renderAModelAt((TileEntityTank) tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package liquidmechanics.common;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class CommonProxy implements IGuiHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void preInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,327 +0,0 @@
|
|||
package liquidmechanics.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.block.BlockGenerator;
|
||||
import liquidmechanics.common.block.BlockPipe;
|
||||
import liquidmechanics.common.block.BlockPumpMachine;
|
||||
import liquidmechanics.common.block.BlockReleaseValve;
|
||||
import liquidmechanics.common.block.BlockRod;
|
||||
import liquidmechanics.common.block.BlockSink;
|
||||
import liquidmechanics.common.block.BlockTank;
|
||||
import liquidmechanics.common.block.BlockWasteLiquid;
|
||||
import liquidmechanics.common.item.ItemGuage;
|
||||
import liquidmechanics.common.item.ItemLiquidMachine;
|
||||
import liquidmechanics.common.item.ItemParts;
|
||||
import liquidmechanics.common.item.ItemParts.Parts;
|
||||
import liquidmechanics.common.item.ItemPipe;
|
||||
import liquidmechanics.common.item.ItemReleaseValve;
|
||||
import liquidmechanics.common.item.ItemTank;
|
||||
import liquidmechanics.common.tileentity.TileEntityGenerator;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
import liquidmechanics.common.tileentity.TileEntityReleaseValve;
|
||||
import liquidmechanics.common.tileentity.TileEntityRod;
|
||||
import liquidmechanics.common.tileentity.TileEntitySink;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
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;
|
||||
import universalelectricity.prefab.TranslationHelper;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import cpw.mods.fml.common.DummyModContainer;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Used in the creation of a new mod class
|
||||
*
|
||||
* @author Rseifert
|
||||
*/
|
||||
@Mod(modid = LiquidMechanics.NAME, name = LiquidMechanics.NAME, version = LiquidMechanics.VERSION, dependencies = "after:BasicComponents")
|
||||
@NetworkMod(channels = { LiquidMechanics.CHANNEL }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
|
||||
public class LiquidMechanics extends DummyModContainer
|
||||
{
|
||||
// TODO Change in Version Release
|
||||
public static final String VERSION = "0.2.7";
|
||||
|
||||
// Constants
|
||||
public static final String NAME = "LiquidMechanics";
|
||||
public static final String CHANNEL = "liquidMech";
|
||||
|
||||
public static final String PATH = "/liquidmechanics/";
|
||||
public static final String RESOURCE_PATH = PATH + "resource/";
|
||||
public static final String BLOCK_TEXTURE_FILE = RESOURCE_PATH + "blocks.png";
|
||||
public static final String ITEM_TEXTURE_FILE = RESOURCE_PATH + "items.png";
|
||||
public static final String LANGUAGE_PATH = RESOURCE_PATH + "lang/";
|
||||
|
||||
private static final String[] LANGUAGES_SUPPORTED = new String[] { "en_US" };
|
||||
|
||||
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir() + "/UniversalElectricity/", NAME + ".cfg"));
|
||||
|
||||
public final static int BLOCK_ID_PREFIX = 3100;
|
||||
public final static int ITEM_ID_PREFIX = 13200;
|
||||
|
||||
public static Block blockPipe;
|
||||
public static Block blockTank;
|
||||
public static Block blockMachine;
|
||||
public static Block blockRod;
|
||||
public static Block blockGenerator;
|
||||
public static Block blockReleaseValve;
|
||||
public static Block blockSink;
|
||||
|
||||
public static Block blockWasteLiquid;
|
||||
|
||||
public static LiquidStack liquidSteam;
|
||||
|
||||
public static Item itemParts;
|
||||
// public static Item itemPipes;
|
||||
public static Item itemGauge;
|
||||
|
||||
@SidedProxy(clientSide = "liquidmechanics.client.ClientProxy", serverSide = "liquidmechanics.common.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Instance(NAME)
|
||||
public static LiquidMechanics instance;
|
||||
|
||||
public static Logger FMLog = Logger.getLogger(NAME);
|
||||
|
||||
@PreInit
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
FMLog.setParent(FMLLog.getLogger());
|
||||
FMLog.info("Initializing...");
|
||||
MinecraftForge.EVENT_BUS.register(new LiquidHandler());
|
||||
|
||||
instance = this;
|
||||
CONFIGURATION.load();
|
||||
|
||||
// Blocks
|
||||
blockPipe = new BlockPipe(this.CONFIGURATION.getBlock("Pipes", BLOCK_ID_PREFIX).getInt());
|
||||
blockMachine = new BlockPumpMachine(this.CONFIGURATION.getBlock("Machines", BLOCK_ID_PREFIX + 1).getInt());
|
||||
blockRod = new BlockRod(this.CONFIGURATION.getBlock("Mechanical Rod", BLOCK_ID_PREFIX + 3).getInt());
|
||||
blockGenerator = new BlockGenerator((this.CONFIGURATION.getBlock("Generator", BLOCK_ID_PREFIX + 4).getInt()));
|
||||
blockReleaseValve = new BlockReleaseValve((this.CONFIGURATION.getBlock("Release Valve", BLOCK_ID_PREFIX + 5).getInt()));
|
||||
blockTank = new BlockTank(this.CONFIGURATION.getBlock("Tank", BLOCK_ID_PREFIX + 6).getInt());
|
||||
blockWasteLiquid = new BlockWasteLiquid(this.CONFIGURATION.getBlock("WasteLiquid", BLOCK_ID_PREFIX + 7).getInt());
|
||||
blockSink = new BlockSink(this.CONFIGURATION.getBlock("Sink", BLOCK_ID_PREFIX + 8).getInt());
|
||||
|
||||
// Items
|
||||
itemParts = new ItemParts(this.CONFIGURATION.getItem("Parts", ITEM_ID_PREFIX).getInt());
|
||||
// itemPipes = new ItemPipe(this.CONFIGURATION.getItem("PipeItem",
|
||||
// ITEM_ID_PREFIX + 1).getInt());
|
||||
|
||||
// Valve item
|
||||
itemGauge = new ItemGuage(this.CONFIGURATION.getItem("PipeGuage", ITEM_ID_PREFIX + 3).getInt());
|
||||
|
||||
CONFIGURATION.save();
|
||||
|
||||
proxy.preInit();
|
||||
|
||||
// block registry
|
||||
GameRegistry.registerBlock(blockPipe, ItemPipe.class, "lmPipe");
|
||||
GameRegistry.registerBlock(blockReleaseValve, ItemReleaseValve.class, "eValve");
|
||||
GameRegistry.registerBlock(blockRod, "mechRod");
|
||||
GameRegistry.registerBlock(blockGenerator, "lmGen");
|
||||
GameRegistry.registerBlock(blockMachine, ItemLiquidMachine.class, "lmMachines");
|
||||
GameRegistry.registerBlock(blockTank, ItemTank.class, "lmTank");
|
||||
GameRegistry.registerBlock(blockSink, "lmSink");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Init
|
||||
public void Init(FMLInitializationEvent event)
|
||||
{
|
||||
FMLog.info("Loading...");
|
||||
proxy.Init();
|
||||
// TileEntities
|
||||
GameRegistry.registerTileEntity(TileEntityPipe.class, "lmPipeTile");
|
||||
GameRegistry.registerTileEntity(TileEntityPump.class, "lmPumpTile");
|
||||
GameRegistry.registerTileEntity(TileEntityRod.class, "lmRodTile");
|
||||
GameRegistry.registerTileEntity(TileEntityReleaseValve.class, "lmeValve");
|
||||
GameRegistry.registerTileEntity(TileEntityTank.class, "lmTank");
|
||||
GameRegistry.registerTileEntity(TileEntityGenerator.class, "lmGen");
|
||||
GameRegistry.registerTileEntity(TileEntitySink.class, "lmSink");
|
||||
FMLog.info("Fluid Mechanics Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages.");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@PostInit
|
||||
public void PostInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
FMLog.info("Finalizing...");
|
||||
proxy.postInit();
|
||||
TabLiquidMechanics.setItemStack(new ItemStack(blockPipe, 1, 4));
|
||||
// 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
|
||||
GameRegistry.addRecipe(new ItemStack(this.itemGauge, 1, 0), new Object[] {
|
||||
"TVT", " T ",
|
||||
'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()),
|
||||
'T', new ItemStack(itemParts, 1, Parts.Iron.ordinal()) });
|
||||
// iron tube
|
||||
GameRegistry.addRecipe(new ItemStack(itemParts, 4, Parts.Iron.ordinal()), new Object[] {
|
||||
"@@@",
|
||||
'@', Item.ingotIron });
|
||||
// bronze tube
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(itemParts, 4, Parts.Bronze.ordinal()), new Object[] {
|
||||
"@@@",
|
||||
'@', "ingotBronze" }));
|
||||
// obby tube
|
||||
GameRegistry.addRecipe(new ItemStack(itemParts, 4, Parts.Obby.ordinal()), new Object[] {
|
||||
"@@@",
|
||||
'@', Block.obsidian });
|
||||
// nether tube
|
||||
GameRegistry.addRecipe(new ItemStack(itemParts, 4, Parts.Nether.ordinal()), new Object[] {
|
||||
"N@N",
|
||||
'N', Block.netherrack,
|
||||
'@', new ItemStack(itemParts, 2, Parts.Obby.ordinal()) });
|
||||
// seal
|
||||
GameRegistry.addRecipe(new ItemStack(itemParts, 4, Parts.Seal.ordinal()), new Object[] {
|
||||
"@@", "@@",
|
||||
'@', Item.leather });
|
||||
// slime steal
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(itemParts, 1, Parts.SlimeSeal.ordinal()), new Object[] {
|
||||
new ItemStack(itemParts, 1, Parts.Seal.ordinal()),
|
||||
new ItemStack(Item.slimeBall, 1) });
|
||||
// part valve
|
||||
GameRegistry.addRecipe(new ItemStack(itemParts, 1, Parts.Valve.ordinal()), new Object[] {
|
||||
"T@T",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Iron.ordinal()),
|
||||
'@', Block.lever });
|
||||
|
||||
// unfinished tank
|
||||
GameRegistry.addRecipe(new ItemStack(itemParts, 1, Parts.Tank.ordinal()), new Object[] {
|
||||
" @ ", "@ @", " @ ",
|
||||
'@', Item.ingotIron });
|
||||
// mechanical rod
|
||||
GameRegistry.addRecipe(new ItemStack(blockRod, 1), new Object[] {
|
||||
"I@I",
|
||||
'I', Item.ingotIron,
|
||||
'@', new ItemStack(itemParts, 1, Parts.Iron.ordinal()) });
|
||||
|
||||
// Iron Pipe
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 1, 15), new Object[] {
|
||||
new ItemStack(itemParts, 1, Parts.Iron.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
|
||||
for (int it = 0; it < 15; it++)
|
||||
{
|
||||
if (it != ColorCode.WHITE.ordinal() && it != ColorCode.ORANGE.ordinal())
|
||||
{
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, it), new Object[] {
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(Item.dyePowder, 1, it) });
|
||||
}
|
||||
}
|
||||
// steam pipes
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 1, ColorCode.ORANGE.ordinal()), new Object[] {
|
||||
new ItemStack(itemParts, 1, Parts.Bronze.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
|
||||
// milk pipes
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.WHITE.ordinal()), new Object[] {
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(Item.dyePowder, 1, 15) });
|
||||
// steam tank
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(blockTank, 1, ColorCode.ORANGE.ordinal()), new Object[] {
|
||||
new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Seal.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Bronze.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Bronze.ordinal()) });
|
||||
// lava tank
|
||||
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.RED.ordinal()), new Object[] {
|
||||
"N@N", "@ @", "N@N",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
'@', Block.obsidian,
|
||||
'N', Block.netherrack });
|
||||
// water tank
|
||||
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.BLUE.ordinal()), new Object[] {
|
||||
"@G@", "STS", "@G@",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
'@', Block.planks,
|
||||
'G', Block.glass,
|
||||
'S', new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
|
||||
// milk tank
|
||||
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.WHITE.ordinal()), new Object[] {
|
||||
"W@W", "WTW", "W@W",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
'@', Block.stone,
|
||||
'W', Block.planks });
|
||||
// generic Tank
|
||||
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.NONE.ordinal()), new Object[] {
|
||||
"@@@", "@T@", "@@@",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
'@', Block.stone });
|
||||
|
||||
// pump
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(blockMachine, 1, 0), new Object[] {
|
||||
"C@C", "BMB", "@X@",
|
||||
'@', "plateSteel",
|
||||
'X', new ItemStack(blockPipe, 1, ColorCode.NONE.ordinal()),
|
||||
'B', new ItemStack(itemParts, 1, Parts.Valve.ordinal()),
|
||||
'C',"basicCircuit",
|
||||
'M', "motor" }));
|
||||
|
||||
// release valve
|
||||
GameRegistry.addRecipe(new ItemStack(blockReleaseValve, 1), new Object[] {
|
||||
"RPR", "PVP", "RPR",
|
||||
'P', new ItemStack(blockPipe, 1, 15),
|
||||
'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()),
|
||||
'R', Item.redstone });
|
||||
// sink
|
||||
GameRegistry.addRecipe(new ItemStack(blockSink, 1), new Object[] {
|
||||
"I I", "SIS", "SPS",
|
||||
'P', new ItemStack(blockPipe, 1, 15),
|
||||
'I', Item.ingotIron,
|
||||
'S', Block.stone });
|
||||
|
||||
// reg ore directory for parts
|
||||
OreDictionary.registerOre("bronzeTube", new ItemStack(itemParts, 1, Parts.Bronze.ordinal()));
|
||||
OreDictionary.registerOre("ironTube", new ItemStack(itemParts, 1, Parts.Iron.ordinal()));
|
||||
OreDictionary.registerOre("netherTube", new ItemStack(itemParts, 1, Parts.Nether.ordinal()));
|
||||
OreDictionary.registerOre("obbyTube", new ItemStack(itemParts, 1, Parts.Obby.ordinal()));
|
||||
OreDictionary.registerOre("leatherSeal", new ItemStack(itemParts, 1, Parts.Seal.ordinal()));
|
||||
OreDictionary.registerOre("leatherSlimeSeal", new ItemStack(itemParts, 1, Parts.SlimeSeal.ordinal()));
|
||||
OreDictionary.registerOre("valvePart", new ItemStack(itemParts, 1, Parts.Valve.ordinal()));
|
||||
OreDictionary.registerOre("bronzeTube", new ItemStack(itemParts, 1, Parts.Bronze.ordinal()));
|
||||
OreDictionary.registerOre("unfinishedTank", new ItemStack(itemParts, 1, Parts.Tank.ordinal()));
|
||||
// add Default Liquids to current list, done last to let other mods use
|
||||
// there liquid data first if used
|
||||
LiquidStack waste = LiquidDictionary.getOrCreateLiquid("Waste", new LiquidStack(LiquidMechanics.blockWasteLiquid, 1));
|
||||
LiquidHandler.addDefaultLiquids();
|
||||
FMLog.info("Done Loading");
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package liquidmechanics.common;
|
||||
|
||||
|
||||
public class MetaGroup
|
||||
{
|
||||
public static int getFacingMeta(int metaData)
|
||||
{
|
||||
int meta = metaData % 4;
|
||||
int newMeta = 0;
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
newMeta = 2;
|
||||
break;
|
||||
case 1:
|
||||
newMeta = 5;
|
||||
break;
|
||||
case 2:
|
||||
newMeta = 3;
|
||||
break;
|
||||
case 3:
|
||||
newMeta = 4;
|
||||
}
|
||||
|
||||
return newMeta;
|
||||
}
|
||||
|
||||
public static int getGrouping(int meta)
|
||||
{
|
||||
if ((meta >= 0) && (meta <= 3))
|
||||
return 0;
|
||||
if ((meta >= 4) && (meta <= 7))
|
||||
return 1;
|
||||
if ((meta >= 8) && (meta <= 11))
|
||||
return 2;
|
||||
if ((meta >= 12) && (meta <= 15))
|
||||
return 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getGroupStartMeta(int grouping)
|
||||
{
|
||||
return grouping * 4;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package liquidmechanics.common;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class TabLiquidMechanics extends CreativeTabs
|
||||
{
|
||||
public static final TabLiquidMechanics INSTANCE = new TabLiquidMechanics("fluidMechanics");
|
||||
private static ItemStack itemStack;
|
||||
|
||||
public TabLiquidMechanics(String par2Str)
|
||||
{
|
||||
super(CreativeTabs.getNextID(), par2Str);
|
||||
}
|
||||
|
||||
public static void setItemStack(ItemStack newItemStack)
|
||||
{
|
||||
if (itemStack == null)
|
||||
{
|
||||
itemStack = newItemStack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
if (itemStack == null) { return new ItemStack(Block.blocksList[this.getTabIconItemIndex()]); }
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityGenerator;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
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;
|
||||
import universalelectricity.prefab.implement.IRedstoneReceptor;
|
||||
|
||||
public class BlockGenerator extends universalelectricity.prefab.BlockMachine
|
||||
{
|
||||
|
||||
public BlockGenerator(int id)
|
||||
{
|
||||
super("lmGen", id, Material.iron);
|
||||
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCreativeItems(ArrayList itemList)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
return new ItemStack(LiquidMechanics.blockGenerator, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving)
|
||||
{
|
||||
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
world.setBlockAndMetadataWithUpdate(x, y, z, blockID, angle, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int metadata = par1World.getBlockMetadata(x, y, z);
|
||||
if (metadata < 3)
|
||||
{
|
||||
par1World.setBlockAndMetadata(x, y, z, blockID, metadata + angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.setBlockAndMetadata(x, y, z, blockID, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderHelper.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileEntityGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int x, int y, int z, int side)
|
||||
{
|
||||
super.onNeighborBlockChange(par1World, x, y, z, side);
|
||||
this.checkForPower(par1World, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
public static void checkForPower(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileEntityGenerator)
|
||||
{
|
||||
boolean powered = ((TileEntityGenerator) tileEntity).isPowered;
|
||||
boolean beingPowered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockGettingPowered(x, y, z);
|
||||
if (powered && !beingPowered)
|
||||
{
|
||||
((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOff();
|
||||
}
|
||||
else if (!powered && beingPowered)
|
||||
{
|
||||
((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
|
||||
public class BlockPipe extends BlockMachine
|
||||
{
|
||||
public BlockPipe(int id)
|
||||
{
|
||||
super("Pipe", id, Material.iron, TabLiquidMechanics.INSTANCE);
|
||||
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
|
||||
this.setHardness(1f);
|
||||
this.setBlockName("lmPipe");
|
||||
this.setResistance(3f);
|
||||
//this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
* Lets the block know when one of its neighbor changes. Doesn't know which
|
||||
* neighbor changed (coordinates passed are their own) Args: x, y, z,
|
||||
* neighbor blockID
|
||||
*/
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int blockID)
|
||||
{
|
||||
super.onNeighborBlockChange(world, x, y, z, blockID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
int var5 = par1World.getBlockId(par2, par3, par4);
|
||||
return var5 == 0 || blocksList[var5].blockMaterial.isReplaceable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityPipe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return new ItemStack(LiquidMechanics.blockPipe, 1, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
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;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
||||
public class BlockPumpMachine extends BlockMachine
|
||||
{
|
||||
|
||||
public BlockPumpMachine(int id)
|
||||
{
|
||||
super("lmMachines", id, Material.iron, TabLiquidMechanics.INSTANCE);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderHelper.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
if (meta < 4) { return 0; }
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
TileEntity ent = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (meta < 4)
|
||||
{
|
||||
new ItemStack(LiquidMechanics.blockMachine, 1, 0);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving p)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int angle = MathHelper.floor_double((p.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
TileEntity ent = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
world.setBlockMetadata(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta)));
|
||||
if (ent instanceof TileEntityAdvanced)
|
||||
{
|
||||
((TileEntityAdvanced) world.getBlockTileEntity(x, y, z)).initiate();
|
||||
}
|
||||
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
|
||||
if (p instanceof EntityPlayer)
|
||||
{
|
||||
// ((EntityPlayer) p).sendChatToPlayer("meta:" +
|
||||
// world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int meta)
|
||||
{
|
||||
if (meta >= 12)
|
||||
{
|
||||
}
|
||||
else if (meta >= 8)
|
||||
{
|
||||
|
||||
}
|
||||
else if (meta >= 4)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return new TileEntityPump();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
}
|
||||
|
||||
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int meta = par1World.getBlockMetadata(x, y, z);
|
||||
int g = MetaGroup.getGrouping(meta);
|
||||
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
|
||||
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
if (meta == (g * 4) + 3)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, meta + 1);
|
||||
return true;
|
||||
}
|
||||
//return false;
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityReleaseValve;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import universalelectricity.prefab.implement.IRedstoneReceptor;
|
||||
|
||||
public class BlockReleaseValve extends BlockMachine
|
||||
{
|
||||
public BlockReleaseValve(int par1)
|
||||
{
|
||||
super("eValve",par1, Material.iron,TabLiquidMechanics.INSTANCE);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(5f);
|
||||
this.setTextureFile(LiquidMechanics.BLOCK_TEXTURE_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityReleaseValve();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int x, int y, int z)
|
||||
{
|
||||
this.checkForPower(par1World, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTextureFromSideAndMetadata(int side, int meta)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int x, int y, int z, int side)
|
||||
{
|
||||
super.onNeighborBlockChange(par1World, x, y, z, side);
|
||||
this.checkForPower(par1World, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
return new ItemStack(LiquidMechanics.blockReleaseValve, 1, 0);
|
||||
}
|
||||
|
||||
public static void checkForPower(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileEntityReleaseValve)
|
||||
{
|
||||
boolean powered = ((TileEntityReleaseValve) tileEntity).isPowered;
|
||||
boolean beingPowered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockGettingPowered(x, y, z);
|
||||
if (powered && !beingPowered)
|
||||
{
|
||||
((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOff();
|
||||
}
|
||||
else if (!powered && beingPowered)
|
||||
{
|
||||
((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityRod;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
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;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class BlockRod extends universalelectricity.prefab.BlockMachine
|
||||
{
|
||||
|
||||
public BlockRod(int par1)
|
||||
{
|
||||
super("MechanicRod", par1, Material.iron);
|
||||
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int i, int j, int k,
|
||||
EntityLiving player)
|
||||
{
|
||||
int angle = MathHelper
|
||||
.floor_double((player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int meta = 0;
|
||||
ForgeDirection idr;
|
||||
int dZ = 0;
|
||||
int dX = 0;
|
||||
switch (angle)
|
||||
{
|
||||
case 0:
|
||||
meta = 2;
|
||||
dZ--;
|
||||
break;
|
||||
case 1:
|
||||
meta = 5;
|
||||
dX--;
|
||||
break;
|
||||
case 2:
|
||||
meta = 3;
|
||||
dZ++;
|
||||
break;
|
||||
case 3:
|
||||
meta = 4;
|
||||
dX++;
|
||||
break;
|
||||
}
|
||||
world.setBlockAndMetadataWithUpdate(i, j, k, blockID, meta, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta >= 5)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta + 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityRod();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
return new ItemStack(LiquidMechanics.blockRod, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderHelper.renderID;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,188 +0,0 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntitySink;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
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;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
||||
public class BlockSink extends BlockMachine
|
||||
{
|
||||
public BlockSink(int par1)
|
||||
{
|
||||
super("lmSink", par1, Material.iron, TabLiquidMechanics.INSTANCE);
|
||||
this.setResistance(4f);
|
||||
this.setHardness(4f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntitySink();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (entityplayer.isSneaking()) { return false; }
|
||||
ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
if (current != null)
|
||||
{
|
||||
|
||||
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
|
||||
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileEntitySink)
|
||||
{
|
||||
TileEntitySink tank = (TileEntitySink) tileEntity;
|
||||
|
||||
// Handle filled containers
|
||||
if (liquid != null)
|
||||
{
|
||||
if (current.isItemEqual(new ItemStack(Item.potion)))
|
||||
{
|
||||
liquid = new LiquidStack(liquid.itemID, (LiquidContainerRegistry.BUCKET_VOLUME / 4), liquid.itemMeta);
|
||||
}
|
||||
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
|
||||
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
// Handle empty containers
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (current.getItem() instanceof ItemArmor && ((ItemArmor) current.getItem()).getArmorMaterial() == EnumArmorMaterial.CLOTH)
|
||||
{
|
||||
ItemArmor var13 = (ItemArmor) current.getItem();
|
||||
var13.removeColor(current);
|
||||
return true;
|
||||
}
|
||||
LiquidStack stack = tank.getStack();
|
||||
if (stack != null)
|
||||
{
|
||||
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
|
||||
|
||||
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
|
||||
|
||||
if (liquid != null)
|
||||
{
|
||||
if (!entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
if (current.stackSize > 1)
|
||||
{
|
||||
if (!entityplayer.inventory.addItemStackToInventory(liquidItem)) return false;
|
||||
else
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
|
||||
}
|
||||
}
|
||||
int ammount = liquid.amount;
|
||||
if (current.isItemEqual(new ItemStack(Item.glassBottle)))
|
||||
{
|
||||
ammount = (LiquidContainerRegistry.BUCKET_VOLUME / 4);
|
||||
}
|
||||
tank.drain(null, ammount, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int meta = par1World.getBlockMetadata(x, y, z);
|
||||
int g = MetaGroup.getGrouping(meta);
|
||||
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
|
||||
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
if (meta == (g * 4) + 3)
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, meta + 1);
|
||||
return true;
|
||||
}
|
||||
// return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
TileEntity ent = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
world.setBlockMetadata(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta)));
|
||||
if (ent instanceof TileEntityAdvanced)
|
||||
{
|
||||
((TileEntityAdvanced) world.getBlockTileEntity(x, y, z)).initiate();
|
||||
}
|
||||
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
return new ItemStack(this, 1, 0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderHelper.renderID;
|
||||
}
|
||||
}
|
|
@ -1,158 +0,0 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
|
||||
public class BlockTank extends BlockMachine
|
||||
{
|
||||
|
||||
public BlockTank(int id)
|
||||
{
|
||||
super("lmTank", id, Material.rock, TabLiquidMechanics.INSTANCE);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderHelper.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (entityplayer.isSneaking()) { return false; }
|
||||
ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
if (current != null)
|
||||
{
|
||||
|
||||
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
|
||||
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileEntityTank)
|
||||
{
|
||||
TileEntityTank tank = (TileEntityTank) tileEntity;
|
||||
|
||||
// Handle filled containers
|
||||
if (liquid != null)
|
||||
{
|
||||
if (current.isItemEqual(new ItemStack(Item.potion)))
|
||||
{
|
||||
liquid = new LiquidStack(liquid.itemID, (LiquidContainerRegistry.BUCKET_VOLUME / 4), liquid.itemMeta);
|
||||
}
|
||||
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
|
||||
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
// Handle empty containers
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
LiquidStack stack = tank.getStack();
|
||||
if (stack != null)
|
||||
{
|
||||
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
|
||||
|
||||
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
|
||||
|
||||
if (liquid != null)
|
||||
{
|
||||
if (!entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
if (current.stackSize > 1)
|
||||
{
|
||||
if (!entityplayer.inventory.addItemStackToInventory(liquidItem)) return false;
|
||||
else
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
|
||||
}
|
||||
}
|
||||
int ammount = liquid.amount;
|
||||
if (current.isItemEqual(new ItemStack(Item.glassBottle)))
|
||||
{
|
||||
ammount = (LiquidContainerRegistry.BUCKET_VOLUME / 4);
|
||||
}
|
||||
tank.drain(null, ammount, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
return new ItemStack(this, 1, meta);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 13));
|
||||
par3List.add(new ItemStack(par1, 1, 15));
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import net.minecraft.block.BlockFluid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.liquids.ILiquid;
|
||||
|
||||
public class BlockWasteLiquid extends BlockFluid implements ILiquid
|
||||
{
|
||||
//TODO turn into a lava type liquid with chance of corrupting connected water blocks
|
||||
public BlockWasteLiquid(int par1)
|
||||
{
|
||||
super(par1, Material.water);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stillLiquidId()
|
||||
{
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMetaSensitive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stillLiquidMeta()
|
||||
{
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package liquidmechanics.common.block.liquids;
|
||||
|
||||
import liquidmechanics.api.liquids.LiquidFiniteStill;
|
||||
|
||||
public class BlockMilk extends LiquidFiniteStill
|
||||
{
|
||||
public BlockMilk(int i)
|
||||
{
|
||||
super(i);
|
||||
this.setBlockName("MilkStill");
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package liquidmechanics.common.block.liquids;
|
||||
|
||||
import liquidmechanics.api.liquids.LiquidFiniteStill;
|
||||
|
||||
public class BlockOil extends LiquidFiniteStill
|
||||
{
|
||||
public BlockOil(int i)
|
||||
{
|
||||
super(i);
|
||||
this.setBlockName("OilStill");
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package liquidmechanics.common.block.liquids;
|
||||
|
||||
import liquidmechanics.api.liquids.LiquidFiniteFlowing;
|
||||
|
||||
public class BlockOilFlowing extends LiquidFiniteFlowing
|
||||
{
|
||||
public BlockOilFlowing(int i)
|
||||
{
|
||||
super(i);
|
||||
this.setBlockName("OilFlowing");
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package liquidmechanics.common.handlers;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* used to help convert older system to newer systems.
|
||||
*/
|
||||
public class UpdateConverter
|
||||
{
|
||||
public static void convert(TileEntityPipe pipe, NBTTagCompound nbt)
|
||||
{
|
||||
Boolean converted24 = nbt.getBoolean("converted");
|
||||
Boolean converted25 = nbt.getBoolean("converted025");
|
||||
if (!converted24)
|
||||
{
|
||||
pipe.setColor(ColorCode.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
|
||||
}
|
||||
else if (converted24 && !converted25)
|
||||
{
|
||||
pipe.setColor(ColorCode.get(LiquidHandler.get(nbt.getString("name"))));
|
||||
}
|
||||
nbt.setBoolean("converted", true);
|
||||
nbt.setBoolean("converted025", true);
|
||||
}
|
||||
public static void convert(TileEntityTank pipe, NBTTagCompound nbt)
|
||||
{
|
||||
Boolean converted24 = nbt.getBoolean("converted");
|
||||
Boolean converted25 = nbt.getBoolean("converted025");
|
||||
if (!converted24)
|
||||
{
|
||||
pipe.setColor(ColorCode.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
|
||||
}
|
||||
else if (converted24 && !converted25)
|
||||
{
|
||||
pipe.setColor(ColorCode.get(LiquidHandler.get(nbt.getString("name"))));
|
||||
}
|
||||
nbt.setBoolean("converted", true);
|
||||
nbt.setBoolean("converted025", true);
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
package liquidmechanics.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class ItemGuage extends Item
|
||||
{
|
||||
private int spawnID;
|
||||
|
||||
public ItemGuage(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("lmTool");
|
||||
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
|
||||
this.setMaxStackSize(1);
|
||||
this.setTextureFile(LiquidMechanics.ITEM_TEXTURE_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
{
|
||||
switch (par1)
|
||||
{
|
||||
case 0:
|
||||
return 24;
|
||||
case 1:
|
||||
}
|
||||
return this.iconIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int x, int y, int z, int side, float par8, float par9, float par10)
|
||||
{
|
||||
if (!par3World.isRemote)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
TileEntity blockEntity = par3World.getBlockTileEntity(x, y, z);
|
||||
|
||||
// pipe Guage
|
||||
if (meta == 0)
|
||||
{
|
||||
|
||||
if (blockEntity instanceof IReadOut)
|
||||
{
|
||||
String output = ((IReadOut) blockEntity).getMeterReading(player, ForgeDirection.getOrientation(side));
|
||||
if (output.length() > 100)
|
||||
{
|
||||
output = output.substring(0, 100);
|
||||
}
|
||||
output.trim();
|
||||
player.sendChatToPlayer("ReadOut: " + output);
|
||||
}
|
||||
} else if (meta == 1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
return this.getItemName() + "." + itemstack.getItemDamage();
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package liquidmechanics.common.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemLiquidMachine extends ItemBlock
|
||||
{
|
||||
|
||||
public ItemLiquidMachine(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack par1ItemStack)
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getBlockName() + "." + (par1ItemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName()
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getBlockName() + ".0";
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
package liquidmechanics.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/** A metadata item containing parts of various machines in Liquid Mechanics Mod.
|
||||
*
|
||||
* @author Rs */
|
||||
public class ItemParts extends Item
|
||||
{
|
||||
public enum Parts
|
||||
{
|
||||
Bronze("Bronze", 0),
|
||||
Iron("Iron", 1),
|
||||
Obby("Obby", 2),
|
||||
Nether("Nether", 3),
|
||||
Seal("Seal", 16),
|
||||
SlimeSeal("Slime", 17),
|
||||
Tank("Tank", 18),
|
||||
Valve("Valve", 19);
|
||||
|
||||
public String name;
|
||||
public int itemIndex;
|
||||
|
||||
private Parts(String name, int itemIndex)
|
||||
{
|
||||
this.name = name;
|
||||
this.itemIndex = itemIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemParts(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setMaxStackSize(64);
|
||||
this.setItemName("lmPart");
|
||||
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
{
|
||||
if (par1 < Parts.values().length) { return Parts.values()[par1].itemIndex; }
|
||||
return par1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureFile()
|
||||
{
|
||||
return LiquidMechanics.ITEM_TEXTURE_FILE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack i)
|
||||
{
|
||||
int j = i.getItemDamage();
|
||||
return i.getItem().getItemName() + "." + j;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < Parts.values().length; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package liquidmechanics.common.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemPipe extends ItemBlock
|
||||
{
|
||||
|
||||
public ItemPipe(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack par1ItemStack)
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getBlockName() + "." + (par1ItemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName()
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getBlockName() + ".0";
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package liquidmechanics.common.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemReleaseValve extends ItemBlock
|
||||
{
|
||||
|
||||
public ItemReleaseValve(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack par1ItemStack)
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getBlockName() + "." + (par1ItemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName()
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getBlockName() + ".0";
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package liquidmechanics.common.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemTank extends ItemBlock
|
||||
{
|
||||
|
||||
public ItemTank(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack par1ItemStack)
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getBlockName() + "." + (par1ItemStack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName()
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getBlockName() + ".0";
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
package liquidmechanics.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemValve extends ItemBlock
|
||||
{
|
||||
int index = 26;
|
||||
private int spawnID;
|
||||
|
||||
public ItemValve(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.setIconIndex(10);
|
||||
this.setItemName("Machine");
|
||||
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconFromDamage(int par1)
|
||||
{
|
||||
|
||||
return par1 + index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
return itemstack.getItemDamage() == 0 ? "Pump" : "Conderser";// itemstack.getItemDamage() ==
|
||||
// 4 ?
|
||||
// "Condenser":"Unknown";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
par3List.add(new ItemStack(this, 1, 4));
|
||||
|
||||
}
|
||||
|
||||
public String getTextureFile()
|
||||
{
|
||||
return LiquidMechanics.ITEM_TEXTURE_FILE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName()
|
||||
{
|
||||
return "Machines";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
int blockID = par3World.getBlockId(par4, par5, par6);
|
||||
spawnID = LiquidMechanics.blockReleaseValve.blockID;
|
||||
if (blockID == Block.snow.blockID)
|
||||
{
|
||||
par7 = 1;
|
||||
}
|
||||
else if (blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID && blockID != Block.deadBush.blockID)
|
||||
{
|
||||
if (par7 == 0)
|
||||
{
|
||||
--par5;
|
||||
}
|
||||
|
||||
if (par7 == 1)
|
||||
{
|
||||
++par5;
|
||||
}
|
||||
|
||||
if (par7 == 2)
|
||||
{
|
||||
--par6;
|
||||
}
|
||||
|
||||
if (par7 == 3)
|
||||
{
|
||||
++par6;
|
||||
}
|
||||
|
||||
if (par7 == 4)
|
||||
{
|
||||
--par4;
|
||||
}
|
||||
|
||||
if (par7 == 5)
|
||||
{
|
||||
++par4;
|
||||
}
|
||||
}
|
||||
|
||||
if (LiquidMechanics.blockPipe.canPlaceBlockAt(par3World, par4, par5, par6))
|
||||
{
|
||||
Block var9 = Block.blocksList[this.spawnID];
|
||||
par3World.editingBlocks = true;
|
||||
int angle = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, var9.blockID, angle + itemStack.getItemDamage()))
|
||||
{
|
||||
if (par3World.getBlockId(par4, par5, par6) == var9.blockID)
|
||||
{
|
||||
|
||||
Block.blocksList[this.spawnID].onBlockAdded(par3World, par4, par5, par6);
|
||||
Block.blocksList[this.spawnID].onBlockPlacedBy(par3World, par4, par5, par6, player);
|
||||
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
|
||||
|
||||
}
|
||||
|
||||
--itemStack.stackSize;
|
||||
par3World.editingBlocks = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
par3World.editingBlocks = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerReleaseValve extends Container
|
||||
{
|
||||
private TileEntityReleaseValve valve;
|
||||
private int lastCookTime = 0;
|
||||
private int lastBurnTime = 0;
|
||||
private int lastItemBurnTime = 0;
|
||||
|
||||
public ContainerReleaseValve(InventoryPlayer par1InventoryPlayer, TileEntityReleaseValve par2TileEntityFurnace)
|
||||
{
|
||||
this.valve = par2TileEntityFurnace;
|
||||
int var3;
|
||||
|
||||
for (var3 = 0; var3 < 3; ++var3)
|
||||
{
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (var3 = 0; var3 < 9; ++var3)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.valve.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
|
||||
*/
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot)this.inventorySlots.get(par2);
|
||||
return var3;
|
||||
}
|
||||
}
|
|
@ -1,310 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.api.mech.IForce;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import liquidmechanics.common.block.BlockGenerator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.electricity.ElectricityConnections;
|
||||
import universalelectricity.core.electricity.ElectricityNetwork;
|
||||
import universalelectricity.core.implement.IConductor;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.implement.IRedstoneReceptor;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.tile.TileEntityElectricityProducer;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
||||
public class TileEntityGenerator extends TileEntityElectricityProducer implements IPacketReceiver, IForce, IReadOut, IRedstoneReceptor
|
||||
{
|
||||
public boolean isPowered = false;
|
||||
|
||||
ForgeDirection facing = ForgeDirection.DOWN;
|
||||
|
||||
public int force = 0;// current total force
|
||||
public int aForce = 0;// force this unit can apply
|
||||
public int pos = 0;// current pos of rotation max of 8
|
||||
public int disableTicks = 0;// time disabled
|
||||
public int tCount = 0;
|
||||
double WATTS_PER_TICK = 500;
|
||||
double joulesReceived = 0;
|
||||
double genAmmount = 0;// watt output of machine
|
||||
|
||||
IConductor[] wires = { null, null, null, null, null, null };
|
||||
|
||||
public boolean needUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void initiate()
|
||||
{
|
||||
this.registerConnections();
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, LiquidMechanics.blockGenerator.blockID);
|
||||
}
|
||||
|
||||
public void registerConnections()
|
||||
{
|
||||
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
|
||||
ForgeDirection[] dirs = new ForgeDirection[] { ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN };
|
||||
ElectricityConnections.registerConnector(this, EnumSet.of(facing.getOpposite()));
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
if (dir != facing && dir != facing.getOpposite())
|
||||
{
|
||||
dirs[i] = dir;
|
||||
}
|
||||
}
|
||||
ElectricityConnections.registerConnector(this, EnumSet.of(dirs[0], dirs[1], dirs[2], dirs[3], dirs[4], dirs[5]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
this.genAmmount = Math.abs(force / this.getVoltage());
|
||||
// wire count update
|
||||
int wireCount = 0;
|
||||
TileEntity[] ents = connectionHelper.getSurroundingTileEntities(worldObj, xCoord, yCoord, zCoord);
|
||||
this.wires = new IConductor[6];
|
||||
for (int i = 0; i < ents.length; i++)
|
||||
{
|
||||
if (ents[i] instanceof IConductor)
|
||||
{
|
||||
this.wires[i] = (IConductor) ents[i];
|
||||
wireCount++;
|
||||
}
|
||||
}// end wire count
|
||||
if (tCount-- <= 0)
|
||||
{
|
||||
BlockGenerator.checkForPower(worldObj, xCoord, yCoord, zCoord);
|
||||
tCount = 10;
|
||||
if (this.force > 0 || this.isPowered)
|
||||
{
|
||||
this.pos++;
|
||||
if (force < 0)
|
||||
pos -= 2;
|
||||
if (pos >= 8)
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord + facing.offsetX, yCoord + facing.offsetY, zCoord + facing.offsetZ);
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
|
||||
if (!this.isPowered)
|
||||
{
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
if (dir != facing && dir != facing.getOpposite())
|
||||
{
|
||||
|
||||
TileEntity outputTile = Vector3.getConnectorFromSide(this.worldObj, new Vector3(this), dir);
|
||||
ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(outputTile, dir);
|
||||
if (network != null)
|
||||
{
|
||||
if (network.getRequest().getWatts() > 0)
|
||||
{
|
||||
network.startProducing(this, (this.genAmmount), this.getVoltage());
|
||||
}
|
||||
else
|
||||
{
|
||||
network.stopProducing(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
if (dir != facing && dir != facing.getOpposite())
|
||||
{
|
||||
TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), dir);
|
||||
ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(inputTile, dir);
|
||||
if (network != null)
|
||||
{
|
||||
|
||||
if (this.joulesReceived < this.WATTS_PER_TICK)
|
||||
{
|
||||
network.startRequesting(this, WATTS_PER_TICK / this.getVoltage(), this.getVoltage());
|
||||
this.joulesReceived = Math.max(Math.min(this.joulesReceived + network.consumeElectricity(this).getWatts(), WATTS_PER_TICK), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
network.stopRequesting(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.joulesReceived >= this.WATTS_PER_TICK - 50)
|
||||
{
|
||||
joulesReceived -= this.WATTS_PER_TICK;
|
||||
TileEntity rod = Vector3.getTileEntityFromSide(worldObj, new Vector3(this), facing);
|
||||
if (rod instanceof IForce && ((IForce) rod).canInputSide(facing))
|
||||
{
|
||||
((IForce) rod).applyForce(10000);
|
||||
}
|
||||
else if (rod instanceof IForce && ((IForce) rod).canOutputSide(facing))
|
||||
{
|
||||
((IForce) rod).applyForce(-10000);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
public void outputEnergy(ElectricityNetwork network, IConductor connectedElectricUnit, TileEntity outputTile)
|
||||
{
|
||||
if (network != null)
|
||||
{
|
||||
if (network.getRequest().getWatts() > 0)
|
||||
{
|
||||
connectedElectricUnit = (IConductor) outputTile;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectedElectricUnit = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
connectedElectricUnit = null;
|
||||
}
|
||||
|
||||
if (connectedElectricUnit != null)
|
||||
{
|
||||
if (this.genAmmount > 0)
|
||||
{
|
||||
connectedElectricUnit.getNetwork().startProducing(this, (this.genAmmount / this.getVoltage()) / 20, this.getVoltage());
|
||||
}
|
||||
else
|
||||
{
|
||||
connectedElectricUnit.getNetwork().stopProducing(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
// Data handling
|
||||
// ------------------------------
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput data)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
// Mechanics
|
||||
// ------------------------------
|
||||
@Override
|
||||
public int getForceSide(ForgeDirection side)
|
||||
{
|
||||
if (side == facing.getOpposite()) { return aForce; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getForce()
|
||||
{
|
||||
return this.force;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOutputSide(ForgeDirection side)
|
||||
{
|
||||
if (side == facing) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInputSide(ForgeDirection side)
|
||||
{
|
||||
if (side == facing || side == facing.getOpposite()) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int applyForce(int force)
|
||||
{
|
||||
this.force = force;
|
||||
return force;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnimationPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
// Electric
|
||||
// ------------------------------
|
||||
@Override
|
||||
public void onDisable(int duration)
|
||||
{
|
||||
this.disableTicks = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisabled()
|
||||
{
|
||||
if (disableTicks-- <= 0) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage(Object... data)
|
||||
{
|
||||
return 120;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
if (this.isPowered)
|
||||
return "Outputing Force " + this.joulesReceived + "J " + "pos " + this.pos;
|
||||
return this.force + "N Input " + this.genAmmount + "W output " + "pos " + this.pos;
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
// redSand
|
||||
// ------------------------------
|
||||
@Override
|
||||
public void onPowerOn()
|
||||
{
|
||||
this.isPowered = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerOff()
|
||||
{
|
||||
this.isPowered = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,183 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
||||
public abstract class TileEntityMachine extends TileEntity implements IInventory
|
||||
|
||||
{
|
||||
/* 15 */private int tickCounts = 0;
|
||||
/* 16 */private int userCount = 0;
|
||||
/* 17 */public ItemStack[] storedItems = new ItemStack[getSizeInventory()];
|
||||
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
|
||||
{
|
||||
/* 22 */super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
/* 24 */NBTTagList var2 = new NBTTagList();
|
||||
|
||||
/* 26 */for (int var3 = 0; var3 < this.storedItems.length; var3++)
|
||||
|
||||
{
|
||||
/* 28 */if (this.storedItems[var3] != null)
|
||||
|
||||
{
|
||||
/* 30 */NBTTagCompound var4 = new NBTTagCompound();
|
||||
/* 31 */var4.setByte("Slot", (byte) var3);
|
||||
/* 32 */this.storedItems[var3].writeToNBT(var4);
|
||||
/* 33 */var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
|
||||
/* 37 */par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
|
||||
{
|
||||
/* 43 */super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
/* 45 */NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
/* 46 */this.storedItems = new ItemStack[getSizeInventory()];
|
||||
|
||||
/* 48 */for (int var3 = 0; var3 < var2.tagCount(); var3++)
|
||||
|
||||
{
|
||||
/* 50 */NBTTagCompound var4 = (NBTTagCompound) var2.tagAt(var3);
|
||||
/* 51 */byte var5 = var4.getByte("Slot");
|
||||
|
||||
/* 53 */if ((var5 >= 0) && (var5 < this.storedItems.length))
|
||||
|
||||
{
|
||||
/* 55 */this.storedItems[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canUpdate()
|
||||
|
||||
{
|
||||
/* 63 */return true;
|
||||
}
|
||||
|
||||
public abstract Object[] getSendData();
|
||||
|
||||
public abstract boolean needUpdate();
|
||||
|
||||
public void updateEntity()
|
||||
|
||||
{
|
||||
/* 77 */super.updateEntity();
|
||||
|
||||
/* 79 */if ((this.tickCounts++ >= 10) && (!this.worldObj.isRemote) && (needUpdate()))
|
||||
|
||||
{
|
||||
/* 81 */this.tickCounts = 0;
|
||||
/* 82 */Packet packet = PacketManager.getPacket(getChannel(), this, getSendData());
|
||||
/* 83 */PacketManager.sendPacketToClients(packet, this.worldObj, new Vector3(this), 40.0D);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract String getChannel();
|
||||
|
||||
public abstract int getSizeInventory();
|
||||
|
||||
public int getInventoryStackLimit()
|
||||
|
||||
{
|
||||
/* 102 */return 64;
|
||||
}
|
||||
|
||||
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
|
||||
|
||||
{
|
||||
/* 111 */return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) == this;
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlot(int par1)
|
||||
|
||||
{
|
||||
/* 119 */return this.storedItems[par1];
|
||||
}
|
||||
|
||||
public ItemStack decrStackSize(int par1, int par2)
|
||||
|
||||
{
|
||||
/* 124 */if (this.storedItems[par1] != null)
|
||||
|
||||
{
|
||||
/* 128 */if (this.storedItems[par1].stackSize <= par2)
|
||||
|
||||
{
|
||||
/* 130 */ItemStack var3 = this.storedItems[par1];
|
||||
/* 131 */this.storedItems[par1] = null;
|
||||
/* 132 */return var3;
|
||||
}
|
||||
|
||||
/* 136 */ItemStack var3 = this.storedItems[par1].splitStack(par2);
|
||||
|
||||
/* 138 */if (this.storedItems[par1].stackSize == 0)
|
||||
|
||||
{
|
||||
/* 140 */this.storedItems[par1] = null;
|
||||
}
|
||||
|
||||
/* 143 */return var3;
|
||||
}
|
||||
|
||||
/* 148 */return null;
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlotOnClosing(int par1)
|
||||
|
||||
{
|
||||
/* 159 */if (this.storedItems[par1] != null)
|
||||
|
||||
{
|
||||
/* 161 */ItemStack var2 = this.storedItems[par1];
|
||||
/* 162 */this.storedItems[par1] = null;
|
||||
/* 163 */return var2;
|
||||
}
|
||||
|
||||
/* 167 */return null;
|
||||
}
|
||||
|
||||
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
|
||||
|
||||
{
|
||||
/* 177 */this.storedItems[par1] = par2ItemStack;
|
||||
|
||||
/* 179 */if ((par2ItemStack != null) && (par2ItemStack.stackSize > getInventoryStackLimit()))
|
||||
|
||||
{
|
||||
/* 181 */par2ItemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
public String getInvName()
|
||||
|
||||
{
|
||||
/* 187 */return "SteamMachine";
|
||||
}
|
||||
|
||||
public void openChest()
|
||||
|
||||
{
|
||||
/* 193 */this.userCount += 1;
|
||||
}
|
||||
|
||||
public void closeChest()
|
||||
|
||||
{
|
||||
/* 199 */this.userCount -= 1;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,345 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import liquidmechanics.api.IPipe;
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.api.liquids.IPressure;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.handlers.UpdateConverter;
|
||||
import net.minecraft.block.Block;
|
||||
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.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
|
||||
public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut, IPipe
|
||||
{
|
||||
private ColorCode color = ColorCode.NONE;
|
||||
|
||||
private int count = 20;
|
||||
private int count2, presure = 0;
|
||||
|
||||
public boolean converted = false;
|
||||
public boolean isUniversal = false;
|
||||
|
||||
public TileEntity[] connectedBlocks = new TileEntity[6];
|
||||
|
||||
private LiquidTank stored = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * 2);
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
|
||||
this.validataConnections();
|
||||
this.color = ColorCode.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
if (++count >= 20)
|
||||
{
|
||||
count = 0;
|
||||
this.updatePressure();
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
this.randomDisplayTick();
|
||||
}
|
||||
LiquidStack stack = stored.getLiquid();
|
||||
if (!worldObj.isRemote && stack != null && stack.amount >= 0)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
|
||||
if (connectedBlocks[i] instanceof ITankContainer)
|
||||
{
|
||||
if (connectedBlocks[i] instanceof TileEntityPipe)
|
||||
{
|
||||
if (((TileEntityPipe) connectedBlocks[i]).presure < this.presure)
|
||||
{
|
||||
stored.drain(((TileEntityPipe) connectedBlocks[i]).fill(dir, stack, true), true);
|
||||
}
|
||||
|
||||
}
|
||||
else if (connectedBlocks[i] instanceof TileEntityTank && ((TileEntityTank) connectedBlocks[i]).getColor() == this.color)
|
||||
{
|
||||
if (dir == ForgeDirection.UP && !color.getLiquidData().getCanFloat())
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
else if (dir == ForgeDirection.DOWN && color.getLiquidData().getCanFloat())
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
else
|
||||
{
|
||||
stored.drain(((ITankContainer) connectedBlocks[i]).fill(dir.getOpposite(), stack, true), true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stored.drain(((ITankContainer) connectedBlocks[i]).fill(dir.getOpposite(), stack, true), true);
|
||||
}
|
||||
}
|
||||
|
||||
if (stack == null || stack.amount <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void randomDisplayTick()
|
||||
{
|
||||
Random random = new Random();
|
||||
LiquidStack stack = stored.getLiquid();
|
||||
if (stack != null && random.nextInt(10) == 0)
|
||||
{
|
||||
// TODO align this with the pipe model so not to drip where there is
|
||||
// no pipe
|
||||
double xx = (double) ((float) xCoord + random.nextDouble());
|
||||
double zz = (double) yCoord + .3D;
|
||||
double yy = (double) ((float) zCoord + random.nextDouble());
|
||||
|
||||
if (ColorCode.get(stack) != ColorCode.RED)
|
||||
{
|
||||
worldObj.spawnParticle("dripWater", xx, zz, yy, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldObj.spawnParticle("dripLava", xx, zz, yy, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the current color mark of the pipe
|
||||
*/
|
||||
@Override
|
||||
public ColorCode getColor()
|
||||
{
|
||||
return this.color;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the current color mark of the pipe
|
||||
*/
|
||||
@Override
|
||||
public void setColor(Object cc)
|
||||
{
|
||||
this.color = ColorCode.get(cc);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the current color mark of the pipe
|
||||
*/
|
||||
public void setColor(int i)
|
||||
{
|
||||
if (i < ColorCode.values().length)
|
||||
{
|
||||
this.color = ColorCode.values()[i];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a tile entity from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
UpdateConverter.convert(this, nbt);
|
||||
|
||||
LiquidStack liquid = new LiquidStack(0, 0, 0);
|
||||
liquid.readFromNBT(nbt.getCompoundTag("stored"));
|
||||
stored.setLiquid(liquid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a tile entity to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
if (stored.getLiquid() != null)
|
||||
{
|
||||
nbt.setTag("stored", stored.getLiquid().writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
LiquidStack stack = this.stored.getLiquid();
|
||||
if (stack != null) { return (stack.amount / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (this.stored.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME) + " " + LiquidHandler.get(stack).getName() + " @ " + this.presure + "p"; }
|
||||
|
||||
return "Empty" + " @ " + this.presure + "p";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null) { return 0; }
|
||||
LiquidStack stack = stored.getLiquid();
|
||||
if (color != ColorCode.NONE)
|
||||
{
|
||||
|
||||
if (stack == null || LiquidHandler.isEqual(resource, this.color.getLiquidData()))
|
||||
{
|
||||
return this.fill(0, resource, doFill);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.causeMix(stack, resource);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stack == null || LiquidHandler.isEqual(stack, resource))
|
||||
{
|
||||
return this.fill(0, resource, doFill);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.causeMix(stack, resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (tankIndex != 0 || resource == null) { return 0; }
|
||||
return stored.fill(resource, doFill);
|
||||
}
|
||||
|
||||
public int causeMix(LiquidStack stored, LiquidStack fill)
|
||||
{
|
||||
if (stored == null || fill == null) { return 0; }
|
||||
// water flowing into lava creates obby
|
||||
if (LiquidHandler.isEqual(stored, LiquidHandler.lava) && LiquidHandler.isEqual(fill, LiquidHandler.water))
|
||||
{
|
||||
worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, Block.obsidian.blockID);
|
||||
return fill.amount;
|
||||
}// lava flowing into water creates cobble
|
||||
else if (LiquidHandler.isEqual(stored, LiquidHandler.water) && LiquidHandler.isEqual(fill, LiquidHandler.lava))
|
||||
{
|
||||
worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, Block.cobblestone.blockID);
|
||||
return fill.amount;
|
||||
}
|
||||
else
|
||||
// anything else creates waste liquid
|
||||
{
|
||||
int f = this.stored.fill(new LiquidStack(stored.itemID, fill.amount, stored.itemMeta), true);
|
||||
int s = this.stored.getLiquid().amount;
|
||||
LiquidStack stack = LiquidHandler.getStack(LiquidHandler.waste, s);
|
||||
this.stored.setLiquid(stack);
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank[] getTanks(ForgeDirection direction)
|
||||
{
|
||||
return new ILiquidTank[] { this.stored };
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* collects and sorts the surrounding TE for valid connections
|
||||
*/
|
||||
public void validataConnections()
|
||||
{
|
||||
this.connectedBlocks = connectionHelper.getSurroundingTileEntities(worldObj, xCoord, yCoord, zCoord);
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
TileEntity ent = connectedBlocks[i];
|
||||
if (ent instanceof ITankContainer)
|
||||
{
|
||||
if (ent instanceof TileEntityPipe && color != ((TileEntityPipe) ent).getColor())
|
||||
{
|
||||
connectedBlocks[i] = null;
|
||||
}
|
||||
// TODO switch side catch for IPressure
|
||||
if (this.color != ColorCode.NONE && ent instanceof TileEntityTank && ((TileEntityTank) ent).getColor() != ColorCode.NONE && color != ((TileEntityTank) ent).getColor())
|
||||
{
|
||||
connectedBlocks[i] = null;
|
||||
}
|
||||
}
|
||||
else if (ent instanceof IPressure)
|
||||
{
|
||||
if (!((IPressure) ent).canPressureToo(color.getLiquidData(), dir))
|
||||
{
|
||||
connectedBlocks[i] = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
connectedBlocks[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* updates this units pressure level using the pipe/machines around it
|
||||
*/
|
||||
public void updatePressure()
|
||||
{
|
||||
int highestPressure = 0;
|
||||
this.presure = 0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
|
||||
if (connectedBlocks[i] instanceof TileEntityPipe)
|
||||
{
|
||||
if (((TileEntityPipe) connectedBlocks[i]).getPressure() > highestPressure)
|
||||
{
|
||||
highestPressure = ((TileEntityPipe) connectedBlocks[i]).getPressure();
|
||||
}
|
||||
}
|
||||
if (connectedBlocks[i] instanceof IPressure && ((IPressure) connectedBlocks[i]).canPressureToo(color.getLiquidData(), dir))
|
||||
{
|
||||
|
||||
int p = ((IPressure) connectedBlocks[i]).presureOutput(color.getLiquidData(), dir);
|
||||
if (p > highestPressure)
|
||||
highestPressure = p;
|
||||
}
|
||||
}
|
||||
this.presure = highestPressure - 1;
|
||||
}
|
||||
|
||||
public int getPressure()
|
||||
{
|
||||
return this.presure;
|
||||
}
|
||||
}
|
|
@ -1,261 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.liquids.IPressure;
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import net.minecraft.block.Block;
|
||||
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.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.core.electricity.ElectricityConnections;
|
||||
import universalelectricity.core.electricity.ElectricityNetwork;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.prefab.tile.TileEntityElectricityReceiver;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntityPump extends TileEntityElectricityReceiver implements IPacketReceiver, IReadOut, IPressure
|
||||
{
|
||||
public final double WATTS_PER_TICK = (400/20);
|
||||
double percentPumped = 0.0;
|
||||
double joulesReceived = 0;
|
||||
|
||||
int disableTimer = 0;
|
||||
int count = 0;
|
||||
public int pos = 0;
|
||||
|
||||
private boolean converted = false;
|
||||
public ColorCode color = ColorCode.BLUE;
|
||||
|
||||
ForgeDirection back = ForgeDirection.EAST;
|
||||
ForgeDirection side = ForgeDirection.EAST;
|
||||
|
||||
ITankContainer fillTarget = null;
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
this.getConnections();
|
||||
ElectricityConnections.registerConnector(this, EnumSet.of(back, side));
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, LiquidMechanics.blockMachine.blockID);
|
||||
}
|
||||
|
||||
public void getConnections()
|
||||
{
|
||||
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
back = ForgeDirection.getOrientation(notchMeta);
|
||||
side = Vector3.getOrientationFromSide(back, ForgeDirection.WEST);
|
||||
if (notchMeta == 2 || notchMeta == 3)
|
||||
{
|
||||
side = side.getOpposite();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable(int duration)
|
||||
{
|
||||
disableTimer = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisabled()
|
||||
{
|
||||
if (disableTimer <= 0) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
// consume/give away stored units
|
||||
this.chargeUp();
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord+side.offsetX,yCoord+side.offsetY,zCoord+side.offsetZ);
|
||||
if(ent instanceof ITankContainer)
|
||||
{
|
||||
this.fillTarget = (ITankContainer) ent;
|
||||
}else
|
||||
{
|
||||
ent = null;
|
||||
}
|
||||
if (this.canPump(xCoord, yCoord - 1, zCoord) && this.joulesReceived >= this.WATTS_PER_TICK)
|
||||
{
|
||||
|
||||
joulesReceived -= this.WATTS_PER_TICK;
|
||||
this.pos++;
|
||||
if (pos >= 8)
|
||||
{
|
||||
pos = 0;
|
||||
}
|
||||
if (percentPumped++ >= 10)
|
||||
{
|
||||
percentPumped = 0;
|
||||
this.drainBlock(new Vector3(xCoord, yCoord - 1, zCoord));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.ticks % 10 == 0)
|
||||
{
|
||||
//TODO fix this to tell the client its running
|
||||
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, color.ordinal(),this.joulesReceived);
|
||||
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the search range the pump used to find valid block to pump
|
||||
*/
|
||||
public int getPumpRange()
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
switch (MetaGroup.getGrouping(meta))
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 20;
|
||||
case 3:
|
||||
return 50;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* causes this to request/drain energy from connected networks
|
||||
*/
|
||||
public void chargeUp()
|
||||
{
|
||||
// this.joulesReceived += this.WATTS_PER_TICK; //TODO remove after
|
||||
// testing
|
||||
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
if (dir == this.back || dir == this.side)
|
||||
{
|
||||
TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), dir);
|
||||
ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(inputTile, dir);
|
||||
if (network != null)
|
||||
{
|
||||
|
||||
if (this.canPump(xCoord, yCoord - 1, zCoord))
|
||||
{
|
||||
network.startRequesting(this, WATTS_PER_TICK / this.getVoltage(), this.getVoltage());
|
||||
this.joulesReceived = Math.max(Math.min(this.joulesReceived + network.consumeElectricity(this).getWatts(), WATTS_PER_TICK), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
network.stopRequesting(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPump(int x, int y, int z)
|
||||
{
|
||||
int blockID = worldObj.getBlockId(x, y, z);
|
||||
int meta = worldObj.getBlockMetadata(x, y, z);
|
||||
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
|
||||
|
||||
if (this.fillTarget == null || this.fillTarget.fill(side, this.color.getLiquidData().getStack(), false) == 0) { return false; }
|
||||
|
||||
if (this.isDisabled()) { return false; }
|
||||
|
||||
if ((LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == null || LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == LiquidHandler.unkown)) { return false; }
|
||||
|
||||
if (blockID == Block.waterMoving.blockID || blockID == Block.lavaStill.blockID) { return false; }
|
||||
if (blockID == Block.waterStill.blockID || blockID == Block.waterStill.blockID)
|
||||
{
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* drains the block or in other words removes it
|
||||
*
|
||||
* @param loc
|
||||
* @return true if the block was drained
|
||||
*/
|
||||
public boolean drainBlock(Vector3 loc)
|
||||
{
|
||||
int blockID = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ());
|
||||
int meta = worldObj.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ());
|
||||
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
|
||||
if (resource == color.getLiquidData() && meta == 0 && this.fillTarget.fill(back, resource.getStack(), false) != 0)
|
||||
{
|
||||
|
||||
LiquidStack stack = resource.getStack();
|
||||
stack.amount = LiquidContainerRegistry.BUCKET_VOLUME;
|
||||
int f = this.fillTarget.fill(back, this.color.getLiquidData().getStack(), true);
|
||||
if (f > 0)
|
||||
{
|
||||
worldObj.setBlockWithNotify(xCoord, yCoord - 1, zCoord, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput data)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.color = ColorCode.get(data.readInt());
|
||||
this.joulesReceived = data.readDouble();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
return this.joulesReceived + "/" + this.WATTS_PER_TICK + " " + this.percentPumped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(LiquidData type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.color.getLiquidData() || type == LiquidHandler.unkown)
|
||||
return this.color.getLiquidData().getPressure();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPressureToo(LiquidData type, ForgeDirection dir)
|
||||
{
|
||||
if (dir == this.side.getOpposite() && (type == this.color.getLiquidData() || type == LiquidHandler.unkown)) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,376 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.api.IColorCoded;
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.api.liquids.IPressure;
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.block.BlockReleaseValve;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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.LiquidStack;
|
||||
import universalelectricity.prefab.implement.IRedstoneReceptor;
|
||||
|
||||
public class TileEntityReleaseValve extends TileEntity implements IPressure, IReadOut, IRedstoneReceptor, IInventory
|
||||
{
|
||||
public boolean[] allowed = new boolean[ColorCode.values().length - 1];
|
||||
public TileEntity[] connected = new TileEntity[6];
|
||||
|
||||
private List<TileEntityPipe> output = new ArrayList<TileEntityPipe>();
|
||||
private List<ILiquidTank> input = new ArrayList<ILiquidTank>();
|
||||
|
||||
private int ticks = 0;
|
||||
|
||||
public boolean isPowered = false;
|
||||
public boolean converted = false;
|
||||
|
||||
private ItemStack[] inventory = new ItemStack[0];
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
connected = connectionHelper.getSurroundingTileEntities(this);
|
||||
for(int i =0; i < 6;i++)
|
||||
{
|
||||
if(connected[i] instanceof ITankContainer)
|
||||
{
|
||||
if(connected[i] instanceof IColorCoded && !this.canConnect(((IColorCoded) connected[i]).getColor()))
|
||||
{
|
||||
connected[i] = null;
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
||||
connected[i] = null;
|
||||
}
|
||||
}
|
||||
if (!this.worldObj.isRemote && ticks++ >= 20)
|
||||
{
|
||||
ticks = 0;
|
||||
BlockReleaseValve.checkForPower(worldObj, xCoord, yCoord, zCoord);
|
||||
validateNBuildList();
|
||||
// start the draining process
|
||||
if (this.input.size() > 0 && this.output.size() > 0)
|
||||
{
|
||||
for (ILiquidTank tank : input)
|
||||
{
|
||||
|
||||
if (tank.getLiquid() != null && tank.getLiquid().amount > 0)
|
||||
{
|
||||
//FMLLog.warning("Tank: " + LiquidHandler.getName(tank.getLiquid()) + " Vol: " + tank.getLiquid().amount);
|
||||
TileEntityPipe pipe = this.findValidPipe(tank.getLiquid());
|
||||
if (pipe != null)
|
||||
{
|
||||
ILiquidTank tankP = pipe.getTanks(ForgeDirection.UNKNOWN)[0];
|
||||
//FMLLog.warning("Pipe: " + pipe.getColor() + " Vol: " + (tankP.getLiquid() != null ? tankP.getLiquid().amount : 0000));
|
||||
int drain = pipe.fill(ForgeDirection.UNKNOWN, tank.getLiquid(), true);
|
||||
tank.drain(drain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** used to find a valid pipe for filling of the liquid type */
|
||||
public TileEntityPipe findValidPipe(LiquidStack stack)
|
||||
{
|
||||
|
||||
// find normal color selective pipe first
|
||||
for (TileEntityPipe pipe : output)
|
||||
{
|
||||
ILiquidTank tank = pipe.getTanks(ForgeDirection.UNKNOWN)[0];
|
||||
if (LiquidHandler.isEqual(pipe.getColor().getLiquidData().getStack(),stack) && (tank.getLiquid() == null || tank.getLiquid().amount < tank.getCapacity()))
|
||||
{
|
||||
//
|
||||
return pipe;
|
||||
}
|
||||
}
|
||||
// if no color selective pipe is found look for generic pipes
|
||||
for (TileEntityPipe pipe : output)
|
||||
{
|
||||
if (pipe.getColor() == ColorCode.NONE) { return pipe; }
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/** sees if it can connect to a pipe of some color */
|
||||
public boolean canConnect(ColorCode cc)
|
||||
{
|
||||
if (this.isRestricted())
|
||||
{
|
||||
for (int i = 0; i < this.allowed.length; i++)
|
||||
{
|
||||
if (i == cc.ordinal()) { return allowed[i]; }
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** if any of allowed list is true
|
||||
*
|
||||
* @return true */
|
||||
public boolean isRestricted()
|
||||
{
|
||||
for (int i = 0; i < this.allowed.length; i++)
|
||||
{
|
||||
if (allowed[i]) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** checks a liquidstack against its color code
|
||||
*
|
||||
* @param stack
|
||||
* @return */
|
||||
public boolean canAcceptLiquid(LiquidStack stack)
|
||||
{
|
||||
if (!this.isRestricted()) { return true; }
|
||||
return canConnect(ColorCode.get(LiquidHandler.get(stack)));
|
||||
}
|
||||
|
||||
/** Collects info about the surrounding 6 tiles and orders them into
|
||||
* drain-able(ITankContainer) and fill-able(TileEntityPipes) instances */
|
||||
public void validateNBuildList()
|
||||
{
|
||||
// cleanup
|
||||
this.connected = connectionHelper.getSurroundingTileEntities(worldObj, xCoord, yCoord, zCoord);
|
||||
this.input.clear();
|
||||
this.output.clear();
|
||||
// read surroundings
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
TileEntity ent = connected[i];
|
||||
if (ent instanceof TileEntityPipe)
|
||||
{
|
||||
TileEntityPipe pipe = (TileEntityPipe) ent;
|
||||
ILiquidTank tank = pipe.getTanks(ForgeDirection.UNKNOWN)[0];
|
||||
if (this.isRestricted() && this.canConnect(pipe.getColor()))
|
||||
{
|
||||
connected[i] = null;
|
||||
}
|
||||
else if (tank.getLiquid() != null && tank.getLiquid().amount >= tank.getCapacity())
|
||||
{
|
||||
connected[i] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.output.add(pipe);
|
||||
}
|
||||
}
|
||||
else if (ent instanceof ITankContainer)
|
||||
{
|
||||
ILiquidTank[] tanks = ((ITankContainer) connected[i]).getTanks(dir);
|
||||
for (int t = 0; t < tanks.length; t++)
|
||||
{
|
||||
LiquidStack ll = tanks[t].getLiquid();
|
||||
if (ll != null && ll.amount > 0 && ll.amount > 0)
|
||||
{
|
||||
if (this.canAcceptLiquid(ll))
|
||||
{
|
||||
this.input.add(tanks[t]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
connected[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(LiquidData type, ForgeDirection dir)
|
||||
{
|
||||
if (type == null) return 0;
|
||||
if (this.canConnect(type.getColor())) { return type.getPressure(); }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPressureToo(LiquidData type, ForgeDirection dir)
|
||||
{
|
||||
if (type == null) return false;
|
||||
if (this.canConnect(type.getColor())) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
// TODO maybe debug on # of connected units of input/output
|
||||
String output = "";
|
||||
if (this.isRestricted())
|
||||
{
|
||||
output += "Output: Restricted and";
|
||||
}
|
||||
else
|
||||
{
|
||||
output += " Output: UnRestricted and";
|
||||
}
|
||||
if (!this.isPowered)
|
||||
{
|
||||
output += " Running ";
|
||||
}
|
||||
else
|
||||
{
|
||||
output += " Offline ";
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
for (int i = 0; i < this.allowed.length; i++)
|
||||
{
|
||||
allowed[i] = nbt.getBoolean("allowed" + i);
|
||||
}
|
||||
}
|
||||
|
||||
/** Writes a tile entity to NBT. */
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
for (int i = 0; i < this.allowed.length; i++)
|
||||
{
|
||||
nbt.setBoolean("allowed" + i, allowed[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerOn()
|
||||
{
|
||||
this.isPowered = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerOff()
|
||||
{
|
||||
this.isPowered = false;
|
||||
|
||||
}
|
||||
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.inventory.length;
|
||||
}
|
||||
|
||||
/** Returns the stack in slot i */
|
||||
public ItemStack getStackInSlot(int par1)
|
||||
{
|
||||
return this.inventory[par1];
|
||||
}
|
||||
|
||||
/** Removes from an inventory slot (first arg) up to a specified number
|
||||
* (second arg) of items and returns them in a new stack. */
|
||||
public ItemStack decrStackSize(int par1, int par2)
|
||||
{
|
||||
if (this.inventory[par1] != null)
|
||||
{
|
||||
ItemStack var3;
|
||||
|
||||
if (this.inventory[par1].stackSize <= par2)
|
||||
{
|
||||
var3 = this.inventory[par1];
|
||||
this.inventory[par1] = null;
|
||||
return var3;
|
||||
}
|
||||
else
|
||||
{
|
||||
var3 = this.inventory[par1].splitStack(par2);
|
||||
|
||||
if (this.inventory[par1].stackSize == 0)
|
||||
{
|
||||
this.inventory[par1] = null;
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** When some containers are closed they call this on each slot, then drop
|
||||
* whatever it returns as an EntityItem - like when you close a workbench
|
||||
* GUI. */
|
||||
public ItemStack getStackInSlotOnClosing(int par1)
|
||||
{
|
||||
if (this.inventory[par1] != null)
|
||||
{
|
||||
ItemStack var2 = this.inventory[par1];
|
||||
this.inventory[par1] = null;
|
||||
return var2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the given item stack to the specified slot in the inventory (can be
|
||||
* crafting or armor sections). */
|
||||
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
this.inventory[par1] = par2ItemStack;
|
||||
|
||||
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
par2ItemStack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return "Release Valve";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer var1)
|
||||
{
|
||||
return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : var1.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.mech.IForce;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
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.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
||||
public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce, IReadOut
|
||||
{
|
||||
|
||||
public int pos = 0;
|
||||
private int currentForce = 0;// current force given to rod
|
||||
private int pasteForce = 0;// last update force count
|
||||
public int appliedForce = 0;// force this rod can apply to other things
|
||||
private int tickCount = 0;
|
||||
private int posCount = 0;// animation position 0-8
|
||||
|
||||
private ForgeDirection facing = ForgeDirection.UNKNOWN;
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if (tickCount++ >= 10)
|
||||
{
|
||||
tickCount = 0;
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
facing = ForgeDirection.getOrientation(meta);
|
||||
if (this.currentForce > 0)
|
||||
{
|
||||
this.pos++;
|
||||
if (pos >= 8)
|
||||
pos = 0;
|
||||
}
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
TileEntity ent = Vector3.getTileEntityFromSide(worldObj, new Vector3(this), facing);
|
||||
appliedForce = Math.max(currentForce - 20, 0);
|
||||
if (ent instanceof IForce && (((IForce) ent).canInputSide(facing)))
|
||||
{
|
||||
((IForce) ent).applyForce(appliedForce);
|
||||
}
|
||||
|
||||
if (this.currentForce != this.pasteForce)
|
||||
{
|
||||
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, new Object[] { currentForce });
|
||||
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 40);
|
||||
}
|
||||
this.pasteForce = this.currentForce;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getForceSide(ForgeDirection side)
|
||||
{
|
||||
return appliedForce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOutputSide(ForgeDirection side)
|
||||
{
|
||||
if (side == facing || side == facing.getOpposite()) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInputSide(ForgeDirection side)
|
||||
{
|
||||
if (side == facing || side == facing.getOpposite()) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int applyForce(int force)
|
||||
{
|
||||
this.currentForce = force;
|
||||
return force;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput data)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.currentForce = data.readInt();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.out.print("MechRodDataFailure \n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnimationPos()
|
||||
{
|
||||
return this.pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getForce()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return this.currentForce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
return this.appliedForce + "N Out " + this.currentForce + "N In";
|
||||
}
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import liquidmechanics.api.IColorCoded;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
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.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntitySink extends TileEntity implements IPacketReceiver, ITankContainer, IColorCoded
|
||||
{
|
||||
public TileEntity[] cc = { null, null, null, null, null, null };
|
||||
|
||||
private ColorCode color = ColorCode.BLUE;
|
||||
|
||||
public static final int LMax = 2;
|
||||
private int count = 100;
|
||||
private LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * LMax);
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (count++ >= 100)
|
||||
{
|
||||
triggerUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void triggerUpdate()
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
LiquidStack stack = new LiquidStack(0, 0, 0);
|
||||
if (this.tank.getLiquid() != null)
|
||||
{
|
||||
stack = this.tank.getLiquid();
|
||||
}
|
||||
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, new Object[] { stack.itemID, stack.amount, stack.itemMeta });
|
||||
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 20);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public LiquidStack getStack()
|
||||
{
|
||||
return tank.getLiquid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
LiquidStack liquid = new LiquidStack(0, 0, 0);
|
||||
liquid.readFromNBT(nbt.getCompoundTag("stored"));
|
||||
tank.setLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
if (tank.getLiquid() != null)
|
||||
{
|
||||
nbt.setTag("stored", tank.getLiquid().writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput data)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.tank.setLiquid(new LiquidStack(data.readInt(), data.readInt(), data.readInt()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.out.print("Fail reading data for Storage tank \n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null || (!LiquidHandler.isEqual(resource, color.getLiquidData().getStack()))) { return 0; }
|
||||
return this.fill(0, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null || tankIndex != 0) { return 0; }
|
||||
if (doFill)
|
||||
{
|
||||
triggerUpdate();
|
||||
}
|
||||
return this.tank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack 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) { return null; }
|
||||
LiquidStack stack = this.tank.getLiquid();
|
||||
if (maxDrain < this.tank.getLiquid().amount)
|
||||
{
|
||||
stack = LiquidHandler.getStack(stack, maxDrain);
|
||||
}
|
||||
if (doDrain)
|
||||
{
|
||||
triggerUpdate();
|
||||
this.tank.drain(maxDrain, doDrain);
|
||||
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank[] getTanks(ForgeDirection direction)
|
||||
{
|
||||
return new ILiquidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(Object obj)
|
||||
{
|
||||
// this.color = ColorCode.get(cc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorCode getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
}
|
|
@ -1,329 +0,0 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import liquidmechanics.api.IColorCoded;
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.api.liquids.IPressure;
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.UpdateConverter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
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.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntityTank extends TileEntity implements IPacketReceiver, IReadOut, IPressure, ITankContainer, IColorCoded
|
||||
{
|
||||
public TileEntity[] cc = { null, null, null, null, null, null };
|
||||
|
||||
private ColorCode color = ColorCode.NONE;
|
||||
|
||||
public static final int LMax = 4;
|
||||
private int count, count2 = 0;
|
||||
|
||||
public int pVolume = 0;
|
||||
|
||||
private LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * LMax);
|
||||
|
||||
public void updateEntity()
|
||||
{
|
||||
|
||||
this.color = ColorCode.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
if (++count >= 40)
|
||||
{
|
||||
count = 0;
|
||||
this.cc = connectionHelper.getSurroundingTileEntities(worldObj, xCoord, yCoord, zCoord);
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
this.tradeDown();
|
||||
this.tradeArround();
|
||||
this.fillPipe();
|
||||
|
||||
LiquidStack stack = new LiquidStack(0, 0, 0);
|
||||
if (this.tank.getLiquid() != null)
|
||||
{
|
||||
stack = this.tank.getLiquid();
|
||||
}
|
||||
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, new Object[] { stack.itemID, stack.amount, stack.itemMeta });
|
||||
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 20);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LiquidStack getStack()
|
||||
{
|
||||
return tank.getLiquid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
if (tank.getLiquid() == null) { return "Empty"; }
|
||||
return (tank.getLiquid().amount / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (tank.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME)
|
||||
+ " " + LiquidHandler.get(tank.getLiquid()).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
UpdateConverter.convert(this, nbt);
|
||||
|
||||
LiquidStack liquid = new LiquidStack(0, 0, 0);
|
||||
liquid.readFromNBT(nbt.getCompoundTag("stored"));
|
||||
tank.setLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
if (tank.getLiquid() != null)
|
||||
{
|
||||
nbt.setTag("stored", tank.getLiquid().writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput data)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.tank.setLiquid(new LiquidStack(data.readInt(), data.readInt(), data.readInt()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.out.print("Fail reading data for Storage tank \n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null || (!LiquidHandler.isEqual(resource, color.getLiquidData().getStack()) && this.color != ColorCode.NONE)) { return 0; }
|
||||
return this.fill(0, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null || tankIndex != 0) { return 0; }
|
||||
|
||||
if (this.isFull())
|
||||
{
|
||||
int change = 1;
|
||||
if (LiquidHandler.get(resource).getCanFloat())
|
||||
{
|
||||
change = -1;
|
||||
}
|
||||
TileEntity tank = worldObj.getBlockTileEntity(xCoord, yCoord + change, zCoord);
|
||||
if (tank instanceof TileEntityTank) { return ((TileEntityTank) tank).fill(0, resource, doFill); }
|
||||
}
|
||||
return this.tank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
/**
|
||||
* find out if this tank is actual full or not
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isFull()
|
||||
{
|
||||
if (this.tank.getLiquid() == null) { return false; }
|
||||
if (this.tank.getLiquid().amount > 0 && this.tank.getLiquid().amount < this.tank.getCapacity()) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack 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) { return null; }
|
||||
LiquidStack stack = this.tank.getLiquid();
|
||||
if (maxDrain < this.tank.getLiquid().amount)
|
||||
{
|
||||
stack = LiquidHandler.getStack(stack, maxDrain);
|
||||
}
|
||||
if (doDrain)
|
||||
{
|
||||
this.tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank[] getTanks(ForgeDirection direction)
|
||||
{
|
||||
return new ILiquidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int presureOutput(LiquidData type, ForgeDirection dir)
|
||||
{
|
||||
if (type == color.getLiquidData() || type == LiquidHandler.unkown)
|
||||
{
|
||||
if (type.getCanFloat() && dir == ForgeDirection.DOWN)
|
||||
return type.getPressure();
|
||||
if (!type.getCanFloat() && dir == ForgeDirection.UP)
|
||||
return type.getPressure();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPressureToo(LiquidData type, ForgeDirection dir)
|
||||
{
|
||||
if (type == color.getLiquidData() || type == LiquidHandler.unkown)
|
||||
{
|
||||
if (type.getCanFloat() && dir == ForgeDirection.DOWN)
|
||||
return true;
|
||||
if (!type.getCanFloat() && dir == ForgeDirection.UP)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* cause this TE to trade liquid down if the liquid is in liquid state or up
|
||||
* if in gas state.
|
||||
*/
|
||||
public void tradeDown()
|
||||
{
|
||||
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= 0)
|
||||
return;
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
if (ent instanceof TileEntityTank && ((TileEntityTank) ent).getColor() == this.color && !((TileEntityTank) ent).isFull())
|
||||
{
|
||||
int f = ((TileEntityTank) ent).tank.fill(this.tank.getLiquid(), true);
|
||||
this.tank.drain(f, true);
|
||||
}
|
||||
}
|
||||
|
||||
/** Cause this TE to trade liquid with the Tanks around it to level off */
|
||||
public void tradeArround()
|
||||
{
|
||||
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= 0) { return; }
|
||||
|
||||
TileEntity[] ents = connectionHelper.getSurroundingTileEntities(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
int commonVol = this.tank.getLiquid().amount;
|
||||
int tanks = 1;
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
if (ents[i] instanceof TileEntityTank && ((TileEntityTank) ents[i]).color == this.color)
|
||||
{
|
||||
tanks++;
|
||||
if (((TileEntityTank) ents[i]).tank.getLiquid() != null)
|
||||
{
|
||||
commonVol += ((TileEntityTank) ents[i]).tank.getLiquid().amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int equalVol = commonVol / tanks;
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= equalVol)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ents[i] instanceof TileEntityTank && ((TileEntityTank) ents[i]).color == this.color && !((TileEntityTank) ents[i]).isFull())
|
||||
{
|
||||
LiquidStack target = ((TileEntityTank) ents[i]).tank.getLiquid();
|
||||
LiquidStack filling = this.tank.getLiquid();
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
filling = LiquidHandler.getStack(this.tank.getLiquid(), equalVol);
|
||||
}
|
||||
else if (target.amount < equalVol)
|
||||
{
|
||||
filling = LiquidHandler.getStack(this.tank.getLiquid(), equalVol - target.amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
filling = null;
|
||||
}
|
||||
int f = ((TileEntityTank) ents[i]).tank.fill(filling, true);
|
||||
this.tank.drain(f, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Causes this to fill a pipe either above or bellow based on liquid data */
|
||||
public void fillPipe()
|
||||
{
|
||||
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= 0) { return; }
|
||||
LiquidData data = LiquidHandler.get(this.tank.getLiquid());
|
||||
if (data != null)
|
||||
{
|
||||
|
||||
int change = -1;
|
||||
if (data.getCanFloat())
|
||||
{
|
||||
change = 1;
|
||||
}
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord + change, zCoord);
|
||||
if (ent instanceof TileEntityPipe)
|
||||
{
|
||||
ColorCode c = ((TileEntityPipe) ent).getColor();
|
||||
if (c == ColorCode.NONE || c == this.color)
|
||||
{
|
||||
int vol = LiquidContainerRegistry.BUCKET_VOLUME;
|
||||
if (this.tank.getLiquid().amount < vol)
|
||||
{
|
||||
vol = this.tank.getLiquid().amount;
|
||||
}
|
||||
int f = ((TileEntityPipe) ent).fill(0, LiquidHandler.getStack(this.tank.getLiquid(), vol), true);
|
||||
this.tank.drain(f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(Object obj)
|
||||
{
|
||||
this.color = ColorCode.get(cc);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorCode getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package liquidmechanics.core.implement;
|
||||
|
||||
import liquidmechanics.core.pressure.FluidPressureNetwork;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.core.electricity.ElectricityNetwork;
|
||||
|
||||
/**
|
||||
* Must be applied to all tile entities that are conductors.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public interface IPipe
|
||||
{
|
||||
/**
|
||||
* The Fluid network that this pipe is part of
|
||||
*/
|
||||
public FluidPressureNetwork getNetwork();
|
||||
|
||||
public void setNetwork(FluidPressureNetwork network);
|
||||
|
||||
/**
|
||||
* The UE tile entities that this conductor is connected to.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public TileEntity[] getConnectedBlocks();
|
||||
|
||||
/**
|
||||
* Gets the resistance the pipes too the liquid going threw it
|
||||
*
|
||||
* @return The amount of Ohm's of resistance.
|
||||
*/
|
||||
public double getResistance(LiquidStack stack);
|
||||
|
||||
/**
|
||||
* The maximum amount of amps this pipe can handle before bursting. This is calculating
|
||||
* PER TICK!
|
||||
*
|
||||
* @return The amount of amps in volts
|
||||
*/
|
||||
public double getMaxPressure();
|
||||
|
||||
/**
|
||||
* Called when the pressure on the pipe passes max
|
||||
*/
|
||||
public void onOverPressure();
|
||||
|
||||
/**
|
||||
* Resets the pipe and recalculate connection IDs again
|
||||
*/
|
||||
public void reset();
|
||||
|
||||
/**
|
||||
* Instantly refreshes all connected blocks
|
||||
*/
|
||||
public void refreshConnectedBlocks();
|
||||
|
||||
/**
|
||||
* Adds a connection between this conductor and a UE unit
|
||||
*
|
||||
* @param tileEntity - Must be either a producer, consumer or a conductor
|
||||
* @param side - side in which the connection is coming from
|
||||
*/
|
||||
public void updateConnection(TileEntity tileEntity, ForgeDirection side);
|
||||
|
||||
public void updateConnectionWithoutSplit(TileEntity connectorFromSide, ForgeDirection orientation);
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
package liquidmechanics.core.pressure;
|
||||
|
||||
/**
|
||||
* An easy way to display information on electricity.
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
|
||||
public class FluidInfo
|
||||
{
|
||||
public static enum FluidUnits
|
||||
{
|
||||
FLOW_Rate("FLOW", "I"), PRESSURE("NPB", "P"), FORCE("Force", "N"), WATT_HOUR("Watt Hour", "Wh"), RESISTANCE("Ohm", "R");
|
||||
|
||||
public String name;
|
||||
public String symbol;
|
||||
|
||||
private FluidUnits(String name, String symbol)
|
||||
{
|
||||
this.name = name;
|
||||
this.symbol = symbol;
|
||||
}
|
||||
|
||||
public String getPlural()
|
||||
{
|
||||
return this.name + "s";
|
||||
}
|
||||
}
|
||||
|
||||
public static enum MeasurementUnit
|
||||
{
|
||||
MICRO("Micro", "u", 0.000001), MILLI("Milli", "m", 0.001), KILO("Kilo", "k", 1000), MEGA("Mega", "M", 1000000);
|
||||
|
||||
public String name;
|
||||
public String symbol;
|
||||
public double value;
|
||||
|
||||
private MeasurementUnit(String name, String symbol, double value)
|
||||
{
|
||||
this.name = name;
|
||||
this.symbol = symbol;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName(boolean isSymbol)
|
||||
{
|
||||
if (isSymbol)
|
||||
{
|
||||
return symbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public double process(double value)
|
||||
{
|
||||
return value / this.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Displays the unit as text. Works only for positive numbers.
|
||||
*/
|
||||
public static String getDisplay(double value, FluidUnits unit, int decimalPlaces, boolean isShort)
|
||||
{
|
||||
String unitName = unit.name;
|
||||
|
||||
if (isShort)
|
||||
{
|
||||
unitName = unit.symbol;
|
||||
}
|
||||
else if (value > 1)
|
||||
{
|
||||
unitName = unit.getPlural();
|
||||
}
|
||||
|
||||
if (value == 0) { return value + " " + unitName; }
|
||||
|
||||
if (value <= MeasurementUnit.MILLI.value) { return roundDecimals(MeasurementUnit.MICRO.process(value), decimalPlaces) + " " + MeasurementUnit.MICRO.getName(isShort) + unitName; }
|
||||
|
||||
if (value < 1) { return roundDecimals(MeasurementUnit.MILLI.process(value), decimalPlaces) + " " + MeasurementUnit.MILLI.getName(isShort) + unitName; }
|
||||
|
||||
if (value > MeasurementUnit.MEGA.value) { return roundDecimals(MeasurementUnit.MEGA.process(value), decimalPlaces) + " " + MeasurementUnit.MEGA.getName(isShort) + unitName; }
|
||||
|
||||
if (value > MeasurementUnit.KILO.value) { return roundDecimals(MeasurementUnit.KILO.process(value), decimalPlaces) + " " + MeasurementUnit.KILO.getName(isShort) + unitName; }
|
||||
|
||||
return roundDecimals(value, decimalPlaces) + " " + unitName;
|
||||
}
|
||||
|
||||
public static String getDisplay(double value, FluidUnits unit)
|
||||
{
|
||||
return getDisplay(value, unit, 2, false);
|
||||
}
|
||||
|
||||
public static String getDisplayShort(double value, FluidUnits unit)
|
||||
{
|
||||
return getDisplay(value, unit, 2, true);
|
||||
}
|
||||
|
||||
public static String getDisplayShort(double value, FluidUnits unit, int decimalPlaces)
|
||||
{
|
||||
return getDisplay(value, unit, decimalPlaces, true);
|
||||
}
|
||||
|
||||
public static String getDisplaySimple(double value, FluidUnits unit, int decimalPlaces)
|
||||
{
|
||||
if (value > 1)
|
||||
{
|
||||
if (decimalPlaces < 1) { return (int) value + " " + unit.getPlural(); }
|
||||
|
||||
return roundDecimals(value, decimalPlaces) + " " + unit.getPlural();
|
||||
}
|
||||
|
||||
if (decimalPlaces < 1) { return (int) value + " " + unit.name; }
|
||||
|
||||
return roundDecimals(value, decimalPlaces) + " " + unit.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds a number to a specific number place places
|
||||
*
|
||||
* @param The number
|
||||
* @return The rounded number
|
||||
*/
|
||||
public static double roundDecimals(double d, int decimalPlaces)
|
||||
{
|
||||
int j = (int) (d * Math.pow(10, decimalPlaces));
|
||||
return j / (double) Math.pow(10, decimalPlaces);
|
||||
}
|
||||
|
||||
public static double roundDecimals(double d)
|
||||
{
|
||||
return roundDecimals(d, 2);
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package liquidmechanics.core.pressure;
|
||||
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
/**
|
||||
* A simple way to store electrical data.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class FluidPacket implements Cloneable
|
||||
{
|
||||
public LiquidStack liquidStack;
|
||||
public double pressure;
|
||||
|
||||
public FluidPacket(double pressure, LiquidStack stack)
|
||||
{
|
||||
this.liquidStack = stack;
|
||||
this.pressure = pressure;
|
||||
}
|
||||
|
||||
public FluidPacket()
|
||||
{
|
||||
this(0, new LiquidStack(0,0,0));
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ElectricityPack [Amps:" + this.liquidStack + " Volts:" + this.pressure + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidPacket clone()
|
||||
{
|
||||
return new FluidPacket( this.pressure,this.liquidStack);
|
||||
}
|
||||
|
||||
public boolean isEquals(FluidPacket electricityPack)
|
||||
{
|
||||
return this.liquidStack == electricityPack.liquidStack && this.pressure == electricityPack.pressure;
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
package liquidmechanics.core.pressure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import liquidmechanics.core.implement.IPipe;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
/**
|
||||
* based on Calclavia's UE Electric Network stuff
|
||||
*
|
||||
*/
|
||||
public class FluidPressure
|
||||
{
|
||||
public static FluidPressure instance = new FluidPressure();
|
||||
|
||||
private List<FluidPressureNetwork> electricityNetworks = new ArrayList<FluidPressureNetwork>();
|
||||
|
||||
/**
|
||||
* Registers a conductor into the UE electricity net.
|
||||
*/
|
||||
public void registerConductor(IPipe newConductor)
|
||||
{
|
||||
this.cleanUpNetworks();
|
||||
FluidPressureNetwork newNetwork = new FluidPressureNetwork(newConductor);
|
||||
this.electricityNetworks.add(newNetwork);
|
||||
}
|
||||
|
||||
public void unregister(TileEntity tileEntity)
|
||||
{
|
||||
for (FluidPressureNetwork network : this.electricityNetworks)
|
||||
{
|
||||
network.stopProducing(tileEntity);
|
||||
network.stopRequesting(tileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two connection lines together into one.
|
||||
*
|
||||
* @param networkA
|
||||
* - The network to be merged into. This network will be kept.
|
||||
* @param networkB
|
||||
* - The network to be merged. This network will be deleted.
|
||||
*/
|
||||
public void mergeConnection(FluidPressureNetwork networkA, FluidPressureNetwork networkB)
|
||||
{
|
||||
if (networkA != networkB)
|
||||
{
|
||||
if (networkA != null && networkB != null)
|
||||
{
|
||||
networkA.conductors.addAll(networkB.conductors);
|
||||
networkA.setNetwork();
|
||||
this.electricityNetworks.remove(networkB);
|
||||
networkB = null;
|
||||
|
||||
networkA.cleanConductors();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("Failed to merge Universal Electricity wire connections!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Separate one connection line into two different ones between two
|
||||
* conductors. This function does this by resetting all wires in the
|
||||
* connection line and making them each reconnect.
|
||||
*
|
||||
* @param conductorA
|
||||
* - existing conductor
|
||||
* @param conductorB
|
||||
* - broken/invalid conductor
|
||||
*/
|
||||
public void splitConnection(IPipe conductorA, IPipe conductorB)
|
||||
{
|
||||
try
|
||||
{
|
||||
FluidPressureNetwork network = conductorA.getNetwork();
|
||||
|
||||
if (network != null)
|
||||
{
|
||||
network.cleanConductors();
|
||||
network.resetConductors();
|
||||
|
||||
Iterator it = network.conductors.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
IPipe conductor = (IPipe) it.next();
|
||||
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
conductor.updateConnectionWithoutSplit(Vector3.getConnectorFromSide(((TileEntity) conductor).worldObj, new Vector3((TileEntity) conductor), ForgeDirection.getOrientation(i)), ForgeDirection.getOrientation(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.severe("Conductor invalid network while splitting connection!");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.severe("Failed to split wire connection!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up and remove all useless and invalid connections.
|
||||
*/
|
||||
public void cleanUpNetworks()
|
||||
{
|
||||
try
|
||||
{
|
||||
Iterator it = electricityNetworks.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
FluidPressureNetwork network = (FluidPressureNetwork) it.next();
|
||||
network.cleanConductors();
|
||||
|
||||
if (network.conductors.size() == 0)
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.severe("Failed to clean up wire connections!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void resetConductors()
|
||||
{
|
||||
Iterator it = electricityNetworks.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
FluidPressureNetwork network = ((FluidPressureNetwork) it.next());
|
||||
network.resetConductors();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,309 +0,0 @@
|
|||
package liquidmechanics.core.pressure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.core.implement.IPipe;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class FluidPressureNetwork
|
||||
{
|
||||
private final HashMap<TileEntity, FluidPacket> producers = new HashMap<TileEntity, FluidPacket>();
|
||||
private final HashMap<TileEntity, FluidPacket> consumers = new HashMap<TileEntity, FluidPacket>();
|
||||
|
||||
public final List<IPipe> conductors = new ArrayList<IPipe>();
|
||||
|
||||
public LiquidStack stack = new LiquidStack(0,0,0);
|
||||
|
||||
public FluidPressureNetwork(IPipe conductor)
|
||||
{
|
||||
this.addConductor(conductor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this tile entity to start producing energy in this network.
|
||||
*/
|
||||
public void startProducing(TileEntity tileEntity, FluidPacket pack)
|
||||
{
|
||||
if (tileEntity != null && pack.liquidStack != null && LiquidHandler.isEqual(stack, pack.liquidStack))
|
||||
{
|
||||
this.producers.put(tileEntity, pack);
|
||||
}
|
||||
}
|
||||
|
||||
public void startProducing(TileEntity tileEntity, double pressure, LiquidStack stack)
|
||||
{
|
||||
this.startProducing(tileEntity, new FluidPacket(pressure, stack));
|
||||
}
|
||||
|
||||
public boolean isProducing(TileEntity tileEntity)
|
||||
{
|
||||
return this.producers.containsKey(tileEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this tile entity to stop producing energy in this network.
|
||||
*/
|
||||
public void stopProducing(TileEntity tileEntity)
|
||||
{
|
||||
this.producers.remove(tileEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this tile entity to start producing energy in this network.
|
||||
*/
|
||||
public void startRequesting(TileEntity tileEntity, FluidPacket pack)
|
||||
{
|
||||
if (tileEntity != null && pack.liquidStack != null && LiquidHandler.isEqual(stack, pack.liquidStack))
|
||||
{
|
||||
this.consumers.put(tileEntity, pack);
|
||||
}
|
||||
}
|
||||
|
||||
public void startRequesting(TileEntity tileEntity, double pressure, LiquidStack stack)
|
||||
{
|
||||
this.startRequesting(tileEntity, new FluidPacket(pressure, stack));
|
||||
}
|
||||
|
||||
public boolean isRequesting(TileEntity tileEntity)
|
||||
{
|
||||
return this.consumers.containsKey(tileEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this tile entity to stop producing energy in this network.
|
||||
*/
|
||||
public void stopRequesting(TileEntity tileEntity)
|
||||
{
|
||||
this.consumers.remove(tileEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The electricity produced in this electricity network
|
||||
*/
|
||||
public FluidPacket getProduced(LiquidStack stack)
|
||||
{
|
||||
FluidPacket totalElectricity = new FluidPacket(0, new LiquidStack(stack.itemID,0,stack.itemMeta));
|
||||
|
||||
Iterator it = this.producers.entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) it.next();
|
||||
|
||||
if (pairs != null)
|
||||
{
|
||||
TileEntity tileEntity = (TileEntity) pairs.getKey();
|
||||
|
||||
if (tileEntity == null)
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tileEntity.isInvalid())
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) != tileEntity)
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
FluidPacket pack = (FluidPacket) pairs.getValue();
|
||||
|
||||
if (pairs.getKey() != null && pairs.getValue() != null && pack != null && totalElectricity.liquidStack != null && pack.liquidStack != null)
|
||||
{
|
||||
int volume = totalElectricity.liquidStack.amount + pack.liquidStack.amount;
|
||||
double pressure = Math.max(totalElectricity.pressure, pack.pressure);
|
||||
|
||||
totalElectricity.liquidStack = new LiquidStack(stack.itemID,volume,stack.itemMeta);
|
||||
totalElectricity.pressure = pressure;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalElectricity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return How much electricity this network needs.
|
||||
*/
|
||||
public FluidPacket getRequest(LiquidStack stack)
|
||||
{
|
||||
FluidPacket totalElectricity = this.getRequestWithoutReduction(stack);
|
||||
LiquidStack a = totalElectricity.liquidStack;
|
||||
LiquidStack b = this.getProduced(stack).liquidStack;
|
||||
if(a != null && b != null)
|
||||
{
|
||||
int amount = Math.max(a.amount - b.amount, 0);
|
||||
totalElectricity.liquidStack.amount = amount;
|
||||
}
|
||||
|
||||
return totalElectricity;
|
||||
}
|
||||
|
||||
public FluidPacket getRequestWithoutReduction(LiquidStack stack)
|
||||
{
|
||||
FluidPacket totalElectricity = new FluidPacket(0, new LiquidStack(stack.itemID,0,stack.itemMeta));
|
||||
|
||||
Iterator it = this.consumers.entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) it.next();
|
||||
|
||||
if (pairs != null)
|
||||
{
|
||||
TileEntity tileEntity = (TileEntity) pairs.getKey();
|
||||
|
||||
if (tileEntity == null)
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tileEntity.isInvalid())
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) != tileEntity)
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
FluidPacket pack = (FluidPacket) pairs.getValue();
|
||||
|
||||
if (pack != null && pack.liquidStack != null)
|
||||
{
|
||||
totalElectricity.liquidStack.amount += pack.liquidStack.amount;
|
||||
totalElectricity.pressure = Math.max(totalElectricity.pressure, pack.pressure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalElectricity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return Returns all producers in this electricity network.
|
||||
*/
|
||||
public HashMap<TileEntity, FluidPacket> getProducers()
|
||||
{
|
||||
return this.producers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns all consumers in this electricity network.
|
||||
*/
|
||||
public HashMap<TileEntity, FluidPacket> getConsumers()
|
||||
{
|
||||
return this.consumers;
|
||||
}
|
||||
|
||||
public void addConductor(IPipe newConductor)
|
||||
{
|
||||
this.cleanConductors();
|
||||
|
||||
if (!conductors.contains(newConductor))
|
||||
{
|
||||
conductors.add(newConductor);
|
||||
newConductor.setNetwork(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get only the electric units that can receive electricity from the given side.
|
||||
*/
|
||||
public List<TileEntity> getReceivers()
|
||||
{
|
||||
List<TileEntity> receivers = new ArrayList<TileEntity>();
|
||||
|
||||
Iterator it = this.consumers.entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) it.next();
|
||||
|
||||
if (pairs != null)
|
||||
{
|
||||
receivers.add((TileEntity) pairs.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
return receivers;
|
||||
}
|
||||
|
||||
public void cleanConductors()
|
||||
{
|
||||
for (int i = 0; i < conductors.size(); i++)
|
||||
{
|
||||
if (conductors.get(i) == null)
|
||||
{
|
||||
conductors.remove(i);
|
||||
}
|
||||
else if (((TileEntity) conductors.get(i)).isInvalid())
|
||||
{
|
||||
conductors.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void resetConductors()
|
||||
{
|
||||
for (int i = 0; i < conductors.size(); i++)
|
||||
{
|
||||
conductors.get(i).reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void setNetwork()
|
||||
{
|
||||
this.cleanConductors();
|
||||
|
||||
for (IPipe conductor : this.conductors)
|
||||
{
|
||||
conductor.setNetwork(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void onOverCharge()
|
||||
{
|
||||
this.cleanConductors();
|
||||
|
||||
for (int i = 0; i < conductors.size(); i++)
|
||||
{
|
||||
conductors.get(i).onOverPressure();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called to refresh all conductors in this network
|
||||
*/
|
||||
public void refreshConductors()
|
||||
{
|
||||
for (int j = 0; j < this.conductors.size(); j++)
|
||||
{
|
||||
IPipe conductor = this.conductors.get(j);
|
||||
conductor.refreshConnectedBlocks();
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 771 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 706 B |
Before Width: | Height: | Size: 28 KiB |
|
@ -1,59 +0,0 @@
|
|||
# FluidMechanics Language Properties
|
||||
# @author DarkGuardsman
|
||||
|
||||
itemGroup.fluidMechanics=Fluid Mechanics
|
||||
|
||||
# Blocks
|
||||
tile.lmGen.name=Generator
|
||||
tile.lmMachines.0.name=Pump
|
||||
tile.MechanicRod.name=Geared Rod
|
||||
tile.eValve.0.name=Release Valve
|
||||
tile.lmTank.name = Tank
|
||||
tile.lmSink.name = Sink
|
||||
|
||||
tile.lmPipe.0.name =Oil Pipe
|
||||
tile.lmPipe.1.name =Lava Pipe
|
||||
tile.lmPipe.2.name =Green Pipe
|
||||
tile.lmPipe.3.name =Waste Pipe
|
||||
tile.lmPipe.4.name =Water Pipe
|
||||
tile.lmPipe.5.name =Purple Pipe
|
||||
tile.lmPipe.6.name =Cyan Pipe
|
||||
tile.lmPipe.7.name =Silver Pipe
|
||||
tile.lmPipe.8.name =Grey Pipe
|
||||
tile.lmPipe.9.name =Pink Pipe
|
||||
tile.lmPipe.10.name =Lime Pipe
|
||||
tile.lmPipe.11.name =Fuel Pipe
|
||||
tile.lmPipe.12.name =LightBlue Pipe
|
||||
tile.lmPipe.13.name =Milk Pipe
|
||||
tile.lmPipe.14.name =Orange Pipe
|
||||
tile.lmPipe.15.name =Generic Pipe
|
||||
|
||||
tile.lmTank.0.name =Oil Tank
|
||||
tile.lmTank.1.name =Lava Tank
|
||||
tile.lmTank.2.name =Green Tank
|
||||
tile.lmTank.3.name =Waste Tank
|
||||
tile.lmTank.4.name =Water Tank
|
||||
tile.lmTank.5.name =Purple Tank
|
||||
tile.lmTank.6.name =Cyan Tank
|
||||
tile.lmTank.7.name =Silver Tank
|
||||
tile.lmTank.8.name =Grey Tank
|
||||
tile.lmTank.9.name =Pink Tank
|
||||
tile.lmTank.10.name =Lime Tank
|
||||
tile.lmTank.11.name =Fuel Tank
|
||||
tile.lmTank.12.name =LightBlue Tank
|
||||
tile.lmTank.13.name =Milk Tank
|
||||
tile.lmTank.14.name =Steam Tank
|
||||
tile.lmTank.15.name =Generic Tank
|
||||
|
||||
# Items
|
||||
item.lmPart.0.name=Bronze Tube
|
||||
item.lmPart.1.name=Iron Tube
|
||||
item.lmPart.2.name=Obby Tube
|
||||
item.lmPart.3.name=Nether Tube
|
||||
item.lmPart.4.name=Leather Seal
|
||||
item.lmPart.5.name=Slime Seal
|
||||
item.lmPart.6.name=Unfinished Tank
|
||||
item.lmPart.7.name=Valve
|
||||
|
||||
item.lmTool.0.name=Pipe Gauge
|
||||
|
Before Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 1 KiB |