How to make logs unbreakable by hand?

Started by GrayEtc on Sat, 06/06/2020 - 03:38

Topic category: Help with modding (Java Edition)

Last seen on 17:50, 10. Feb 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to make logs unbreakable by hand?
Sat, 06/06/2020 - 03:38

I’m planning on making the starting stages of the game more difficult, similar to RLCraft. How would I make wood unbreakable with just your hand, to where only wood or above could break it?

Last seen on 09:13, 18. Jun 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
make 2 versions of it and…
Sat, 06/06/2020 - 04:51

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 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I am so fired up right now…
Sat, 06/06/2020 - 04:54

I am so fired up right now with this mod idea! I have been wanting to do a mod like this for so long. My plans would be limiting the player inventory to 3 slots (main hand, offhand, inventory). Also, I would do similar things to this request. I almost want to join in on this project of yours!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

To cut to the chase, this is an event I came up with off the spot;

    @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);
            }
        }
    }

 

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Don't be mad if I do a…
Sat, 06/06/2020 - 04:54

Don't be mad if I do a similar mod on my own! Good luck to you!

Last seen on 17:50, 10. Feb 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Haha, the mod I’m working on…
Sat, 06/06/2020 - 05:47

Haha, the mod I’m working on will just have this in it and I won’t be going as far as you do most likely with it, but Thank you for the code! I’m quite inexperienced with it though, so how I would I go about implementing this string?

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You just chuck that tang…
Sat, 06/06/2020 - 05:50

You just chuck that tang right in 'er!

 

But actually, you can just put that snippet in any class as long as it is registered using;

		MinecraftForge.EVENT_BUS.register(new AnyDangClass());

You should probably just create a procedure, lock it, and put it in.

If you need more information or help. Post code, preferably in a pastebin/git. Or add me on discord!