Changed Liquid to store as a Type rather than Int

This is a major change in how everything is stored and is only first
step. This change water being ID I to Liquid.WATER. Makes it so much
easier to understand what a liquid is and carries extra info like the
block that is linked to the liquid. The Name of the liquid.

I also started on a way to stored beams by create a class like Clac's
Vectors.  It stores a beam as a new beam with intensity, canProduce
light,and direction moving.
This commit is contained in:
Rseifert 2012-09-20 03:34:07 -04:00
parent 7dddcd1be3
commit ad45a0ce59
22 changed files with 470 additions and 123 deletions

View file

@ -7,6 +7,7 @@ import basicpipes.pipes.ItemGuage;
import basicpipes.pipes.ItemParts;
import basicpipes.pipes.ItemPipe;
import basicpipes.pipes.TileEntityPump;
import basicpipes.pipes.api.Liquid;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Block;
@ -74,30 +75,25 @@ public class BasicPipesMain{
{
//register
proxy.init();
//Names
LanguageRegistry.addName((new ItemStack(machine, 1, 0)), "WaterPump");
LanguageRegistry.addName((new ItemStack(gauge, 1, 0)), "PipeGuage");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 0)), "SteamPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 1)), "WaterPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 2)), "LavaPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 3)), "OilPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 4)), "FuelPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 5)), "AirPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 6)), "MethainPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 7)), "BioFuelPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 8)), "coolentPipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 9)), "NukeWastePipe");
LanguageRegistry.addName((new ItemStack(itemPipes, 1, 10)), "Pipe");
LanguageRegistry.addName((new ItemStack(parts, 1, 0)), "BronzeTube");
LanguageRegistry.addName((new ItemStack(parts, 1, 1)), "IronTube");
LanguageRegistry.addName((new ItemStack(parts, 1, 2)), "ObsidianTube");
LanguageRegistry.addName((new ItemStack(parts, 1, 3)), "NetherTube");
LanguageRegistry.addName((new ItemStack(parts, 1, 4)), "LeatherSeal");
LanguageRegistry.addName((new ItemStack(parts, 1, 5)), "SlimeSeal");
LanguageRegistry.addName((new ItemStack(parts, 1, 6)), "BronzeTank");
LanguageRegistry.addName((new ItemStack(parts, 1, 7)), "Valve");
//crafting parts
//Names and lang stuff
//Pipe Names
for(int i =0; i < Liquid.values().length;i++)
{
LanguageRegistry.addName((new ItemStack(itemPipes, 1, i)), Liquid.getLiquid(i).lName+" Pipe");
}
//Pump
LanguageRegistry.addName((new ItemStack(machine, 1, 0)), "WaterPump");
//Tools
LanguageRegistry.addName((new ItemStack(gauge, 1, 0)), "PipeGuage");
//Parts
LanguageRegistry.addName((new ItemStack(parts, 1, 0)), "BronzeTube");
LanguageRegistry.addName((new ItemStack(parts, 1, 1)), "IronTube");
LanguageRegistry.addName((new ItemStack(parts, 1, 2)), "ObsidianTube");
LanguageRegistry.addName((new ItemStack(parts, 1, 3)), "NetherTube");
LanguageRegistry.addName((new ItemStack(parts, 1, 4)), "LeatherSeal");
LanguageRegistry.addName((new ItemStack(parts, 1, 5)), "SlimeSeal");
LanguageRegistry.addName((new ItemStack(parts, 1, 6)), "BronzeTank");
LanguageRegistry.addName((new ItemStack(parts, 1, 7)), "Valve");
}
@PostInit
public void postInit(FMLPostInitializationEvent event)

View file

@ -1,6 +1,7 @@
package basicpipes;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.Liquid;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -43,7 +44,7 @@ public class TradeHelper {
* @param rise - does the liquid rise up like a gas
* @return the remaining untraded liquid
*/
public static int shareLiquid(TileEntity blockEntity,int type,boolean rise)
public static int shareLiquid(TileEntity blockEntity,Liquid type,boolean rise)
{
TileEntity[] connectedBlocks = getSourounding(blockEntity);
ILiquidConsumer blockMachine = (ILiquidConsumer) blockEntity;

View file

@ -4,6 +4,7 @@ import java.util.Random;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.Liquid;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.Material;
@ -70,7 +71,7 @@ public class BlockPipe extends BlockContainer
this.updateConductorTileEntity(world, x, y, z);
}
public static TileEntity getUEUnit(World world, int x, int y, int z, byte side,int type)
public static TileEntity getUEUnit(World world, int x, int y, int z, byte side,Liquid type)
{
switch(side)
{
@ -135,7 +136,7 @@ public class BlockPipe extends BlockContainer
if(tileEntity instanceof TileEntityPipe)
{
TileEntityPipe conductorTileEntity = (TileEntityPipe) tileEntity;
int type = conductorTileEntity.getType();
Liquid type = conductorTileEntity.getType();
conductorTileEntity.addConnection(getUEUnit(world, x, y, z, i, type), ForgeDirection.getOrientation(i));
}
}

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import basicpipes.BasicPipesMain;
import basicpipes.pipes.api.Liquid;
import net.minecraft.src.*;
@ -52,9 +53,9 @@ public class ItemGuage extends Item
if(blockEntity instanceof TileEntityPipe)
{
TileEntityPipe pipeEntity = (TileEntityPipe) blockEntity;
int type = pipeEntity.getType();
Liquid type = pipeEntity.getType();
int steam = pipeEntity.getStoredLiquid(type);
String typeName = getType(type);
String typeName = type.lName;
String print = "Error";
if(steam <= 0)
{

View file

@ -3,6 +3,7 @@ package basicpipes.pipes;
import java.util.List;
import basicpipes.BasicPipesMain;
import basicpipes.pipes.api.Liquid;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
@ -16,7 +17,6 @@ import net.minecraft.src.World;
public class ItemPipe extends Item
{
int index = 32;//32 + 4 rows alloted to pipes
String[] names = new String[]{"Steam","Water","Lava","Oil","Fuel","Air","Methain","BioFuel","coolent","NukeWaste"};
private int spawnID;
public ItemPipe(int id)
@ -37,12 +37,12 @@ public class ItemPipe extends Item
@Override
public String getItemNameIS(ItemStack itemstack)
{
return itemstack.getItemDamage() < names.length ? names[itemstack.getItemDamage()] +" Pipe2" : "EmptyPipe";
return itemstack.getItemDamage() < Liquid.values().length ? Liquid.getLiquid(itemstack.getItemDamage()).lName+" Pipe" : "Empty Pipe";
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for(int i = 0; i < names.length; i++)
for(int i = 0; i < Liquid.values().length; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
@ -112,7 +112,7 @@ public class ItemPipe extends Item
if(blockEntity instanceof TileEntityPipe)
{
TileEntityPipe pipeEntity = (TileEntityPipe) blockEntity;
int dm = par1ItemStack.getItemDamage();
Liquid dm = Liquid.getLiquid(par1ItemStack.getItemDamage());
pipeEntity.setType(dm);
}
}

View file

@ -1,6 +1,7 @@
package basicpipes.pipes;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.Liquid;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -11,8 +12,8 @@ public class TileEntityCondenser extends TileEntity implements ILiquidProducer,
int waterStored = 0;
int energyStored = 0;
@Override
public int onProduceLiquid(int type,int maxVol, ForgeDirection side) {
if(type == 1)
public int onProduceLiquid(Liquid type,int maxVol, ForgeDirection side) {
if(type == Liquid.WATER)
{
int tradeW = Math.min(maxVol, waterStored);
waterStored -= tradeW;
@ -44,8 +45,8 @@ public class TileEntityCondenser extends TileEntity implements ILiquidProducer,
tickCount++;
}
@Override
public boolean canProduceLiquid(int type, ForgeDirection side) {
if(type == 1)
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.WATER)
{
return true;
}

View file

@ -10,6 +10,7 @@ import universalelectricity.network.IPacketReceiver;
import universalelectricity.network.PacketManager;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.Liquid;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacketReceiver
@ -17,7 +18,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
//The amount stored in the conductor
protected int liquidStored = 0;
//the current set type of the pipe 0-5
protected int type = 0;
protected Liquid type = Liquid.DEFUALT;
//The maximum amount of electricity this conductor can take
protected int capacity = 5;
private int count = 0;
@ -95,7 +96,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
* @return vol - The amount of rejected liquid that can't enter the pipe
*/
@Override
public int onReceiveLiquid(int type,int vol, ForgeDirection side)
public int onReceiveLiquid(Liquid type,int vol, ForgeDirection side)
{
if(type == this.type)
{
@ -190,7 +191,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
* @return Return the stored volume in this pipe.
*/
@Override
public int getStoredLiquid(int type)
public int getStoredLiquid(Liquid type)
{
if(type == this.type)
{
@ -201,7 +202,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
@Override
public int getLiquidCapacity(int type)
public int getLiquidCapacity(Liquid type)
{
if(type == this.type)
{
@ -217,7 +218,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
{
super.readFromNBT(par1NBTTagCompound);
this.liquidStored = par1NBTTagCompound.getInteger("liquid");
this.type = par1NBTTagCompound.getInteger("type");
this.type = Liquid.getLiquid(par1NBTTagCompound.getInteger("type"));
}
/**
@ -227,11 +228,11 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("liquid", this.liquidStored);
par1NBTTagCompound.setInteger("type", this.type);
par1NBTTagCompound.setInteger("type", this.type.ordinal());
}
//find wether or not this side of X block can recieve X liquid type. Also use to determine connection of a pipe
@Override
public boolean canRecieveLiquid(int type, ForgeDirection side) {
public boolean canRecieveLiquid(Liquid type, ForgeDirection side) {
if(type == this.type)
{
return true;
@ -239,12 +240,12 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
return false;
}
//returns liquid type
public int getType() {
public Liquid getType() {
return this.type;
}
//used by the item to set the liquid type on spawn
public void setType(int rType) {
public void setType(Liquid rType) {
this.type = rType;
}
@ -260,7 +261,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
int type = data.readInt();
if(worldObj.isRemote)
{
this.type = type;
this.type = Liquid.getLiquid(type);
}
}
catch(Exception e)
@ -270,6 +271,13 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
}
public int getSize() {
// TODO Auto-generated method stub
return 6;
}
}

View file

@ -2,6 +2,7 @@ package basicpipes.pipes;
import basicpipes.TradeHelper;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.Liquid;
import net.minecraft.src.Block;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -78,8 +79,8 @@ public class TileEntityPump extends TileEntityElectricUnit implements ILiquidPro
}
@Override
public int onProduceLiquid(int type, int maxVol, ForgeDirection side) {
if(type == 1 && wStored > 0)
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side) {
if(type == Liquid.WATER && wStored > 0)
{
int tradeW = Math.min(maxVol, wStored);
wStored -= tradeW;
@ -89,8 +90,8 @@ public class TileEntityPump extends TileEntityElectricUnit implements ILiquidPro
}
@Override
public boolean canProduceLiquid(int type, ForgeDirection side) {
if(type == 1 && side != ForgeDirection.DOWN)
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.WATER && side != ForgeDirection.DOWN)
{
return true;
}

View file

@ -0,0 +1,26 @@
package basicpipes.pipes.api;
import net.minecraftforge.common.ForgeDirection;
public class Beam {
//might need a more complex system for this later but for now this will work
public int intensity; //Beam intensity level
public boolean light; //Can prodcue light, might use this later
public ForgeDirection movDir; //Used to find the beams current direction
public Beam()
{
this(0,false,ForgeDirection.UNKNOWN);
}
Beam(int i, boolean light, ForgeDirection dir)
{
intensity = i;
this.light = light;
movDir = dir;
}
public static int getBeamLevel(Beam beam)
{
return beam.intensity;
}
}

View file

@ -0,0 +1,26 @@
package basicpipes.pipes.api;
import net.minecraftforge.common.ForgeDirection;
public interface IBeamProducer {
/**
* onProduceLiquid
* block.
* @param type - the type of liquid
* @param regInt - requested beam intensity
* @param side - The side
* @return New Beam - Return a vol of liquid type that is produced
*/
public int createNewBeam(int type, int reqInt, ForgeDirection side);
/**
* canProduceLiquid
* block.
* @param type - the type of liquid
* @param side - The side
* @return boolean - True if can, false if can't produce liquid of type or on that side
* Also used for connection rules of pipes'
*/
public boolean canCreateBeam(int type, ForgeDirection side);
}

View file

@ -16,7 +16,7 @@ public interface ILiquidConsumer
* @parm type - The type of liquid being received
* @return vol - The amount liquid that can't be recieved
*/
public int onReceiveLiquid(int type, int vol, ForgeDirection side);
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side);
/**
* You can use this to check if a pipe can connect to this liquid consumer to properly render the graphics
@ -24,16 +24,16 @@ public interface ILiquidConsumer
* @parm type - The type of liquid
* @return Returns true or false if this consumer can receive a volume at this given tick or moment.
*/
public boolean canRecieveLiquid(int type, ForgeDirection forgeDirection);
public boolean canRecieveLiquid(Liquid type, ForgeDirection forgeDirection);
/**
* @return Return the stored liquid of type in this consumer.
*/
public int getStoredLiquid(int type);
public int getStoredLiquid(Liquid type);
/**
* @return Return the maximum amount of stored liquid this consumer can get.
*/
public int getLiquidCapacity(int type);
public int getLiquidCapacity(Liquid type);
}

View file

@ -17,7 +17,7 @@ public interface ILiquidProducer
* @param side - The side
* @return vol - Return a vol of liquid type that is produced
*/
public int onProduceLiquid(int type, int maxVol, ForgeDirection side);
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side);
/**
* canProduceLiquid
* block.
@ -26,5 +26,5 @@ public interface ILiquidProducer
* @return boolean - True if can, false if can't produce liquid of type or on that side
* Also used for connection rules of pipes'
*/
public boolean canProduceLiquid(int type, ForgeDirection side);
public boolean canProduceLiquid(Liquid type, ForgeDirection side);
}

View file

@ -0,0 +1,51 @@
package basicpipes.pipes.api;
import universalelectricity.basiccomponents.BasicComponents;
import net.minecraft.src.Block;
import net.minecraftforge.common.ForgeDirection;
/**
* System too easily reference a liquid type and its info
* @author Rseifert
*
*/
public enum Liquid {
// -1 == null || unused
STEAM("Steam",false,true,-1,-1),
WATER("Water",false,false,Block.waterStill.blockID,Block.waterMoving.blockID),
LAVA("Lava",false,false,Block.lavaStill.blockID,Block.lavaMoving.blockID),
OIL("Oil",true,false,BasicComponents.oilStill.blockID,BasicComponents.oilMoving.blockID),
Fuel("Fuel",true,false,-1,-1),
Air("Air",false,true,0,-1),
Methain("Methain",true,true,-1,-1),
BioFuel("BioFuel",true,false,-1,-1),
Coolent("Coolent",true,false,-1,-1),
NukeWaste("NukeWaste",true,false,-1,-1),
DEFUALT("Empty",false,false,-1,-1);
public final boolean flamable;//can it catch on fire, not used but might be
public final boolean isGas;//is it a gas, used to find if it floats
public final int Still;//if there is a block of still liquid linked to this
public final int Moving;//if there is a block of moving liquid linked to this
public final String lName;
private Liquid(String name,boolean flame,boolean gas,int block, int Moving)
{
this.flamable = flame;
this.isGas = gas;
this.Still = block;
this.Moving = Moving;
this.lName = name;
}
/**
* Only use this if you are converting from the old system
* Or have a special need for it
* @param id of liquid
* @return Liquid Object
*/
public static Liquid getLiquid(int id)
{
if (id >= 0 && id < Liquid.values().length)
{
return Liquid.values()[id];
}
return DEFUALT;
}
}

View file

@ -7,7 +7,7 @@ public class TileEntityNuller extends TileEntityMachine implements IElectricUnit
@Override
public float ampRequest()
{
return 100;
return 200;
}
@Override
public boolean canReceiveFromSide(ForgeDirection side)
@ -22,7 +22,7 @@ public class TileEntityNuller extends TileEntityMachine implements IElectricUnit
@Override
public int getTickInterval()
{
return 10;
return 20;
}
@Override
public boolean canConnect(ForgeDirection side)

View file

@ -1,6 +1,7 @@
package steampower;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.Liquid;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -43,7 +44,7 @@ public class TradeHelper {
* @param rise - does the liquid rise up like a gas
* @return the remaining untraded liquid
*/
public static int shareLiquid(TileEntity blockEntity,int type,boolean rise)
public static int shareLiquid(TileEntity blockEntity,Liquid type,boolean rise)
{
TileEntity[] connectedBlocks = getSourounding(blockEntity);
ILiquidConsumer blockMachine = (ILiquidConsumer) blockEntity;

View file

@ -15,6 +15,7 @@ import steampower.burner.TileEntityFireBox;
import universalelectricity.network.IPacketReceiver;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.Liquid;
import com.google.common.io.ByteArrayDataInput;
@ -155,8 +156,8 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
if(count >= 16)
{
//adds water from container slot
this.waterStored = TradeHelper.shareLiquid(this, 1, false);
this.steamStored = TradeHelper.shareLiquid(this, 0, true);
this.waterStored = TradeHelper.shareLiquid(this, Liquid.WATER, false);
this.steamStored = TradeHelper.shareLiquid(this, Liquid.STEAM, true);
count = 0;
}
@ -183,7 +184,7 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
{
if(storedItems[0].isItemEqual(new ItemStack(Item.bucketWater,1)))
{
if((int)waterStored < getLiquidCapacity(1))
if((int)waterStored < getLiquidCapacity(Liquid.WATER))
{
++waterStored;
this.storedItems[0] = new ItemStack(Item.bucketEmpty,1);
@ -192,7 +193,7 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
}
if(storedItems[0].isItemEqual(new ItemStack(Block.ice,1)))
{
if((int)waterStored < getLiquidCapacity(1) && this.heatStored > 100)
if((int)waterStored < getLiquidCapacity(Liquid.WATER) && this.heatStored > 100)
{
++waterStored;
int stacksize = this.storedItems[0].stackSize;
@ -224,16 +225,16 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
return var1;
}
@Override
public int onReceiveLiquid(int type, int vol, ForgeDirection side) {
if(type == 0)
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side) {
if(type == Liquid.STEAM)
{
int rejectedSteam = Math.max((this.steamStored + vol) - this.getLiquidCapacity(0), 0);
int rejectedSteam = Math.max((this.steamStored + vol) - this.getLiquidCapacity(Liquid.STEAM), 0);
this.steamStored += vol - rejectedSteam;
return rejectedSteam;
}
if(type == 1)
if(type == Liquid.WATER)
{
int rejectedWater = Math.max((this.waterStored + vol) - this.getLiquidCapacity(1), 0);
int rejectedWater = Math.max((this.waterStored + vol) - this.getLiquidCapacity(Liquid.WATER), 0);
this.waterStored += vol - rejectedWater;
return rejectedWater;
}
@ -241,8 +242,8 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
}
@Override
public boolean canRecieveLiquid(int type,ForgeDirection side) {
if(type == 1)
public boolean canRecieveLiquid(Liquid type,ForgeDirection side) {
if(type == Liquid.WATER)
{
return true;
}
@ -250,12 +251,12 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
}
@Override
public int getStoredLiquid(int type) {
if(type == 1)
public int getStoredLiquid(Liquid type) {
if(type == Liquid.WATER)
{
return this.waterStored;
}
if(type == 0)
if(type == Liquid.STEAM)
{
return this.steamStored;
}
@ -263,20 +264,20 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
}
@Override
public int getLiquidCapacity(int type) {
if(type ==1)
public int getLiquidCapacity(Liquid type) {
if(type ==Liquid.WATER)
{
return 14;
}
if(type == 0)
if(type == Liquid.STEAM)
{
return steamMax;
}
return 0;
}
@Override
public int onProduceLiquid(int type, int maxVol, ForgeDirection side) {
if(type == 0)
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side) {
if(type == Liquid.STEAM)
{
if(steamStored > 1)
{
@ -288,8 +289,8 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
}
@Override
public boolean canProduceLiquid(int type, ForgeDirection side) {
if(type == 0)
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.STEAM)
{
return true;
}

View file

@ -20,6 +20,7 @@ import universalelectricity.extend.TileEntityConductor;
import universalelectricity.network.IPacketReceiver;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.Liquid;
import com.google.common.io.ByteArrayDataInput;
@ -318,8 +319,8 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
}
@Override
public int onProduceLiquid(int type, int Vol, ForgeDirection side) {
if(type == 1)
public int onProduceLiquid(Liquid type, int Vol, ForgeDirection side) {
if(type == Liquid.WATER)
{
if(this.waterStored >= 1)
{
@ -331,8 +332,8 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
}
@Override
public boolean canProduceLiquid(int type, ForgeDirection side) {
if(type == 1)
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.WATER)
{
return true;
}
@ -340,8 +341,8 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
}
@Override
public int onReceiveLiquid(int type, int vol, ForgeDirection side) {
if(type == 0)
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side) {
if(type == Liquid.STEAM)
{
int rejectedSteam = Math.max((this.steamStored + vol) - 100, 0);
this.steamStored += vol - rejectedSteam;
@ -351,8 +352,8 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
}
@Override
public boolean canRecieveLiquid(int type, ForgeDirection side) {
if(type == 0)
public boolean canRecieveLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.STEAM)
{
return true;
}
@ -360,12 +361,12 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
}
@Override
public int getStoredLiquid(int type) {
if(type == 0)
public int getStoredLiquid(Liquid type) {
if(type == Liquid.STEAM)
{
return this.steamStored;
}
if(type == 1)
if(type == Liquid.WATER)
{
return this.waterStored;
}
@ -373,8 +374,8 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
}
@Override
public int getLiquidCapacity(int type) {
if(type == 0)
public int getLiquidCapacity(Liquid type) {
if(type == Liquid.STEAM)
{
return 100;
}

View file

@ -6,6 +6,7 @@ import steampower.TileEntityMachine;
import universalelectricity.extend.IElectricUnit;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.Liquid;
public class TileEntitytopGen extends TileEntityMachine implements IElectricUnit,ILiquidConsumer,ILiquidProducer {
public TileEntitySteamPiston genB = null;
@ -22,37 +23,43 @@ public TileEntitySteamPiston genB = null;
}
}
@Override
public int onProduceLiquid(int type, int maxVol, ForgeDirection side) {
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side) {
// TODO Auto-generated method stub
return genB !=null ? genB.onProduceLiquid(type, maxVol, side) : 0;
}
@Override
public boolean canProduceLiquid(int type, ForgeDirection side) {
// TODO Auto-generated method stub
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.WATER)
{
return true;
}
return genB !=null ? genB.canProduceLiquid(type, side) : false;
}
@Override
public int onReceiveLiquid(int type, int vol, ForgeDirection side) {
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side) {
// TODO Auto-generated method stub
return genB !=null ? genB.onReceiveLiquid(type, vol, side) : vol;
}
@Override
public boolean canRecieveLiquid(int type, ForgeDirection side) {
// TODO Auto-generated method stub
public boolean canRecieveLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.STEAM)
{
return true;
}
return genB !=null ? genB.canRecieveLiquid(type, side): false;
}
@Override
public int getStoredLiquid(int type) {
public int getStoredLiquid(Liquid type) {
// TODO Auto-generated method stub
return genB !=null ? genB.getStoredLiquid(type): 0;
}
@Override
public int getLiquidCapacity(int type) {
public int getLiquidCapacity(Liquid type) {
// TODO Auto-generated method stub
return genB !=null ? genB.getLiquidCapacity(type): 0;
}

View file

@ -0,0 +1,200 @@
// 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 basicpipes;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.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);}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5);
}
}

View file

@ -1,23 +1,28 @@
package basicpipes;
import net.minecraft.src.ModelBase;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import basicpipes.pipes.TileEntityPipe;
import basicpipes.pipes.api.Liquid;
public class RenderPipe extends TileEntitySpecialRenderer
{
int type = 0;
private ModelPipe model;
private ModelPipe model2;
Liquid type;
int size = 6;
private ModelPipe fourPipe;
private ModelLargePipe SixPipe;
private ModelBase model = fourPipe;
public RenderPipe()
{
model = new ModelPipe();
model2 = new ModelPipe();
fourPipe = new ModelPipe();
SixPipe = new ModelLargePipe();
}
public void renderAModelAt(TileEntityPipe tileEntity, double d, double d1, double d2, float f)
@ -25,25 +30,43 @@ public class RenderPipe extends TileEntitySpecialRenderer
//Texture file
type = tileEntity.getType();
switch(type)
{
case 0: bindTextureByName(BasicPipesMain.textureFile+"/pipes/SteamPipe.png");break;
case 1: bindTextureByName(BasicPipesMain.textureFile+"/pipes/WaterPipe.png");break;
default:bindTextureByName(BasicPipesMain.textureFile+"/pipes/DefaultPipe.png"); break;
}
size = tileEntity.getSize();
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if(tileEntity.connectedBlocks[0] != null) model.renderBottom();
if(tileEntity.connectedBlocks[1] != null) model.renderTop();
if(tileEntity.connectedBlocks[2] != null) model.renderFront();
if(tileEntity.connectedBlocks[3] != null) model.renderBack();
if(tileEntity.connectedBlocks[4] != null) model.renderRight();
if(tileEntity.connectedBlocks[5] != null) model.renderLeft();
model.renderMiddle();
if(size == 4)
{
switch(type.ordinal())
{
case 0: bindTextureByName(BasicPipesMain.textureFile+"/pipes/SteamPipe.png");break;
case 1: bindTextureByName(BasicPipesMain.textureFile+"/pipes/WaterPipe.png");break;
default:bindTextureByName(BasicPipesMain.textureFile+"/pipes/DefaultPipe.png"); break;
}
if(tileEntity.connectedBlocks[0] != null) fourPipe.renderBottom();
if(tileEntity.connectedBlocks[1] != null) fourPipe.renderTop();
if(tileEntity.connectedBlocks[2] != null) fourPipe.renderFront();
if(tileEntity.connectedBlocks[3] != null) fourPipe.renderBack();
if(tileEntity.connectedBlocks[4] != null) fourPipe.renderRight();
if(tileEntity.connectedBlocks[5] != null) fourPipe.renderLeft();
fourPipe.renderMiddle();
}
if(size == 6)
{
switch(type.ordinal())
{
case 0: bindTextureByName(BasicPipesMain.textureFile+"/pipes/SixSteamPipe.png");break;
default:bindTextureByName(BasicPipesMain.textureFile+"/pipes/DefaultPipe.png"); break;
}
if(tileEntity.connectedBlocks[0] != null) SixPipe.renderBottom();
if(tileEntity.connectedBlocks[1] != null) SixPipe.renderTop();
if(tileEntity.connectedBlocks[2] != null) SixPipe.renderFront();
if(tileEntity.connectedBlocks[3] != null) SixPipe.renderBack();
if(tileEntity.connectedBlocks[4] != null) SixPipe.renderRight();
if(tileEntity.connectedBlocks[5] != null) SixPipe.renderLeft();
SixPipe.renderMiddle();
}
GL11.glPopMatrix();
}

View file

@ -7,6 +7,8 @@ import net.minecraft.src.StatCollector;
import org.lwjgl.opengl.GL11;
import basicpipes.pipes.api.Liquid;
import steampower.boiler.ContainerBoiler;
import steampower.boiler.TileEntityBoiler;
@ -51,7 +53,7 @@ public class GuiBoiler extends GuiContainer
int var10;
if (this.boilerInventory.waterStored > 0)
{
var7 = boilerInventory.getStoredLiquid(1)*4 + 1;
var7 = boilerInventory.getStoredLiquid(Liquid.WATER)*4 + 1;
this.drawTexturedModalRect(var5 + 29, var6 + 72 - var7, 176, 148 - var7, 23, var7);
}
if (this.boilerInventory.steamStored > 0)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB