Jan5676 Posted March 20, 2025 Report Posted March 20, 2025 Hey, I had a really simple idea I tried to implement via a new Block Class, the Sliding Pole. The idea is basically, it acts like a ladder, but increases your downward (sneak) movement by 3 times while slowing you to 1/3 when climbing it. I set the climbable property to true and fiddled a bit with the OnEntityCollide method. There is a default speed modifier applied (entityAgent.SidedPos.Motion) that only counts when actively walking into the block, however I didnt't know how to adjust the default "sneak" and "jump" functionality when hanging or rather hovering on a ladder. The documentation for this unfortunately wasn't very helpful and I feel like climbing behaviour is implemented at another place I don't know about. This is the code I changed: public override void OnEntityCollide(IWorldAccessor world, Entity entity, BlockPos pos, BlockFacing facing, Vec3d collideSpeed, bool isImpact) { if (entity.Properties.CanClimb && entity is EntityAgent) { EntityAgent entityAgent = entity as EntityAgent; if (!new bool?(entityAgent.Controls.Sneak).GetValueOrDefault()) { //Tried setting to 0 when doing nothing, but gravity pulls me down without "climbable" set to false, but overriden if it IS set to true entityAgent.SidedPos.Motion.Y = 0; } else { //Technically works, but I can't really hover entityAgent.SidedPos.Motion.Y = -10.0; } } } I feel like it's difficult to explain the problem without testing it yourself. Ultimately my question would probably be: How is the climbable property implemented into the game and how could I adjust it accordingly?
Recommended Posts