writing Steam power
since half of it was not working i'm going to write the mod part by part starting with the steam piston and its new model
This commit is contained in:
parent
0748ec34ee
commit
b26beba828
16 changed files with 634 additions and 503 deletions
|
@ -65,19 +65,19 @@ public class ItemGuage extends Item
|
|||
|
||||
player.addChatMessage(print);
|
||||
return true;
|
||||
}
|
||||
}/**
|
||||
if(blockEntity instanceof TileEntityRod)
|
||||
{
|
||||
TileEntityRod rod = (TileEntityRod) blockEntity;
|
||||
int steam = rod.loadRPM;
|
||||
int pressure = rod.getRPM(ForgeDirection.getOrientation(par7));
|
||||
double steam = rod.loadRPM;
|
||||
double pressure = rod.getForce(ForgeDirection.getOrientation(par7));
|
||||
String print = "Error";
|
||||
|
||||
print = " " + steam +"Load "+pressure+"RPM";
|
||||
|
||||
player.addChatMessage(print);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,136 +4,51 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.network.IPacketReceiver;
|
||||
import universalelectricity.network.PacketManager;
|
||||
import universalelectricity.prefab.Vector3;
|
||||
import basicpipes.BasicPipesMain;
|
||||
import basicpipes.pipes.api.ILiquidConsumer;
|
||||
import basicpipes.pipes.api.IMechenical;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
|
||||
public class TileEntityRod extends TileEntity implements IPacketReceiver,IMechenical {
|
||||
private int count = 0;
|
||||
public float rotation = 0;
|
||||
public int rpm = 0;//rpm received from producer
|
||||
public int loadRPM = 0; //rpm lost to the load
|
||||
public int currentRPM = 0;
|
||||
public TileEntity front = null;
|
||||
public TileEntity back = null;
|
||||
ForgeDirection frontD;
|
||||
ForgeDirection backD;
|
||||
|
||||
public int pos = 0;
|
||||
|
||||
@Override
|
||||
public double getForce(ForgeDirection side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOutputSide(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInputSide(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double applyForce(int force) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(NetworkManager network,
|
||||
Packet250CustomPayload packet, EntityPlayer player,
|
||||
ByteArrayDataInput dataStream) {
|
||||
try{
|
||||
this.rpm = dataStream.readInt();
|
||||
this.loadRPM = dataStream.readInt();
|
||||
this.currentRPM = dataStream.readInt();
|
||||
}catch(Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
public Object[] data()
|
||||
{
|
||||
return new Object[]{rpm,loadRPM,currentRPM};
|
||||
}
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(count++ >= 5)
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
frontD = ForgeDirection.getOrientation(meta);
|
||||
backD = ForgeDirection.getOrientation(meta).getOpposite();
|
||||
count = 0;
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
|
||||
|
||||
back = worldObj.getBlockTileEntity(xCoord+backD.offsetX, yCoord+backD.offsetY, zCoord+backD.offsetZ);
|
||||
front = worldObj.getBlockTileEntity(xCoord+frontD.offsetX, yCoord+frontD.offsetY, zCoord+frontD.offsetZ);
|
||||
|
||||
if(!(back instanceof IMechenical))
|
||||
{
|
||||
back = null;
|
||||
}
|
||||
if(!(front instanceof IMechenical))
|
||||
{
|
||||
front = null;
|
||||
}
|
||||
|
||||
if(back != null && front != null)
|
||||
{
|
||||
this.rpm = ((IMechenical) back).getRPM(backD);
|
||||
if(rpm > 0)
|
||||
{
|
||||
this.loadRPM = ((IMechenical) front).useRPM(rpm)+10;
|
||||
this.currentRPM = rpm-loadRPM-10;//minus 10 is what it take to over come the rods friction
|
||||
if(currentRPM < 0)
|
||||
{
|
||||
//TODO add stress to rod and break if left stressed too long
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(currentRPM > 0)
|
||||
{
|
||||
currentRPM-=10;
|
||||
if(currentRPM < 0)
|
||||
{
|
||||
currentRPM = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PacketManager.sendTileEntityPacketWithRange(this, BasicPipesMain.channel, 20, this.data());
|
||||
|
||||
}
|
||||
if(currentRPM > 0)
|
||||
{
|
||||
this.rotation = currentRPM * 240;
|
||||
if(back != null && back instanceof TileEntityRod)
|
||||
{
|
||||
this.rotation = ((TileEntityRod)back).getRPM(backD) * 240;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getRPM(ForgeDirection side) {
|
||||
return this.currentRPM;
|
||||
}
|
||||
@Override
|
||||
public boolean canOutputSide(ForgeDirection side) {
|
||||
if(frontD != null && side == frontD)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canInputSide(ForgeDirection side) {
|
||||
if(backD != null && side == backD)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int useRPM(int RPM) {
|
||||
//rpm * T / 5252
|
||||
return 10+loadRPM;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ public interface IMechenical {
|
|||
* @param side the rpm is coming from
|
||||
* @return rpm that the block is running at
|
||||
*/
|
||||
public int getRPM(ForgeDirection side);
|
||||
public double getForce(ForgeDirection side);
|
||||
/**
|
||||
*
|
||||
* @param side
|
||||
|
@ -26,5 +26,5 @@ public interface IMechenical {
|
|||
* @param RPM being applied to this machine
|
||||
* @return the rpm after the load has been applied
|
||||
*/
|
||||
public int useRPM(int RPM);//will change later to include force of rotation
|
||||
public double applyForce(int force);
|
||||
}
|
||||
|
|
|
@ -90,35 +90,6 @@ public class TileEntityMachine extends TileEntityElectricityReceiver implements
|
|||
{
|
||||
return new Object[]{};
|
||||
}
|
||||
public int getNumSide(ForgeDirection side)
|
||||
{
|
||||
if(side == ForgeDirection.DOWN)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(side == ForgeDirection.UP)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if(side == ForgeDirection.NORTH)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if(side == ForgeDirection.SOUTH)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
if(side == ForgeDirection.WEST)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
if(side == ForgeDirection.EAST)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
|
|
@ -44,20 +44,20 @@ public class BlockSteamPiston extends universalelectricity.prefab.BlockMachine{
|
|||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int x, int y, int z, EntityLiving par5EntityLiving)
|
||||
{
|
||||
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int metadata = par1World.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)par1World.getBlockTileEntity(x, y, z);
|
||||
|
||||
switch (angle)
|
||||
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer)
|
||||
{
|
||||
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int metadata = par1World.getBlockMetadata(x, y, z);
|
||||
if(metadata < 3)
|
||||
{
|
||||
case 0: tileEntity.setDirection(1); break;
|
||||
case 1: tileEntity.setDirection(2); break;
|
||||
case 2: tileEntity.setDirection(3); break;
|
||||
case 3: tileEntity.setDirection(4); break;
|
||||
par1World.setBlockAndMetadata(x, y, z, blockID, metadata+angle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
par1World.setBlockAndMetadata(x, y, z, blockID, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return null;
|
||||
|
@ -119,7 +119,7 @@ public class BlockSteamPiston extends universalelectricity.prefab.BlockMachine{
|
|||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
if (meta == 1)
|
||||
if (meta < 4)
|
||||
{
|
||||
if (par1World.getBlockId(par2, par3 + 1, par4) != this.blockID)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ContainerGenerator extends Container
|
|||
public ContainerGenerator(InventoryPlayer par1InventoryPlayer, TileEntitySteamPiston tileEntity)
|
||||
{
|
||||
this.tileEntity = tileEntity;
|
||||
this.addSlotToContainer(new Slot(tileEntity, 0, 33, 34));
|
||||
// this.addSlotToContainer(new Slot(tileEntity, 0, 33, 34));
|
||||
int var3;
|
||||
|
||||
for (var3 = 0; var3 < 3; ++var3)
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.src.ItemStack;
|
|||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.World;
|
||||
import steampower.SteamPowerMain;
|
||||
import steampower.TileEntityMachine;
|
||||
|
||||
public class ItemEngine extends Item
|
||||
{
|
||||
|
@ -30,9 +31,9 @@ public class ItemEngine extends Item
|
|||
return SteamPowerMain.textureFile+"Items.png";
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer ePlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer ePlayer, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (par3World.isRemote)
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -40,17 +41,26 @@ public class ItemEngine extends Item
|
|||
Block var11 = SteamPowerMain.engine;
|
||||
int angle = MathHelper.floor_double((ePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
if (ePlayer.canPlayerEdit(par4, par5, par6))
|
||||
if (ePlayer.canPlayerEdit(x, y, z))
|
||||
{
|
||||
++par5;
|
||||
if (var11.canPlaceBlockAt(par3World, par4, par5, par6))
|
||||
++y;
|
||||
if (var11.canPlaceBlockAt(world, x, y, z))
|
||||
{
|
||||
par3World.editingBlocks = true;
|
||||
par3World.setBlockAndMetadataWithNotify(par4, par5, par6, var11.blockID, 1);
|
||||
par3World.notifyBlocksOfNeighborChange(par4, par5, par6, var11.blockID);
|
||||
par3World.setBlockAndMetadataWithNotify(par4, par5+1, par6, var11.blockID, 14);
|
||||
par3World.notifyBlocksOfNeighborChange(par4, par5, par6, var11.blockID);
|
||||
par3World.editingBlocks = false;
|
||||
world.editingBlocks = true;
|
||||
|
||||
switch (angle)
|
||||
{
|
||||
case 0: world.setBlockAndMetadata(x, y, z, var11.blockID, 0); break;
|
||||
case 1: world.setBlockAndMetadata(x, y, z, var11.blockID, 1); break;
|
||||
case 2: world.setBlockAndMetadata(x, y, z, var11.blockID, 2); break;
|
||||
case 3: world.setBlockAndMetadata(x, y, z, var11.blockID, 3); break;
|
||||
}
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
//ePlayer.sendChatToPlayer("A:"+angle+" M:"+meta);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, var11.blockID);
|
||||
world.setBlockAndMetadataWithNotify(x, y+1, z, var11.blockID, 14);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, var11.blockID);
|
||||
world.editingBlocks = false;
|
||||
--itemStack.stackSize;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -13,270 +13,129 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.common.ISidedInventory;
|
||||
import steampower.TileEntityMachine;
|
||||
import universalelectricity.network.IPacketReceiver;
|
||||
import basicpipes.conductors.TileEntityRod;
|
||||
import basicpipes.pipes.api.ILiquidConsumer;
|
||||
import basicpipes.pipes.api.ILiquidProducer;
|
||||
import basicpipes.pipes.api.IMechenical;
|
||||
import basicpipes.pipes.api.Liquid;
|
||||
import basicpipes.conductors.*;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntitySteamPiston extends TileEntityMachine implements IPacketReceiver,ILiquidConsumer,ILiquidProducer, IInventory, ISidedInventory,IMechenical
|
||||
public class TileEntitySteamPiston extends TileEntityMachine implements IPacketReceiver,ILiquidConsumer,ILiquidProducer,IMechenical
|
||||
{
|
||||
//Maximum possible generation rate of watts in SECONDS
|
||||
public int maxGenerateRate = 1000;
|
||||
public int waterStored = 0;
|
||||
public int steamStored = 0;
|
||||
public int steamConsumed = 0;
|
||||
public float position = 0;
|
||||
public int count = 0;
|
||||
//Current generation rate based on hull heat. In TICKS.
|
||||
public float generateRate = 0;
|
||||
//public TileEntityConductor connectedWire = null;
|
||||
/**
|
||||
* The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for
|
||||
*/
|
||||
public int genTime = 0;
|
||||
/**
|
||||
* The ItemStacks that hold the items currently being used in the battery box
|
||||
*/
|
||||
private ItemStack[] containingItems = new ItemStack[1];
|
||||
public boolean isConnected = false;
|
||||
private boolean posT = true;
|
||||
/**
|
||||
* Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
|
||||
* ticks and creates a new spawn inside its implementation.
|
||||
*/
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if(count++ >= 10){
|
||||
count = 0;
|
||||
|
||||
float cPercent = (generateRate/10);
|
||||
int cCount = 1;
|
||||
if(cPercent > 25f)
|
||||
{
|
||||
cCount = 2;
|
||||
}
|
||||
if(cPercent > 50f)
|
||||
{
|
||||
cCount = 3;
|
||||
}
|
||||
if(cPercent > 75f)
|
||||
{
|
||||
cCount = 4;
|
||||
}
|
||||
if(generateRate > 0)
|
||||
{
|
||||
|
||||
if(position < 9f && posT )
|
||||
{
|
||||
position+= cCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
posT = false;
|
||||
}
|
||||
if(position > 1f && !posT )
|
||||
{
|
||||
position-= cCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
posT = true;
|
||||
}
|
||||
}
|
||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord+1, zCoord);
|
||||
if(ent instanceof TileEntitytopGen)
|
||||
{
|
||||
isConnected = true;
|
||||
}
|
||||
if(!this.worldObj.isRemote)
|
||||
{
|
||||
|
||||
|
||||
|
||||
//Adds time to runTime by consuming steam
|
||||
if(this.genTime <= 0)
|
||||
{
|
||||
if(steamStored > 0)
|
||||
{
|
||||
--steamStored;
|
||||
++steamConsumed;
|
||||
if(steamConsumed >= 10)
|
||||
{
|
||||
++waterStored;
|
||||
steamConsumed = 0;
|
||||
}
|
||||
genTime += 65;
|
||||
}
|
||||
}
|
||||
|
||||
//Empties water from tank to buckets
|
||||
if (this.containingItems[0] != null)
|
||||
{
|
||||
if(this.containingItems[0].getItem().shiftedIndex == Item.bucketEmpty.shiftedIndex)
|
||||
{
|
||||
if(this.waterStored > 0)
|
||||
{
|
||||
this.containingItems[0] = new ItemStack(Item.bucketWater,1);
|
||||
--waterStored;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Starts generating electricity if the device is heated up
|
||||
if (this.genTime > 0)
|
||||
{
|
||||
this.genTime --;
|
||||
|
||||
|
||||
this.generateRate = (float)Math.min(this.generateRate+Math.min((this.generateRate)*0.01+0.015, 0.05F), this.maxGenerateRate/20);
|
||||
|
||||
}
|
||||
public int force = 0;
|
||||
public int aForce = 0;
|
||||
private int frictionLoad = 10;
|
||||
public int steam = 0;
|
||||
public int water = 0;
|
||||
public int maxWater = 1;
|
||||
public int maxSteam = 10;
|
||||
public int pos = 0; //max at 7
|
||||
private int tickCount = 0;
|
||||
private int runTime = 0;
|
||||
|
||||
private ForgeDirection frontDir;
|
||||
private ForgeDirection backDir;
|
||||
|
||||
public boolean running= false;
|
||||
|
||||
if(this.genTime <= 0)
|
||||
{
|
||||
this.generateRate = (float)Math.max(this.generateRate-0.05, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a tile entity from NBT.
|
||||
*/
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
this.genTime = par1NBTTagCompound.getInteger("itemCookTime");
|
||||
this.waterStored = par1NBTTagCompound.getInteger("waterStored");
|
||||
this.steamConsumed = par1NBTTagCompound.getInteger("steamConsumed");
|
||||
this.steamStored = par1NBTTagCompound.getInteger("steamStored");
|
||||
this.generateRate = par1NBTTagCompound.getFloat("generateRate");
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
this.containingItems = new ItemStack[this.getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
|
||||
{
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < this.containingItems.length)
|
||||
{
|
||||
this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Writes a tile entity to NBT.
|
||||
*/
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setInteger("itemCookTime", (int)this.genTime);
|
||||
par1NBTTagCompound.setInteger("waterStored", (int)this.waterStored);
|
||||
par1NBTTagCompound.setInteger("steamConsumed", (int)this.steamConsumed);
|
||||
par1NBTTagCompound.setInteger("steamStored", (int)this.steamStored);
|
||||
par1NBTTagCompound.setFloat("generateRate", (int)this.generateRate);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < this.containingItems.length; ++var3)
|
||||
{
|
||||
if (this.containingItems[var3] != null)
|
||||
{
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
this.containingItems[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
public void updateEntity()
|
||||
{
|
||||
return 0;
|
||||
if(tickCount++ >=10)
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
int nMeta = 0;
|
||||
switch(meta)
|
||||
{
|
||||
case 0: nMeta = 2;break;
|
||||
case 1: nMeta = 4;break;
|
||||
case 2: nMeta = 3;break;
|
||||
case 3: nMeta = 5;break;
|
||||
}
|
||||
frontDir = ForgeDirection.getOrientation(nMeta);
|
||||
backDir = ForgeDirection.getOrientation(nMeta).getOpposite();
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(this.runTime < 0 && this.steam > 0)
|
||||
{
|
||||
this.steam--;
|
||||
this.runTime+=60;
|
||||
}else
|
||||
if(this.runTime > 0)
|
||||
{
|
||||
this.running = true;
|
||||
this.runTime-=1;
|
||||
}else
|
||||
{
|
||||
this.running = false;
|
||||
}
|
||||
TileEntity ff = worldObj.getBlockTileEntity(xCoord+frontDir.offsetX, yCoord+1, zCoord+frontDir.offsetZ);
|
||||
TileEntity bb = worldObj.getBlockTileEntity(xCoord+backDir.offsetX, yCoord+1, zCoord+backDir.offsetZ);
|
||||
if(ff instanceof IMechenical)
|
||||
{
|
||||
((IMechenical) ff).applyForce(this.aForce);
|
||||
}
|
||||
if(bb instanceof TileEntitySteamPiston)
|
||||
{
|
||||
this.pos = ((TileEntitySteamPiston) bb).pos + 1;
|
||||
if(this.pos > 7)
|
||||
{
|
||||
pos = 0;
|
||||
}
|
||||
}else
|
||||
if(this.running)
|
||||
{
|
||||
this.pos += 1;
|
||||
if(this.pos > 7)
|
||||
{
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------
|
||||
//Liquid and mechanical stuff
|
||||
//----------------
|
||||
@Override
|
||||
public int getSizeInventorySide(ForgeDirection side) { return 0; }
|
||||
@Override
|
||||
public int getSizeInventory() { return this.containingItems.length; }
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int par1) { return this.containingItems[par1]; }
|
||||
@Override
|
||||
public ItemStack decrStackSize(int par1, int par2)
|
||||
{
|
||||
if (this.containingItems[par1] != null)
|
||||
{
|
||||
ItemStack var3;
|
||||
if (this.containingItems[par1].stackSize <= par2)
|
||||
{
|
||||
var3 = this.containingItems[par1];
|
||||
this.containingItems[par1] = null;
|
||||
return var3;
|
||||
}
|
||||
else
|
||||
{
|
||||
var3 = this.containingItems[par1].splitStack(par2);
|
||||
if (this.containingItems[par1].stackSize == 0)
|
||||
{
|
||||
this.containingItems[par1] = null;
|
||||
}
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public double getForce(ForgeDirection side) {
|
||||
return aForce;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int par1)
|
||||
{
|
||||
if (this.containingItems[par1] != null)
|
||||
{
|
||||
ItemStack var2 = this.containingItems[par1];
|
||||
this.containingItems[par1] = null;
|
||||
return var2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
this.containingItems[par1] = par2ItemStack;
|
||||
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
par2ItemStack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getInvName() {
|
||||
return "SteamGen";
|
||||
}
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.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() { }
|
||||
|
||||
@Override
|
||||
public int onProduceLiquid(Liquid type, int Vol, ForgeDirection side) {
|
||||
public boolean canOutputSide(ForgeDirection side) {
|
||||
if(frontDir == side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInputSide(ForgeDirection side) {
|
||||
if(backDir == side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double applyForce(int force) {
|
||||
return aForce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onProduceLiquid(Liquid type, int vol, ForgeDirection side) {
|
||||
if(type == Liquid.WATER)
|
||||
{
|
||||
if(this.waterStored >= 1)
|
||||
{
|
||||
this.waterStored--;
|
||||
if(this.water > 0)
|
||||
{
|
||||
this.water -= 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -293,18 +152,36 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
|
|||
}
|
||||
|
||||
@Override
|
||||
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side) {
|
||||
if(type == Liquid.STEAM)
|
||||
public boolean canProducePresure(Liquid type, ForgeDirection side) {
|
||||
if(type == Liquid.WATER)
|
||||
{
|
||||
int rejectedSteam = Math.max((this.steamStored + vol) - 100, 0);
|
||||
this.steamStored += vol - rejectedSteam;
|
||||
return rejectedSteam;
|
||||
return true;
|
||||
}
|
||||
return vol;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRecieveLiquid(Liquid type, ForgeDirection side) {
|
||||
public int presureOutput(Liquid type, ForgeDirection side) {
|
||||
if(type == Liquid.WATER)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side) {
|
||||
if(type == Liquid.STEAM)
|
||||
{
|
||||
int rejectedSteam = Math.max((this.steam + vol) - this.getLiquidCapacity(Liquid.STEAM), 0);
|
||||
this.steam += vol - rejectedSteam;
|
||||
return rejectedSteam;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRecieveLiquid(Liquid type, ForgeDirection forgeDirection) {
|
||||
if(type == Liquid.STEAM)
|
||||
{
|
||||
return true;
|
||||
|
@ -314,84 +191,71 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
|
|||
|
||||
@Override
|
||||
public int getStoredLiquid(Liquid type) {
|
||||
if(type == Liquid.STEAM)
|
||||
{
|
||||
return this.steamStored;
|
||||
}
|
||||
if(type == Liquid.WATER)
|
||||
{
|
||||
return this.waterStored;
|
||||
return this.water;
|
||||
}else
|
||||
if(type == Liquid.STEAM)
|
||||
{
|
||||
return this.steam;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiquidCapacity(Liquid type) {
|
||||
if(type == Liquid.WATER)
|
||||
{
|
||||
return this.maxWater;
|
||||
}else
|
||||
if(type == Liquid.STEAM)
|
||||
{
|
||||
return 100;
|
||||
return this.maxSteam;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
//-------------------
|
||||
//Data
|
||||
//----------------
|
||||
public Object[] getSendData()
|
||||
{
|
||||
return new Object[]{(int)waterStored,(int)steamStored,(int)steamConsumed,(float)generateRate,(int)genTime};
|
||||
return new Object[]{steam,water,force,aForce,pos};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(NetworkManager network,
|
||||
Packet250CustomPayload packet, EntityPlayer player,
|
||||
ByteArrayDataInput dataStream) {
|
||||
public void handlePacketData(NetworkManager network,Packet250CustomPayload packet, EntityPlayer player,ByteArrayDataInput dataStream) {
|
||||
try
|
||||
{
|
||||
waterStored = dataStream.readInt();
|
||||
steamStored = dataStream.readInt();
|
||||
steamConsumed = dataStream.readInt();
|
||||
generateRate = dataStream.readFloat();
|
||||
genTime = dataStream.readInt();
|
||||
this.steam = dataStream.readInt();
|
||||
this.water = dataStream.readInt();
|
||||
this.force = dataStream.readInt();
|
||||
this.aForce = dataStream.readInt();
|
||||
this.pos = dataStream.readInt();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
System.out.print("SteamPistonDataFail");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public int presureOutput(Liquid type, ForgeDirection side) {
|
||||
if(type == Liquid.WATER)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean canProducePresure(Liquid type, ForgeDirection side)
|
||||
{
|
||||
if(type == Liquid.WATER)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int getRPM(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
return 100;
|
||||
}
|
||||
@Override
|
||||
public boolean canOutputSide(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canInputSide(ForgeDirection side) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int useRPM(int RPM) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
this.runTime = par1NBTTagCompound.getShort("time");
|
||||
this.steam = par1NBTTagCompound.getInteger("steam");
|
||||
this.water = par1NBTTagCompound.getInteger("water");
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a tile entity to NBT.
|
||||
*/
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setShort("time", (short)this.runTime);
|
||||
par1NBTTagCompound.setInteger("steam", (int)this.steam);
|
||||
par1NBTTagCompound.setInteger("water", (int)this.water);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -113,8 +113,8 @@ public class ModelGearRod extends ModelBase
|
|||
{
|
||||
Rod.render(f5);
|
||||
Rod2.render(f5);
|
||||
Rod.rotateAngleZ+= r;
|
||||
Rod2.rotateAngleZ+= r;
|
||||
Rod.rotateAngleZ+= (r)*45;
|
||||
Rod2.rotateAngleZ+= (r)*45;
|
||||
//TODO add rotation to rods
|
||||
front.render(f5);
|
||||
back.render(f5);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class RenderGearRod extends TileEntitySpecialRenderer
|
|||
case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break;
|
||||
case 4:GL11.glRotatef(270f, 0f, 1f, 0f);break;
|
||||
}
|
||||
model.render(0.0625F,tileEntity.rotation);
|
||||
model.render(0.0625F,tileEntity.pos);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
|
|
@ -40,29 +40,24 @@ import universalelectricity.electricity.ElectricInfo.ElectricUnit;
|
|||
displayText = "Not Connected";
|
||||
}
|
||||
else*/
|
||||
if(tileEntity.generateRate*20 <= 0)
|
||||
if(!tileEntity.running)
|
||||
{
|
||||
if(tileEntity.steamStored> 0)
|
||||
if(tileEntity.steam> 0)
|
||||
{
|
||||
displayText = "Power Full";
|
||||
displayText = "OutPut Full";
|
||||
}
|
||||
if(tileEntity.steamStored<= 0)
|
||||
if(tileEntity.steam<= 0)
|
||||
{
|
||||
displayText = "No Steam";
|
||||
}
|
||||
}
|
||||
|
||||
else if(tileEntity.generateRate*20 < 20)
|
||||
{
|
||||
displayText = "Warming UP: "+(int)(tileEntity.generateRate*100)+"%";
|
||||
}
|
||||
else
|
||||
{
|
||||
//displayText = ElectricUnit.getWattDisplay((int)(tileEntity.generateRate*20));
|
||||
displayText = ElectricInfo.getDisplay(ElectricInfo.getWatts(tileEntity.generateRate*20, tileEntity.getVoltage()), ElectricUnit.WATT);
|
||||
displayText = "Force: "+tileEntity.force+"N";
|
||||
}
|
||||
displayText2 = "water" + "-" + tileEntity.waterStored;
|
||||
displayText3 = "steam" + "-" + tileEntity.steamStored;
|
||||
displayText2 = "water" + "-" + tileEntity.water;
|
||||
displayText3 = "steam" + "-" + tileEntity.steam;
|
||||
this.fontRenderer.drawString(displayText, (int)(105-displayText.length()*1), 45, 4210752);
|
||||
this.fontRenderer.drawString(displayText2, (int)(105-displayText.length()*1), 55, 4210752);
|
||||
this.fontRenderer.drawString(displayText3, (int)(105-displayText.length()*1), 65, 4210752);
|
||||
|
|
|
@ -25,8 +25,8 @@ public class RenderSteamEngine extends TileEntitySpecialRenderer
|
|||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
||||
float p = ((TileEntitySteamPiston)tileEntity).position;
|
||||
boolean cc = ((TileEntitySteamPiston)tileEntity).isConnected;
|
||||
float p = ((TileEntitySteamPiston)tileEntity).pos;
|
||||
//boolean cc = ((TileEntitySteamPiston)tileEntity).isConnected;
|
||||
int meta = ((TileEntityMachine) tileEntity).getDirection();
|
||||
switch(meta)
|
||||
{
|
||||
|
@ -35,11 +35,10 @@ public class RenderSteamEngine extends TileEntitySpecialRenderer
|
|||
case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break;
|
||||
case 4:GL11.glRotatef(270f, 0f, 1f, 0f);break;
|
||||
}
|
||||
if(cc)
|
||||
{
|
||||
|
||||
model.renderTop(0.0625F);
|
||||
model.renderMid(0.0625F,p);
|
||||
}
|
||||
|
||||
model.renderBot(0.0625F);
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ package steampower;
|
|||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import steampower.boiler.TileEntityBoiler;
|
||||
import steampower.burner.TileEntityFireBox;
|
||||
import steampower.geared.RenderGearPiston;
|
||||
import steampower.turbine.TileEntityGen;
|
||||
import steampower.turbine.TileEntitySteamPiston;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
@ -20,7 +21,7 @@ public class SteamClientProxy extends SteamProxy{
|
|||
{
|
||||
ClientRegistry.registerTileEntity(TileEntityBoiler.class, "boiler", new RenderBoiler(0f));
|
||||
ClientRegistry.registerTileEntity(TileEntityFireBox.class, "fireBox", new RenderFurnace());
|
||||
ClientRegistry.registerTileEntity(TileEntitySteamPiston.class, "generator", new RenderSteamEngine());
|
||||
ClientRegistry.registerTileEntity(TileEntitySteamPiston.class, "generator", new RenderGearPiston());
|
||||
ClientRegistry.registerTileEntity(TileEntityGen.class, "elecGen", new RenderGenerator());
|
||||
}
|
||||
public void postInit()
|
||||
|
|
324
src/minecraft/steampower/geared/ModelGearPiston.java
Normal file
324
src/minecraft/steampower/geared/ModelGearPiston.java
Normal file
|
@ -0,0 +1,324 @@
|
|||
// Date: 10/1/2012 12:32:21 AM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package steampower.geared;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
|
||||
public class ModelGearPiston extends ModelBase
|
||||
{
|
||||
//fields
|
||||
ModelRenderer PistonCover;
|
||||
ModelRenderer RSpiston;
|
||||
ModelRenderer LSpiston;
|
||||
ModelRenderer RodPiston;
|
||||
ModelRenderer Base;
|
||||
ModelRenderer Front;
|
||||
ModelRenderer BackCC;
|
||||
ModelRenderer RightPipe;
|
||||
ModelRenderer FrontCC;
|
||||
ModelRenderer LeftCC;
|
||||
ModelRenderer FrontPipe;
|
||||
ModelRenderer Right;
|
||||
ModelRenderer RightCC;
|
||||
ModelRenderer Back;
|
||||
ModelRenderer BackPipe;
|
||||
ModelRenderer Left;
|
||||
ModelRenderer LeftPipe;
|
||||
ModelRenderer RigthF4;
|
||||
ModelRenderer LeftF4;
|
||||
ModelRenderer LeftF3;
|
||||
ModelRenderer LeftF2;
|
||||
ModelRenderer LeftF1;
|
||||
ModelRenderer RigthF3;
|
||||
ModelRenderer RigthF2;
|
||||
ModelRenderer RigthF1;
|
||||
ModelRenderer RigthGCC;
|
||||
ModelRenderer RightSlide;
|
||||
ModelRenderer LeftSlide;
|
||||
ModelRenderer RightRod2;
|
||||
ModelRenderer LeftGCC;
|
||||
ModelRenderer LeftRod2;
|
||||
ModelRenderer LeftSlide2;
|
||||
|
||||
public ModelGearPiston()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
PistonCover = new ModelRenderer(this, 13, 31);
|
||||
PistonCover.addBox(0F, -9F, -3F, 6, 10, 6);
|
||||
PistonCover.setRotationPoint(-3F, 20F, 0F);
|
||||
PistonCover.setTextureSize(128, 128);
|
||||
PistonCover.mirror = true;
|
||||
setRotation(PistonCover, 0F, 0F, 0F);
|
||||
RSpiston = new ModelRenderer(this, 0, 32);
|
||||
RSpiston.addBox(-3F, -2F, -2F, 1, 7, 4);
|
||||
RSpiston.setRotationPoint(1F, 3F, 0F);
|
||||
RSpiston.setTextureSize(128, 128);
|
||||
RSpiston.mirror = true;
|
||||
setRotation(RSpiston, 0F, 0F, 0F);
|
||||
LSpiston = new ModelRenderer(this, 0, 32);
|
||||
LSpiston.addBox(-1F, -2F, -2F, 1, 7, 4);
|
||||
LSpiston.setRotationPoint(2F, 3F, 0F);
|
||||
LSpiston.setTextureSize(128, 128);
|
||||
LSpiston.mirror = true;
|
||||
setRotation(LSpiston, 0F, 0F, 0F);
|
||||
RodPiston = new ModelRenderer(this, 0, 59);
|
||||
RodPiston.addBox(-1F, -2F, -1.5F, 2, 13, 3);
|
||||
RodPiston.setRotationPoint(0F, 8F, 0F);
|
||||
RodPiston.setTextureSize(128, 128);
|
||||
RodPiston.mirror = true;
|
||||
setRotation(RodPiston, 0F, 0F, 0F);
|
||||
Base = new ModelRenderer(this, 12, 49);
|
||||
Base.addBox(0F, 0F, 0F, 10, 5, 10);
|
||||
Base.setRotationPoint(-5F, 19F, -5F);
|
||||
Base.setTextureSize(128, 128);
|
||||
Base.mirror = true;
|
||||
setRotation(Base, 0F, 0F, 0F);
|
||||
Front = new ModelRenderer(this, 28, 68);
|
||||
Front.addBox(-3F, 0F, 0F, 6, 12, 1);
|
||||
Front.setRotationPoint(0F, 12F, -7F);
|
||||
Front.setTextureSize(128, 128);
|
||||
Front.mirror = true;
|
||||
setRotation(Front, 0F, 0F, 0F);
|
||||
BackCC = new ModelRenderer(this, 43, 68);
|
||||
BackCC.addBox(-2F, -2F, 1F, 4, 4, 1);
|
||||
BackCC.setRotationPoint(0F, 16F, 6F);
|
||||
BackCC.setTextureSize(128, 128);
|
||||
BackCC.mirror = true;
|
||||
setRotation(BackCC, 0F, 0F, 0F);
|
||||
RightPipe = new ModelRenderer(this, 12, 87);
|
||||
RightPipe.addBox(0F, 0F, -2F, 2, 10, 4);
|
||||
RightPipe.setRotationPoint(-6F, 14F, 0F);
|
||||
RightPipe.setTextureSize(128, 128);
|
||||
RightPipe.mirror = true;
|
||||
setRotation(RightPipe, 0F, 0F, 0F);
|
||||
FrontCC = new ModelRenderer(this, 43, 68);
|
||||
FrontCC.addBox(-2F, -2F, -1F, 4, 4, 1);
|
||||
FrontCC.setRotationPoint(0F, 16F, -7F);
|
||||
FrontCC.setTextureSize(128, 128);
|
||||
FrontCC.mirror = true;
|
||||
setRotation(FrontCC, 0F, 0F, 0F);
|
||||
LeftCC = new ModelRenderer(this, 43, 74);
|
||||
LeftCC.addBox(0F, -2F, -2F, 1, 4, 4);
|
||||
LeftCC.setRotationPoint(7F, 16F, 0F);
|
||||
LeftCC.setTextureSize(128, 128);
|
||||
LeftCC.mirror = true;
|
||||
setRotation(LeftCC, 0F, 0F, 0F);
|
||||
FrontPipe = new ModelRenderer(this, 28, 82);
|
||||
FrontPipe.addBox(-2F, 0F, 0F, 4, 10, 2);
|
||||
FrontPipe.setRotationPoint(0F, 14F, -6F);
|
||||
FrontPipe.setTextureSize(128, 128);
|
||||
FrontPipe.mirror = true;
|
||||
setRotation(FrontPipe, 0F, 0F, 0F);
|
||||
Right = new ModelRenderer(this, 12, 68);
|
||||
Right.addBox(0F, 0F, -3F, 1, 12, 6);
|
||||
Right.setRotationPoint(-7F, 12F, 0F);
|
||||
Right.setTextureSize(128, 128);
|
||||
Right.mirror = true;
|
||||
setRotation(Right, 0F, 0F, 0F);
|
||||
RightCC = new ModelRenderer(this, 43, 74);
|
||||
RightCC.addBox(-1F, -2F, -2F, 1, 4, 4);
|
||||
RightCC.setRotationPoint(-7F, 16F, 0F);
|
||||
RightCC.setTextureSize(128, 128);
|
||||
RightCC.mirror = true;
|
||||
setRotation(RightCC, 0F, 0F, 0F);
|
||||
Back = new ModelRenderer(this, 28, 68);
|
||||
Back.addBox(-3F, 0F, 0F, 6, 12, 1);
|
||||
Back.setRotationPoint(0F, 12F, 6F);
|
||||
Back.setTextureSize(128, 128);
|
||||
Back.mirror = true;
|
||||
setRotation(Back, 0F, 0F, 0F);
|
||||
BackPipe = new ModelRenderer(this, 28, 82);
|
||||
BackPipe.addBox(-2F, 0F, -2F, 4, 10, 2);
|
||||
BackPipe.setRotationPoint(0F, 14F, 6F);
|
||||
BackPipe.setTextureSize(128, 128);
|
||||
BackPipe.mirror = true;
|
||||
setRotation(BackPipe, 0F, 0F, 0F);
|
||||
Left = new ModelRenderer(this, 12, 68);
|
||||
Left.addBox(0F, 0F, -3F, 1, 12, 6);
|
||||
Left.setRotationPoint(6F, 12F, 0F);
|
||||
Left.setTextureSize(128, 128);
|
||||
Left.mirror = true;
|
||||
setRotation(Left, 0F, 0F, 0F);
|
||||
LeftPipe = new ModelRenderer(this, 12, 87);
|
||||
LeftPipe.addBox(-2F, 0F, -2F, 2, 10, 4);
|
||||
LeftPipe.setRotationPoint(6F, 14F, 0F);
|
||||
LeftPipe.setTextureSize(128, 128);
|
||||
LeftPipe.mirror = true;
|
||||
setRotation(LeftPipe, 0F, 0F, 0F);
|
||||
RigthF4 = new ModelRenderer(this, 0, 56);
|
||||
RigthF4.addBox(-2F, 1F, 1F, 2, 1, 1);
|
||||
RigthF4.setRotationPoint(-8F, 0F, 0F);
|
||||
RigthF4.setTextureSize(128, 128);
|
||||
RigthF4.mirror = true;
|
||||
setRotation(RigthF4, 0F, 0F, 0F);
|
||||
LeftF4 = new ModelRenderer(this, 0, 56);
|
||||
LeftF4.addBox(0F, 1F, 1F, 2, 1, 1);
|
||||
LeftF4.setRotationPoint(8F, 0F, 0F);
|
||||
LeftF4.setTextureSize(128, 128);
|
||||
LeftF4.mirror = true;
|
||||
setRotation(LeftF4, 0.7853982F, 0F, 0F);
|
||||
LeftF3 = new ModelRenderer(this, 0, 56);
|
||||
LeftF3.addBox(0F, 1F, -2F, 2, 1, 1);
|
||||
LeftF3.setRotationPoint(8F, 0F, 0F);
|
||||
LeftF3.setTextureSize(128, 128);
|
||||
LeftF3.mirror = true;
|
||||
setRotation(LeftF3, 0.7853982F, 0F, 0F);
|
||||
LeftF2 = new ModelRenderer(this, 0, 56);
|
||||
LeftF2.addBox(0F, -2F, -2F, 2, 1, 1);
|
||||
LeftF2.setRotationPoint(8F, 0F, 0F);
|
||||
LeftF2.setTextureSize(128, 128);
|
||||
LeftF2.mirror = true;
|
||||
setRotation(LeftF2, 0.7853982F, 0F, 0F);
|
||||
LeftF1 = new ModelRenderer(this, 0, 56);
|
||||
LeftF1.addBox(0F, -2F, 1F, 2, 1, 1);
|
||||
LeftF1.setRotationPoint(8F, 0F, 0F);
|
||||
LeftF1.setTextureSize(128, 128);
|
||||
LeftF1.mirror = true;
|
||||
setRotation(LeftF1, 0.7853982F, 0F, 0F);
|
||||
RigthF3 = new ModelRenderer(this, 0, 56);
|
||||
RigthF3.addBox(-2F, 1F, -2F, 2, 1, 1);
|
||||
RigthF3.setRotationPoint(-8F, 0F, 0F);
|
||||
RigthF3.setTextureSize(128, 128);
|
||||
RigthF3.mirror = true;
|
||||
setRotation(RigthF3, 0F, 0F, 0F);
|
||||
RigthF2 = new ModelRenderer(this, 0, 56);
|
||||
RigthF2.addBox(-2F, -2F, 1F, 2, 1, 1);
|
||||
RigthF2.setRotationPoint(-8F, 0F, 0F);
|
||||
RigthF2.setTextureSize(128, 128);
|
||||
RigthF2.mirror = true;
|
||||
setRotation(RigthF2, 0F, 0F, 0F);
|
||||
RigthF1 = new ModelRenderer(this, 0, 56);
|
||||
RigthF1.addBox(-2F, -2F, -2F, 2, 1, 1);
|
||||
RigthF1.setRotationPoint(-8F, 0F, 0F);
|
||||
RigthF1.setTextureSize(128, 128);
|
||||
RigthF1.mirror = true;
|
||||
setRotation(RigthF1, 0F, 0F, 0F);
|
||||
RigthGCC = new ModelRenderer(this, 12, 18);
|
||||
RigthGCC.addBox(-2F, -2F, -2F, 2, 4, 4);
|
||||
RigthGCC.setRotationPoint(-6F, 0F, 0F);
|
||||
RigthGCC.setTextureSize(128, 128);
|
||||
RigthGCC.mirror = true;
|
||||
setRotation(RigthGCC, 0F, 0F, 0F);
|
||||
RightSlide = new ModelRenderer(this, 0, 44);
|
||||
RightSlide.addBox(0F, -2F, -2F, 1, 7, 4);
|
||||
RightSlide.setRotationPoint(-4F, 0F, 0F);
|
||||
RightSlide.setTextureSize(128, 128);
|
||||
RightSlide.mirror = true;
|
||||
setRotation(RightSlide, 0F, 0F, 0F);
|
||||
LeftSlide2 = new ModelRenderer(this, 0, 27);
|
||||
LeftSlide2.addBox(0F, 2F, -1F, 6, 2, 2);
|
||||
LeftSlide2.setRotationPoint(-3F, 0F, 0F);
|
||||
LeftSlide2.setTextureSize(128, 128);
|
||||
LeftSlide2.mirror = true;
|
||||
setRotation(LeftSlide2, 0F, 0F, 0F);
|
||||
RightRod2 = new ModelRenderer(this, 0, 20);
|
||||
RightRod2.addBox(0F, -1.5F, -1.5F, 2, 3, 3);
|
||||
RightRod2.setRotationPoint(-6F, 0F, 0F);
|
||||
RightRod2.setTextureSize(128, 128);
|
||||
RightRod2.mirror = true;
|
||||
setRotation(RightRod2, 0F, 0F, 0F);
|
||||
LeftGCC = new ModelRenderer(this, 24, 18);
|
||||
LeftGCC.addBox(-1F, -2F, -2F, 2, 4, 4);
|
||||
LeftGCC.setRotationPoint(7F, 0F, 0F);
|
||||
LeftGCC.setTextureSize(128, 128);
|
||||
LeftGCC.mirror = true;
|
||||
setRotation(LeftGCC, 0.7853982F, 0F, 0F);
|
||||
LeftRod2 = new ModelRenderer(this, 0, 20);
|
||||
LeftRod2.addBox(-3F, -1.5F, -1.5F, 2, 3, 3);
|
||||
LeftRod2.setRotationPoint(7F, 0F, 0F);
|
||||
LeftRod2.setTextureSize(128, 128);
|
||||
LeftRod2.mirror = true;
|
||||
setRotation(LeftRod2, 0F, 0F, 0F);
|
||||
LeftSlide = new ModelRenderer(this, 0, 32);
|
||||
LeftSlide.addBox(-1F, -2F, -2F, 1, 7, 4);
|
||||
LeftSlide.setRotationPoint(4F, 0F, 0F);
|
||||
LeftSlide.setTextureSize(128, 128);
|
||||
LeftSlide.mirror = true;
|
||||
setRotation(LeftSlide, 0F, 0F, 0F);
|
||||
}
|
||||
public void renderBody(float f5)
|
||||
{
|
||||
Base.render(f5);
|
||||
PistonCover.render(f5);
|
||||
|
||||
}
|
||||
public void renderGear(float f5)
|
||||
{
|
||||
//Rod connectors
|
||||
LeftF4.render(f5);
|
||||
LeftF3.render(f5);
|
||||
LeftF2.render(f5);
|
||||
LeftF1.render(f5);
|
||||
RigthF4.render(f5);
|
||||
RigthF3.render(f5);
|
||||
RigthF2.render(f5);
|
||||
RigthF1.render(f5);
|
||||
RigthGCC.render(f5);
|
||||
LeftGCC.render(f5);
|
||||
}
|
||||
public void renderR(float f5,int pos)
|
||||
{
|
||||
int change = pos/2;
|
||||
|
||||
//Piston Arm
|
||||
RSpiston.render(f5);
|
||||
LSpiston.render(f5);
|
||||
RodPiston.render(f5);
|
||||
RodPiston.setRotationPoint(0, 8f-change, 0);
|
||||
//GearShaft
|
||||
RightSlide.render(f5);
|
||||
LeftSlide.render(f5);
|
||||
RightRod2.render(f5);
|
||||
LeftRod2.render(f5);
|
||||
LeftSlide2.render(f5);
|
||||
}
|
||||
public void renderLeft(float f5)
|
||||
{
|
||||
Left.render(f5);
|
||||
LeftPipe.render(f5);
|
||||
LeftCC.render(f5);
|
||||
}
|
||||
public void renderRight(float f5)
|
||||
{
|
||||
Right.render(f5);
|
||||
RightCC.render(f5);
|
||||
RightPipe.render(f5);
|
||||
}
|
||||
public void renderFront(float f5)
|
||||
{
|
||||
Front.render(f5);
|
||||
FrontCC.render(f5);
|
||||
FrontPipe.render(f5);
|
||||
}
|
||||
public void renderBack(float f5)
|
||||
{
|
||||
Back.render(f5);
|
||||
BackPipe.render(f5);
|
||||
BackCC.render(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);
|
||||
}
|
||||
|
||||
}
|
52
src/minecraft/steampower/geared/RenderGearPiston.java
Normal file
52
src/minecraft/steampower/geared/RenderGearPiston.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package steampower.geared;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import steampower.SteamPowerMain;
|
||||
import steampower.turbine.TileEntitySteamPiston;
|
||||
|
||||
public class RenderGearPiston extends TileEntitySpecialRenderer
|
||||
{
|
||||
int type = 0;
|
||||
private ModelGearPiston model;
|
||||
|
||||
public RenderGearPiston()
|
||||
{
|
||||
model = new ModelGearPiston();
|
||||
}
|
||||
public void renderTileEntityAt(TileEntitySteamPiston tileEntity, double d, double d1, double d2, float d3) {
|
||||
bindTextureByName(SteamPowerMain.textureFile+"GearShaftPiston.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
switch(meta)
|
||||
{
|
||||
case 1:GL11.glRotatef(0f, 0f, 1f, 0f);break;
|
||||
case 2:GL11.glRotatef(90f, 0f, 1f, 0f);break;
|
||||
case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break;
|
||||
case 0:GL11.glRotatef(270f, 0f, 1f, 0f);break;
|
||||
}
|
||||
model.renderGear(0.0625F);
|
||||
model.renderR(0.0625F,tileEntity.pos);
|
||||
model.renderBody(0.0625F);
|
||||
model.renderBack(0.0625F);
|
||||
model.renderFront(0.0625F);
|
||||
model.renderLeft(0.0625F);
|
||||
model.renderRight(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity var1, double d, double d1,
|
||||
double d2, float d3) {
|
||||
this.renderTileEntityAt(((TileEntitySteamPiston)var1), d, d1, d2, d3);
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
src/minecraft/textures/GearShaftPiston.png
Normal file
BIN
src/minecraft/textures/GearShaftPiston.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 706 B |
Loading…
Reference in a new issue