Advertisement
TitanChase

Untitled

Apr 26th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. package mods.chase.sm.fluids.fuild;
  2.  
  3. import javax.swing.Icon;
  4.  
  5. import mods.chase.sm.blocks.SMBlocks;
  6. import mods.chase.sm.references.SMNameReferences;
  7. import net.minecraft.block.material.Material;
  8. import net.minecraft.client.renderer.texture.IIconRegister;
  9. import net.minecraft.creativetab.CreativeTabs;
  10. import net.minecraft.util.IIcon;
  11. import net.minecraft.world.IBlockAccess;
  12. import net.minecraft.world.World;
  13. import net.minecraftforge.fluids.BlockFluidClassic;
  14. import net.minecraftforge.fluids.Fluid;
  15. import cpw.mods.fml.relauncher.Side;
  16. import cpw.mods.fml.relauncher.SideOnly;
  17.  
  18. public class SMProtonFluid extends BlockFluidClassic
  19. {
  20.  
  21. @SideOnly(Side.CLIENT)
  22. protected IIcon stillIcon;
  23. @SideOnly(Side.CLIENT)
  24. protected IIcon flowingIcon;
  25.  
  26. public SMProtonFluid(Fluid fluid, Material material)
  27. {
  28. super(fluid, material);
  29. this.setBlockName("yourFluid");
  30. setCreativeTab(CreativeTabs.tabMisc);
  31. SMBlocks.register(this);
  32. }
  33.  
  34. @Override
  35. public IIcon getIcon(int side, int meta)
  36. {
  37. return (side == 0 || side == 1) ? stillIcon : flowingIcon;
  38. }
  39.  
  40. @SideOnly(Side.CLIENT)
  41. @Override
  42. public void registerBlockIcons(IIconRegister iconRegister)
  43. {
  44. stillIcon = iconRegister.registerIcon(SMNameReferences.MOD.ID + ":fluidStill.png");
  45. flowingIcon = iconRegister.registerIcon(SMNameReferences.MOD.ID + ":fluidFlowing.png");
  46. }
  47.  
  48. @Override
  49. public boolean canDisplace(IBlockAccess world, int x, int y, int z)
  50. {
  51. if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
  52. return super.canDisplace(world, x, y, z);
  53. }
  54.  
  55. @Override
  56. public boolean displaceIfPossible(World world, int x, int y, int z)
  57. {
  58. if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
  59. return super.displaceIfPossible(world, x, y, z);
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement