package net.pivipi.ball; import net.minestom.server.entity.Entity; import net.minestom.server.entity.EntityType; import net.minestom.server.entity.metadata.other.FallingBlockMeta; import net.minestom.server.instance.block.Block; import net.pivipi.physics.Physics; public class Ball extends Entity { private long lastTick; private final Physics physics = new Physics(this); public Ball(Block block) { super(EntityType.FALLING_BLOCK); // not block display because its movement lags for some reason this.setNoGravity(true); this.setGlowing(true); this.editEntityMeta(FallingBlockMeta.class, meta -> { meta.setBlock(block); }); } public Ball() { this(Block.WHITE_WOOL); } public void tick(long time) { // I don't know if change that to update if (this.lastTick == 0) { this.lastTick = time; } long delay = time - this.lastTick; physics.applyPhysics(delay / 1000.0); this.lastTick = time; } }