Advertisement
Eragonn14900

Untitled

Nov 28th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. //Change Meta
  2. public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
  3. {
  4. if (IntegratedBlocks.bookcases.getDefaultState().withProperty(BlockBookcaseMulti.TYPE, EnumBookshelf.one1) != null)
  5. {
  6. System.out.println("hi");
  7.  
  8. if(heldItem.getItem() == Items.BOOK)
  9. {
  10. System.out.println("changed into 1");
  11. worldIn.setBlockState(pos, IntegratedBlocks.bookcases.getDefaultState(), 4);
  12. return true;
  13. }
  14.  
  15. }
  16. if (((EnumBookshelf)state.getValue(TYPE)).getMetadata() == 4)
  17. {
  18. if(heldItem.getItem() == Items.BOOK)
  19. {
  20. System.out.println("changed into 2");
  21. worldIn.setBlockState(pos, IntegratedBlocks.bookcases.getDefaultState(), 5);
  22. return true;
  23. }
  24. }
  25.  
  26. if (((EnumBookshelf)state.getValue(TYPE)).getMetadata() == 5)
  27. {
  28. if(heldItem.getItem() == Items.BOOK)
  29. {
  30. System.out.println("changed into 3");
  31. worldIn.setBlockState(pos, IntegratedBlocks.bookcases.getDefaultState(), 6);
  32. return true;
  33. }
  34. }
  35.  
  36. else
  37. {
  38. worldIn.setBlockToAir(pos);
  39. return true;
  40. }
  41. return true;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement