Guest User

Sugarstone Plant

a guest
Feb 15th, 2018
137
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.thatguy64.redstonestew;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Random;
  5.  
  6. import cpw.mods.fml.relauncher.Side;
  7. import cpw.mods.fml.relauncher.SideOnly;
  8.  
  9. import net.minecraft.block.Block;
  10. import net.minecraft.block.BlockStem;
  11. import net.minecraft.client.renderer.texture.IIconRegister;
  12. import net.minecraft.init.Blocks;
  13. import net.minecraft.item.Item;
  14. import net.minecraft.item.ItemStack;
  15. import net.minecraft.util.IIcon;
  16. import net.minecraft.world.World;
  17.  
  18. public class PlantSugarStone extends BlockStem{
  19. protected PlantSugarStone(int par1) {
  20.     super(RedstoneStew.sugarstoneblock);
  21.     setCreativeTab(null);
  22. }
  23.     @SideOnly(Side.CLIENT)
  24.     private IIcon[] icons;
  25.    
  26.     @Override
  27.     @SideOnly(Side.CLIENT)
  28.     public void registerBlockIcons(IIconRegister par1IconRegister) {
  29.         icons = new IIcon[8];
  30.        
  31.         for (int i = 0; i < icons.length; i++) {
  32.             icons[i] = par1IconRegister.registerIcon(RedstoneStew.MODID + ":" + "sugarstoneplant" + i);
  33.         }
  34.     }
  35.    
  36.     @Override
  37.     @SideOnly(Side.CLIENT)
  38.     public IIcon getIcon(int par1, int par2) {
  39.         if(par2 < 0 ||par2 >= 8) {
  40.             System.out.println("Houston, we have a problem.");
  41.             return icons[0];
  42.         }
  43.         else
  44.             return icons[par2];
  45.     }
  46.    
  47.     @Override
  48.     protected boolean canPlaceBlockOn(Block p_149854_1_)
  49.     {
  50.         return p_149854_1_ == Blocks.stone;
  51.     }
  52.     @Override
  53.     public void updateTick(World parWorld, int parX, int parY, int parZ, Random parRand)
  54.     {
  55.         super.updateTick(parWorld, parX, parY, parZ, parRand);
  56.         int growStage = parWorld.getBlockMetadata(parX, parY, parZ) + 1;
  57.  
  58.         if (growStage > 7)
  59.         {
  60.             growStage = 7;
  61.         }
  62.  
  63.         parWorld.setBlockMetadataWithNotify(parX, parY, parZ, growStage, 2);
  64.     }
  65. }
RAW Paste Data