Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.