You must have the appropriate level to use a weapon

Started by KuBeUsz on

Topic category: Help with modding (Java Edition)

Last seen on 23:59, 19. Feb 2022
Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You must have the appropriate level to use a weapon
Mon, 06/15/2020 - 15:39 (edited)

sorry for my english...

It is possible to make a level system like in RPGs that makes you wouldn't give you use weapon or armor without the appropriate level?

If so, how?

Edited by KuBeUsz on Mon, 06/15/2020 - 15:39
Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This has already been…
Mon, 06/15/2020 - 15:51

This has already been discussed before recently. So please check other posts before posting.

https://mcreator.net/forum/62151/how-make-logs-unbreakable-hand

 

 

This method is flawless. So if you know how to code you can switch things around to fit your needs.

@SubscribeEvent
    public void harvestCheck(PlayerEvent.BreakSpeed event)
    {
        BlockState block = event.getState();
        if (block.getBlock() instanceof LogBlock)
        {
            PlayerEntity player = event.getPlayer();
            ItemStack item = player.getItemStackFromSlot(EquipmentSlotType.MAINHAND);
            if (!(item.getItem() instanceof AxeItem))
            {
                event.setCanceled(true);
            }
        }
    }

However, @thesupermodder stated this (I haven't checked it to made sure it would work);

 

make 2 versions of it and use trigger and procedures to change it to a breakable version of this block.

Note:hardness should more than or equal to 10,000 but do not check "is block unbreakable?"

Last seen on 23:59, 19. Feb 2022
Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for help!  
Tue, 06/16/2020 - 09:09

Thanks for help!