Jump to content

JanneSoon

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by JanneSoon

  1. 20 hours ago, Zetko said:

    Also, extend BlockHorizontal instead of BaseHarshenFacedBlock because trySleep() checks if the block is an instance of BlockHorizontal.

    Yes, but i can sleep on the bed. If the check would fail, i couldn't. 

    Oh my god, wait, it fixed the amazing placing bug! Now i can sleep actually on the bed, but only on the head part. If i right click on the bottom part, player lays 1 block away. And i can fix it, gonna just put a check for if its the bottom part so sleeping position will be changed into head part's pos. I don't really know but it's amazing!

  2. 21 hours ago, Zetko said:

    Could you change 

    
    if (state.getBlock() != HarshenBlocks.BLOODY_BED_HEAD)
    {
    	return true;
    }

    into this:

    
    if (state.getBlock() != this)
    {
    	return true;
    }

     

    Tell me if it works.

    I did this too. nothing different. But... Sleeping from the bottom part is different than the head part. It's 1 block away different. But placing is still not correct

  3. 14 minutes ago, Zetko said:

    Could you try creating a new BlockPos between lines 63 and 64, before you offset it, like this:

    
    BlockPos pos = pos;

    That might be the problem.

    You mean this, right? (image)

    If so, it didn't work too. :(

    And it didn't fix the insane place bug that happens after lay on the vanilla bed then get up.

    To explain this bug more:

    I create a new world, place my custom beds, then try to sleep on them(only to lay on) the player lays on just 1 block away from the bed. So, pretty close to be fixed. But when i place a vanilla bed, right click then leave the bed, then try to lay on my custom bed, player lays bit more away (about 2-3 blocks).

    asd.PNG

  4. 11 minutes ago, Zetko said:

    Is there a difference if you right-click on the leg and head part of the bed? Could you record it?

    I tested, and no, theres no difference. BUT with out that code that i committed about 10 mins ago, the place is different.

    But the weird point is, the place that player lies, is getting insane after i sleep on any vanilla bed in the world. Isn't it weird?

  5. 3 minutes ago, Zetko said:

    You should add a version of the vanilla bed offset code between lines 68 and 69 of your BaseBloodyBed class.

     

    The vanilla offset code:

    
    if (state.getValue(PART) != BlockBed.EnumPartType.HEAD) {
    	pos = pos.offset((EnumFacing)state.getValue(FACING));
    	state = worldIn.getBlockState(pos);
    
    	if (state.getBlock() != this) {
    		return true;
    	}
    }
    
    net.minecraft.world.WorldProvider.WorldSleepResult sleepResult = worldIn.provider.canSleepAt(playerIn, pos);

     

    Yes i understood you, and i did it in this commit. Please take a look. Because it's still the same, not working :(

  6. 2 hours ago, Zetko said:

    You should keep the bed part facing the same as in the vanilla bed, sorry if I confused you. I was only pointing this out because you were offsetting in both parts of the bed in the facing direction. 

     

    I looked through your code and I don't see the offset code. Could you please point me where it is?

    Did you delete it?

    I just made a commit after reading your first comment, and shared the link of that commit in the last comment. Nothing else. And i don't understand what you mean by offset code :S

    About the first sentence, i already did it same as in the vanilla bed? Sorry if i'm stupid at some point.

  7. 16 hours ago, Zetko said:

    I suspect the problem is that the sleep location depends on which part of the bed you click. You could test that by right-clicking on the bottom and the head part of the bed and see if your sleeping position changes.

     

    This is probably because both your parts of the bed are facing in the same direction, and you are offsetting the sleeping position in the same direction both times as both parts of the bed extend BaseBloodyBed.

     

    
    73.			pos = pos.offset((EnumFacing)state.getValue(FACING));
    .
    .
    .
    82.			net.minecraft.world.WorldProvider.WorldSleepResult sleepResult = worldIn.provider.canSleepAt(playerIn, pos);

     

    I think you should try disabling the offset on the head part of the bed and see if that fixes your problem.

     

    You should also look at the vanilla code for a bed, it offsets the position only when the block is the bottom bed.

    
    if (state.getValue(PART) != BlockBed.EnumPartType.HEAD) {
    	pos = pos.offset((EnumFacing)state.getValue(FACING));
    	state = worldIn.getBlockState(pos);
    
    	if (state.getBlock() != this) {
    		return true;
    	}
    }
    
    net.minecraft.world.WorldProvider.WorldSleepResult sleepResult = worldIn.provider.canSleepAt(playerIn, pos);

     

    Thank you for your help. See the commit i did just now: https://github.com/JanneSoon/HarshenUniverse/commit/3675f103a9b507afff3dcbc752a54ba18cc9746a

    The lying position changes when try to sleep from the bottom part, you're right. But it's still buggy, the sleeping place still not correct, not exactly on the bed.

    You also said that direction shouldn't be same with both parts. But on vanilla bed, both parts' facing is same? While looking to vanilla bed's both parts, only "part" value changes, rest is same (minecraft:bed, facing:)

  8. Hello. Trying to add a custom bed. All is working, but player lies on wrong place when sleep on it, as you can see in the video below:

    The white bed is the vanilla bed. Other beds are the bed that i add.

    It's not a huge problem, but i want to fix this. Thanks for incoming answers.

    It's on MC 1.12.2, Forge 2758

  9. Hello everyone. I'm stuck at somewhere in modding. I need to customize the arrow drop (getting the arrow back from the ground you shot). All i want is; the EntityArrow on the ground gives Broken Arrow(my mod item) by a chance instead of Arrow item from vanilla. Isn't it possible to do?

    I looked into LivingDropsEvent, EntityItemPickupEvent and ItemPickupEvent but i couldn't find a way to do it. These events fired only when the player pickups an arrow as an item(dropped item) from the ground. Help me please :(

    Thank you.

    I'm currently on 1.12.2

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.