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

I'm creating a custom that just looks aesthetically different from the base bed. However when I use the bed, it doesn't let the player sleep. 

 

Here's my code.

 

I figure I probably have to override a few methods but I'm not sure which ones and the only help I can find online is fro MC 1.7.* which is of no help.

 

Thanks.

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.

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.

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.

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

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

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/

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.