I'm trying to make a event which will make entities in the world bounce when they fall from any distance, like they would if they fell onto a slimeblock. I created a event that triggers on LivingFallEvent in my mod's event class to multiply the y_motion of the target when they land by d; which works, however, the distance the entity bounces up to is very small compared to a slime block. How would I make it more accurate to how entities bounce when falling onto a slimeblock?
public static void onEntityLand(LivingFallEvent event) {
LivingEntity entity = event.getEntity();
Vec3 motion = entity.getDeltaMovement();
event.setDistance(event.getDistance() + 2);
if(motion.y < 0.0D && event.getDistance() > 1.0F) {
float d = (float)0.9 + event.getDistance();
entity.setDeltaMovement(motion.x, -motion.y * d, motion.z);
}
}