Search in sources :

Example 6 with EntityMountable

use of org.valkyrienskies.mod.common.entity.EntityMountable in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class ValkyrienUtils method getMountedShipAndPos.

public EntityShipMountData getMountedShipAndPos(Entity entity) {
    Entity ridingEntity = entity.ridingEntity;
    if (ridingEntity instanceof EntityMountable) {
        EntityMountable mountable = (EntityMountable) ridingEntity;
        Optional<PhysicsObject> mountedShip = mountable.getMountedShip();
        if (mountedShip.isPresent()) {
            return new EntityShipMountData(mountedShip.get(), mountable.getMountPos());
        }
    }
    return new EntityShipMountData();
}
Also used : Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntityShipMountData(org.valkyrienskies.mod.common.ships.entity_interaction.EntityShipMountData) EntityMountable(org.valkyrienskies.mod.common.entity.EntityMountable) PhysicsObject(org.valkyrienskies.mod.common.ships.ship_world.PhysicsObject)

Aggregations

EntityMountable (org.valkyrienskies.mod.common.entity.EntityMountable)6 World (net.minecraft.world.World)4 BlockPos (net.minecraft.util.math.BlockPos)3 Entity (net.minecraft.entity.Entity)2 EntityArmorStand (net.minecraft.entity.item.EntityArmorStand)2 EntityBoat (net.minecraft.entity.item.EntityBoat)2 EntityFallingBlock (net.minecraft.entity.item.EntityFallingBlock)2 EntityPig (net.minecraft.entity.passive.EntityPig)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 PhysicsObject (org.valkyrienskies.mod.common.ships.ship_world.PhysicsObject)2 Nullable (javax.annotation.Nullable)1 IBlockState (net.minecraft.block.state.IBlockState)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 TileEntity (net.minecraft.tileentity.TileEntity)1 EnumFacing (net.minecraft.util.EnumFacing)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vec3d (net.minecraft.util.math.Vec3d)1 Triple (org.apache.commons.lang3.tuple.Triple)1