Guest User

LiquidGlowstoneBlock

a guest
Nov 4th, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.25 KB | None | 0 0
  1. package yesodmod.general.block;
  2.  
  3. import java.io.IOException;
  4.  
  5. import yesodmod.general.Generic;
  6. import net.minecraft.block.material.Material;
  7. import net.minecraft.client.renderer.texture.IIconRegister;
  8. import net.minecraft.creativetab.CreativeTabs;
  9. import net.minecraft.util.IIcon;
  10. import net.minecraft.world.IBlockAccess;
  11. import net.minecraft.world.World;
  12. import net.minecraftforge.fluids.BlockFluidClassic;
  13. import net.minecraftforge.fluids.Fluid;
  14. import cpw.mods.fml.common.Mod.EventHandler;
  15. import cpw.mods.fml.common.event.FMLPreInitializationEvent;
  16. import cpw.mods.fml.relauncher.Side;
  17. import cpw.mods.fml.relauncher.SideOnly;
  18.  
  19. public class LiquidGlowstoneBlock extends BlockFluidClassic
  20. {
  21.     @SideOnly(Side.CLIENT)
  22.     public static IIcon blockIcon;
  23.     @SideOnly(Side.CLIENT)
  24.     public static IIcon flowingIcon;
  25.     @SideOnly(Side.CLIENT)
  26.     public static IIcon stillIcon;
  27.    
  28.     public LiquidGlowstoneBlock(Fluid fluid, Material material)
  29.     {
  30.         super(fluid, material);
  31.         setCreativeTab(CreativeTabs.tabMisc);
  32.     }
  33.    
  34.     @EventHandler // used in 1.6.2
  35.     public void preInit(FMLPreInitializationEvent event) throws IOException{
  36.  
  37.           Generic.liquidGlowstone.setIcons(blockIcon).setBlock(Generic.LiquidGlowstoneBlock);
  38.     }
  39.    
  40.     @Override
  41.     public IIcon getIcon(int side, int meta) {
  42.             return (side == 0 || side == 1)? stillIcon : flowingIcon;
  43.     }
  44.  
  45.     @SideOnly(Side.CLIENT)
  46.     @Override
  47.     public void registerBlockIcons(IIconRegister iconRegister) {
  48.             this.blockIcon = iconRegister.registerIcon("yesodmod:liquidglowstone");
  49.             this.stillIcon = iconRegister.registerIcon("yesodmod:liquidglowstonestill");
  50.             this.flowingIcon = iconRegister.registerIcon("yesodmod:liquidglowstoneflow");
  51.     }
  52.    
  53.    
  54.     @Override
  55.     public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
  56.             if (world.getBlock(x,  y,  z).getMaterial().isLiquid()) return true;
  57.             return super.canDisplace(world, x, y, z);
  58.     }
  59.    
  60.     @Override
  61.     public boolean displaceIfPossible(World world, int x, int y, int z) {
  62.             if (world.getBlock(x,  y,  z).getMaterial().isLiquid()) return true;
  63.             return super.displaceIfPossible(world, x, y, z);
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment