Advertisement
Eragonn14900

Untitled

Nov 29th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. //Change Meta
  2. @Override
  3. public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
  4. {
  5. ItemStack stacktosubtract = new ItemStack(Items.BOOK);
  6. ItemStack stack = playerIn.getHeldItem(hand);
  7.  
  8. final IBlockState set0 = IntegratedBlocks.bookcases.getDefaultState().withProperty(BlockBookcaseMulti.TYPE, EnumBookshelf.one1); // Empty
  9. final IBlockState set1 = IntegratedBlocks.bookcases.getDefaultState().withProperty(BlockBookcaseMulti.TYPE, EnumBookshelf.two2); // 1/3 full
  10. final IBlockState set2 = IntegratedBlocks.bookcases.getDefaultState().withProperty(BlockBookcaseMulti.TYPE, EnumBookshelf.two3); // 2/3 full
  11. final IBlockState set3 = IntegratedBlocks.bookcases.getDefaultState().withProperty(BlockBookcaseMulti.TYPE, EnumBookshelf.three1);// full
  12.  
  13.  
  14. if(stack != null && playerIn.getHeldItemMainhand().getItem() == Items.BOOK)
  15. {
  16. if (state.getValue(BlockBookcaseMulti.TYPE) == EnumBookshelf.one1)
  17. {
  18. System.out.println("changed into 3");
  19. worldIn.setBlockState(pos, set1);
  20. //--stacktosubtract.stackSize;
  21. return true;
  22. }
  23. //if (IntegratedBlocks.bookcases.getDefaultState().getValue(BlockBookcaseMulti.TYPE) == EnumBookshelf.two2)
  24. if (state.getValue(BlockBookcaseMulti.TYPE) == EnumBookshelf.two2)
  25. {
  26. System.out.println("changed into 4");
  27. worldIn.setBlockState(pos, set2);
  28. //--stacktosubtract.stackSize;
  29. return true;
  30. }
  31. else
  32. {
  33. return false;
  34. }
  35. }
  36. else
  37. {
  38. if(stack != null)
  39. {
  40. if (IntegratedBlocks.bookcases.getDefaultState().getValue(BlockBookcaseMulti.TYPE) == EnumBookshelf.two2)
  41. {
  42. System.out.println("changed into 1");
  43. worldIn.setBlockState(pos, this.blockState.getBaseState().withProperty(TYPE, EnumBookshelf.one1));
  44. //++stacktosubtract.stackSize;
  45. return true;
  46. }
  47. }
  48. }
  49. return true;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement