package me.hammerle.supersnuvi.tiles;

import me.hammerle.supersnuvi.entity.Entity;
import me.hammerle.supersnuvi.util.Face;

public class TrampolinTile extends BaseBoxTile
{
    public TrampolinTile() 
    {
        super("bounce_shroom/bounce_shroom");
    }

    @Override
    public void onEntityCollide(Entity ent, int x, int y, Face face) 
    {
        super.onEntityCollide(ent, x, y, face);
        if(face == Face.UP)
        {
            double motionY = ent.getPreviousMotionY();
            if(motionY < 0)
            {
                motionY *= -0.9;
                if(motionY > 1)
                {
                    ent.setMotionY(motionY);
                }
            }
        }
    }
}
