All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.entity.ai.controller.DiveController Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.entity.ai.controller;

import cn.nukkit.api.PowerNukkitXOnly;
import cn.nukkit.api.Since;
import cn.nukkit.entity.EntityIntelligent;
import cn.nukkit.entity.ai.memory.CoreMemoryTypes;

/**
 * 下潜运动控制器,使实体下潜
 */
@PowerNukkitXOnly
@Since("1.19.60-r1")
public class DiveController implements IController {
    @Override
    public boolean control(EntityIntelligent entity) {
        //add dive force
        if (entity.getMemoryStorage().get(CoreMemoryTypes.ENABLE_DIVE_FORCE))
            //                                                                  抵消额外的浮力即可
            entity.motionY -= entity.getGravity() * (entity.getFloatingForceFactor() - 1);
        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy