Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent //Turn Regular Bookcase into my partially empty one
- public void onPlayerClickEvent(RightClickBlock event)
- {
- EnumHand hand = event.getHand();
- ItemStack stacktoAdd = new ItemStack(Items.BOOK);
- ItemStack stack = event.getEntityPlayer().getHeldItem(hand);
- final IBlockState set2 = IntegratedBlocks.bookcases.getDefaultState().withProperty(BlockBookcaseMulti.TYPE, EnumBookshelf.two3); // 2/3 full
- if (event.getEntity() instanceof EntityPlayer)
- {
- if(stack != null && event.getEntityPlayer().getHeldItem(hand).getItem() == Items.BOOK)
- {
- if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.BOOKSHELF)
- {
- if (!event.getWorld().isRemote)
- {
- //event.getWorld().setBlockState(event.getPos(), set2);
- //If the item is a book do nothing
- }
- }
- }
- else
- {
- if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.BOOKSHELF)
- {
- if (!event.getWorld().isRemote)
- {
- event.getWorld().setBlockState(event.getPos(), set2);
- //Set Vanilla Bookcase to my half filled one
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement