Posted April 20, 20178 yr 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.
April 20, 20178 yr Ok, why are minecraft source files in your repository? Why is it under mcp? WHY ARE YOU NOT USING FORGE. Edited April 20, 20178 yr 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.
April 20, 20178 yr Author I'm using forge, I had to put the MC files there so that Eclipse would read them as actual files correctly.
April 20, 20178 yr 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.
April 20, 20178 yr Author Regardless this isn't answering my question Draco18s. I removed the MC source from my github repo. Will you help me now? Thanks a lot...
April 20, 20178 yr 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.
April 20, 20178 yr 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.
April 20, 20178 yr 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.
April 24, 20178 yr 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.