package me.hammerle.supersnuvi.tiles;

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

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)
        {
            ent.setMotionY(ent.getJumpPower() * 1.5);
            SoundUtils.playSound(SoundUtils.Sound.JUMP_ON_BOUNCE_SHROOM);
            /*double motionY = ent.getPreviousMotionY();
            if(motionY < 0)
            {
                motionY *= -0.9;
                if(motionY > 1)
                {
                    ent.setMotionY(motionY);
                }
            }*/
        }
    }

    @Override
    public double getRenderOffsetY() 
    {
        return 2;
    }
}
