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

NOTE: Before yelling at me for posting such a mention, please keep in mind that I am trying to do this without a full class patch; I found a tutorial for that, but didn't want to create incompatibilities.

 

I am trying to add a sound for when a player sleeps in a bed.  Sadly enough, when I was looking at what that would take, it appears an edit to the onBlockActivated function in BlockBed would need to be made, and I don't have very many ideas as to going about and making this change.

 

I do know that you can edit fields with reflection or asms, but this is adding an entire line to a base class, not simply changing a field.

 

Any help would be greatly appreciated.

 

Okay, when using the solution given below, everything works the way it should EXCEPT for the conditional regarding EnumStatus; through tests I have concluded the event always seems to return null for its status.  Thoughts?

 

~zombiepig333

    @SubscribeEvent
    public void onSleep(PlayerSleepInBedEvent event) {
        if(event.result == EntityPlayer.EnumStatus.OK)
        event.entityPlayer.worldObj.playSoundEffect(event.entityPlayer.posX, event.entityPlayer.posY, event.entityPlayer.posZ, "random.successful_hit", 1.0F, 0.1F);
    }

  • Author

My god- I forgot to look there.  Welp, another derp for me :P.  Haven't really done this kind of stuff before, so thanks for the help- now that I know where all these events are things should be muuuuuuuch easier.

 

Honestly, thanks a ton.  I should have looked through more of the documentation before posting this.

 

~zombiepig333

 

Edit: Ran into another problem, and I don't think it is of my doing this time.  Updated the first post with info.

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.