Search in sources :

Example 1 with EntityCannonBall

use of ValkyrienWarfareCombat.Entity.EntityCannonBall in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class EntityDraggable method tickAddedVelocityForWorld.

public static void tickAddedVelocityForWorld(World world) {
    try {
        for (int i = 0; i < world.loadedEntityList.size(); i++) {
            Entity e = world.loadedEntityList.get(i);
            //TODO: Maybe add a check to prevent moving entities that are fixed onto a Ship, but I like the visual effect
            if (!(e instanceof PhysicsWrapperEntity) && !(e instanceof EntityCannonBall)) {
                EntityDraggable draggable = getDraggableFromEntity(e);
                draggable.tickAddedVelocity();
                if (draggable.worldBelowFeet == null) {
                    if (draggable.draggableAsEntity.onGround) {
                        draggable.velocityAddedToPlayer.zero();
                        draggable.yawDifVelocity = 0;
                    } else {
                        if (draggable.draggableAsEntity instanceof EntityPlayer) {
                            EntityPlayer player = (EntityPlayer) draggable.draggableAsEntity;
                            if (player.isCreative() && player.capabilities.isFlying) {
                                draggable.velocityAddedToPlayer.multiply(.99D * .95D);
                                draggable.yawDifVelocity *= .95D * .95D;
                            }
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Entity(net.minecraft.entity.Entity) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) EntityCannonBall(ValkyrienWarfareCombat.Entity.EntityCannonBall) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Aggregations

PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 EntityCannonBall (ValkyrienWarfareCombat.Entity.EntityCannonBall)1 Entity (net.minecraft.entity.Entity)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1