Geordi La Forge

Build a mod that makes it so each time a player move they loose scale and shrink until they are at scale 0.1 and when a player is at scale 0.1 they can be walked on by other entity that have a scale equal or over 1 and take damage.

Kodari AI
KodariNov 1 at 8:59 pm 1
ShrinkStomp
ShrinkStomp is a Fabric mod for Minecraft 1.21.1 that causes players to continuously lose scale and shrink whenever they move, down to a minimum of 0.1. Once a player reaches this tiny size, they become walkable by any entity with a scale of 1.0 or greater, and taking damage from being stepped on. The mod tracks player movement, applies gradual scaling, and implements collision-based damage for oversized entities trampling shrunken players.
  1. Add a Fabric 1.21.11 mod that shrinks players as they move, down to 0.1 scale.

  2. At minimum scale, let full-size entities stand on them and damage them when doing so.

Added the Fabric 1.21.11 mod. Players shrink by 0.005 scale per movement tick, stopping at 0.1; living entities at scale 1 or greater can stand on them and deal 1 damage on landing. Continuous movement reaches minimum scale in about 9 seconds.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
7 227
src/main/java/com/kodari/walkablescale/mixin/EntityMixin.java
package com.kodari.walkablescale.mixin;

import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.damage.DamageSources;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Entity.class)
public abstract class EntityMixin {
    @Unique
    private static final double walkablescale$minimumPlayerScale = 0.100001;

    @Unique
    private static final double walkablescale$landingTolerance = 1.0E-5;

    @Unique
    private Box walkablescale$boundsBeforeMove;

    @Inject(method = "move", at = @At("HEAD"))
    private void walkablescale$captureBounds(MovementType type, Vec3d movement, CallbackInfo ci) {
        this.walkablescale$boundsBeforeMove = ((Entity) (Object) this).getBoundingBox();
    }

    @Inject(method = "move", at = @At("TAIL"))
    private void walkablescale$landOnTinyPlayers(MovementType type, Vec3d movement, CallbackInfo ci) {
        Entity entity = (Entity) (Object) this;
        Box boundsBeforeMove = this.walkablescale$boundsBeforeMove;
        if (boundsBeforeMove == null || movement.y >= 0.0 || !(entity instanceof LivingEntity stomper)) {
            return;
        }

        if (stomper.getAttributeValue(EntityAttributes.SCALE) < 1.0
                || !(entity.getEntityWorld() instanceof ServerWorld world)) {
            return;
        }

        Box boundsAfterMove = entity.getBoundingBox();
        for (ServerPlayerEntity player : world.getPlayers()) {
            if (player == entity
                    || player.getAttributeValue(EntityAttributes.SCALE) > walkablescale$minimumPlayerScale) {
                continue;
            }

            Box playerBounds = player.getBoundingBox();
            if (boundsAfterMove.maxX <= playerBounds.minX || boundsAfterMove.minX >= playerBounds.maxX
                    || boundsAfterMove.maxZ <= playerBounds.minZ || boundsAfterMove.minZ >= playerBounds.maxZ) {
                continue;
            }

            double playerTop = playerBounds.maxY;
            if (boundsBeforeMove.minY < playerTop - walkablescale$landingTolerance
                    || boundsAfterMove.minY > playerTop) {
                continue;
            }

            boolean landedFromAbove = boundsBeforeMove.minY > playerTop + walkablescale$landingTolerance;
            entity.setPosition(entity.getX(), entity.getY() + playerTop - boundsAfterMove.minY, entity.getZ());
            entity.setOnGround(true);

            if (landedFromAbove) {
                DamageSources damageSources = world.getDamageSources();
                player.damage(world, damageSources.generic(), 1.0F);
            }
        }
    }
}