Jump to content

Event RightClickBlock fired 4 times


Zacomat

Recommended Posts

I'm trying the RightClickBlock event.

In the mod class i have a method for handling the event:

 

this is the class declaration:

@Mod(ExampleMod.MODID)

@Mod.EventBusSubscriber

public class ExampleMod { ...

 

and this is my static method in ExampleMod class:

@SubscribeEvent

public static void onBlockRichtClick(RightClickBlock e) {

    LOGGER.info("HELLO FROM onBlockRichtClick " + e + " phase=" + e.getPhase() + " isRemote=" + e.getPlayer().world.isRemote);

    if (e.getPlayer().world.isRemote) {

        LOGGER.info("onBlockRichtClick world.isRemote=true bookshelves.silkRequired=" + BookshelfConfig.silkRequiredValue.get().toString());

        LOGGER.info("onBlockRichtClick world.isRemote=true bookshelves.items=" + BookshelfConfig.itemsValue.get().toString());

        LOGGER.info("onBlockRichtClick world.isRemote=true bookshelves.books=" + BookshelfConfig.booksValue.get().toString());

        LOGGER.info("onBlockRichtClick world.isRemote=true bookshelves.silkRequired=" + BookshelfConfig.silkRequired);

        LOGGER.info("onBlockRichtClick world.isRemote=true bookshelves.items=" + BookshelfConfig.items);

        LOGGER.info("onBlockRichtClick world.isRemote=true bookshelves.books=" + BookshelfConfig.books);

    } else {

        LOGGER.info("onBlockRichtClick world.isRemote=false bookshelves.silkRequired=" + BookshelfConfig.silkRequiredValue.get().toString());

        LOGGER.info("onBlockRichtClick world.isRemote=false bookshelves.items=" + BookshelfConfig.itemsValue.get().toString());

        LOGGER.info("onBlockRichtClick world.isRemote=false bookshelves.books=" + BookshelfConfig.booksValue.get().toString());

        LOGGER.info("onBlockRichtClick world.isRemote=false bookshelves.silkRequired=" + BookshelfConfig.silkRequired);

        LOGGER.info("onBlockRichtClick world.isRemote=false bookshelves.items=" + BookshelfConfig.items);

        LOGGER.info("onBlockRichtClick world.isRemote=false bookshelves.books=" + BookshelfConfig.books);

    }

}

 

but this is the logger output:

[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: HELLO FROM onBlockRichtClick net.minecraftforge.event.entity.player.PlayerInteractEvent$RightClickBlock@5b160208 phase=NORMAL isRemote=true
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.silkRequired=true
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.items=[minecraft:painting, minecraft:paper, minecraft:filled_map, minecraft:item_frame, minecraft:map]
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.books=[minecraft:book, minecraft:writable_book, minecraft:written_book, minecraft:enchanted_book]
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.silkRequired=true
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.items=[item_frame, paper, filled_map, painting, map]
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.books=[written_book, writable_book, book, enchanted_book]
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: HELLO FROM onBlockRichtClick net.minecraftforge.event.entity.player.PlayerInteractEvent$RightClickBlock@36ec4071 phase=NORMAL isRemote=true
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.silkRequired=true
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.items=[minecraft:painting, minecraft:paper, minecraft:filled_map, minecraft:item_frame, minecraft:map]
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.books=[minecraft:book, minecraft:writable_book, minecraft:written_book, minecraft:enchanted_book]
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.silkRequired=true
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.items=[item_frame, paper, filled_map, painting, map]
[08:20:29] [Render thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=true bookshelves.books=[written_book, writable_book, book, enchanted_book]
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: HELLO FROM onBlockRichtClick net.minecraftforge.event.entity.player.PlayerInteractEvent$RightClickBlock@78512fcc phase=NORMAL isRemote=false
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.silkRequired=true
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.items=[minecraft:painting, minecraft:paper, minecraft:filled_map, minecraft:item_frame, minecraft:map]
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.books=[minecraft:book, minecraft:writable_book, minecraft:written_book, minecraft:enchanted_book]
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.silkRequired=true
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.items=[item_frame, paper, filled_map, painting, map]
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.books=[written_book, writable_book, book, enchanted_book]
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: HELLO FROM onBlockRichtClick net.minecraftforge.event.entity.player.PlayerInteractEvent$RightClickBlock@5b675fb6 phase=NORMAL isRemote=false
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.silkRequired=true
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.items=[minecraft:painting, minecraft:paper, minecraft:filled_map, minecraft:item_frame, minecraft:map]
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.books=[minecraft:book, minecraft:writable_book, minecraft:written_book, minecraft:enchanted_book]
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.silkRequired=true
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.items=[item_frame, paper, filled_map, painting, map]
[08:20:29] [Server thread/INFO] [co.ex.ex.ExampleMod/]: onBlockRichtClick world.isRemote=false bookshelves.books=[written_book, writable_book, book, enchanted_book]

 

Why there are 4 different instance of the event?

Link to comment
Share on other sites

Specifically once on each side for each hand.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.