resonant-induction/minecraft/liquidmechanics/common/block/BlockPipe.java
Rseifert 183dc35c47 more Changes
*added Name to the color Enum
*added a new liquid call Waste liquid
*added effect for mixing liquids in pipes
*stored+filling=outcome
*lava+water = obby
*water+lava=cobble
*other+other=waste liquid
*Improve pipe render and create 14 new pipe textures
*Improved Tank render and creates some new textures
*Fixed lang file for all Blocks, items still don't work
*Fixed save issue using Compent Tags to save liquids
*Fixed Universal Pipe working with pumps
*Removed: Some crafting recipes plus fixed others
*Removed: Item version of pipe,tank, though a similar version is used
just for naming as a BlockItem
*Bug: Tanks don't work at all
2013-01-06 00:13:09 -05:00

91 lines
2.5 KiB
Java

package liquidmechanics.common.block;
import java.util.List;
import liquidmechanics.client.render.BlockRenderHelper;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.TabLiquidMechanics;
import liquidmechanics.common.tileentity.TileEntityPipe;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
public class BlockPipe extends BlockMachine
{
public BlockPipe(int id)
{
super("Pipe", id, Material.iron, TabLiquidMechanics.INSTANCE);
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
this.setHardness(1f);
this.setBlockName("lmPipe");
this.setResistance(3f);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which
* neighbor changed (coordinates passed are their own) Args: x, y, z,
* neighbor blockID
*/
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int blockID)
{
super.onNeighborBlockChange(world, x, y, z, blockID);
}
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockId(par2, par3, par4);
return var5 == 0 || blocksList[var5].blockMaterial.isReplaceable();
}
@Override
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
return true;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityPipe();
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(LiquidMechanics.blockPipe, 1, meta);
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < 16; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
}
}