Posted December 17, 201410 yr 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.
December 17, 201410 yr 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.
December 17, 201410 yr 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.
December 17, 201410 yr 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.
December 17, 201410 yr Author Okay, Its just for testing. http://pastebin.com/VsNFKPP0 Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
December 17, 201410 yr 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
December 18, 201410 yr 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?
December 18, 201410 yr 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.
December 18, 201410 yr 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.
December 18, 201410 yr 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.