Package extracells.blocks

Source Code of extracells.blocks.BlockFluidTransitionPlane

package extracells.blocks;

import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import extracells.tileentity.TileEntityTransitionPlaneFluid;

public class BlockFluidTransitionPlane extends RotatableColorBlock
{

  @SideOnly(Side.CLIENT)
  Icon frontIcon;
  @SideOnly(Side.CLIENT)
  Icon sideIcon;
  @SideOnly(Side.CLIENT)
  Icon bottomIcon;
  @SideOnly(Side.CLIENT)
  Icon topIcon;

  public BlockFluidTransitionPlane(int id)
  {
    super(id, Material.rock);
    setCreativeTab(extracells.Extracells.ModTab);
    setUnlocalizedName("block.fluid.transitionplane");
    setHardness(2.0F);
    setResistance(10.0F);
  }

  @Override
  public TileEntity createNewTileEntity(World world)
  {
    return new TileEntityTransitionPlaneFluid();
  }

  @SideOnly(Side.CLIENT)
  public Icon getIcon(int side, int metadata)
  {
    return side == 3 ? frontIcon : side == 0 ? bottomIcon : side == 1 ? topIcon : sideIcon;
  }

  @Override
  @SideOnly(Side.CLIENT)
  public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
  {
    TileEntity tileentity = blockAccess.getBlockTileEntity(x, y, z);
    int metadata = blockAccess.getBlockMetadata(x, y, z);

    if (tileentity != null)
    {
      return side == metadata ? frontIcon : side == 0 ? bottomIcon : side == 1 ? topIcon : sideIcon;
    }
    return null;
  }

  @SideOnly(Side.CLIENT)
  public void registerIcons(IconRegister iconregister)
  {
    frontIcon = iconregister.registerIcon("extracells:fluid.transplane.front");
    sideIcon = iconregister.registerIcon("extracells:machine.side");
    bottomIcon = iconregister.registerIcon("extracells:machine.bottom");
    topIcon = iconregister.registerIcon("extracells:machine.top");
  }

  @Override
  public void onNeighborBlockChange(World world, int x, int y, int z, int neighbourID)
  {
    TileEntity blockTE = world.getBlockTileEntity(x, y, z);
    if (blockTE instanceof TileEntityTransitionPlaneFluid)
    {
      ((TileEntityTransitionPlaneFluid) blockTE).doWork();
    }
  }
}
TOP

Related Classes of extracells.blocks.BlockFluidTransitionPlane

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.