Help fixing procedure that shrinks hitbox then makes it bigger again

Started by ultiCRAFTer on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help fixing procedure that shrinks hitbox then makes it bigger again
Sat, 09/14/2024 - 15:36 (edited)

I am creating a mod that adds an entity that i want to be able to crouch to get under smaller spaces. I already asked about this, and someone gave a good procedure. Here it is.

Overall, it works well, but there is one problem. So as you can see, it will shrink its hitbox if it detects a solid block 2 blocks in front of it, then it will make it back to normal, and that's the problem. when it shrinks it's hitbox and it's under a space that's smaller than it's original hitbox, it suffocates itself for a tick or so, because it rapidly changes between smaller and normal. So if it's under there long enough, it will die. So would anyone know how i could change so that it stays smaller until it doesn't detect a solid block? Or do you know a better procedure or way to do this? Please leave a detailed explanation, as i suck at modding. And please leave a picture of what it should look like if you can.

also, if you see the little unloaded image icon, just right click on it and left click "open image in new tab", and you should see it.

Thank you in advance!

Edited by ultiCRAFTer on Sat, 09/14/2024 - 15:36
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Run a check for if block at…
Sun, 09/15/2024 - 15:07

Run a check for if block at x y+1 z is air, if not then return 0.6, otherwise return 1

Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@fr6_17 something like this?…
Sun, 09/15/2024 - 16:05

@fr6_17 something like this?

It needs to have the x and z +2 so than it can detect the block in front of it, otherwise it can only become smaller if it's under the cieling, which isn't possible unless i spawn it.

Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i tried it, and it he still…
Sun, 09/15/2024 - 16:09

i tried it, and it he still switches back and forth. Could you explain a little more, or did i do something wrong?

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well the second procedure…
Mon, 09/16/2024 - 15:09

Well the second procedure image you got there is basically the same. So I dont know what you did, but either of these should work:

Also Is this procedure on tick cause if not then that might be the cause of it switching back and forth.

 

 

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also try changing outline to…
Mon, 09/16/2024 - 15:11

Also try changing outline to visual