Posted May 29, 20223 yr hi, i wrote a little procedure for the item, it works great, but i wish i could put the skeleton skull and the skeleton skull with the skeleton without pressing shift. here is my code: @SuppressWarnings("deprecation") @Override public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if(player.getHeldItem(hand).getItem() == CoSRPGItems.CosoriteScrap.get()) { if (!world.isRemote()) { BlockPos YblockPos = new BlockPos(pos.getX(),pos.getY() + 1,pos.getZ()); BlockState Yblock = world.getBlockState(YblockPos); if(Yblock.getBlock() == Blocks.SKELETON_SKULL || Yblock.getBlock() == Blocks.WITHER_SKELETON_SKULL) { if (!player.isCreative()) player.getHeldItem(hand).shrink(1); world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.PARTICLE_SOUL_ESCAPE, SoundCategory.BLOCKS, 1.7f, 0.7f); world.setBlockState(pos.up(1), Blocks.AIR.getDefaultState()); if (!player.inventory.addItemStackToInventory(new ItemStack(CoSRPGItems.Cosorite.get()))) player.dropItem(new ItemStack(CoSRPGItems.Cosorite.get()), false); } } else return ActionResultType.FAIL; } return ActionResultType.CONSUME; } how to implement it?
May 30, 20223 yr Author 7 hours ago, diesieben07 said: Check the held item and return ActionResultType.PASS to pass the action on to the item. it worked, thanks!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.