Hey everyone, for the past however long, a friend and I have been slowly trying (and recently failing) to create our own private little mod that only has two little functions: change the player hit box to be either half the size of the normal player hit box or be 1 block taller than normal. In other words, one of us should be able to fit under 1 block while the other can only fit if the gap is at least 3 blocks tall.
We just need to get it to work for only the two of us on our private server. We also don't need to worry about eye level/model height because we are basically making this as an add-on to a separate mod that does that.
With that in mind, we were hoping to be able to use setSize() to take care of all our problems in life but it has not been working like that. It seems to change the hit box so long as you are colliding with something but it still acts like the default hit box either way. Our current code in question looks like this:
segment in KeyHandler.java
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
if (keySmall.isPressed()) {
System.out.println("THIS SHOULD BE VISIBLE IN THE LOG");
EntityPlayer player = event.player;
float width = 0.6f;
float height = 0.4f;
AccessThing.setSize(player, width, height);
}
if (keyLarge.isPressed()) {
System.out.println("THIS SHOULD BE PRETTY VISIBLE TOO");
EntityPlayer player = event.player;
float width = 0.6f;
float height = 2.0f;
AccessThing.setSize(player, width, height);
}
}
in AccessThing.java (Great name I know)
package net.minecraft.entity;
import net.minecraft.entity.player.*;
import net.minecraft.util.math.*;
public class AccessThing {
public static void setSize(EntityPlayer player, float width, float height) {
player.setSize(width, height);
}
}
Every test of this has been in singleplayer so far. Also, this isn't the most efficient code in the world. I'll be cleaning it up at some point in the future.
What are we missing that would get this working? Oh and it's fine if we need to get makeshift, we just need to get it to work.