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

Hello,

 

I wonder if there's a "onHitBlockByPlayer()" event into EntityPlayer's @SubscribeEvent with which is possible to retrieve all block affected attributes ??

 

thank you so much

  • Author

I found this code but crash mc:

 

 

 

Into mainMod Class:

    @EventHandler

    public void Init(FMLInitializationEvent event)

    {

    MinecraftForge.EVENT_BUS.register(new ServerEventBlock());  <=== ERROR LINE

....

 

Into ServerEventBlock Class:

public class ServerEventBlock {

 

    @SubscribeEvent

    public void onBreakBlock(BreakEvent event, Block block, EntityPlayer player, int meta) {

    if(block instanceof BlockLog){

                  ......

    }

    }

 

 

 

Crash:

 

 

 

[22:49:25] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue

[22:49:25] [Client thread/ERROR] [FML]:

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML{7.10.85.1232} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1232.jar) Unloaded->Constructed->Pre-initialized->Initialized

Forge{10.13.2.1232} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1232.jar) Unloaded->Constructed->Pre-initialized->Initialized

CodeChickenCore{1.0.2.9} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

SummonSphere{@VERSION@} [summon Sphere Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored

DamageIndicatorsMod{3.2.0} [Damage Indicators] ([1.7.10]DamageIndicatorsMod-3.2.0.jar) Unloaded->Constructed->Pre-initialized->Initialized

eplus{3.0.2-d} [Enchanting Plus] (EnchantingPlus-1.7.10-3.0.2-d.jar) Unloaded->Constructed->Pre-initialized->Initialized

AencEx{0.0.1} [AencEx] (MoreEnchantments-1.7.X-1.1.jar) Unloaded->Constructed->Pre-initialized->Initialized

me{1.1} [More Enchantments] (MoreEnchantments-1.7.X-1.1.jar) Unloaded->Constructed->Pre-initialized->Initialized

MoreEnchants{1.3.0} [MoreEnchants] (MoreEnchants-MC1.7-1.3.1.jar) Unloaded->Constructed->Pre-initialized->Initialized

[22:49:25] [Client thread/ERROR] [FML]: The following problems were captured during this phase

[22:49:25] [Client thread/ERROR] [FML]: Caught exception from SummonSphere

java.lang.IllegalArgumentException: Method public void com.summonsphere.main.ServerEventBlock.onBreakBlock(net.minecraftforge.event.world.BlockEvent$BreakEvent,net.minecraft.block.Block,net.minecraft.entity.player.EntityPlayer,int) has @SubscribeEvent annotation, but requires 4 arguments.  Event handler methods must require a single argument.

at cpw.mods.fml.common.eventhandler.EventBus.register(EventBus.java:72) ~[forgeSrc-1.7.10-10.13.2.1232.jar:?]

at com.summonsphere.main.mainRegistry.Init(mainRegistry.java:108) ~[bin/:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forgeSrc-1.7.10-10.13.2.1232.jar:?]

at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forgeSrc-1.7.10-10.13.2.1232.jar:?]

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.7.10-10.13.2.1232.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) [Loader.class:?]

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at GradleStart.bounce(GradleStart.java:107) [start/:?]

at GradleStart.startClient(GradleStart.java:100) [start/:?]

at GradleStart.main(GradleStart.java:55) [start/:?]

[22:49:25] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----

// Why did you do that?

 

 

    
    @SubscribeEvent
    public void onBreakBlock(BreakEvent event, [b]Block block, EntityPlayer player, int meta[/b]) {
    if(block instanceof BlockLog){
                   ......
    }
    }

 

The method only takes the event not Block block, EntityPlayer player, int meta. The event will contain all of the info you require.

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.