Jump to content

Custom bed doesn't let player sleep


DragonFerocity

Recommended Posts

Ok, why are minecraft source files in your repository?

Why is it under mcp? WHY ARE YOU NOT USING FORGE.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You imported your project into eclipse wrongly. Minecraft and Forge files should be a referenced jar, not raw .java files.

And even so you should have excluded them with the git-ignore file because distributing Minecraft's source files is not allowed.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Well, my first (uh...third) question is "Why are you not extending BlockBed?"

Question two...

    public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
    {
        return new ItemStack(Items.BED);
    }

Seriously?

 

Now, as to your problem, if you run the game in the debugger, you'll find this:

    public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable Entity player)
    {
        return this == net.minecraft.init.Blocks.BED;
    }

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

11 hours ago, Draco18s said:

Well, my first (uh...third) question is "Why are you not extending BlockBed?"

Question two...


    public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
    {
        return new ItemStack(Items.BED);
    }

Seriously?

 

Now, as to your problem, if you run the game in the debugger, you'll find this:


    public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable Entity player)
    {
        return this == net.minecraft.init.Blocks.BED;
    }

 

You underestimate me. I tried extending BlockBed before creating this topic and it didn't work, so I naturally went to the other possible solution: to create my own bed class based off of BlockBed.

Link to comment
Share on other sites

3 hours ago, TheSunCat said:

Wow... I am trying to make a mod like Good Night's Sleep, but for 1.11.2... U was wondering why I couldn't sleep. How would I fix that?

Here's how you fix it, override the isBed function inside Block.java:

public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable Entity player)
    {
        return true;
    }

for your custom bed class, whether or not it extends BlockBed or is basically a copy/paste of BlockBed that extends BlockHorizontal, you'll need to override that function to allow the player to actually sleep.

 

Technically you could override that function for any block and tell the game that it is indeed a valid place to sleep.

Link to comment
Share on other sites

16 minutes ago, TheSunCat said:

Is this possible? To override isBed() for every block already in the game?

 

Not easily, as you can't edit the Minecraft source code.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

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.