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 have a problem about my colored bed.

 

When i right click the "Blue bed" it flashes into the bed and goes back out withing a half second.

 

Everything works good exept that part, it just won't get into bed ant sleep i see "Leave bed" for a flash of time and then you get out of the bed. It doesn't crahses or anything like that, no log message, nothing

I think its with the BlockBlueBed file, i dont see a reason why it is at the ItemBlueBed, but for sure iam posting it below.

 

Please help.

 

ItemBlueBed.java

http://pastebin.com/uiMi5i1g

BlockBlueBed.java

http://pastebin.com/z12Kw6cX

 

 

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

  • Author

What line? An what Class file?

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

  • Author

Like public class BlockBlueBed extends BlockDirectional? or what do you mean?

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

  • Author

Nope, Doesn't work, it keeps going into bed for a minimum of time and goes back out of the bed.

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

Hi

 

I suggest you put a breakpoint in the following two places:

EntityPlayer.sleepInBedAt()

and

EntityPlayer.wakeUpPlayer()

That should help you narrow down whether the player is going to sleep correctly, and why they are waking up again.

 

-TGG

I'm fairly certain that there are parts of the EntityPlayer file that point directly to Blocks.Bed

 

Unsure exactly how to go around that, but when I was messing around with making new beds a few versions ago, I had to change something in the EntityPlayer file to accept new types of beds, even though I was extending the BlockBed file. I wasn't using forge at the time. Might want to check those files as well?

I'm fairly certain that there are parts of the EntityPlayer file that point directly to Blocks.Bed

 

Unsure exactly how to go around that, but when I was messing around with making new beds a few versions ago, I had to change something in the EntityPlayer file to accept new types of beds, even though I was extending the BlockBed file. I wasn't using forge at the time. Might want to check those files as well?

Nope. Forge made a hook for that.

 

@kander16:

I don't see you overriding isBed() in your blocks class. You need to do that in order for it to be recognized as a bed. (The original implementation checks if the block instance is

Blocks.bed

, so it will return false on your block instance).

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • Author

Yes, it works!

 

Know I know what I was forgotten.

Just the @Override Anotation with

 

    public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player)

    {

        return this == Living.blockBlueBed;

    }

 

In it.

 

 

Also, is there a way to work more efficient, like

return this == Living.blockBlueBed OR Living.blockOrangeBed?

 

Thanks!

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

You can make a super class BlockColoredBed and have all your custom colored beds extend that class.

Then in your superclass, override isBed and check if

this instanceof BlockColoredBed

.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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.