git repo moved to project folder

src will now upload strait from my MCP project location. Meaning the
package names changed just in git.
This commit is contained in:
Rseifert 2012-08-27 09:11:16 -04:00
parent 40f0710849
commit 66fc0aee1b
113 changed files with 1650 additions and 4074 deletions

37
.gitignore vendored
View file

@ -4,3 +4,40 @@
*.jar
*.war
*.ear
*.bat
*.sh
*.txt
*.cfg
CHANGELOG
LICENSE
/src/minecraft_server/*
/src/minecraft/cpw/*
/src/minecraft/ibxm/*
/src/minecraft/net/*
/src/minecraft/paulscode/*
/src/minecraft/forge_logo.png
/src/minecraft/start.java
/src/minecraft/universalelectricity/*
/src/minecraft/basiccomponents/*
/src/minecraft/buildcraft/*
/src/common/cpw/*
/src/common/net/*
/src/common/org/*
/src/common/fml_at.cfg
/src/common/fml_marker.cfg
/src/common/fmlversion.properties
/src/common/forge_at.cfg
/src/common/universalelectricity/*
/src/common/basiccomponents/*
/src/common/buildcraft/*
/bin/
/conf/
/docs/
/eclipse/
/forge/
/jars/
/lib/
/logs/
/modsrc/
/runtime/
/temp/

View file

@ -1,375 +0,0 @@
package net.minecraft.src.eui;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.src.*;
import net.minecraft.src.basiccomponents.*;
import net.minecraft.src.eui.boiler.*;
import net.minecraft.src.eui.burner.GUIFireBox;
import net.minecraft.src.eui.burner.TileEntityFireBox;
import net.minecraft.src.eui.turbine.GUIGenerator;
import net.minecraft.src.eui.turbine.TileEntityGenerator;
import net.minecraft.src.forge.*;
import net.minecraft.src.universalelectricity.*;
public class BlockMachine extends net.minecraft.src.universalelectricity.extend.BlockMachine implements ITextureProvider
{
private Random furnaceRand = new Random();
private static boolean keepFurnaceInventory = true;
public BlockMachine(int par1)
{
super("machine", par1, Material.iron);
this.setRequiresSelfNotify();
}
@Override
protected int damageDropped(int metadata)
{
return metadata;
}
@Override
public void randomDisplayTick(World par1World, int x, int y, int z, Random par5Random)
{
TileEntity tileEntity = par1World.getBlockTileEntity(x, y, z);
if(tileEntity instanceof TileEntityFireBox)
{
if(((TileEntityFireBox)tileEntity).generateRate > 0)
{
int var6 = (int)((TileEntityFireBox)tileEntity).getDirection();
float var7 = (float)x + 0.5F;
float var8 = (float)y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
float var9 = (float)z + 0.5F;
float var10 = 0.52F;
float var11 = par5Random.nextFloat() * 0.6F - 0.3F;
if (var6 == 5)
{
par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (var6 == 4)
{
par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
}
else if (var6 == 3)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
}
else if (var6 == 2)
{
par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
}
}
}
}
@Override
public int getBlockTexture(IBlockAccess par1iBlockAccess, int x, int y, int z, int side)
{
TileEntity tileEntity = par1iBlockAccess.getBlockTileEntity(x, y, z);
int metadata = par1iBlockAccess.getBlockMetadata(x, y, z);
if(metadata > -1 && tileEntity != null)
{
if (side == 1)
{
switch(metadata)
{
case 0: return 6;
case 1: return 4;
case 2: return 7;
case 3: return 4;
}
}
//If it is the back side
else if(side == UniversalElectricity.getOrientationFromSide(((TileEntityMachine)tileEntity).getDirection(), (byte)2))
{
switch(metadata)
{
case 0: return 5;
case 2: return 8;
case 3: return 4;
}
}
switch(metadata)
{
case 1: return 0;
case 2: return 2;
}
}
return 1;
}
@Override
public int getBlockTextureFromSideAndMetadata(int side, int metadata)
{
if (side == 1)
{
switch(metadata)
{
case 0: return 6;
case 1: return 4;
case 2: return 7;
case 3: return 0;
}
}
else
{
//If it is the front side
if(side == 3)
{
switch(metadata)
{
case 0: return 5;
case 1: return 0;
case 2: return 8;
case 3: return 4;
}
}
//If it is the back side
else if(side == 2)
{
switch(metadata)
{
case 0: return this.blockIndexInTexture + 2;
case 1: return this.blockIndexInTexture + 3;
case 2: return this.blockIndexInTexture + 2;
}
}
switch(metadata)
{
case 1: return 0;
case 2: return 2;
case 3: return 0;
}
}
return 1;
}
public boolean blockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
{
int metadata = par1World.getBlockMetadata(par2, par3, par4);
/**
* Check if the player is holding a wrench or an electric item. If so, do not open the GUI.
*/
if(par5EntityPlayer.inventory.getCurrentItem() != null)
{
if(par5EntityPlayer.inventory.getCurrentItem().itemID == BasicComponents.ItemWrench.shiftedIndex)
{
if(onUseWrench(par1World, par2, par3, par4, par5EntityPlayer))
{
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID);
return true;
}
}
else if(par5EntityPlayer.inventory.getCurrentItem().getItem() instanceof net.minecraft.src.universalelectricity.extend.ItemElectric)
{
if(onUseElectricItem(par1World, par2, par3, par4, par5EntityPlayer))
{
return true;
}
}
}
return machineActivated(par1World, par2, par3, par4, par5EntityPlayer);
}
public boolean onUseElectricItem(World par1World, int par2, int par3,
int par4, EntityPlayer par5EntityPlayer) {
// TODO Auto-generated method stub
return false;
}
public boolean onUseWrench(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
{
TileEntityMachine tileEntity = (TileEntityMachine)par1World.getBlockTileEntity(par2, par3, par4);
//Reorient the block
switch(tileEntity.getDirection())
{
case 2: tileEntity.setDirection((byte)5); break;
case 5: tileEntity.setDirection((byte)3); break;
case 3: tileEntity.setDirection((byte)4); break;
case 4: tileEntity.setDirection((byte)2); break;
}
return true;
}
/**
* Called upon block activation (left or right click on the block.). The three integers represent x,y,z of the
* block.
*/
public boolean machineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer)
{
if (par1World.isRemote)
{
return true;
}
else
{
TileEntity blockEntity = (TileEntity)par1World.getBlockTileEntity(x, y, z);
if (blockEntity != null)
{
if(blockEntity instanceof TileEntityBoiler)
{
TileEntity var6 = (TileEntityBoiler)par1World.getBlockTileEntity(x, y, z);
ModLoader.openGUI(par5EntityPlayer, new GuiBoiler(par5EntityPlayer.inventory, (TileEntityBoiler) var6 )); ;
}
if(blockEntity instanceof TileEntityFireBox)
{
TileEntity var6 = (TileEntityFireBox)par1World.getBlockTileEntity(x, y, z);
ModLoader.openGUI(par5EntityPlayer, new GUIFireBox(par5EntityPlayer.inventory, (TileEntityFireBox) var6 )); ;
}
if(blockEntity instanceof TileEntityGenerator)
{
TileEntity var6 = (TileEntityGenerator)par1World.getBlockTileEntity(x, y, z);
ModLoader.openGUI(par5EntityPlayer, new GUIGenerator(par5EntityPlayer.inventory, (TileEntityGenerator) var6 )); ;
}
}
return true;
}
}
@Override
public TileEntity getBlockEntity(int meta)
{
switch(meta)
{
case 1: return new TileEntityBoiler();
case 2: return new TileEntityFireBox();
case 3: return new TileEntityGenerator();
case 15: return new TileEntityNuller();
}
return null;
}
/**
* Called when the block is placed in the world.
*/
@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);
if(metadata == 0)
{
switch (angle)
{
case 0: tileEntity.setDirection((byte)5); break;
case 1: tileEntity.setDirection((byte)3); break;
case 2: tileEntity.setDirection((byte)4); break;
case 3: tileEntity.setDirection((byte)2); break;
}
}
else
{
switch (angle)
{
case 0: tileEntity.setDirection((byte)3); break;
case 1: tileEntity.setDirection((byte)4); break;
case 2: tileEntity.setDirection((byte)2); break;
case 3: tileEntity.setDirection((byte)5); break;
}
}
}
/**
* Called whenever the block is removed.
*/
public void onBlockRemoval(World par1World, int par2, int par3, int par4)
{
if (!keepFurnaceInventory)
{
TileEntityMachine var5 = null;
TileEntity entityBox = par1World.getBlockTileEntity(par2, par3, par4);
if(entityBox instanceof TileEntityFireBox)
{
var5 = (TileEntityFireBox)entityBox;
}
else if(entityBox instanceof TileEntityBoiler)
{
var5 = (TileEntityBoiler)entityBox;
}
if (var5 != null)
{
for (int var6 = 0; var6 < var5.getSizeInventory(); ++var6)
{
ItemStack var7 = var5.getStackInSlot(var6);
if (var7 != null)
{
float var8 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
float var9 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
float var10 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
while (var7.stackSize > 0)
{
int var11 = this.furnaceRand.nextInt(21) + 10;
if (var11 > var7.stackSize)
{
var11 = var7.stackSize;
}
var7.stackSize -= var11;
EntityItem var12 = new EntityItem(par1World, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
if (var7.hasTagCompound())
{
var12.item.setTagCompound((NBTTagCompound)var7.getTagCompound().copy());
}
float var13 = 0.05F;
var12.motionX = (double)((float)this.furnaceRand.nextGaussian() * var13);
var12.motionY = (double)((float)this.furnaceRand.nextGaussian() * var13 + 0.2F);
var12.motionZ = (double)((float)this.furnaceRand.nextGaussian() * var13);
par1World.spawnEntityInWorld(var12);
}
}
}
}
}
super.onBlockRemoval(par1World, par2, par3, par4);
}
@Override
public TileEntity getBlockEntity() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getTextureFile() {
// TODO Auto-generated method stub
return "/eui/blocks.png";
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return -1;
}
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this, 1,1));//boiler
itemList.add(new ItemStack(this, 1,2));//firebox
itemList.add(new ItemStack(this, 1,3));//generator
itemList.add(new ItemStack(this, 1,15));//eu vamp
}
}

View file

@ -1,60 +0,0 @@
package net.minecraft.src.eui;
import java.util.ArrayList;
import net.minecraft.src.*;
import net.minecraft.src.forge.*;
public class ItemCoalFuel extends Item implements ITextureProvider
{
public ItemCoalFuel(int par1)
{
super(par1);
this.setItemName("CoalDust");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
}
@Override
public int getIconFromDamage(int par1)
{
switch(par1)
{
case 0: return 0;
case 1: return 1;
case 2: return 2;
}
return this.iconIndex;
}
@Override
public String getTextureFile() {
// TODO Auto-generated method stub
return "/eui/Items.png";
}
public String getItemName()
{
return "CoalDust";
}
public String getItemNameIS(ItemStack par1ItemStack)
{
int var3 = par1ItemStack.getItemDamage();
switch(var3)
{
case 0: return "CoalNuggets";
case 1: return "CoalPellets";
case 2: return "CoalDust";
}
return this.getItemName();
}
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this, 1,0));
itemList.add(new ItemStack(this, 1,1));
itemList.add(new ItemStack(this, 1,2));
}
}

View file

@ -1,38 +0,0 @@
package net.minecraft.src.eui;
import java.util.ArrayList;
import net.minecraft.src.*;
public class ItemMachine extends ItemBlock {
public ItemMachine(int id) {
super(id);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public int getMetadata(int metadata)
{
return metadata;
}
@Override
public String getItemName()
{
return "Machine";
}
@Override
public String getItemNameIS(ItemStack par1ItemStack)
{
int var3 = par1ItemStack.getItemDamage();
switch(var3)
{
case 0: return "CoalProcessor";
case 1: return "Boiler";
case 2: return "FireBox";
case 3: return "SteamGen";
case 15: return "EnergyNuller";
}
return this.getItemName();
}
}

View file

@ -1,71 +0,0 @@
package net.minecraft.src.eui;
import java.util.ArrayList;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.forge.ITextureProvider;
public class ItemParts extends Item implements ITextureProvider{
public ItemParts(int par1)
{
super(par1);
this.setItemName("Parts");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
}
@Override
public int getIconFromDamage(int par1)
{
switch(par1)
{
case 0: return 3;
case 1: return 4;
case 2: return 5;
case 3: return 6;
case 4: return 7;
case 5: return 8;
case 6: return 9;
}
return this.iconIndex;
}
@Override
public String getTextureFile() {
// TODO Auto-generated method stub
return "/eui/Items.png";
}
public String getItemName()
{
return "parts";
}
public String getItemNameIS(ItemStack par1ItemStack)
{
int var3 = par1ItemStack.getItemDamage();
switch(var3)
{
case 1: return "Tank";
case 3: return "Valve";
case 4: return "Tube";
case 5: return "Seal";
case 6: return "Rivits";
}
return this.getItemName();
}
public void addCreativeItems(ArrayList itemList)
{
itemList.add(new ItemStack(this, 1,1));
itemList.add(new ItemStack(this, 1,3));
itemList.add(new ItemStack(this, 1,4));
itemList.add(new ItemStack(this, 1,5));
itemList.add(new ItemStack(this, 1,6));
}
}

View file

@ -1,94 +0,0 @@
package net.minecraft.src.eui;
import net.minecraft.src.*;
import net.minecraft.src.eui.boiler.TileEntityBoiler;
import net.minecraft.src.forge.ITextureProvider;
import net.minecraft.src.universalelectricity.electricity.TileEntityElectricUnit;
import net.minecraft.src.universalelectricity.extend.IRotatable;
public class TileEntityMachine extends TileEntityElectricUnit implements ITextureProvider, IRotatable
{
private byte facing = 0;
public TileEntity getSteamMachine(int i)
{
int x = this.xCoord;
int y = this.yCoord;
int z = this.zCoord;
switch(i)
{
case 0: y = y - 1;break;
case 1: y = y + 1;break;
case 2: z = z + 1;break;
case 3: z = z - 1;break;
case 4: x = x + 1;break;
case 5: x = x - 1;break;
}
TileEntity aEntity = worldObj.getBlockTileEntity(x, y, z);
if(aEntity instanceof TileEntityMachine)
{
return aEntity;
}
return null;
}
public byte getDirection()
{
return this.facing;
}
public void setDirection(byte facingDirection)
{
this.facing = facingDirection;
}
@Override
public String getTextureFile()
{
return "/eui/blocks.png";
}
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setByte("facing", (byte)this.facing);
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.facing = par1NBTTagCompound.getByte("facing");
}
@Override
public float electricityRequest() {
// TODO Auto-generated method stub
return 0;
}
@Override
public boolean canReceiveFromSide(byte side) {
// TODO Auto-generated method stub
return false;
}
public int getSizeInventory() {
// TODO Auto-generated method stub
return 0;
}
public ItemStack getStackInSlot(int var6) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean canUpdate()
{
return true;
}
}

View file

@ -1,28 +0,0 @@
package net.minecraft.src.eui;
import net.minecraft.src.universalelectricity.electricity.IElectricUnit;
public class TileEntityNuller extends TileEntityMachine implements IElectricUnit {
public float electricityRequest()
{
return 100;
}
public boolean canReceiveFromSide(byte side)
{
return true;
}
public float getVoltage()
{
return 1000;
}
public int getTickInterval()
{
return 1;
}
public boolean canConnect(byte side)
{
return true;
}
}

View file

@ -1,22 +0,0 @@
package net.minecraft.src.eui.api;
/**
* The IHeatConsumer interface is an interface that must be applied to all tile entities that can receive heat joules.
* @author Darkguardsman code sourced from Calclavia
*
*/
public interface IHeatConsumer
{
/**
* onRecieveSteam is called whenever a Steam transmitter sends a packet of electricity to the consumer (which is this block).
* @param vol - The amount of steam this block received
* @param side - The side of the block in which the electricity came from.
* @return vol - The amount of rejected steam to be sent to back
*/
public float onReceiveHeat(float jouls, int side);
/**
* @return Return the stored electricity in this consumer. Called by conductors to spread electricity to this unit.
*/
public float getStoredHeat();
}

View file

@ -1,14 +0,0 @@
package net.minecraft.src.eui.api;
public interface IHeatProducer
{
/**
* onProduceElectricity is called when a conductor is connected to the producer block in which the conductor will demand power from the producer
* block.
* @param jouls - The maximum jouls can be transfered
* @param side - The side of block in which the conductor is on
* @return jouls - Return jouls to consumer
*/
public float onProduceHeat(float jouls, int side);
}

View file

@ -1,30 +0,0 @@
package net.minecraft.src.eui.api;
public interface ISteamConsumer
{
/**
* onRecieveElectricity is called whenever a Universal Electric conductor sends a packet of electricity to the consumer (which is this block).
* @param watts - The amount of watts this block received.
* @param side - The side of the block in which the electricity came from.
* @return watt - The amount of rejected power to be sent back into the conductor
*/
public int onReceiveSteam(int watts, byte side);
// 1 unit of steam is = to 7132.6gal(27m^3) at 1ATM 424*F(200*C)
/**
* You can use this to check if a wire can connect to this UE consumer to properly render the graphics
* @param side - The side in which the electricity is coming from.
* @return Returns true or false if this consumer can receive electricity at this given tick or moment.
*/
public boolean canRecieveSteam(byte side);
/**
* @return Return the stored electricity in this consumer. Called by conductors to spread electricity to this unit.
*/
public int getStoredSteam();
/**
* @return Return the maximum amount of stored electricity this consumer can get.
*/
public int getSteamCapacity();
}

View file

@ -1,20 +0,0 @@
package net.minecraft.src.eui.api;
/**
* The UEIProducer interface is an interface that must be applied to all tile entities that can produce electricity.
* @author Calclavia
*
*/
public interface ISteamProducer
{
/**
* onProduceElectricity is called when a conductor is connected to the producer block in which the conductor will demand power from the producer
* block.
* @param maxvol - The maximum vol the steam pipe can take
* @param side - The side of block in which the conductor is on
* @return vol - Return the amount of vol that cam be moved at one time
*/
public int onProduceSteam(float maxVol, int side);
public boolean canProduceSteam(byte side);
}

View file

@ -1,30 +0,0 @@
package net.minecraft.src.eui.api;
public interface IWaterConsumer
{
/**
* onRecieveElectricity is called whenever a Universal Electric conductor sends a packet of electricity to the consumer (which is this block).
* @param watts - The amount of watts this block received.
* @param side - The side of the block in which the electricity came from.
* @return watt - The amount of rejected power to be sent back into the conductor
*/
public int onReceiveWater(int vol, byte side);
/**
* You can use this to check if a wire can connect to this UE consumer to properly render the graphics
* @param side - The side in which the electricity is coming from.
* @return Returns true or false if this consumer can receive electricity at this given tick or moment.
*/
public boolean canRecieveWater(byte side);
/**
* @return Return the stored electricity in this consumer. Called by conductors to spread electricity to this unit.
*/
public int getStoredWater();
/**
* @return Return the maximum amount of stored electricity this consumer can get.
*/
public int getWaterCapacity();
}

View file

@ -1,20 +0,0 @@
package net.minecraft.src.eui.api;
/**
* The UEIProducer interface is an interface that must be applied to all tile entities that can produce electricity.
* @author Calclavia
*
*/
public interface IWaterProducer
{
/**
* onProduceElectricity is called when a conductor is connected to the producer block in which the conductor will demand power from the producer
* block.
* @param maxvol - The maximum vol the steam pipe can take
* @param side - The side of block in which the conductor is on
* @return vol - Return the amount of vol that cam be moved at one time
*/
public int onProduceWater(int maxVol, int side);
public boolean canProduceWater(byte side);
}

View file

@ -1,59 +0,0 @@
package net.minecraft.src.eui.boiler;
import net.minecraft.src.*;
public class ContainerBoiler extends Container
{
private TileEntityBoiler boiler;
private int lastCookTime = 0;
private int lastBurnTime = 0;
private int lastItemBurnTime = 0;
public ContainerBoiler(InventoryPlayer par1InventoryPlayer, TileEntityBoiler par2TileEntityboiler)
{
this.boiler = par2TileEntityboiler;
this.addSlot(new Slot(par2TileEntityboiler, 0, 56, 17));
int var3;
for (var3 = 0; var3 < 3; ++var3)
{
for (int var4 = 0; var4 < 9; ++var4)
{
this.addSlot(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
}
}
for (var3 = 0; var3 < 9; ++var3)
{
this.addSlot(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142));
}
}
public void updateProgressBar(int par1, int par2)
{
if (par1 == 0)
{
// this.boiler.furnaceCookTime = par2;
}
if (par1 == 1)
{
//this.boiler.boilerRunTime = par2;
}
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.boiler.isUseableByPlayer(par1EntityPlayer);
}
/**
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
*/
public ItemStack transferStackInSlot(int par1)
{
return null;
}
}

View file

@ -1,84 +0,0 @@
package net.minecraft.src.eui.boiler;
import java.text.DecimalFormat;
import net.minecraft.src.*;
import org.lwjgl.opengl.GL11;
public class GuiBoiler extends GuiContainer
{
private TileEntityBoiler boilerInventory;
public GuiBoiler(InventoryPlayer par1InventoryPlayer, TileEntityBoiler par2TileEntityGrinder)
{
super(new ContainerBoiler(par1InventoryPlayer, par2TileEntityGrinder));
this.boilerInventory = par2TileEntityGrinder;
}
/**
* Draw the foreground layer for the GuiContainer (everythin in front of the items)
*/
protected void drawGuiContainerForegroundLayer()
{
this.fontRenderer.drawString("Boiler", 60, 6, 4210752);
this.fontRenderer.drawString("Inventory", 8, this.ySize - 96 + 2, 4210752); if(boilerInventory.hullHeat >=10000)
{
this.fontRenderer.drawString("Heat Danger", (int)(105), 50, 4210752);
}
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int var4 = this.mc.renderEngine.getTexture("/eui/BoilerGui.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(var4);
int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize-1, this.ySize);
int var7;
int var8;
int var9;
int var10;
if (this.boilerInventory.waterStored > 0)
{
var7 = boilerInventory.getStoredLiquid(1)*4 + 1;
this.drawTexturedModalRect(var5 + 29, var6 + 72 - var7, 176, 148 - var7, 23, var7);
}
if (this.boilerInventory.steamStored > 0)
{
var8 = boilerInventory.steamStored/14*4 + 1;
this.drawTexturedModalRect(var5 + 108, var6 + 72 - var8, 176, 90 - var8, 23, var8);
}
float precentH = Math.min(boilerInventory.hullHeat/1000 + 1, 10);
var9 = (int) Math.min(precentH*3.0F,30);
this.drawTexturedModalRect(var5 + 59, var6 + 70 - var9, 199, 71 - var9, 9, var9);
float precentSH = this.boilerInventory.heatStored/1000;
var10 = (int) Math.round(precentSH*5.33);
this.drawTexturedModalRect(var5 + 78, var6 + 16, 176, 14, var10, 16);
}
public static String getWattDisplay(int watts)
{
String displayWatt;
if(watts > 1000)
{
displayWatt = roundTwoDecimals((double)watts/1000)+" MJ";
}
else
{
displayWatt = watts+" kJ";
}
return displayWatt;
}
public static double roundTwoDecimals(double d)
{
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(d));
}
}

View file

@ -1,155 +0,0 @@
// Date: 8/14/2012 1:48:41 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package net.minecraft.src.eui.boiler;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelTank extends ModelBase
{
//fields
ModelRenderer TANK_WALL_1;
ModelRenderer TANK_WALL_2;
ModelRenderer TANK_WALL_3;
ModelRenderer TANK_WALL_4;
ModelRenderer TANK_SUPPORT_1;
ModelRenderer TANK_TOP_1;
ModelRenderer TANK_WALL_5;
ModelRenderer TANK_SUPPORT_2;
ModelRenderer TANK_SUPPORT_3;
ModelRenderer TANK_WALL_6;
ModelRenderer TANK_TOP_2;
ModelRenderer TANK_TOP_3;
ModelRenderer TANK_VALVE;
public ModelTank()
{
textureWidth = 128;
textureHeight = 128;
TANK_WALL_1 = new ModelRenderer(this, 0, 49);
TANK_WALL_1.addBox(0F, 0F, 0F, 1, 12, 8);
TANK_WALL_1.setRotationPoint(6F, 12F, -4F);
TANK_WALL_1.setTextureSize(128, 128);
TANK_WALL_1.mirror = true;
setRotation(TANK_WALL_1, 0F, 0F, 0F);
TANK_WALL_2 = new ModelRenderer(this, 0, 70);
TANK_WALL_2.addBox(0F, 0F, 0F, 1, 12, 7);
TANK_WALL_2.setRotationPoint(-8F, 12F, -4F);
TANK_WALL_2.setTextureSize(128, 128);
TANK_WALL_2.mirror = true;
setRotation(TANK_WALL_2, 0F, 0F, 0F);
TANK_WALL_3 = new ModelRenderer(this, 0, 34);
TANK_WALL_3.addBox(0F, 0F, 0F, 8, 12, 1);
TANK_WALL_3.setRotationPoint(0F, 12F, 8F);
TANK_WALL_3.setTextureSize(128, 128);
TANK_WALL_3.mirror = true;
setRotation(TANK_WALL_3, 0F, 2.617994F, 0F);
TANK_WALL_4 = new ModelRenderer(this, 0, 34);
TANK_WALL_4.addBox(0F, 0F, 0F, 8, 12, 1);
TANK_WALL_4.setRotationPoint(0F, 12F, -8F);
TANK_WALL_4.setTextureSize(128, 128);
TANK_WALL_4.mirror = true;
setRotation(TANK_WALL_4, 0F, -0.5235988F, 0F);
TANK_SUPPORT_1 = new ModelRenderer(this, 43, 22);
TANK_SUPPORT_1.addBox(-1F, 0F, -8F, 2, 14, 16);
TANK_SUPPORT_1.setRotationPoint(0F, 10F, 0F);
TANK_SUPPORT_1.setTextureSize(128, 128);
TANK_SUPPORT_1.mirror = true;
setRotation(TANK_SUPPORT_1, 0F, 0F, 0F);
TANK_TOP_1 = new ModelRenderer(this, 43, 11);
TANK_TOP_1.addBox(-8F, 0F, -4F, 16, 2, 8);
TANK_TOP_1.setRotationPoint(0F, 10F, 0F);
TANK_TOP_1.setTextureSize(128, 128);
TANK_TOP_1.mirror = true;
setRotation(TANK_TOP_1, 0F, 0F, 0F);
TANK_WALL_5 = new ModelRenderer(this, 0, 34);
TANK_WALL_5.addBox(0F, 0F, 0F, 8, 12, 1);
TANK_WALL_5.setRotationPoint(0F, 12F, -7F);
TANK_WALL_5.setTextureSize(128, 128);
TANK_WALL_5.mirror = true;
setRotation(TANK_WALL_5, 0F, -2.617994F, 0F);
TANK_SUPPORT_2 = new ModelRenderer(this, 0, 0);
TANK_SUPPORT_2.addBox(-1F, 0F, -9F, 2, 14, 18);
TANK_SUPPORT_2.setRotationPoint(0F, 10F, 0F);
TANK_SUPPORT_2.setTextureSize(128, 128);
TANK_SUPPORT_2.mirror = true;
setRotation(TANK_SUPPORT_2, 0F, 1.047198F, 0F);
TANK_SUPPORT_3 = new ModelRenderer(this, 0, 0);
TANK_SUPPORT_3.addBox(-1F, 0F, -9F, 2, 14, 18);
TANK_SUPPORT_3.setRotationPoint(0F, 10F, 0F);
TANK_SUPPORT_3.setTextureSize(128, 128);
TANK_SUPPORT_3.mirror = true;
setRotation(TANK_SUPPORT_3, 0F, -1.047198F, 0F);
TANK_WALL_6 = new ModelRenderer(this, 0, 34);
TANK_WALL_6.addBox(0F, 0F, 0F, 8, 12, 1);
TANK_WALL_6.setRotationPoint(0F, 12F, 7F);
TANK_WALL_6.setTextureSize(128, 128);
TANK_WALL_6.mirror = true;
setRotation(TANK_WALL_6, 0F, 0.5235988F, 0F);
TANK_TOP_2 = new ModelRenderer(this, 43, 0);
TANK_TOP_2.addBox(-6F, 0F, -4F, 12, 2, 8);
TANK_TOP_2.setRotationPoint(0F, 10F, 0F);
TANK_TOP_2.setTextureSize(128, 128);
TANK_TOP_2.mirror = true;
setRotation(TANK_TOP_2, 0F, 1.047198F, 0F);
TANK_TOP_3 = new ModelRenderer(this, 43, 0);
TANK_TOP_3.addBox(-6F, 0F, -4F, 12, 2, 8);
TANK_TOP_3.setRotationPoint(0F, 10F, 0F);
TANK_TOP_3.setTextureSize(128, 128);
TANK_TOP_3.mirror = true;
setRotation(TANK_TOP_3, 0F, -1.047198F, 0F);
TANK_VALVE = new ModelRenderer(this, 84, 0);
TANK_VALVE.addBox(0F, 0F, 0F, 2, 1, 2);
TANK_VALVE.setRotationPoint(-1F, 9F, -1F);
TANK_VALVE.setTextureSize(128, 128);
TANK_VALVE.mirror = true;
setRotation(TANK_VALVE, 0F, 0F, 0F);
}
@Override
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);
generalRender(f5);
}
public void generalRender(float f5)
{
TANK_WALL_1.render(f5);
TANK_WALL_2.render(f5);
TANK_WALL_3.render(f5);
TANK_WALL_4.render(f5);
TANK_SUPPORT_1.render(f5);
TANK_TOP_1.render(f5);
TANK_WALL_5.render(f5);
TANK_SUPPORT_2.render(f5);
TANK_SUPPORT_3.render(f5);
TANK_WALL_6.render(f5);
TANK_TOP_2.render(f5);
TANK_TOP_3.render(f5);
TANK_VALVE.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);
}
}

View file

@ -1,27 +0,0 @@
package net.minecraft.src.eui.boiler;
import org.lwjgl.opengl.GL11;
import net.minecraft.src.*;
public class RenderBoiler extends TileEntitySpecialRenderer
{
int type = 0;
private ModelTank model;
public RenderBoiler()
{
model = new ModelTank();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) {
bindTextureByName("/eui/tankTexture.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
model.generalRender(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -1,15 +0,0 @@
package net.minecraft.src.eui.boiler;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
public class ShareResources {
}

View file

@ -1,60 +0,0 @@
package net.minecraft.src.eui.boiler;
import net.minecraft.src.*;
public class SlotBoiler extends Slot
{
/** The player that is using the GUI where this slot resides. */
private EntityPlayer thePlayer;
private int field_48437_f;
public SlotBoiler(EntityPlayer par1EntityPlayer, IInventory par2IInventory, int par3, int par4, int par5)
{
super(par2IInventory, par3, par4, par5);
this.thePlayer = par1EntityPlayer;
}
/**
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
*/
public boolean isItemValid(ItemStack par1ItemStack)
{
return false;
}
/**
* Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
* stack.
*/
public ItemStack decrStackSize(int par1)
{
if (this.getHasStack())
{
this.field_48437_f += Math.min(par1, this.getStack().stackSize);
}
return super.decrStackSize(par1);
}
/**
* Called when the player picks up an item from an inventory slot
*/
public void onPickupFromSlot(ItemStack par1ItemStack)
{
this.func_48434_c(par1ItemStack);
super.onPickupFromSlot(par1ItemStack);
}
protected void func_48435_a(ItemStack par1ItemStack, int par2)
{
this.field_48437_f += par2;
this.func_48434_c(par1ItemStack);
}
protected void func_48434_c(ItemStack par1ItemStack)
{
par1ItemStack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_48437_f);
this.field_48437_f = 0;
ModLoader.takenFromFurnace(this.thePlayer, par1ItemStack);
}
}

View file

@ -1,512 +0,0 @@
package net.minecraft.src.eui.boiler;
import net.minecraft.src.*;
import net.minecraft.src.eui.BlockMachine;
import net.minecraft.src.eui.TileEntityMachine;
import net.minecraft.src.eui.api.*;
import net.minecraft.src.eui.burner.TileEntityFireBox;
import net.minecraft.src.forge.ForgeHooks;
import net.minecraft.src.forge.ISidedInventory;
import net.minecraft.src.pipes.api.ILiquidConsumer;
import net.minecraft.src.pipes.api.ILiquidProducer;
import net.minecraft.src.universalelectricity.UniversalElectricity;
public class TileEntityBoiler extends TileEntityMachine implements IInventory, ISidedInventory,ILiquidProducer, ILiquidConsumer
{
/**
* The ItemStacks that hold the items currently being used in the furnace
*/
private ItemStack[] furnaceItemStacks = new ItemStack[1];
/** The number of ticks that the boiler will keep burning */
public int RunTime = 0;
/** The ammount of energy stored before being add to run Timer */
public int energyStore = 0;
/** The ammount of water stored */
public int waterStored = 0;
/** The ammount of steam stored */
public int steamStored = 0;
/** The ammount of heat stored */
public int heatStored = 0;
public int heatMax = 10000;
/** The ammount of heat stored */
public int hullHeat = 0;
public int hullHeatMax = 10000;
private int heatTick = 0;
int count = 0;
boolean hullHeated = false;
TileEntity[] connectedBlocks = {null, null, null, null, null, null};
int steamMax = 140;
public boolean isBeingHeated = false;
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return this.furnaceItemStacks.length;
}
/**
* Returns the stack in slot i
*/
public ItemStack getStackInSlot(int par1)
{
return this.furnaceItemStacks[par1];
}
public ItemStack decrStackSize(int par1, int par2)
{
if (this.furnaceItemStacks[par1] != null)
{
ItemStack var3;
if (this.furnaceItemStacks[par1].stackSize <= par2)
{
var3 = this.furnaceItemStacks[par1];
this.furnaceItemStacks[par1] = null;
return var3;
}
else
{
var3 = this.furnaceItemStacks[par1].splitStack(par2);
if (this.furnaceItemStacks[par1].stackSize == 0)
{
this.furnaceItemStacks[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.furnaceItemStacks[par1] != null)
{
ItemStack var2 = this.furnaceItemStacks[par1];
this.furnaceItemStacks[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.furnaceItemStacks[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
par2ItemStack.stackSize = this.getInventoryStackLimit();
}
}
/**
* Returns the name of the inventory.
*/
public String getInvName()
{
return "container.boiler";
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.furnaceItemStacks = 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.furnaceItemStacks.length)
{
this.furnaceItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
this.RunTime = par1NBTTagCompound.getShort("BurnTime");
this.energyStore = par1NBTTagCompound.getInteger("energyStore");
this.steamStored = par1NBTTagCompound.getInteger("steamStore");
this.heatStored = par1NBTTagCompound.getInteger("heatStore");
this.waterStored = par1NBTTagCompound.getInteger("waterStore");
this.hullHeat = par1NBTTagCompound.getInteger("hullHeat");
}
/**
* Writes a tile entity to NBT.
*/
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setShort("BurnTime", (short)this.RunTime);
par1NBTTagCompound.setInteger("energyStore", (int)this.energyStore);
par1NBTTagCompound.setInteger("steamStore", (int)this.steamStored);
par1NBTTagCompound.setInteger("heatStore", (int)this.heatStored);
par1NBTTagCompound.setInteger("waterStore", (int)this.waterStored);
par1NBTTagCompound.setInteger("hullHeat", (int)this.hullHeat);
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < this.furnaceItemStacks.length; ++var3)
{
if (this.furnaceItemStacks[var3] != null)
{
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.furnaceItemStacks[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
par1NBTTagCompound.setTag("Items", var2);
}
/**
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
* this more of a set than a get?*
*/
public int getInventoryStackLimit()
{
return 64;
}
/**
* 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.
*/
private boolean getIsHeated() {
TileEntity blockEntity = worldObj.getBlockTileEntity(this.xCoord, this.yCoord - 1, this.zCoord);
if(blockEntity instanceof TileEntityFireBox)
{
return true;
}
else
{
return false;
}
}
@Override
public void updateEntity(){
count++;
if(count >= 20){
isBeingHeated = getIsHeated();
addWater();//adds water from container slot
shareWater();
count = 0;
}
//changed hullHeat max depending on contents of boiler
if(waterStored > 0)
{
hullHeatMax = 4700;
if(hullHeat > hullHeatMax)
{
hullHeat = 4700;
}
}
else
{
hullHeatMax = 10000;
}
//Checks if the hull is heated
if(hullHeat >= hullHeatMax)
{
hullHeated = true;
}
else
{
hullHeat = Math.min(hullHeat + heatStored, hullHeatMax);
}
//checks if heat level hit max
if(hullHeat >= 10000)
{
if(heatTick >= 1200)
{
// TODO remove block and set fire
heatTick = 0;
}
else
{
heatTick += 1;
}
}
int heatNeeded = mod_EUIndustry.boilerHeat; // kilo joules
//if hull heated do work
if(hullHeated)
{
if(heatStored > mod_EUIndustry.fireOutput)
{
if(waterStored >= 1){
if(heatStored >= heatNeeded)
{
heatStored = Math.max(heatStored - heatNeeded, 0);
--waterStored;
steamStored = Math.min(steamStored + mod_EUIndustry.steamOutBoiler,this.steamMax);
}
}
else
{
heatStored = 0;
}
}
}
TileEntity blockE = worldObj.getBlockTileEntity(xCoord, yCoord -1, zCoord);
if(blockE instanceof TileEntityFireBox)
{
if(!hullHeated || waterStored > 0)
{
heatStored = (int) Math.min((heatStored + ((TileEntityFireBox)blockE).onProduceHeat(mod_EUIndustry.fireOutput, 1)), heatMax);
}
}
}
public void shareWater()
{
int wSum = getStoredLiquid(1); //pre-sets the sum to the first tanks current volume
int tankCount = 1; //amount of tanks around this tank, used to get avarage liquid ammount
boolean bottom = false; // whether or not this tanks need to worry about what is bellow it
TileEntity entityBellow = worldObj.getBlockTileEntity(this.xCoord,this.yCoord-1, this.zCoord);
TileEntity entityAbove = worldObj.getBlockTileEntity(this.xCoord,this.yCoord+1, this.zCoord);
//checks wether or not the block bellow it is a tank to move liquid too
if(entityBellow instanceof TileEntityBoiler)
{
int bWater = ((TileEntityBoiler) entityBellow).getStoredLiquid(1);
int bMax = ((TileEntityBoiler) entityBellow).getLiquidCapacity(1);
//checks if that tank has room to get liquid.
if(bWater < bMax)
{
int emptyVol = Math.max( bMax - bWater,0);
int tradeVol = Math.min(emptyVol, waterStored);
int rejected = ((TileEntityBoiler) entityBellow).onReceiveLiquid(1, tradeVol, (byte) 1);
waterStored = Math.max(waterStored - rejected,0);
wSum -= rejected;
}
else
{
bottom = true;
}
}
else
{
//there was no tank bellow this tank
bottom = true;
}
//if this is the bottom tank or bottom tank is full then trade liquid with tanks around it.
if(bottom)
{
//get average water around center tank
for(int i = 0; i<4;i++)
{
int x = this.xCoord;
int z = this.zCoord;
//switch to check each side TODO rewrite for side values
switch(i)
{
case 0: --x;
case 1: ++x;
case 2: --z;
case 3: ++z;
}
TileEntity entity = worldObj.getBlockTileEntity(x,this.yCoord, z);
if(entity instanceof TileEntityBoiler)
{
//if is a tank add to the sum
wSum += ((TileEntityBoiler) entity).getStoredLiquid(1);
tankCount += 1;
}
}
}
//transfers water
for(int i = 0; i<4;i++)
{
int average = wSum / tankCount;// takes the sum and makes it an average
int x2 = this.xCoord;
int z2 = this.zCoord;
int tradeSum = 0;
//switch to check each side TODO rewrite for side values
switch(i)
{
case 0: --x2;
case 1: ++x2;
case 2: --z2;
case 3: ++z2;
}
TileEntity entity = worldObj.getBlockTileEntity(x2,this.yCoord, z2);
if(entity instanceof TileEntityBoiler)
{
int targetW = ((TileEntityBoiler) entity).getStoredLiquid(1);
if(targetW < average)
{
tradeSum = Math.min(average, waterStored); //gets the ammount to give to the target tank
int rejectedAm = ((TileEntityBoiler) entity).onReceiveLiquid(1, tradeSum, (byte) i); //send that ammount with safty incase some comes back
waterStored =rejectedAm + waterStored - tradeSum; //counts up current water sum after trade
}
}
}
if(entityAbove instanceof TileEntityBoiler)
{
int bWater = ((TileEntityBoiler) entityAbove).getStoredLiquid(1);
int bMax = ((TileEntityBoiler) entityAbove).getLiquidCapacity(1);
if(bottom && waterStored > 0)
{
if(bWater < bMax)
{
int emptyVolS = Math.max( bMax - bWater,0);
int tradeVolS = Math.min(emptyVolS, steamStored);
int rejectedS = ((TileEntityBoiler) entityAbove).addSteam(tradeVolS);
waterStored = Math.max(waterStored - rejectedS,0);
wSum -= rejectedS;
}
}
}
}
public int addSteam(int watt) {
int rejectedElectricity = Math.max((this.steamStored + watt) - steamMax, 0);
this.steamStored += watt - rejectedElectricity;
return rejectedElectricity;
}
private void addWater() {
if (this.furnaceItemStacks[0] != null)
{
if(this.furnaceItemStacks[0].isItemEqual(new ItemStack(Item.bucketWater,1)))
{
if((int)waterStored < getLiquidCapacity(1))
{
++waterStored;
this.furnaceItemStacks[0] = new ItemStack(Item.bucketEmpty,1);
this.onInventoryChanged();
}
}
}
}
/**
* Do not make give this method the name canInteractWith because it clashes with Container
*/
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;
}
public void openChest() {}
public void closeChest() {}
@Override
public int getStartInventorySide(int side)
{
return 0;
}
@Override
public int getSizeInventorySide(int side)
{
return 1;
}
public int precentHeated() {
int var1;
if(hullHeat < 100)
{
var1 = (int)(100 *(hullHeat/100));
}
else
{
var1 = 100;
}
return var1;
}
@Override
public int onReceiveLiquid(int type, int vol, byte side) {
if(type == 1)
{
int rejectedElectricity = Math.max((this.waterStored + vol) - this.getLiquidCapacity(1), 0);
this.waterStored += vol - rejectedElectricity;
return rejectedElectricity;
}
return vol;
}
@Override
public boolean canRecieveLiquid(int type, byte side) {
if(type == 1)
{
return true;
}
return false;
}
@Override
public int getStoredLiquid(int type) {
if(type == 1)
{
return this.waterStored;
}
if(type == 0)
{
return this.steamStored;
}
return 0;
}
@Override
public int getLiquidCapacity(int type) {
if(type ==1)
{
return 14;
}
if(type == 0)
{
return steamMax;
}
return 0;
}
@Override
public int onProduceLiquid(int type, int maxVol, int side) {
if(type == 0)
{
if(steamStored > 1)
{
this.steamStored -= 1;
return 1;
}
}
return 0;
}
@Override
public boolean canProduceLiquid(int type, byte side) {
if(type == 0)
{
return true;
}
return false;
}
}

View file

@ -1,42 +0,0 @@
package net.minecraft.src.eui.burner;
import net.minecraft.src.*;
public class ContainerFireBox extends Container
{
private TileEntityFireBox tileEntity;
public ContainerFireBox(InventoryPlayer par1InventoryPlayer, TileEntityFireBox tileEntity)
{
this.tileEntity = tileEntity;
this.addSlot(new Slot(tileEntity, 0, 33, 34));
int var3;
for (var3 = 0; var3 < 3; ++var3)
{
for (int var4 = 0; var4 < 9; ++var4)
{
this.addSlot(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
}
}
for (var3 = 0; var3 < 9; ++var3)
{
this.addSlot(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142));
}
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.tileEntity.isUseableByPlayer(par1EntityPlayer);
}
/**
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
*/
public ItemStack transferStackInSlot(int par1)
{
return null;
}
}

View file

@ -1,82 +0,0 @@
// Date: 8/14/2012 3:02:31 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package net.minecraft.src.eui.burner;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class FurnaceModel extends ModelBase
{
//fields
ModelRenderer Body;
ModelRenderer top;
ModelRenderer bottom;
ModelRenderer Shape1;
public FurnaceModel()
{
textureWidth = 256;
textureHeight = 256;
Body = new ModelRenderer(this, 0, 0);
Body.addBox(-8F, -8F, -8F, 14, 14, 12);
Body.setRotationPoint(1F, 18F, 1F);
Body.setTextureSize(256, 256);
Body.mirror = true;
setRotation(Body, 0F, 0F, 0F);
top = new ModelRenderer(this, 80, 20);
top.addBox(-8F, 0F, -8F, 16, 2, 16);
top.setRotationPoint(0F, 8F, 0F);
top.setTextureSize(256, 256);
top.mirror = true;
setRotation(top, 0F, 0F, 0F);
bottom = new ModelRenderer(this, 80, 0);
bottom.addBox(-8F, 22F, -8F, 16, 2, 16);
bottom.setRotationPoint(0F, 0F, 0F);
bottom.setTextureSize(256, 256);
bottom.mirror = true;
setRotation(bottom, 0F, 0F, 0F);
Shape1 = new ModelRenderer(this, 0, 0);
Shape1.addBox(-4F, -4F, 0F, 10, 8, 1);
Shape1.setRotationPoint(-1F, 16F, 5F);
Shape1.setTextureSize(256, 256);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
}
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);
genRender(f5);
}
public void genRender(float f5)
{
Body.render(f5);
top.render(f5);
bottom.render(f5);
Shape1.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);
}
}

View file

@ -1,87 +0,0 @@
package net.minecraft.src.eui.burner;
import org.lwjgl.opengl.GL11;
import java.math.*;
import java.text.DecimalFormat;
import java.lang.Integer;
import net.minecraft.src.*;
import net.minecraft.src.universalelectricity.UniversalElectricity;
public class GUIFireBox extends GuiContainer
{
private TileEntityFireBox tileEntity;
private int containerWidth;
private int containerHeight;
public GUIFireBox(InventoryPlayer par1InventoryPlayer, TileEntityFireBox tileEntity)
{
super(new ContainerFireBox(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer()
{
this.fontRenderer.drawString("FireBox", 55, 6, 4210752);
this.fontRenderer.drawString("HeatOut", 90, 33, 4210752);
String displayText = "";
if(!tileEntity.isConnected)
{
displayText = "No Boiler";
}
else if(tileEntity.containingItems[0] != null)
{
if(tileEntity.containingItems[0].getItem().shiftedIndex != Item.coal.shiftedIndex)
{
displayText = "No Coal";
}
else{
if(tileEntity.generateRate*20 < 20)
{
displayText = "Hull Heat: "+(tileEntity.generateRate*100)+"%";
}
else
{
displayText = getWattDisplay((tileEntity.generateRate*20));
}
}
}
this.fontRenderer.drawString(displayText, (int)(105-displayText.length()*1.25), 45, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int var4 = this.mc.renderEngine.getTexture("/eui/SteamGUI.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(var4);
containerWidth = (this.width - this.xSize) / 2;
containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
}
public static String getWattDisplay(int watts)
{
String displayWatt;
if(watts > 1000)
{
displayWatt = roundTwoDecimals((double)watts/1000)+" MJ";
}
else
{
displayWatt = watts+" KJ";
}
return displayWatt;
}
public static double roundTwoDecimals(double d)
{
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(d));
}
}

View file

@ -1,27 +0,0 @@
package net.minecraft.src.eui.burner;
import org.lwjgl.opengl.GL11;
import net.minecraft.src.*;
public class RenderFurnace extends TileEntitySpecialRenderer
{
int type = 0;
private FurnaceModel model;
public RenderFurnace()
{
model = new FurnaceModel();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) {
bindTextureByName("/eui/Furnace.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
model.genRender(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -1,265 +0,0 @@
package net.minecraft.src.eui.burner;
import net.minecraft.src.eui.TileEntityMachine;
import net.minecraft.src.eui.api.IHeatProducer;
import net.minecraft.src.eui.boiler.TileEntityBoiler;
import net.minecraft.src.forge.ForgeHooks;
import net.minecraft.src.*;
import net.minecraft.src.universalelectricity.*;
import net.minecraft.src.forge.ISidedInventory;
public class TileEntityFireBox extends TileEntityMachine implements IInventory, ISidedInventory, IHeatProducer
{
//max heat generated per second
private int connectedUnits = 0;
public static int maxGenerateRate = 0;
//Current generation rate based on hull heat. In TICKS.
public int generateRate = 0;
public boolean isConnected = false;
public TileEntity[] connectedBlocks = {null, null, null, null, null, null};
int count = 0;
public int itemCookTime = 0;
public ItemStack[] containingItems = new ItemStack[1];
public void updateEntity()
{if (!this.worldObj.isRemote){
if(count == 20)
{
addConnection();
sharCoal();
count = 0;
}
count++;
maxGenerateRate = mod_EUIndustry.fireOutput + (connectedUnits*5);
TileEntity blockEntity = worldObj.getBlockTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
if(blockEntity instanceof TileEntityBoiler)
{
isConnected = true;
}
else
{
isConnected = false;
}
//The top slot is for recharging items. Check if the item is a electric item. If so, recharge it.
if (this.containingItems[0] != null && isConnected)
{
if (this.containingItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex)
{
if(this.itemCookTime <= 0)
{
itemCookTime = Math.max(1600 - (int)(this.generateRate*20), 400);
this.decrStackSize(0, 1);
}
}
}
}
//Starts generating electricity if the device is heated up
if (this.itemCookTime > 0)
{
this.itemCookTime --;
if(isConnected)
{
this.generateRate = Math.min(this.generateRate+Math.min((this.generateRate)+1, 1), this.maxGenerateRate/20);
}
}
//Loose heat when the generator is not connected or if there is no coal in the inventory.
if(this.itemCookTime <= 0 || !isConnected)
{
this.generateRate = Math.max(this.generateRate-5, 0);
}
}
//gets all connected fireBoxes and shares its supply of coal
public void sharCoal(){
for(int i =0; i<6;i++)
{
if(connectedBlocks[i] instanceof TileEntityFireBox)
{
TileEntityFireBox connectedConsumer = (TileEntityFireBox) connectedBlocks[i];
if(this.containingItems[0] != null)
{
if(this.containingItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex && this.containingItems[0].stackSize > 0)
{
if(connectedConsumer.containingItems[0] != null)
{
if(connectedConsumer.containingItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex)
{
if(connectedConsumer.containingItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex)
{
int CSum = Math.round(this.containingItems[0].stackSize + connectedConsumer.containingItems[0].stackSize)/2;
if(this.containingItems[0].stackSize > connectedConsumer.containingItems[0].stackSize)
{
int transferC = 0;
transferC = Math.round(CSum - connectedConsumer.containingItems[0].stackSize);
connectedConsumer.containingItems[0].stackSize = connectedConsumer.containingItems[0].stackSize + transferC;
this.containingItems[0].stackSize = this.containingItems[0].stackSize - transferC;
}
}
}
}
else
{
connectedConsumer.containingItems[0] = new ItemStack(this.containingItems[0].getItem());
this.containingItems[0].stackSize -= 1;
}
}
}
}
}
}
public void addConnection()
{
connectedUnits = 0;
for(int i = 0; i<6; i++)
{
TileEntity aEntity = getSteamMachine(i);
if(aEntity instanceof TileEntityFireBox && i != 0 && i != 1)
{
this.connectedBlocks[i] = aEntity;
connectedUnits += 1;
}
else
{
this.connectedBlocks[i] = null;
}
}
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.itemCookTime = par1NBTTagCompound.getInteger("itemCookTime");
this.generateRate = par1NBTTagCompound.getInteger("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.itemCookTime);
par1NBTTagCompound.setInteger("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(int side)
{
if (side == 0)
{
return 1;
}
if (side == 1)
{
return 0;
}
return 2;
}
@Override
public int getSizeInventorySide(int side) { return getSizeInventory(); }
@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;
}
}
@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 "FireBox";
}
@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 float onProduceHeat(float jouls, int side) {
// TODO Auto-generated method stub
return Math.min(generateRate,jouls);
}
}

View file

@ -1,62 +0,0 @@
package net.minecraft.src.eui.robotics;
import java.util.List;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.eui.TileEntityNuller;
import net.minecraft.src.eui.boiler.TileEntityBoiler;
import net.minecraft.src.eui.burner.TileEntityFireBox;
import net.minecraft.src.eui.turbine.TileEntityGenerator;
import net.minecraft.src.universalelectricity.Vector3;
import net.minecraft.src.universalelectricity.extend.*;
public class BlockComp extends BlockMachine {
public BlockComp(int par1) {
super("RobotMachine", par1, Material.iron);
// TODO Auto-generated constructor stub
}
public int getBlockTexture(IBlockAccess par1iBlockAccess, int x, int y, int z, int side)
{
return 0;
}
public int getBlockTextureFromSideAndMetadata(int side, int metadata)
{
return 0;
}
@Override
public TileEntity getBlockEntity() {
// TODO Auto-generated method stub
return null;
}
@Override
public TileEntity getBlockEntity(int meta)
{
switch(meta)
{
case 0: return new TileEntityComp();
case 1: return new TileEntityComp();
case 2: return new TileEntityComp();
case 3: return new TileEntityComp();
}
return null;
}
@Override
public String getTextureFile() {
// TODO Auto-generated method stub
return "/eui/blocks.png";
}
@Override
public boolean isOpaqueCube()
{
return false;
}
public int getRenderType()
{
return 0;
}
}

View file

@ -1,5 +0,0 @@
package net.minecraft.src.eui.robotics;
public class BlockRail {
}

View file

@ -1,12 +0,0 @@
package net.minecraft.src.eui.robotics;
import net.minecraft.src.World;
public class EntityDigger extends EntityRobot {
public EntityDigger(World par1World) {
super(par1World);
// TODO Auto-generated constructor stub
}
}

View file

@ -1,314 +0,0 @@
package net.minecraft.src.eui.robotics;
import java.util.List;
import net.minecraft.src.*;
import net.minecraft.src.universalelectricity.Vector3;
public class EntityRobot extends EntityCreature {
public int attackStrength = 0;
public int battery = 0; //how long this but will run in, 2 = 20ticks
public int disabled = 0; //disabled timer
public int updateCount = 0; //used to control how fast the bot calls its updates
public boolean isDisabled = false;//is not updating
public boolean hasTask = false; //has a working task
public Vector3 taskLocation = null; //task location usual a block or item
int[] taskLoc = {0,0,0};
public String currentTask = "none"; //type of task this bot can perform
public boolean isLinked = false; // is linked to a controller
public int[] linkFrq = {0,0,0}; //not so much a link number but controller location
public EntityRobot(World par1World) {
super(par1World);
}
@Override
public void onEntityUpdate()
{
super.onEntityUpdate();
if(!worldObj.isRemote)
{
updateCount++;
//used for emping of bot or empty battery
isDisabled = true;
if(disabled <=0)
{
isDisabled = false;
}
if(!isDisabled && updateCount >= 10)
{
updateCount =0;
battery += 2; //TODO remove after testing
--battery;
botUpdate();
}
}
}
//update function to control how fast the bot updates to reduce load
public void botUpdate()
{
if(taskLocation != null)
{
taskLoc[0] = taskLocation.intX();
taskLoc[1] = taskLocation.intY();
taskLoc[2] = taskLocation.intZ();
}
//links the bot to a controler if it is not already linked
if(!isLinked)
{
this.setDead();
/**
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("linking To Controler");
TileEntityComp targetComp = this.getEmptyControler(this.posX,this.posY,this.posZ, 50);
if(targetComp != null){
boolean added = targetComp.addBot(this);
if(added)
{
isLinked = true;
linkFrq[0] = targetComp.xCoord;
linkFrq[1] = targetComp.yCoord;
linkFrq[2] = targetComp.zCoord;
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("linked To Controler");
}
}
**/
}
else
{
//TODO add logic too tell controler this bot is alive, current task, hp, location,etc....
TileEntity comp = worldObj.getBlockTileEntity(this.linkFrq[0], this.linkFrq[1], this.linkFrq[2]);
if(comp instanceof TileEntityComp)
{
Boolean linked = ((TileEntityComp) comp).addBot(this);
if(!linked)
{
this.isLinked = false;
}
}
else
{
this.isLinked = true;
}
}
}
/**
* used to find the closest controller
* @param par1 - x
* @param par3 - y
* @param par5 - z
* @param par7 - range in blocks
* @return the nearest controller
*/
public TileEntityComp getClosestControler(double par1, double par3, double par5, double par7)
{
double var9 = -1.0D;
TileEntityComp var11 = null;
List itemList = worldObj.getEntitiesWithinAABB(TileEntityComp.class, this.boundingBox.expand(par7, 4.0D, par7));
for (int var12 = 0; var12 < itemList.size(); ++var12)
{
TileEntityComp var13 = (TileEntityComp)itemList.get(var12);
double var14 = var13.getDistanceFrom(par1, par3, par5);
if ((par7 < 0.0D || var14 < par7 * par7) && (var9 == -1.0D || var14 < var9))
{
var9 = var14;
var11 = var13;
}
}
return var11;
}
/**
* used to find the closest controller with an empty slot mainly used to find and add a robot to the controller
* @param par1 - x
* @param par3 - y
* @param par5 - z
* @param par7 - range in blocks
* @return the nearest controller block with an empty control slot
*/
public TileEntityComp getEmptyControler(double par1, double par3, double par5, double par7)
{
double var9 = -1.0D;
TileEntityComp var11 = null;
List itemList = worldObj.getEntitiesWithinAABB(TileEntityComp.class, this.boundingBox.expand(par7, 4.0D, par7));
for (int var12 = 0; var12 < itemList.size(); ++var12)
{
TileEntityComp var13 = (TileEntityComp)itemList.get(var12);
double var14 = var13.getDistanceFrom(par1, par3, par5);
if ((par7 < 0.0D || var14 < par7 * par7) && (var9 == -1.0D || var14 < var9))
{
for(int c = 0; c < 4; c++)
{
if(var13.BotList[c]==null)
{
var11 = var13;
}
}
var9 = var14;
}
}
return var11;
}
public boolean isAIEnabled()
{
return false;
}
protected boolean canDespawn()
{
return false;
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("batt", this.battery);
par1NBTTagCompound.setIntArray("linkFrq", this.linkFrq);
par1NBTTagCompound.setBoolean("linked", isLinked);
par1NBTTagCompound.setBoolean("hasTask", hasTask);
par1NBTTagCompound.setIntArray("taskLoc", taskLoc);
}
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
this.battery = par1NBTTagCompound.getInteger("batt");
this.linkFrq = par1NBTTagCompound.getIntArray("linkFrq");
this.isLinked = par1NBTTagCompound.getBoolean("linked");
this.hasTask = par1NBTTagCompound.getBoolean("hasTask");
taskLoc = par1NBTTagCompound.getIntArray("taskLoc");
this.taskLocation = new Vector3(taskLoc[0],taskLoc[1],taskLoc[2]);
}
@Override
public int getMaxHealth() {
return 1;
}
public String getTaskType() {
return "n/a";
}
public boolean isIdle() {
// TODO Auto-generated method stub
return !hasTask;
}
public boolean setWorkTask(Vector3 taskLoc, String task) {
int x = taskLoc.intX();
int y = taskLoc.intY();
int z = taskLoc.intZ();
Vector3 thisBot = new Vector3(this.posX,this.posY,this.posZ);
PathEntity PathToItem = this.worldObj.getEntityPathToXYZ(this, x, y, z, 30, true, false, false, true);
if(PathToItem != null){
if(task.toLowerCase() == this.getTaskType().toLowerCase())
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("TaskSet");
this.taskLocation = taskLoc;
this.currentTask = task;
hasTask = true;
return true;
}
}
return false;
}
public boolean harvest(Vector3 BlockLoc)
{
int x = BlockLoc.intX();
int y = BlockLoc.intY();
int z = BlockLoc.intZ();
Vector3 thisBot = new Vector3(this.posX,this.posY,this.posZ);
PathEntity PathToItem = this.worldObj.getEntityPathToXYZ(this, x, y, z, 30, true, false, false, true);
if(PathToItem != null){
this.setPathToEntity(PathToItem);
this.moveSpeed = 1.0F;
if(thisBot.distanceTo(BlockLoc) < 4)
{
int blockTargetc = worldObj.getBlockId(x, y, z);
boolean harvested = worldObj.setBlock(x, y, z, 0);
if(blockTargetc ==0)
{
harvested = true;
}
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Harvesting Block "+blockTargetc);
if(blockTargetc > 0 && harvested)
{
EntityItem dropedItem = new EntityItem(worldObj, x, y - 0.3D, z, new ItemStack(blockTargetc,1,1));
worldObj.spawnEntityInWorld(dropedItem);
if(getController() != null)
{
getController().ClearFromList(BlockLoc);
}
}
return harvested;
}
}
return false;
}
public TileEntityComp getController()
{
TileEntity comp = worldObj.getBlockTileEntity(this.linkFrq[0], this.linkFrq[1], this.linkFrq[2]);
if(comp instanceof TileEntityComp)
{
return (TileEntityComp) comp;
}
return null;
}
public EntityItem findClosestItem(double par1, double par3, double par5, double par7)
{
double var9 = -1.0D;
EntityItem var11 = null;
List itemList = worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(par7, 4.0D, par7));
for (int var12 = 0; var12 < itemList.size(); ++var12)
{
EntityItem var13 = (EntityItem)itemList.get(var12);
double var14 = var13.getDistanceSq(par1, par3, par5);
if ((par7 < 0.0D || var14 < par7 * par7) && (var9 == -1.0D || var14 < var9))
{
var9 = var14;
var11 = var13;
}
}
return var11;
}
public boolean collectItem(EntityItem targetItem)
{
if(targetItem == null)
{
targetItem = findClosestItem(this.posX, this.posY, this.posZ,30);
}
else
{
if(!targetItem.isEntityAlive())
{
targetItem = null;
}
}
if(targetItem != null)
{
PathEntity PathToItem = this.worldObj.getPathEntityToEntity(this, targetItem, 30, true, false, false, true);
if(hasPath()){
this.setPathToEntity(PathToItem);
this.moveSpeed = 1.0F;
if(targetItem.getDistanceSq(this.posX,this.posY,this.posZ) < 2)
{
targetItem.setDead();
//TODO add item to inventory
targetItem = null;
}
}
else
{
this.moveSpeed = 0.23F;
}
}
return false;
}
public void clearTask() {
this.taskLocation = null;
this.currentTask = "none";
this.hasTask = false;
}
}

View file

@ -1,60 +0,0 @@
package net.minecraft.src.eui.robotics;
import java.util.List;
import net.minecraft.src.*;
import net.minecraft.src.universalelectricity.Vector3;
public class EntityShoeBot extends EntityRobot {
EntityItem targetItem = null;
public EntityShoeBot(World par1World) {
super(par1World);
this.setSize(0.6F, 0.5F);
this.moveSpeed = 0.23F;
this.texture = "/mobs/char.png";
}
@Override
public void botUpdate()
{
super.botUpdate();
EntityPlayer person = Modloader.getMinecraftInstance().thePlayer;
person.addChatMessage("CC");
if(hasTask)
{
person.addChatMessage("resuming task");
if(this.currentTask == this.getTaskType() && this.taskLocation != null)
{
boolean harDone = harvest(this.taskLocation);
if(harDone)
{
clearTask();
}
}
else
{
clearTask();
}
}
else
{
//requestTask
}
}
@Override
public int getMaxHealth() {
// TODO Auto-generated method stub
return 5;
}
public String getRenderedName() {
// TODO Auto-generated method stub
return "Harvester Bot";
}
public String getTaskType() {
return "harvest";
}
}

View file

@ -1,12 +0,0 @@
package net.minecraft.src.eui.robotics;
import net.minecraft.src.World;
public class Entitycollector extends EntityRobot {
public Entitycollector(World par1World) {
super(par1World);
// TODO Auto-generated constructor stub
}
}

View file

@ -1,24 +0,0 @@
package net.minecraft.src.eui.robotics;
import java.util.ArrayList;
import net.minecraft.src.*;
public class ItemMachine extends ItemBlock {
public ItemMachine(int id) {
super(id);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public int getMetadata(int metadata)
{
return metadata;
}
@Override
public String getItemName()
{
return "Machine";
}
}

View file

@ -1,58 +0,0 @@
package net.minecraft.src.eui.robotics;
import java.util.ArrayList;
import net.minecraft.src.*;
public class ItemSpawn extends Item
{
public ItemSpawn (int id)
{
super(id);
maxStackSize = 1;
setMaxDamage(0);
setHasSubtypes(true);
}
public void addCreativeItems(ArrayList itemList)
{
itemList.add(new ItemStack(this, 1,1));
}
public String getItemNameIS(ItemStack itemstack) {
switch(itemstack.getItemDamage())
{
case 1: return "Bot";
}
return "Blank";
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
if(!world.isRemote)
{
i += Facing.offsetsXForSide[l];
j += Facing.offsetsYForSide[l];
k += Facing.offsetsZForSide[l];
EntityShoeBot Guard = new EntityShoeBot(world);
Guard.setLocationAndAngles((double)i + 0.5D, (double)j + 1.0D, (double)k + 0.5D, 0.0F, 0.0F);
world.spawnEntityInWorld(Guard);
entityplayer.swingItem();
--itemstack.stackSize;
}
return true;
}
}

View file

@ -1,45 +0,0 @@
package net.minecraft.src.eui.robotics;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
//Model code generated by MCModeller. All animation, AI,
//and special features are yours to program. Also keep in
//mind that some of these class names may have changed since
//wrote this. Make sure to check for compatibility with the
//latest version of the Minecraft Coder Pack before attempting
//to use this code.
import net.minecraft.src.ModelRenderer;
public class ModelModelShoeBot extends ModelBase
{
public ModelRenderer body;
public ModelRenderer Head;
public ModelModelShoeBot()
{
body = new ModelRenderer(this,0, 0);
body.addBox(-4.0F, -2.0F, -4.0F, 8, 4, 8, 0);
Head = new ModelRenderer(this,0, 0);
Head.addBox(-2.0F, -2.0F, -2.0F, 4, 4, 4, 0);
}
@Override
public void render(Entity par1Entity, float f, float f1, float f2, float f3, float f4, float f5)
{
this.setRotationAngles(f, f1, f2, f3, f4, f5);
body.render(f5);
Head.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);
}
}

View file

@ -1,101 +0,0 @@
package net.minecraft.src.eui.robotics;
import static net.minecraft.src.forge.IItemRenderer.ItemRenderType.EQUIPPED;
import static net.minecraft.src.forge.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Block;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityBlaze;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EntityPlayerSP;
import net.minecraft.src.EnumAction;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModelBiped;
import net.minecraft.src.ModelBlaze;
import net.minecraft.src.ModelGhast;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.RenderLiving;
import net.minecraft.src.Tessellator;
import net.minecraft.src.forge.IItemRenderer;
import net.minecraft.src.forge.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
public class RenderShoeBot extends RenderLiving
{
public RenderShoeBot()
{
super(new ModelModelShoeBot(), 0.5F);
}
protected void renderName(EntityShoeBot par1EntityGuard, double par2, double par4, double par6)
{
if (Minecraft.isGuiEnabled())
{
float var8 = 1.6F;
float var9 = 0.016666668F * var8;
float var10 = par1EntityGuard.getDistanceToEntity(this.renderManager.livingPlayer);
float var11 = par1EntityGuard.isSneaking() ? 4.0F : 32.0F;
if (var10 < var11)
{
String var12 = par1EntityGuard.getRenderedName();
FontRenderer var13 = this.getFontRendererFromRenderManager();
GL11.glPushMatrix();
GL11.glTranslatef((float)par2 + 0.0F, (float)par4 + 2.3F, (float)par6);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GL11.glScalef(-var9, -var9, var9);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glTranslatef(0.0F, 0.25F / var9, 0.0F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Tessellator var14 = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
var14.startDrawingQuads();
int var15 = var13.getStringWidth(var12) / 2;
var14.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
var14.addVertex((double)(-var15 - 1), -1.0D, 0.0D);
var14.addVertex((double)(-var15 - 1), 8.0D, 0.0D);
var14.addVertex((double)(var15 + 1), 8.0D, 0.0D);
var14.addVertex((double)(var15 + 1), -1.0D, 0.0D);
var14.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(true);
var13.drawString(var12, -var13.getStringWidth(var12) / 2, 0, 553648127);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
}
}
}
public void renderBot(EntityShoeBot par1Entity, double par2, double par4, double par6, float par8, float par9)
{
double var13 = par4 - (double)par1Entity.yOffset - 1.2;
super.doRenderLiving(par1Entity, par2, var13, par6, par8, par9);
}
@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderBot((EntityShoeBot)par1Entity, par2, par4, par6, par8, par9);
}
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
this.renderBot((EntityShoeBot)par1EntityLiving, par2, par4, par6, par8, par9);
}
@Override
protected void passSpecialRender(EntityLiving par1EntityLiving, double par2, double par4, double par6)
{
this.renderName((EntityShoeBot)par1EntityLiving, par2, par4, par6);
}
}

View file

@ -1,302 +0,0 @@
package net.minecraft.src.eui.robotics;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.Block;
import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.ModLoader;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList;
import net.minecraft.src.TileEntity;
import net.minecraft.src.universalelectricity.Vector3;
import net.minecraft.src.universalelectricity.electricity.TileEntityElectricUnit;
public class TileEntityComp extends TileEntityElectricUnit {
public EntityRobot[] BotList = {null,null,null,null};
int updateCount = 0;
int scanCount = 0;
boolean hasScanned = false;
int lastScanXDif=0;
int lastScanYDif=0;
int lastScanZDif=0;
Vector3[] harvestList={null,null,null,null,null,null,null,null,null,null};
public void onUpdate(float watts, float voltage, byte side)
{
if(!worldObj.isRemote)
{
++updateCount;
cleanList();
for(int b =0;b<4;b++)
{
if(BotList[b] ==null)
{
//spawn bot for testing
EntityShoeBot bot = new EntityShoeBot(worldObj);
bot.setLocationAndAngles(this.xCoord, this.yCoord+1, this.zCoord, 10, 10);
bot.linkFrq[0]=this.xCoord;
bot.linkFrq[1]=this.yCoord;
bot.linkFrq[2]=this.zCoord;
bot.isLinked = true;
worldObj.spawnEntityInWorld(bot);
BotList[b]=bot;
}
}
if(updateCount >= 50 && worldObj.checkChunksExist(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1))
{
++scanCount;
if(scanCount < 10){hasScanned = true;}else{scanCount = 0;hasScanned=false;}
Vector3 thisBlock = new Vector3(this.xCoord,this.yCoord,this.zCoord);
updateCount = 0;
Vector3 targetVec = findBlock(thisBlock,Block.leaves,20,hasScanned);
if(targetVec == null)
{
targetVec = findBlock(thisBlock,Block.wood,20,hasScanned);
}
if(targetVec != null)
{
int Targetx = targetVec.intX();
int Targety = targetVec.intY();
int Targetz = targetVec.intZ();
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("rb:"+Targetx+"X:"+Targety+"Y:"+Targetz+"Z");
int blockTargetc = worldObj.getBlockId(Targetx, Targety, Targetz);
boolean taskreceived = sendTask(targetVec,"harvest");
if(taskreceived)
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Harvest Task sent to robot");
}
else
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Task not sent");
}
}
else
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("N/A");//nothing found from scan
scanCount = 0;
}
}
}
}
/**
*
* @param taskLoc - location of the task
* @param task - what is the task harvest, replace, mine, build
* @param bot - bot being given the task
* @return whether or not the task was received
*/
public boolean sendTask(Vector3 taskLoc,String task)
{
for(int i = 0;i < BotList.length;i++)
{
if(BotList[i] instanceof EntityRobot)
{
String botTaskMain = BotList[i].getTaskType();
if(botTaskMain.toLowerCase() == task.toLowerCase())
{
if(BotList[i].isIdle())
{
return BotList[i].setWorkTask(taskLoc,task);
}
}
}
}
return false;
}
/**
*
* @param startSpot - center of the scan radius
* @param block - block being looked for
* @param range - block count from center to scan
* @param resume - whether or not to resume scan from returned block
* @return location vector3 of the block equaling scan args
*/
public Vector3 findBlock(Vector3 startSpot,Block block,int range,boolean resume)
{
int Startx = startSpot.intX();
int Starty = startSpot.intY();
int Startz = startSpot.intZ();
int distanceX = (range * 2) + 1;
int distanceZ = (range * 2) + 1;
int distanceY = (range * 2) + 1;
Boolean negX = Startx < 0;
Boolean negZ = Startz < 0;
int xChange = -1;
int zChange = -1;
int yChange = -1;
Startx += range;
Startz += range;
Starty += range;
int pauseCount = 0;
//ModLoader.getMinecraftInstance().thePlayer.addChatMessage("starting Scan For " + block.getBlockName());
int y = Starty;
for(int iY=0;iY < (distanceY*2);iY++)
{
pauseCount++;
if(pauseCount >= 2)
{
int x = Startx;
int z = Startz;
for(int iX=0;iX < distanceY;iX++)
{
for(int iZ=0;iZ < distanceZ;iZ++)
{
int blockTargetID = worldObj.getBlockId(x, y, z);
//System.out.println("BlockAt:"+x+"x:"+y+"y:"+z+"z:"+blockTargetID+"ID");
if(blockTargetID == block.blockID)
{
Vector3 targetBlock = new Vector3(x,y,z);
if(!onHarvestList(targetBlock))
{
//ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Target Block Found");
boolean taskAdded = addHarvest(targetBlock);
if(taskAdded)
{
return targetBlock;
}
}
}
z += zChange;
}
x += xChange;
z = Startz;
}
pauseCount =0;
y += yChange;
}
}
return null;
}
private boolean addHarvest(Vector3 targetBlock) {
for(int i = 0;i < 10;i++)
{
if(harvestList[i] != targetBlock)
{
harvestList[i]=targetBlock;
return true;
}
}
return false;
}
private boolean onHarvestList(Vector3 targetBlock) {
for(int i = 0;i < 10;i++)
{
if(harvestList[i] == targetBlock)
{
return true;
}
}
return false;
}
public boolean ClearFromList(Vector3 targetBlock) {
for(int i = 0;i < 10;i++)
{
if(harvestList[i] == targetBlock)
{
harvestList[i] = null;
return true;
}
}
return false;
}
public EntityRobot[] getControlList()
{
return BotList;
}
public boolean addBot(EntityRobot bot)
{
for(int i = 0; i < 4; i++)
{
if(BotList[i] == bot)
{
return true;
}
}
for(int i = 0; i < 4; i++)
{
if(BotList[i] == null)
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Bot Added");
BotList[i] = bot;
return true;
}
}
return false;
}
/**will be used to update the bot list on restart or reload of the world.
This way entity ids that are not bots are not stored in the list.
Generally the bots themselves will send the controller there ids when they load
into the world. The controller will then tell the bot its linked to the controller.
**/
public void cleanList()
{
for(int i = 0;i<4;i++)
{
if(BotList[i] instanceof EntityRobot)
{
EntityRobot Bot = BotList[i];
Vector3 thisLoc = new Vector3(this.xCoord,this.yCoord,this.zCoord);
Vector3 botFrq = new Vector3(Bot.linkFrq[0],Bot.linkFrq[1],Bot.linkFrq[2]);
if(!botFrq.isEqual(thisLoc))
{
BotList[i] = null;
}
}
else
{
BotList[i] = null;
}
}
}
@Override
public float electricityRequest() {
// TODO Auto-generated method stub
return 0;
}
@Override
public boolean canReceiveFromSide(byte side) {
// TODO Auto-generated method stub
return true;
}
public boolean canUpdate()
{
return true;
}
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
}
/**
* Writes a tile entity to NBT.
*/
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
}
}

View file

@ -1,41 +0,0 @@
package net.minecraft.src.eui.turbine;
import net.minecraft.src.*;
public class ContainerGenerator extends Container
{
private TileEntityGenerator tileEntity;
public ContainerGenerator(InventoryPlayer par1InventoryPlayer, TileEntityGenerator tileEntity)
{
this.tileEntity = tileEntity;
this.addSlot(new Slot(tileEntity, 0, 33, 34));
int var3;
for (var3 = 0; var3 < 3; ++var3)
{
for (int var4 = 0; var4 < 9; ++var4)
{
this.addSlot(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
}
}
for (var3 = 0; var3 < 9; ++var3)
{
this.addSlot(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142));
}
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.tileEntity.isUseableByPlayer(par1EntityPlayer);
}
/**
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
*/
public ItemStack transferStackInSlot(int par1)
{
return null;
}
}

View file

@ -1,242 +0,0 @@
// Date: 8/14/2012 3:20:15 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package net.minecraft.src.eui.turbine;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class EngineSmallModel extends ModelBase
{
//fields
ModelRenderer BASE;
ModelRenderer PISTON_WALL_1;
ModelRenderer PISTON_HEAD_MOVES;
ModelRenderer PISTON_TURNER_MOVES;
ModelRenderer PISTON_ARM_MOVES;
ModelRenderer GEAR_A_NECK;
ModelRenderer PISTON_WALL_2;
ModelRenderer PISTON_WALL_3;
ModelRenderer PISTON_WALL_4;
ModelRenderer PISTON_SUPPORT_1;
ModelRenderer PISTON_SUPPORT_2;
ModelRenderer FORCE_CONDUCTOR_BOX;
ModelRenderer GEAR_A_TEETH_1_ROTATES;
ModelRenderer GEAR_A_TEETH_2_ROTATES;
ModelRenderer GEAR_A_TEETH_3_ROTATES;
ModelRenderer FORCE_TRANSMITTER_ROTATES;
ModelRenderer GEAR_B_TEETH_1_ROTATES;
ModelRenderer GEAR_B_TEETH_2_ROTATES;
ModelRenderer GEAR_B_TEETH_3_ROTATES;
ModelRenderer SUPPORT_PLATE;
ModelRenderer ORNAMENT_1;
ModelRenderer ORNAMENT_2;
ModelRenderer LEVER_1_CAN_BE_TURNED;
ModelRenderer LEVER_2_CAN_BE_TURNED;
public EngineSmallModel()
{
textureWidth = 128;
textureHeight = 128;
BASE = new ModelRenderer(this, 0, 0);
BASE.addBox(0F, 0F, 0F, 16, 1, 16);
BASE.setRotationPoint(-8F, 23F, -8F);
BASE.setTextureSize(128, 128);
BASE.mirror = true;
setRotation(BASE, 0F, 0F, 0F);
PISTON_WALL_1 = new ModelRenderer(this, 0, 18);
PISTON_WALL_1.addBox(0F, 0F, 0F, 7, 1, 4);
PISTON_WALL_1.setRotationPoint(0F, 22F, 1F);
PISTON_WALL_1.setTextureSize(128, 128);
PISTON_WALL_1.mirror = true;
setRotation(PISTON_WALL_1, 1.570796F, 0F, 0F);
PISTON_HEAD_MOVES = new ModelRenderer(this, 0, 24);
PISTON_HEAD_MOVES.addBox(0F, -2F, -2F, 4, 4, 4);
PISTON_HEAD_MOVES.setRotationPoint(0F, 20F, 4F);
PISTON_HEAD_MOVES.setTextureSize(128, 128);
PISTON_HEAD_MOVES.mirror = true;
setRotation(PISTON_HEAD_MOVES, 0F, 0F, 0F);
PISTON_TURNER_MOVES = new ModelRenderer(this, 0, 33);
PISTON_TURNER_MOVES.addBox(0F, -1F, -1F, 1, 2, 2);
PISTON_TURNER_MOVES.setRotationPoint(-1F, 20F, 4F);
PISTON_TURNER_MOVES.setTextureSize(128, 128);
PISTON_TURNER_MOVES.mirror = true;
setRotation(PISTON_TURNER_MOVES, 0F, 0F, 0F);
PISTON_ARM_MOVES = new ModelRenderer(this, 0, 38);
PISTON_ARM_MOVES.addBox(0F, 0F, -1F, 4, 1, 1);
PISTON_ARM_MOVES.setRotationPoint(-5F, 19F, 4F);
PISTON_ARM_MOVES.setTextureSize(128, 128);
PISTON_ARM_MOVES.mirror = true;
setRotation(PISTON_ARM_MOVES, 0F, 0F, 0F);
GEAR_A_NECK = new ModelRenderer(this, 65, 25);
GEAR_A_NECK.addBox(-1F, -1F, 0F, 2, 2, 1);
GEAR_A_NECK.setRotationPoint(-4F, 19F, -4F);
GEAR_A_NECK.setTextureSize(128, 128);
GEAR_A_NECK.mirror = true;
setRotation(GEAR_A_NECK, 0F, 0F, 0F);
PISTON_WALL_2 = new ModelRenderer(this, 0, 18);
PISTON_WALL_2.addBox(0F, 0F, 0F, 7, 1, 4);
PISTON_WALL_2.setRotationPoint(0F, 17F, 2F);
PISTON_WALL_2.setTextureSize(128, 128);
PISTON_WALL_2.mirror = true;
setRotation(PISTON_WALL_2, 0F, 0F, 0F);
PISTON_WALL_3 = new ModelRenderer(this, 0, 18);
PISTON_WALL_3.addBox(0F, 0F, 0F, 7, 1, 4);
PISTON_WALL_3.setRotationPoint(0F, 22F, 2F);
PISTON_WALL_3.setTextureSize(128, 128);
PISTON_WALL_3.mirror = true;
setRotation(PISTON_WALL_3, 0F, 0F, 0F);
PISTON_WALL_4 = new ModelRenderer(this, 0, 18);
PISTON_WALL_4.addBox(0F, 0F, 0F, 7, 1, 4);
PISTON_WALL_4.setRotationPoint(0F, 22F, 6F);
PISTON_WALL_4.setTextureSize(128, 128);
PISTON_WALL_4.mirror = true;
setRotation(PISTON_WALL_4, 1.570796F, 0F, 0F);
PISTON_SUPPORT_1 = new ModelRenderer(this, 0, 41);
PISTON_SUPPORT_1.addBox(0F, 0F, 0F, 1, 8, 6);
PISTON_SUPPORT_1.setRotationPoint(7F, 15F, 1F);
PISTON_SUPPORT_1.setTextureSize(128, 128);
PISTON_SUPPORT_1.mirror = true;
setRotation(PISTON_SUPPORT_1, 0F, 0F, 0F);
PISTON_SUPPORT_2 = new ModelRenderer(this, 0, 57);
PISTON_SUPPORT_2.addBox(0F, 0F, 0F, 1, 4, 4);
PISTON_SUPPORT_2.setRotationPoint(7F, 12F, 4F);
PISTON_SUPPORT_2.setTextureSize(128, 128);
PISTON_SUPPORT_2.mirror = true;
setRotation(PISTON_SUPPORT_2, -0.7853982F, 0F, 0F);
FORCE_CONDUCTOR_BOX = new ModelRenderer(this, 65, 0);
FORCE_CONDUCTOR_BOX.addBox(0F, 0F, 0F, 4, 5, 6);
FORCE_CONDUCTOR_BOX.setRotationPoint(-6F, 18F, -3F);
FORCE_CONDUCTOR_BOX.setTextureSize(128, 128);
FORCE_CONDUCTOR_BOX.mirror = true;
setRotation(FORCE_CONDUCTOR_BOX, 0F, 0F, 0F);
GEAR_A_TEETH_1_ROTATES = new ModelRenderer(this, 93, 0);
GEAR_A_TEETH_1_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 1);
GEAR_A_TEETH_1_ROTATES.setRotationPoint(-4F, 19F, -5F);
GEAR_A_TEETH_1_ROTATES.setTextureSize(128, 128);
GEAR_A_TEETH_1_ROTATES.mirror = true;
setRotation(GEAR_A_TEETH_1_ROTATES, 0F, 0F, 0F);
GEAR_A_TEETH_2_ROTATES = new ModelRenderer(this, 93, 0);
GEAR_A_TEETH_2_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 1);
GEAR_A_TEETH_2_ROTATES.setRotationPoint(-4F, 19F, -5F);
GEAR_A_TEETH_2_ROTATES.setTextureSize(128, 128);
GEAR_A_TEETH_2_ROTATES.mirror = true;
setRotation(GEAR_A_TEETH_2_ROTATES, 0F, 0F, 1.047198F);
GEAR_A_TEETH_3_ROTATES = new ModelRenderer(this, 93, 0);
GEAR_A_TEETH_3_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 1);
GEAR_A_TEETH_3_ROTATES.setRotationPoint(-4F, 19F, -5F);
GEAR_A_TEETH_3_ROTATES.setTextureSize(128, 128);
GEAR_A_TEETH_3_ROTATES.mirror = true;
setRotation(GEAR_A_TEETH_3_ROTATES, 0F, 0F, -1.047198F);
FORCE_TRANSMITTER_ROTATES = new ModelRenderer(this, 65, 25);
FORCE_TRANSMITTER_ROTATES.addBox(-1F, -1F, 0F, 2, 2, 1);
FORCE_TRANSMITTER_ROTATES.setRotationPoint(0F, 17F, -8F);
FORCE_TRANSMITTER_ROTATES.setTextureSize(128, 128);
FORCE_TRANSMITTER_ROTATES.mirror = true;
setRotation(FORCE_TRANSMITTER_ROTATES, 0F, 0F, 0F);
GEAR_B_TEETH_1_ROTATES = new ModelRenderer(this, 93, 5);
GEAR_B_TEETH_1_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 3);
GEAR_B_TEETH_1_ROTATES.setRotationPoint(0F, 17F, -7F);
GEAR_B_TEETH_1_ROTATES.setTextureSize(128, 128);
GEAR_B_TEETH_1_ROTATES.mirror = true;
setRotation(GEAR_B_TEETH_1_ROTATES, 0F, 0F, 0F);
GEAR_B_TEETH_2_ROTATES = new ModelRenderer(this, 93, 5);
GEAR_B_TEETH_2_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 3);
GEAR_B_TEETH_2_ROTATES.setRotationPoint(0F, 17F, -7F);
GEAR_B_TEETH_2_ROTATES.setTextureSize(128, 128);
GEAR_B_TEETH_2_ROTATES.mirror = true;
setRotation(GEAR_B_TEETH_2_ROTATES, 0F, 0F, 1.047198F);
GEAR_B_TEETH_3_ROTATES = new ModelRenderer(this, 93, 5);
GEAR_B_TEETH_3_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 3);
GEAR_B_TEETH_3_ROTATES.setRotationPoint(0F, 17F, -7F);
GEAR_B_TEETH_3_ROTATES.setTextureSize(128, 128);
GEAR_B_TEETH_3_ROTATES.mirror = true;
setRotation(GEAR_B_TEETH_3_ROTATES, 0F, 0F, -1.047198F);
SUPPORT_PLATE = new ModelRenderer(this, 65, 12);
SUPPORT_PLATE.addBox(0F, 0F, 0F, 9, 8, 4);
SUPPORT_PLATE.setRotationPoint(-1F, 15F, -4F);
SUPPORT_PLATE.setTextureSize(128, 128);
SUPPORT_PLATE.mirror = true;
setRotation(SUPPORT_PLATE, 0F, 0F, 0F);
ORNAMENT_1 = new ModelRenderer(this, 86, 0);
ORNAMENT_1.addBox(0F, 0F, 0F, 1, 4, 2);
ORNAMENT_1.setRotationPoint(6F, 19F, -5F);
ORNAMENT_1.setTextureSize(128, 128);
ORNAMENT_1.mirror = true;
setRotation(ORNAMENT_1, -0.2094395F, 0F, 0F);
ORNAMENT_2 = new ModelRenderer(this, 86, 0);
ORNAMENT_2.addBox(0F, 0F, 0F, 1, 4, 2);
ORNAMENT_2.setRotationPoint(4F, 19F, -5F);
ORNAMENT_2.setTextureSize(128, 128);
ORNAMENT_2.mirror = true;
setRotation(ORNAMENT_2, -0.2094395F, 0F, 0F);
LEVER_1_CAN_BE_TURNED = new ModelRenderer(this, 0, 0);
LEVER_1_CAN_BE_TURNED.addBox(0F, -6F, 0F, 1, 6, 1);
LEVER_1_CAN_BE_TURNED.setRotationPoint(6F, 16F, -3F);
LEVER_1_CAN_BE_TURNED.setTextureSize(128, 128);
LEVER_1_CAN_BE_TURNED.mirror = true;
setRotation(LEVER_1_CAN_BE_TURNED, 0F, 0F, 0F);
LEVER_2_CAN_BE_TURNED = new ModelRenderer(this, 0, 0);
LEVER_2_CAN_BE_TURNED.addBox(0F, -6F, 0F, 1, 6, 1);
LEVER_2_CAN_BE_TURNED.setRotationPoint(4F, 16F, -3F);
LEVER_2_CAN_BE_TURNED.setTextureSize(128, 128);
LEVER_2_CAN_BE_TURNED.mirror = true;
setRotation(LEVER_2_CAN_BE_TURNED, 0F, 0F, 0F);
}
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);
genRender(f5);
}
public void genRender(float f5)
{
BASE.render(f5);
PISTON_WALL_1.render(f5);
PISTON_HEAD_MOVES.render(f5);
PISTON_TURNER_MOVES.render(f5);
PISTON_ARM_MOVES.render(f5);
GEAR_A_NECK.render(f5);
PISTON_WALL_2.render(f5);
PISTON_WALL_3.render(f5);
PISTON_WALL_4.render(f5);
PISTON_SUPPORT_1.render(f5);
PISTON_SUPPORT_2.render(f5);
FORCE_CONDUCTOR_BOX.render(f5);
GEAR_A_TEETH_1_ROTATES.render(f5);
GEAR_A_TEETH_2_ROTATES.render(f5);
GEAR_A_TEETH_3_ROTATES.render(f5);
FORCE_TRANSMITTER_ROTATES.render(f5);
GEAR_B_TEETH_1_ROTATES.render(f5);
GEAR_B_TEETH_2_ROTATES.render(f5);
GEAR_B_TEETH_3_ROTATES.render(f5);
SUPPORT_PLATE.render(f5);
ORNAMENT_1.render(f5);
ORNAMENT_2.render(f5);
LEVER_1_CAN_BE_TURNED.render(f5);
LEVER_2_CAN_BE_TURNED.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);
}
}

View file

@ -1,75 +0,0 @@
package net.minecraft.src.eui.turbine;
import org.lwjgl.opengl.GL11;
import java.math.*;
import java.lang.Integer;
import net.minecraft.src.*;
import net.minecraft.src.universalelectricity.UniversalElectricity;
public class GUIGenerator extends GuiContainer
{
private TileEntityGenerator tileEntity;
private int containerWidth;
private int containerHeight;
public GUIGenerator(InventoryPlayer par1InventoryPlayer, TileEntityGenerator tileEntity)
{
super(new ContainerGenerator(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer()
{
this.fontRenderer.drawString("Steam Engine MkI", 55, 6, 4210752);
this.fontRenderer.drawString("MeterReadings", 90, 33, 4210752);
String displayText = "";
String displayText2 = "";
String displayText3 = "";
if(tileEntity.connectedElectricUnit == null)
{
displayText = "Not Connected";
}
else if(tileEntity.generateRate*20 <= 0)
{
if(tileEntity.steamStored> 0)
{
displayText = "Power Full";
}
if(tileEntity.steamStored<= 0)
{
displayText = "No Steam";
}
}
else if(tileEntity.generateRate*20 < 20)
{
displayText = "Warming UP: "+(int)(tileEntity.generateRate*100)+"%";
}
else
{
displayText = UniversalElectricity.getWattDisplay((int)(tileEntity.generateRate*20));
}
displayText2 = "water" + "-" + tileEntity.waterStored;
displayText3 = "steam" + "-" + tileEntity.steamStored;
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);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int var4 = this.mc.renderEngine.getTexture("/eui/SteamGUI.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(var4);
containerWidth = (this.width - this.xSize) / 2;
containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -1,27 +0,0 @@
package net.minecraft.src.eui.turbine;
import org.lwjgl.opengl.GL11;
import net.minecraft.src.*;
public class RenderSteamEngine extends TileEntitySpecialRenderer
{
int type = 0;
private EngineSmallModel model;
public RenderSteamEngine()
{
model = new EngineSmallModel();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) {
bindTextureByName("/eui/tankTexture.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
model.genRender(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -1,329 +0,0 @@
package net.minecraft.src.eui.turbine;
import net.minecraft.src.eui.TileEntityMachine;
import net.minecraft.src.eui.api.*;
import net.minecraft.src.forge.ForgeHooks;
import net.minecraft.src.*;
import net.minecraft.src.pipes.api.ILiquidConsumer;
import net.minecraft.src.pipes.api.ILiquidProducer;
import net.minecraft.src.universalelectricity.*;
import net.minecraft.src.universalelectricity.electricity.ElectricityManager;
import net.minecraft.src.universalelectricity.electricity.IElectricUnit;
import net.minecraft.src.universalelectricity.extend.BlockConductor;
import net.minecraft.src.universalelectricity.extend.TileEntityConductor;
import net.minecraft.src.forge.ISidedInventory;
public class TileEntityGenerator extends TileEntityMachine implements IElectricUnit,ILiquidConsumer,ILiquidProducer, IInventory, ISidedInventory
{
//Maximum possible generation rate of watts in SECONDS
public int maxGenerateRate = 1000;
public int waterStored = 0;
public int steamStored = 0;
public int steamConsumed = 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 itemCookTime = 0;
/**
* The ItemStacks that hold the items currently being used in the battery box
*/
private ItemStack[] containingItems = new ItemStack[1];
public TileEntityConductor connectedElectricUnit = null;
@Override
public boolean canConnect(byte side)
{
return 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 onUpdate(float watts, float voltage, byte side)
{ if(!this.worldObj.isRemote)
{
super.onUpdate(watts, voltage, side);
//Check nearby blocks and see if the conductor is full. If so, then it is connected
TileEntity tileEntity = UniversalElectricity.getUEUnitFromSide(this.worldObj, new Vector3(this.xCoord, this.yCoord, this.zCoord), UniversalElectricity.getOrientationFromSide((byte)this.getBlockMetadata(), (byte)3));
if(tileEntity instanceof TileEntityConductor)
{
if(ElectricityManager.electricityRequired(((TileEntityConductor)tileEntity).connectionID) > 0)
{
this.connectedElectricUnit = (TileEntityConductor)tileEntity;
}
else
{
this.connectedElectricUnit = null;
}
}
else
{
this.connectedElectricUnit = null;
}
if(!this.isDisabled())
{
//Adds time to runTime by consuming steam
if(this.itemCookTime <= 0)
{
if(steamStored > 0)
{
--steamStored;
++steamConsumed;
if(steamConsumed == mod_EUIndustry.steamOutBoiler)
{
++waterStored;
steamConsumed = 0;
}
itemCookTime += 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.itemCookTime > 0)
{
this.itemCookTime --;
if(this.connectedElectricUnit != null)
{
this.generateRate = (float)Math.min(this.generateRate+Math.min((this.generateRate)*0.001+0.0015, 0.05F), this.maxGenerateRate/20);
}
}
if(this.connectedElectricUnit == null || this.itemCookTime <= 0)
{
this.generateRate = (float)Math.max(this.generateRate-0.05, 0);
}
if(this.generateRate > 1)
{
ElectricityManager.produceElectricity(this.connectedElectricUnit, this.generateRate*this.getTickInterval(), this.getVoltage());
}
}
}
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.itemCookTime = 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.itemCookTime);
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(int side)
{
if (side == 0)
{
return 1;
}
if (side == 1)
{
return 0;
}
return 2;
}
@Override
public int getSizeInventorySide(int side) { return getSizeInventory(); }
@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;
}
}
@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 void onDisable(int duration) {
// TODO Auto-generated method stub
}
@Override
public boolean isDisabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public int onProduceLiquid(int type, int maxVol, int side) {
if(type == 1)
{
if(this.waterStored > 0)
{
--waterStored;
return 1;
}
}
return 0;
}
@Override
public boolean canProduceLiquid(int type, byte side) {
if(type == 1)
{
return true;
}
return false;
}
@Override
public int onReceiveLiquid(int type, int vol, byte side) {
if(type == 0)
{
int rejectedSteam = Math.max((this.steamStored + vol) - 100, 0);
this.steamStored += vol - rejectedSteam;
return rejectedSteam;
}
return vol;
}
@Override
public boolean canRecieveLiquid(int type, byte side) {
if(type == 0)
{
return true;
}
return false;
}
@Override
public int getStoredLiquid(int type) {
if(type == 0)
{
return this.steamStored;
}
return 0;
}
@Override
public int getLiquidCapacity(int type) {
if(type == 0)
{
return 100;
}
return 0;
}
}

View file

@ -1,90 +0,0 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import net.minecraft.src.basiccomponents.BasicComponents;
import net.minecraft.src.eui.*;
import net.minecraft.src.eui.boiler.RenderBoiler;
import net.minecraft.src.eui.boiler.TileEntityBoiler;
import net.minecraft.src.eui.burner.RenderFurnace;
import net.minecraft.src.eui.burner.TileEntityFireBox;
import net.minecraft.src.eui.turbine.EngineSmallModel;
import net.minecraft.src.eui.turbine.RenderSteamEngine;
import net.minecraft.src.eui.turbine.TileEntityGenerator;
import net.minecraft.src.forge.*;
import net.minecraft.src.universalelectricity.*;
import java.util.ArrayList;
import java.util.Map;
import java.io.*;
public class mod_EUIndustry extends NetworkMod {
static Configuration config = new Configuration((new File(Minecraft.getMinecraftDir(), "config/EUIndustry/SteamPower.cfg")));
private static int BlockID= configurationProperties();
public static int genOutput;
public static int steamOutBoiler;
public static int pipeLoss;
public static int boilerHeat;
public static int fireOutput;
public static Block machine = new net.minecraft.src.eui.BlockMachine(BlockID).setBlockName("machine");
@Override
public String getVersion() {
// TODO change version on each update ;/
return "0.0.7";
}
public static int configurationProperties()
{
config.load();
BlockID = Integer.parseInt(config.getOrCreateIntProperty("Machines", Configuration.CATEGORY_BLOCK, 129).value);
genOutput = Integer.parseInt(config.getOrCreateIntProperty("genOutputWatts", Configuration.CATEGORY_GENERAL, 1000).value);
steamOutBoiler = Integer.parseInt(config.getOrCreateIntProperty("steamOutBoiler", Configuration.CATEGORY_GENERAL, 10).value);
boilerHeat = Integer.parseInt(config.getOrCreateIntProperty("boilerInKJ", Configuration.CATEGORY_GENERAL, 4500).value);
fireOutput = Integer.parseInt(config.getOrCreateIntProperty("fireBoxOutKJ", Configuration.CATEGORY_GENERAL,50).value);
config.save();
return BlockID;
}
@Override
public void modsLoaded()
{
UniversalElectricity.registerAddon(this, "0.4.5");
}
@Override
public void load() {
//register
ModLoader.registerBlock(machine, net.minecraft.src.eui.ItemMachine.class);
MinecraftForgeClient.preloadTexture("/eui/Blocks.png");
MinecraftForgeClient.preloadTexture("/eui/Items.png");
//TileEntities..................................
ModLoader.registerTileEntity(net.minecraft.src.eui.boiler.TileEntityBoiler.class, "boiler", new RenderBoiler());
ModLoader.registerTileEntity(net.minecraft.src.eui.burner.TileEntityFireBox.class, "fireBox", new RenderFurnace());
ModLoader.registerTileEntity(net.minecraft.src.eui.turbine.TileEntityGenerator.class, "generator", new RenderSteamEngine());
ModLoader.registerTileEntity(net.minecraft.src.eui.TileEntityNuller.class, "EUNuller");
//Names...............
ModLoader.addName((new ItemStack(machine, 1, 1)), "Boiler");
ModLoader.addName((new ItemStack(machine, 1, 2)), "FireBox");
ModLoader.addName((new ItemStack(machine, 1, 3)), "SteamGen");
ModLoader.addName((new ItemStack(machine, 1, 15)), "EUVampire");
//Crafting
/**
* case 0: return new TileEntityGrinder(); <-Removed
case 1: return new TileEntityBoiler();
case 2: return new TileEntityFireBox();
case 3: return new TileEntityGenerator();
case 14: return new TileEntityCondenser();<-Removed
case 15: return new TileEntityNuller();<-Just for testing Not craftable
*/
ModLoader.addRecipe(new ItemStack(machine, 1, 1), new Object [] {"@T@", "OVO", "@T@",
'T',new ItemStack(mod_BasicPipes.parts, 1,5),
'@',new ItemStack(BasicComponents.ItemSteelPlate),
'O',new ItemStack(mod_BasicPipes.parts, 1,1),
'V',new ItemStack(mod_BasicPipes.parts, 1,6)});
ModLoader.addRecipe(new ItemStack(machine, 1, 2), new Object [] { "@", "F",
'F',Block.stoneOvenIdle,
'@',new ItemStack(BasicComponents.ItemSteelPlate)});
ModLoader.addRecipe(new ItemStack(machine, 1, 3), new Object [] {"@T@", "PMP", "@T@",
'T',new ItemStack(mod_BasicPipes.parts, 1,0),
'@',new ItemStack(BasicComponents.ItemSteelPlate),
'P',Block.pistonBase,
'M',new ItemStack(BasicComponents.ItemMotor)});
}
}

View file

@ -1,54 +0,0 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import net.minecraft.src.basiccomponents.BasicComponents;
import net.minecraft.src.eui.*;
import net.minecraft.src.eui.robotics.ModelModelShoeBot;
import net.minecraft.src.eui.robotics.RenderShoeBot;
import net.minecraft.src.forge.*;
import net.minecraft.src.universalelectricity.*;
import java.util.ArrayList;
import java.util.Map;
import java.io.*;
public class mod_automation extends NetworkMod {
static Configuration config = new Configuration((new File(Minecraft.getMinecraftDir(), "config/EUIndustry/SteamPower.cfg")));
public static int spawnItemId = configurationProperties();
public static Item spawnItem = (new net.minecraft.src.eui.robotics.ItemSpawn(spawnItemId)).setItemName("Bot");
private static int BlockID = 3454;
public static Block machine = new net.minecraft.src.eui.robotics.BlockComp(BlockID).setBlockName("machine");
@Override
public String getVersion() {
// TODO change version on each update ;/
return "0.0.1";
}
public static int configurationProperties()
{
config.load();
spawnItemId = Integer.parseInt(config.getOrCreateIntProperty("BotItem", Configuration.CATEGORY_ITEM, 31356).value);
config.save();
return spawnItemId;
}
@Override
public void load() {
MinecraftForgeClient.preloadTexture("/eui/Blocks.png");
MinecraftForgeClient.preloadTexture("/eui/Items.png");
//register
UniversalElectricity.registerAddon(this, "0.4.5");
ModLoader.registerBlock(machine, net.minecraft.src.eui.robotics.ItemMachine.class);
//names................................................
ModLoader.addName((new ItemStack(spawnItem, 1, 0)), "Bot");
ModLoader.addName((new ItemStack(machine, 1, 0)), "Controller");
//TileEntities..................................
ModLoader.registerTileEntity(net.minecraft.src.eui.robotics.TileEntityComp.class, "controller");
//Entities...................
ModLoader.registerEntityID(net.minecraft.src.eui.robotics.EntityShoeBot.class, "Bot", 101);//collector
}
@Override
public void addRenderer(Map map)
{
map.put(net.minecraft.src.eui.robotics.EntityShoeBot.class, new RenderShoeBot());
}
}

View file

@ -1,4 +0,0 @@
Dark-sIndustry
==============
My Version of the leading Industry minecraft mods using the UE electricty API

View file

@ -0,0 +1,125 @@
package BasicPipes;
import java.io.File;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraftforge.common.Configuration;
import universalelectricity.basiccomponents.BasicComponents;
import universalelectricity.network.PacketManager;
import BasicPipes.pipes.BlockPipe;
import BasicPipes.pipes.BlockPump;
import BasicPipes.pipes.ItemGuage;
import BasicPipes.pipes.ItemParts;
import BasicPipes.pipes.ItemPipe;
import BasicPipes.pipes.TileEntityPump;
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;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "basicPipes", name = "Basic Pipes", version = "V4")
@NetworkMod(channels = { "Pipes" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
public class BasicPipesMain{
@Instance
public static BasicPipesMain instance;
@SidedProxy(clientSide = "BasicPipes.PipeClientProxy", serverSide = "BasicPipes.PipeProxy")
public static PipeProxy proxy;
static Configuration config = new Configuration((new File(Minecraft.getMinecraftDir(), "config/EUIndustry/BasicPipes.cfg")));
public static int pipeID = configurationProperties();
private static int partID;
private static int ppipeID;
private static int machineID;
public static Block pipe = new BlockPipe(pipeID).setBlockName("pipe");
public static Block machine = new BlockPump(machineID).setBlockName("pump");
public static Item parts = new ItemParts(partID);
public static Item itemPipes = new ItemPipe(ppipeID);
public static Item gauge = new ItemGuage(ppipeID+1);
public static String channel = "Pipes";
public static int configurationProperties()
{
config.load();
pipeID = Integer.parseInt(config.getOrCreateIntProperty("PipeBlock", Configuration.CATEGORY_BLOCK, 155).value);
machineID = Integer.parseInt(config.getOrCreateIntProperty("machineBlock", Configuration.CATEGORY_BLOCK, 156).value);
partID = Integer.parseInt(config.getOrCreateIntProperty("parts", Configuration.CATEGORY_ITEM, 23022).value);
ppipeID = Integer.parseInt(config.getOrCreateIntProperty("pipes", Configuration.CATEGORY_ITEM, 23023).value);
config.save();
return pipeID;
}
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
proxy.preInit();
GameRegistry.registerBlock(pipe);
GameRegistry.registerBlock(machine);
}
@Init
public void load(FMLInitializationEvent evt)
{
//register
proxy.init();
GameRegistry.registerTileEntity(TileEntityPump.class, "pump");
//Names
LanguageRegistry.addName((new ItemStack(gauge, 1, 0)), "guage");
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
}
@PostInit
public void postInit(FMLPostInitializationEvent event)
{
proxy.postInit();
GameRegistry.addRecipe(new ItemStack(parts, 2,0), new Object[] { "@@@", '@',BasicComponents.itemBronzeIngot});//bronze tube
GameRegistry.addRecipe(new ItemStack(parts, 2,1), new Object[] { "@@@", '@',Item.ingotIron});//iron tube
GameRegistry.addRecipe(new ItemStack(parts, 2,2), new Object[] { "@@@", '@',Block.obsidian});//obby Tube
GameRegistry.addRecipe(new ItemStack(parts, 2,3), new Object[] { "N@N", 'N',Block.netherrack,'@',new ItemStack(parts, 2,2)});//nether tube
GameRegistry.addRecipe(new ItemStack(parts, 2,4), new Object[] { "@@","@@", '@',Item.leather});//seal
GameRegistry.addShapelessRecipe(new ItemStack(parts, 1,5), new Object[] { new ItemStack(parts, 1,4),new ItemStack(Item.slimeBall, 1)});//stick seal
GameRegistry.addRecipe(new ItemStack(parts, 1,6), new Object[] { " @ ","@ @"," @ ", '@',BasicComponents.itemBronzeIngot});//tank
GameRegistry.addRecipe(new ItemStack(parts, 1,7), new Object[] { "T@T", 'T',new ItemStack(parts,1,0),'@',Block.lever});//valve
//crafting pipes
//{"black", "red", "green", "brown", "blue", "purple", "cyan",
//"silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"};
//steam
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,0), new Object[] { new ItemStack(parts, 1,0),new ItemStack(parts, 1,4)});
//water
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,1), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,4)});
//lava TODO change to use obby pipe and nether items
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,2), new Object[] { new ItemStack(parts, 1,2),new ItemStack(Item.dyePowder, 1,1)});
//oil
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,3), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,0)});
//fuel
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,4), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,11)});
}
}

View file

@ -0,0 +1,54 @@
package BasicPipes;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import BasicPipes.pipes.TileEntityPipe;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
public class PipeProxy implements IGuiHandler
{
public void preInit()
{
}
public void init()
{
GameRegistry.registerTileEntity(TileEntityPipe.class, "pipe");
}
public void postInit()
{
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
switch(ID)
{
}
}
return null;
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
switch(ID)
{
}
}
return null;
}
}

View file

@ -0,0 +1,173 @@
package BasicPipes;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import BasicPipes.pipes.api.ILiquidConsumer;
import SteamPower.TileEntityMachine;
import SteamPower.boiler.TileEntityBoiler;
public class TradeHelper {
/**
*
* @param entity - entity at center of search
* @return an Array containing found entities and nulls of nonEntities
*/
public static TileEntity[] getSourounding(TileEntity entity)
{
TileEntity[] list = new TileEntity[]{null,null,null,null,null,null};
for(int i =0; i< 6;i++)
{
int x = entity.xCoord;
int y = entity.yCoord;
int z = entity.zCoord;
switch(i)
{
case 0: y = y - 1;break;//down
case 1: y = y + 1;break;//up
case 2: z = z + 1;break;//north
case 3: z = z - 1;break;//south
case 4: x = x + 1;break;//east
case 5: x = x - 1;break;//west
}
TileEntity aEntity = entity.worldObj.getBlockTileEntity(x, y, z);
if(aEntity instanceof TileEntity)
{
list[i] = aEntity;
}
}
return list;
}
/**
*
* @param blockEntity - tile entity trading the liquid
* @param type - liquid type see chart for info
* @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)
{
TileEntity[] connectedBlocks = getSourounding(blockEntity);
ILiquidConsumer blockMachine = (ILiquidConsumer) blockEntity;
int wSum = ((ILiquidConsumer)blockEntity).getStoredLiquid(type);
int ammountStored = blockMachine.getStoredLiquid(type);
int tankCount = 1;
boolean bottom = false;
TileEntity firstEntity = null;
TileEntity secondEntity = null;
if(rise)
{
firstEntity = connectedBlocks[1];
secondEntity = connectedBlocks[0];
}
else
{
firstEntity = connectedBlocks[0];
secondEntity = connectedBlocks[1];
}
//checks wether or not the block bellow it is a tank to move liquid too
if(firstEntity instanceof TileEntityBoiler)
{
int bWater = ((TileEntityBoiler) firstEntity).getStoredLiquid(1);
int bMax = ((TileEntityBoiler) firstEntity).getLiquidCapacity(1);
//checks if that tank has room to get liquid.
if(bWater < bMax)
{
int emptyVol = Math.max( bMax - bWater,0);
int tradeVol = Math.min(emptyVol, ammountStored);
int rejected = ((TileEntityBoiler) firstEntity).onReceiveLiquid(1, tradeVol, ForgeDirection.getOrientation(1));
ammountStored = ammountStored + rejected - tradeVol;
wSum -= tradeVol;
}
else
{
bottom = true;
}
}
else
{
//there was no tank bellow this tank
bottom = true;
}
//if this is the bottom tank or bottom tank is full. Update average water ammount.
if(bottom)
{
//get average water around center tank
for(int i = 2; i<6;i++)
{
TileEntity entityA = connectedBlocks[i];
if(entityA instanceof TileEntityBoiler)
{
//if is a tank add to the sum
wSum += ((TileEntityBoiler) entityA).getStoredLiquid(1);
tankCount += 1;
}
}
}
//if this is the bottom tank or bottom tank is full then trade liquid with tanks around it.
for(int i = 2; i<6;i++)
{
int average = wSum / tankCount;// takes the sum and makes it an average
int tradeSum = 0;
TileEntity entity = connectedBlocks[i];
if(entity instanceof TileEntityBoiler)
{
int targetW = ((TileEntityBoiler) entity).getStoredLiquid(1);
if(targetW < average)
{
tradeSum = Math.min(average, ammountStored); //gets the ammount to give to the target tank
int rejectedAm = ((TileEntityBoiler) entity).onReceiveLiquid(1, tradeSum, ForgeDirection.getOrientation(i)); //send that ammount with safty incase some comes back
ammountStored =rejectedAm + ammountStored - tradeSum; //counts up current water sum after trade
}
}
}
if(secondEntity instanceof TileEntityBoiler)
{
int bWater = ((TileEntityBoiler) secondEntity).getStoredLiquid(1);
int bMax = ((TileEntityBoiler) secondEntity).getLiquidCapacity(1);
if(bottom && ammountStored > 0)
{
if(bWater < bMax)
{
int emptyVolS = Math.max( bMax - bWater,0);
int tradeVolS = Math.min(emptyVolS, ammountStored);
int rejectedS = ((TileEntityBoiler) secondEntity).addSteam(tradeVolS);
ammountStored =rejectedS + ammountStored - tradeVolS;
wSum -= tradeVolS;
}
}
}
return ammountStored;
}
/**
*
* @param entity - entity in question
* @return 1-4 if corner 0 if not a corner
* you have to figure out which is which depending on what your using this for
* 1 should be north east 2 south east
*/
public static int corner(TileEntity entity)
{
TileEntity[] en = getSourounding(entity);
if(en[4] != null && en[2] != null && en[5] == null && en[3] == null)
{
return 1;
}
if(en[2] != null && en[5] != null && en[3] == null && en[4] == null)
{
return 2;
}
if(en[5] != null && en[3] != null && en[4] == null && en[2] == null)
{
return 3;
}
if(en[3] != null && en[4] != null && en[2] == null && en[5] == null)
{
return 4;
}
return 0;
}
}

View file

@ -0,0 +1,146 @@
package BasicPipes.pipes;
import java.util.Random;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import net.minecraftforge.common.ForgeDirection;
import BasicPipes.pipes.api.ILiquidConsumer;
import BasicPipes.pipes.api.ILiquidProducer;
public class BlockPipe extends BlockContainer
{
public BlockPipe(int id)
{
super(id, Material.iron);
this.setBlockName("Pipe");
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return -1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
//Per tick
public int conductorCapacity()
{
return 5;
}
/**
* Called whenever the block is added into the world. Args: world, x, y, z
*/
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.updateConductorTileEntity(world, x, y, z);
}
public static TileEntity getUEUnit(World world, int x, int y, int z, byte side,int type)
{
switch(side)
{
case 0: y -= 1; break;
case 1: y += 1; break;
case 2: z += 1; break;
case 3: z -= 1; break;
case 4: x += 1; break;
case 5: x -= 1; break;
}
//Check if the designated block is a UE Unit - producer, consumer or a conductor
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
TileEntity returnValue = null;
if(tileEntity instanceof ILiquidConsumer)
{
if(((ILiquidConsumer)tileEntity).canRecieveLiquid(type,ForgeDirection.getOrientation(side)))
{
returnValue = tileEntity;
}
}
if (tileEntity instanceof ILiquidProducer)
{
if(((ILiquidProducer)tileEntity).canProduceLiquid(type,ForgeDirection.getOrientation(side)))
{
returnValue = tileEntity;
}
}
return returnValue;
}
/**
* 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);
this.updateConductorTileEntity(world, x, y, z);
}
@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.isGroundCover();
}
@Override
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
return true;
}
public static void updateConductorTileEntity(World world, int x, int y, int z)
{
for(byte i = 0; i < 6; i++)
{
//Update the tile entity on neighboring blocks
TileEntityPipe conductorTileEntity = (TileEntityPipe)world.getBlockTileEntity(x, y, z);
int type = conductorTileEntity.getType();
conductorTileEntity.addConnection(getUEUnit(world, x, y, z, i, type), ForgeDirection.getOrientation(i));;
}
}
@Override
public TileEntity createNewTileEntity(World var1) {
// TODO Auto-generated method stub
return new TileEntityPipe();
}
}

View file

@ -0,0 +1,155 @@
package BasicPipes.pipes;
import java.util.ArrayList;
import net.minecraft.src.*;
import java.util.Random;
public class BlockPump extends BlockContainer
{
public BlockPump(int id)
{
super(id, Material.iron);
this.setBlockName("Pump");
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
@Override
public int getBlockTexture(IBlockAccess par1iBlockAccess, int x, int y, int z, int side)
{
int metadata = par1iBlockAccess.getBlockMetadata(x, y, z);
if (side == 1)
{
switch(metadata)
{
case 0: return 1;
case 1: return 3;
case 2: return 18;
case 3: return 5;
}
}
switch(metadata)
{
case 1: return 4;
case 2: return 16;
case 3: return 2;
}
return 0;
}
@Override
public int getBlockTextureFromSideAndMetadata(int side, int metadata)
{
if (side == 1)
{
switch(metadata)
{
case 0: return 1;
case 1: return 3;
case 2: return 18;
case 3: return 5;
}
}
else
{
//If it is the front side
if(side == 3)
{
switch(metadata)
{
case 0: return 19;
case 1: return 6;
case 2: return 17;
case 3: return 3;
}
}
//If it is the back side
else if(side == 2)
{
switch(metadata)
{
case 0: return this.blockIndexInTexture + 2;
case 1: return this.blockIndexInTexture + 3;
case 2: return this.blockIndexInTexture + 2;
}
}
switch(metadata)
{
case 1: return 4;
case 2: return 16;
case 3: return 2;
}
}
return 0;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return 0;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
@Override
public String getTextureFile() {
// TODO Auto-generated method stub
return "/eui/blocks.png";
}
//Per tick
public int conductorCapacity()
{
return 10;
}
public void addCreativeItems(ArrayList itemList)
{
itemList.add(new ItemStack(this, 1,0));
}
@Override
public TileEntity createNewTileEntity(World var1,int meta) {
// TODO Auto-generated method stub
switch(meta)
{
case 0: return new TileEntityPump();
}
return null;
}
@Override
public TileEntity createNewTileEntity(World var1) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -0,0 +1,78 @@
package BasicPipes.pipes;
import java.util.ArrayList;
import net.minecraft.src.*;
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("guage");
}
@Override
public int getIconFromDamage(int par1)
{
switch(par1)
{
case 0: return 11;
}
return this.iconIndex;
}
@Override
public String getItemName()
{
return "guage";
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
if(blockEntity instanceof TileEntityPipe)
{
TileEntityPipe pipeEntity = (TileEntityPipe) blockEntity;
int steam = pipeEntity.getStoredLiquid(0);
int type = pipeEntity.getType();
String typeName = getType(type);
par2EntityPlayer.addChatMessage(typeName +" " + steam);
return true;
}
return false;
}
public String getType(int type)
{
switch(type)
{
case 0: return "Steam";
case 1: return "Water";
case 2: return "Lava";
case 3: return "Oil";
case 4: return "Fuel";
case 5: return "Air";
default: return "unknow";
}
}
public String getItemNameIS(ItemStack par1ItemStack)
{
int var3 = par1ItemStack.getItemDamage();
switch(var3)
{
case 1: return "PipeGuage";
}
return this.getItemName();
}
@Override
public String getTextureFile() {
return "/eui/Items.png";
}
}

View file

@ -0,0 +1,58 @@
package BasicPipes.pipes;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
public class ItemParts extends Item{
String[] names = new String[]{"BronzeTube","IronTube","ObbyTube","NetherTube","Seal","StickSeal","BronzeTank","Valve",};
int[] iconID = new int[] {0 ,1 ,2 ,3 ,16 ,17 ,18 ,19};//TODO check these
public ItemParts(int par1)
{
super(par1);
this.setItemName("Parts");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
this.setTabToDisplayOn(CreativeTabs.tabMaterials);
}
@Override
public int getIconFromDamage(int par1)
{
if(par1 < iconID.length)
{
return iconID[par1];
}
return par1;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return names[itemstack.getItemDamage()];
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for(int i = 0; i < names.length; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
public String getTextureFile() {
return "/EUIClient/Textures/Items.png";
}
@Override
public String getItemName()
{
return "parts";
}
}

View file

@ -0,0 +1,128 @@
package BasicPipes.pipes;
import java.util.List;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import BasicPipes.BasicPipesMain;
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)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setIconIndex(10);
this.setItemName("pipe");
this.setTabToDisplayOn(CreativeTabs.tabRedstone);
}
@Override
public int getIconFromDamage(int par1)
{
return par1+index;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return itemstack.getItemDamage() < names.length ? names[itemstack.getItemDamage()] +" Pipe2" : "EmptyPipe";
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for(int i = 0; i < names.length; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
public String getTextureFile() {
return "/EUIClient/Textures/Items.png";
}
@Override
public String getItemName()
{
return "Pipes";
}
@Override
public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
int blockID = par3World.getBlockId(par4, par5, par6);
spawnID = BasicPipesMain.pipeID;
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 (BasicPipesMain.pipe.canPlaceBlockAt(par3World,par4,par5,par6))
{
Block var9 = Block.blocksList[this.spawnID];
par3World.editingBlocks = true;
if (par3World.setBlockWithNotify(par4, par5, par6, var9.blockID))
{
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, par2EntityPlayer);
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
if(blockEntity instanceof TileEntityPipe)
{
TileEntityPipe pipeEntity = (TileEntityPipe) blockEntity;
int dm = par1ItemStack.getItemDamage();
pipeEntity.setType(dm);
}
}
--par1ItemStack.stackSize;
par3World.editingBlocks = false;
return true;
}
}
par3World.editingBlocks = false;
return false;
}
}

View file

@ -0,0 +1,98 @@
package BasicPipes.pipes;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.extend.IElectricUnit;
import BasicPipes.pipes.api.ILiquidProducer;
public class TileEntityCondenser extends TileEntity implements ILiquidProducer, IElectricUnit {
int tickCount = 0;
int waterStored = 0;
int energyStored = 0;
@Override
public int onProduceLiquid(int type,int maxVol, ForgeDirection side) {
if(type == 1)
{
int tradeW = Math.min(maxVol, waterStored);
waterStored -= tradeW;
return tradeW;
}
return 0;
}
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("energyStored", (int)this.energyStored);
par1NBTTagCompound.setInteger("waterStored", (int)this.waterStored);
}
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.energyStored = par1NBTTagCompound.getInteger("energyStored");
this.waterStored = par1NBTTagCompound.getInteger("waterStored");
}
public void updateEntity()
{
if(energyStored > 100 && tickCount > 200 && waterStored < 10)
{
energyStored -= 100;
waterStored += 1;
tickCount = 0;
}
tickCount++;
}
@Override
public boolean canProduceLiquid(int type, ForgeDirection side) {
if(type == 1)
{
return true;
}
return false;
}
@Override
public void onDisable(int duration) {
// TODO Auto-generated method stub
}
@Override
public boolean isDisabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public void onUpdate(float amps, float voltage, ForgeDirection side) {
// TODO Auto-generated method stub
}
@Override
public float electricityRequest() {
// TODO Auto-generated method stub
return 0;
}
@Override
public boolean canConnect(ForgeDirection side) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean canReceiveFromSide(ForgeDirection side) {
// TODO Auto-generated method stub
return false;
}
@Override
public float getVoltage() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int getTickInterval() {
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,267 @@
package BasicPipes.pipes;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.Vector3;
import universalelectricity.network.IPacketReceiver;
import universalelectricity.network.PacketManager;
import BasicPipes.BasicPipesMain;
import BasicPipes.pipes.api.ILiquidConsumer;
import BasicPipes.pipes.api.ILiquidProducer;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacketReceiver
{
//The amount stored in the conductor
protected int liquidStored = 0;
//the current set type of the pipe 0-5
protected int type = 0;
//The maximum amount of electricity this conductor can take
protected int capacity = 5;
private int count = 0;
private boolean intiUpdate = true;
//Stores information on all connected blocks around this tile entity
public TileEntity[] connectedBlocks = {null, null, null, null, null, null};
//Checks if this is the first the tile entity updates
protected boolean firstUpdate = true;
/**
* This function adds a connection between this pipe and other blocks
* @param tileEntity - Must be either a producer, consumer or a conductor
* @param side - side in which the connection is coming from
*/
public void addConnection(TileEntity tileEntity, ForgeDirection side)
{
int sideN = getNumSide(side);
this.connectedBlocks[sideN] = null;
if(tileEntity instanceof ILiquidConsumer)
{
if(((ILiquidConsumer)tileEntity).canRecieveLiquid(this.type, side))
{
this.connectedBlocks[sideN] = tileEntity;
}
}
if(tileEntity instanceof ILiquidProducer)
{
if(((ILiquidProducer)tileEntity).canProduceLiquid(this.type, side))
{
this.connectedBlocks[sideN] = tileEntity;
}
}
}
private 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;
}
/**
* onRecieveLiquid is called whenever a something sends a volume to the pipe (which is this block).
* @param vols - The amount of vol source is trying to give to this pipe
* @param side - The side of the block in which the liquid came from
* @return vol - The amount of rejected liquid that can't enter the pipe
*/
@Override
public int onReceiveLiquid(int type,int vol, ForgeDirection side)
{
if(type == this.type)
{
int rejectedVolume = Math.max((this.getStoredLiquid(type) + vol) - this.capacity, 0);
this.liquidStored += vol - rejectedVolume;
return rejectedVolume;
}
return vol;
}
@Override
public void updateEntity()
{
//cause the block to update itself every tick needs to be change to .5 seconds to reduce load
((BlockPipe)this.getBlockType()).updateConductorTileEntity(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
count++;
if(count >= 30 || intiUpdate)
{
PacketManager.sendTileEntityPacket(this, BasicPipesMain.channel, new Object[]{this.type});
count = 0;
intiUpdate = false;
}
if(!this.worldObj.isRemote)
{
byte connectedUnits = 0;
byte connectedConductors = 1;
int averageVolume = this.liquidStored;
Vector3 currentPosition = new Vector3(this.xCoord, this.yCoord, this.zCoord);
for(byte i = 0; i < 6; i++)
{
if(connectedBlocks[i] != null)
{
if(connectedBlocks[i] instanceof ILiquidConsumer || connectedBlocks[i] instanceof ILiquidProducer)
{
connectedUnits ++;
if(connectedBlocks[i] instanceof TileEntityPipe)
{
averageVolume += ((TileEntityPipe)connectedBlocks[i]).liquidStored;
connectedConductors ++;
}
}
}
}
//average volume used to control volume spread to pipes. Prevent one pipe getting all liquid when another is empty
averageVolume = Math.max(averageVolume/connectedConductors,0);
if(connectedUnits > 0)
{
for(byte i = 0; i < 6; i++)
{
if(connectedBlocks[i] != null)
{
//Spread the liquid among the different blocks
if(connectedBlocks[i] instanceof ILiquidConsumer && this.liquidStored > 0)
{
if(((ILiquidConsumer)connectedBlocks[i]).canRecieveLiquid(this.type,ForgeDirection.getOrientation(i)))
{
int transferVolumeAmount = 0; //amount to be moved
ILiquidConsumer connectedConsumer = ((ILiquidConsumer)connectedBlocks[i]);
if(connectedBlocks[i] instanceof TileEntityPipe && this.liquidStored > ((TileEntityPipe)connectedConsumer).liquidStored)
{
transferVolumeAmount = Math.max(Math.min(averageVolume - ((TileEntityPipe)connectedConsumer).liquidStored, this.liquidStored), 0);
}
else if(!(connectedConsumer instanceof TileEntityPipe))
{
transferVolumeAmount = this.liquidStored;
}
int rejectedVolume = connectedConsumer.onReceiveLiquid(this.type,transferVolumeAmount, ForgeDirection.getOrientation(i));
this.liquidStored = Math.max(Math.min(this.liquidStored - transferVolumeAmount + rejectedVolume, 5), 0);
}
}
if(connectedBlocks[i] instanceof ILiquidProducer && this.liquidStored < this.getLiquidCapacity(type))
{
if(((ILiquidProducer)connectedBlocks[i]).canProduceLiquid(this.type,ForgeDirection.getOrientation(i)))
{
int gainedVolume = ((ILiquidProducer)connectedBlocks[i]).onProduceLiquid(this.type,5-this.liquidStored, ForgeDirection.getOrientation(i));
this.onReceiveLiquid(this.type, gainedVolume, ForgeDirection.getOrientation(i));
}
}
}
}
}
}
}
/**
* @return Return the stored volume in this pipe.
*/
@Override
public int getStoredLiquid(int type)
{
return this.liquidStored;
}
@Override
public int getLiquidCapacity(int type)
{
return 5;
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.liquidStored = par1NBTTagCompound.getInteger("liquid");
this.type = par1NBTTagCompound.getInteger("type");
}
/**
* Writes a tile entity to NBT.
*/
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("liquid", this.liquidStored);
par1NBTTagCompound.setInteger("type", this.type);
}
//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) {
if(type == this.type)
{
return true;
}
return false;
}
//returns liquid type
public int getType() {
return this.type;
}
//used by the item to set the liquid type on spawn
public void setType(int rType) {
this.type = rType;
}
@Override
public void handlePacketData(NetworkManager network,
Packet250CustomPayload packet, EntityPlayer player,
ByteArrayDataInput data) {
try
{
int type = data.readInt();
if(worldObj.isRemote)
{
this.type = type;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,89 @@
package BasicPipes.pipes;
import net.minecraft.src.Block;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.electricity.TileEntityElectricUnit;
import universalelectricity.extend.IElectricUnit;
import BasicPipes.pipes.api.ILiquidProducer;
public class TileEntityPump extends TileEntityElectricUnit implements ILiquidProducer,IElectricUnit {
int dCount = 0;
float eStored = 0;
float eMax = 2000;
int wStored = 0;
int wMax = 10;
@Override
public void onDisable(int duration) {
dCount = duration;
}
@Override
public boolean isDisabled() {
if(dCount <= 0)
{
return false;
}
return true;
}
@Override
public void onUpdate(float watts, float voltage, ForgeDirection side) {
super.onUpdate(watts, voltage, side);
if (electricityRequest() > 0 && canConnect(side))
{
float rejectedElectricity = (float) Math.max((this.eStored + watts) - this.eMax, 0.0);
this.eStored = (float) Math.max(this.eStored + watts - rejectedElectricity, 0.0);
}
int bBlock = worldObj.getBlockId(xCoord, yCoord -1, zCoord);
if(bBlock == Block.waterStill.blockID && this.eStored > 1000 && this.wStored < this.wMax)
{
eStored -= 1000;
wStored += 1;
worldObj.setBlockAndMetadataWithNotify(xCoord, yCoord-1, zCoord, 0, 0);
}
}
@Override
public float electricityRequest() {
return Math.max(eMax - eStored,0);
}
@Override
public boolean canReceiveFromSide(ForgeDirection side) {
if(side != ForgeDirection.DOWN)
{
return true;
}
return false;
}
@Override
public float getVoltage() {
return 240;
}
@Override
public int getTickInterval() {
return 40;
}
@Override
public int onProduceLiquid(int type, int maxVol, ForgeDirection side) {
if(type == 1 && wStored > 0)
{
int tradeW = Math.min(maxVol, wStored);
wStored -= tradeW;
return tradeW;
}
return 0;
}
@Override
public boolean canProduceLiquid(int type, ForgeDirection side) {
if(type == 1 && side != ForgeDirection.DOWN)
{
return true;
}
return false;
}
}

View file

@ -0,0 +1,35 @@
package BasicPipes.pipes.api;
import net.minecraftforge.common.ForgeDirection;
public interface ILiquidConsumer
{
/**
* onRecieveLiquid
* @param vol - The amount this block received.
* @param side - The side of the block in which the liquid came from.
* @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);
/**
* You can use this to check if a pipe can connect to this liquid consumer to properly render the graphics
* @param forgeDirection - The side in which the electricity is coming from.
* @parm type - The type of liquid
* @return Returns true or false if this consumer can receive electricity at this given tick or moment.
*/
public boolean canRecieveLiquid(int type, ForgeDirection forgeDirection);
/**
* @return Return the stored liquid of type in this consumer.
*/
public int getStoredLiquid(int type);
/**
* @return Return the maximum amount of stored liquid this consumer can get.
*/
public int getLiquidCapacity(int type);
}

View file

@ -0,0 +1,30 @@
package BasicPipes.pipes.api;
import net.minecraftforge.common.ForgeDirection;
/**
* The UEIProducer interface is an interface that must be applied to all tile entities that can produce electricity.
* @author Calclavia
*
*/
public interface ILiquidProducer
{
/**
* onProduceLiquid
* block.
* @param type - the type of liquid
* @param maxvol - The maximum vol or requested volume
* @param side - The side
* @return vol - Return a vol of liquid type that is produced
*/
public int onProduceLiquid(int type, int maxVol, 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 canProduceLiquid(int type, ForgeDirection side);
}

View file

@ -0,0 +1,98 @@
package BasicPipes;
import net.minecraft.src.*;
public class ModelPipe extends ModelBase
{
//fields
ModelRenderer Middle;
ModelRenderer Right;
ModelRenderer Left;
ModelRenderer Back;
ModelRenderer Front;
ModelRenderer Top;
ModelRenderer Bottom;
public ModelPipe()
{
textureWidth = 64;
textureHeight = 32;
Middle = new ModelRenderer(this, 0, 0);
Middle.addBox(-1F, -1F, -1F, 4, 4, 4);
Middle.setRotationPoint(-1F, 15F, -1F);
Middle.setTextureSize(64, 32);
Middle.mirror = true;
setRotation(Middle, 0F, 0F, 0F);
Right = new ModelRenderer(this, 21, 0);
Right.addBox(0F, 0F, 0F, 6, 4, 4);
Right.setRotationPoint(2F, 14F, -2F);
Right.setTextureSize(64, 32);
Right.mirror = true;
setRotation(Right, 0F, 0F, 0F);
Left = new ModelRenderer(this, 21, 0);
Left.addBox(0F, 0F, 0F, 6, 4, 4);
Left.setRotationPoint(-8F, 14F, -2F);
Left.setTextureSize(64, 32);
Left.mirror = true;
setRotation(Left, 0F, 0F, 0F);
Back = new ModelRenderer(this, 0, 11);
Back.addBox(0F, 0F, 0F, 4, 4, 6);
Back.setRotationPoint(-2F, 14F, 2F);
Back.setTextureSize(64, 32);
Back.mirror = true;
setRotation(Back, 0F, 0F, 0F);
Front = new ModelRenderer(this, 0, 11);
Front.addBox(0F, 0F, 0F, 4, 4, 6);
Front.setRotationPoint(-2F, 14F, -8F);
Front.setTextureSize(64, 32);
Front.mirror = true;
setRotation(Front, 0F, 0F, 0F);
Top = new ModelRenderer(this, 21, 11);
Top.addBox(0F, 0F, 0F, 4, 6, 4);
Top.setRotationPoint(-2F, 8F, -2F);
Top.setTextureSize(64, 32);
Top.mirror = true;
setRotation(Top, 0F, 0F, 0F);
Bottom = new ModelRenderer(this, 21, 11);
Bottom.addBox(0F, 0F, 0F, 4, 6, 4);
Bottom.setRotationPoint(-2F, 18F, -2F);
Bottom.setTextureSize(64, 32);
Bottom.mirror = true;
setRotation(Bottom, 0F, 0F, 0F);
}
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);
this.renderMiddle();
this.renderBottom();
this.renderTop();
this.renderLeft();
this.renderRight();
this.renderBack();
this.renderFront();
}
public void renderMiddle() { Middle.render(0.0625F); }
public void renderBottom() { Bottom.render(0.0625F); }
public void renderTop() { Top.render(0.0625F); }
public void renderLeft() { Left.render(0.0625F); }
public void renderRight() { Right.render(0.0625F); }
public void renderBack() { Back.render(0.0625F); }
public void renderFront() { Front.render(0.0625F);}
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

@ -0,0 +1,22 @@
package BasicPipes;
import net.minecraftforge.client.MinecraftForgeClient;
import BasicPipes.pipes.TileEntityPipe;
import cpw.mods.fml.client.registry.ClientRegistry;
public class PipeClientProxy extends PipeProxy
{
@Override
public void preInit()
{
//Preload textures
MinecraftForgeClient.preloadTexture("/EUIClient/Textures/Items.png");
MinecraftForgeClient.preloadTexture("/EUIClient/Textures/blocks.png");
}
@Override
public void init()
{
ClientRegistry.registerTileEntity(TileEntityPipe.class, "pipe", new RenderPipe());
}
}

View file

@ -0,0 +1,57 @@
package BasicPipes;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import BasicPipes.pipes.TileEntityPipe;
public class RenderPipe extends TileEntitySpecialRenderer
{
int type = 0;
private ModelPipe model;
public RenderPipe()
{
model = new ModelPipe();
}
public void renderAModelAt(TileEntityPipe tileEntity, double d, double d1, double d2, float f)
{
//Texture file
type = tileEntity.getType();
switch(type)
{
case 0: bindTextureByName("/EUIClient/Textures/SteamPipe.png");break;
case 1: bindTextureByName("/EUIClient/Textures/WaterPipe.png");break;
//case 2: bindTextureByName("/eui/lavaPipe.png");break;
//case 3: bindTextureByName("/eui/oilPipe.png");break;
//case 4: bindTextureByName("/eui/fuelPipe.png");break;
//case 5: bindTextureByName("/eui/airPipe.png");break;
default:bindTextureByName("/EUIClient/Textures/DefaultPipe.png"); break;
}
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();
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) {
this.renderAModelAt((TileEntityPipe)tileEntity, var2, var4, var6, var8);
}
}

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

Before

Width:  |  Height:  |  Size: 770 B

After

Width:  |  Height:  |  Size: 770 B

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 658 B

Some files were not shown because too many files have changed in this diff Show more