Advertisement
Guest User

Untitled

a guest
Sep 11th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. package com.mightydanp.eot.block;
  2.  
  3. import java.util.Random;
  4.  
  5. import com.mightydanp.eot.EotCore;
  6. import com.mightydanp.eot.client.render.TextureEssenceOre;
  7. import com.mightydanp.eot.inventory.TileEntityEssenceOre;
  8. import com.mightydanp.eot.lib.BlockStrings;
  9. import com.mightydanp.eot.lib.References;
  10.  
  11. import cpw.mods.fml.common.registry.GameRegistry;
  12. import cpw.mods.fml.relauncher.Side;
  13. import cpw.mods.fml.relauncher.SideOnly;
  14. import net.minecraft.block.Block;
  15. import net.minecraft.block.material.Material;
  16. import net.minecraft.client.Minecraft;
  17. import net.minecraft.client.renderer.texture.IIconRegister;
  18. import net.minecraft.init.Blocks;
  19. import net.minecraft.item.Item;
  20. import net.minecraft.tileentity.TileEntity;
  21. import net.minecraft.util.IIcon;
  22. import net.minecraft.world.IBlockAccess;
  23. import net.minecraft.world.World;
  24.  
  25. public class BlockEssenceOre extends Block {
  26.  
  27. @SideOnly(Side.CLIENT)
  28. private IIcon blockIcon;
  29.  
  30. private final boolean isActive2;
  31.  
  32. protected BlockEssenceOre(String unlocalizedName, boolean isActive) {
  33. super(Material.rock);
  34. this.setCreativeTab(EotCore.eotTab);
  35. this.setBlockName(unlocalizedName);
  36. this.setTickRandomly(true);
  37. GameRegistry.registerBlock(this, unlocalizedName);
  38. isActive2 = isActive;
  39. }
  40.  
  41. @Override
  42. public int tickRate(World world) {
  43. return 10;
  44. }
  45.  
  46. public TileEntity createNewTileEntity(World world, int par2)
  47. {
  48. return new TileEntityEssenceOre();
  49. }
  50.  
  51. @SideOnly(Side.CLIENT)
  52. @Override
  53. public IIcon getIcon(int side, int meta)
  54. {
  55. return blockIcon ;
  56. }
  57.  
  58. public static void updateBlockState(boolean burning, World world, int x, int y, int z) {
  59. int direction = world.getBlockMetadata(x, y, z);
  60. TileEntity tileentity = world.getTileEntity(x, y, z);
  61.  
  62. if (burning) {
  63. world.setBlock(x, y, z, ModBlocks.EssenceStone);
  64. } else {
  65. world.setBlock(x, y, z, ModBlocks.EssenceStone);
  66. }
  67.  
  68. world.setBlockMetadataWithNotify(x, y, z, direction, 2);
  69.  
  70. if (tileentity != null) {
  71. tileentity.validate();
  72. world.setTileEntity(x, y, z, tileentity);
  73. }
  74. }
  75.  
  76. @SideOnly(Side.CLIENT)
  77. @Override
  78. public void registerBlockIcons(IIconRegister par1IconRegister){
  79. this.blockIcon = par1IconRegister.registerIcon(this.isActive2 ? References.RESOURCESPREFIX + BlockStrings.ESSENCESTONE_NAME + "Magic" : References.RESOURCESPREFIX + BlockStrings.ESSENCESTONE_NAME);
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement