Advertisement
Eragonn14900

Untitled

Dec 5th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. @SubscribeEvent //Turn Regular Bookcase into my partially empty one
  2. public void onPlayerClickEvent(RightClickBlock event)
  3. {
  4. EnumHand hand = event.getHand();
  5. ItemStack stacktoAdd = new ItemStack(Items.BOOK);
  6. ItemStack stack = event.getEntityPlayer().getHeldItem(hand);
  7. final IBlockState set2 = IntegratedBlocks.bookcases.getDefaultState().withProperty(BlockBookcaseMulti.TYPE, EnumBookshelf.two3); // 2/3 full
  8.  
  9. if (event.getEntity() instanceof EntityPlayer)
  10. {
  11. if(stack != null && event.getEntityPlayer().getHeldItem(hand).getItem() == Items.BOOK)
  12. {
  13. if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.BOOKSHELF)
  14. {
  15. if (!event.getWorld().isRemote)
  16. {
  17. //event.getWorld().setBlockState(event.getPos(), set2);
  18. //If the item is a book do nothing
  19. }
  20. }
  21. }
  22. else
  23. {
  24. if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.BOOKSHELF)
  25. {
  26. if (!event.getWorld().isRemote)
  27. {
  28. event.getWorld().setBlockState(event.getPos(), set2);
  29. //Set Vanilla Bookcase to my half filled one
  30. }
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement