Jump to content

Recommended Posts

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.

Posted

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

Posted

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?

Posted

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.

Posted

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.

Posted

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

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