Advertisement
Guest User

Block

a guest
May 29th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.47 KB | None | 0 0
  1. package portuar.cubicBeyond.client.blocks.decondenseur;
  2.  
  3.  
  4. import java.util.Random;
  5.  
  6. import net.minecraft.block.Block;
  7. import net.minecraft.block.material.Material;
  8. import net.minecraft.entity.player.EntityPlayer;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.tileentity.TileEntity;
  11. import net.minecraft.world.World;
  12. import portuar.cubicBeyond.client.items.ItemCatalystBabyChicken;
  13. import portuar.cubicBeyond.client.items.ItemCatalystBabyCow;
  14. import portuar.cubicBeyond.client.items.ItemCatalystBabyPig;
  15. import portuar.cubicBeyond.client.items.ItemCatalystBabySheep;
  16. import portuar.cubicBeyond.client.items.ItemCatalystBat;
  17. import portuar.cubicBeyond.client.items.ItemCatalystCaveSpider;
  18. import portuar.cubicBeyond.client.items.ItemCatalystChicken;
  19. import portuar.cubicBeyond.client.items.ItemCatalystCow;
  20. import portuar.cubicBeyond.client.items.ItemCatalystCowMooshroom;
  21. import portuar.cubicBeyond.client.items.ItemCatalystCreeper;
  22. import portuar.cubicBeyond.client.items.ItemCatalystEnderman;
  23. import portuar.cubicBeyond.client.items.ItemCatalystPig;
  24. import portuar.cubicBeyond.client.items.ItemCatalystShearedSheep;
  25. import portuar.cubicBeyond.client.items.ItemCatalystSheep;
  26. import portuar.cubicBeyond.proxy.ClientProxy;
  27. import cpw.mods.fml.relauncher.Side;
  28. import cpw.mods.fml.relauncher.SideOnly;
  29.  
  30. public class BlockDecondenseur extends Block
  31. {
  32.  
  33.     public BlockDecondenseur()
  34.     {
  35.         super(Material.rock);
  36.     }
  37.  
  38.     public TileEntity createTileEntity(World world, int metadata)
  39.     {
  40.         return new TileEntityDecondenseur();
  41.     }
  42.  
  43.     public boolean hasTileEntity(int metadata)
  44.     {
  45.         return true;
  46.     }
  47.  
  48.     public boolean renderAsNormalBlock()
  49.     {
  50.         return false;
  51.     }
  52.  
  53.     public boolean isOpaqueCube()
  54.     {
  55.         return false;
  56.     }
  57.  
  58.    
  59.     @SideOnly(Side.CLIENT)
  60.     public int getRenderType()
  61.     {
  62.         return ClientProxy.renderInventoryTESRId;
  63.     }
  64.  
  65.     /**
  66.      * Called when a player hits the block. Args: world, x, y, z, player
  67.      */
  68.     public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player)
  69.     {
  70.         ItemStack stack = player.getCurrentEquippedItem(); 
  71.         TileEntityDecondenseur te = (TileEntityDecondenseur)world.getTileEntity(x, y, z);
  72.  
  73.         if(!world.isRemote && te.isUse == false && te != null)
  74.         {
  75.             if ((stack != null) && ((stack.getItem() instanceof ItemCatalystPig)))
  76.             {  
  77.                 te.coolDown = 150;
  78.                 te.isUse = true;
  79.                 te.itemId = 1;
  80.                
  81.                 --stack.stackSize;
  82.                 if(stack.stackSize == 0)
  83.                 {
  84.                 stack.stackSize = 0;
  85.                 }
  86.             }
  87.         }
  88.  
  89.  
  90.     }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement