8b1179699f
Model is not fully done since i want to get the valve to set on diffrent faces when the top is in use. Also want it to rotate a bit when powered by redstone. Also worked on connectionHelper and switch a few of the itemRenders to an actual itemRenderHelper so they look nice in the inventory and in the players hand.
91 lines
2.4 KiB
Java
91 lines
2.4 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 -1;
|
|
}
|
|
|
|
/**
|
|
* Lets the block know when one of its neighbor changes. Doesn't know which
|
|
* neighbor changed (coordinates passed are their own) Args: x, y, z,
|
|
* neighbor blockID
|
|
*/
|
|
@Override
|
|
public void onNeighborBlockChange(World world, int x, int y, int z, int blockID)
|
|
{
|
|
super.onNeighborBlockChange(world, x, y, z, blockID);
|
|
}
|
|
|
|
@Override
|
|
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
|
{
|
|
int var5 = par1World.getBlockId(par2, par3, par4);
|
|
return var5 == 0 || blocksList[var5].blockMaterial.isReplaceable();
|
|
}
|
|
|
|
@Override
|
|
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public TileEntity createNewTileEntity(World var1)
|
|
{
|
|
return new TileEntityPipe();
|
|
}
|
|
|
|
@Override
|
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
|
{
|
|
int meta = world.getBlockMetadata(x, y, z);
|
|
return new ItemStack(LiquidMechanics.blockPipe, 1, meta);
|
|
}
|
|
|
|
@Override
|
|
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
|
{
|
|
for (int i = 0; i < 16; i++)
|
|
{
|
|
par3List.add(new ItemStack(par1, 1, i));
|
|
}
|
|
}
|
|
}
|