当前位置: 首页>>代码示例>>Java>>正文


Java EntityLivingBase.getLookVec方法代码示例

本文整理汇总了Java中net.minecraft.entity.EntityLivingBase.getLookVec方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLivingBase.getLookVec方法的具体用法?Java EntityLivingBase.getLookVec怎么用?Java EntityLivingBase.getLookVec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.EntityLivingBase的用法示例。


在下文中一共展示了EntityLivingBase.getLookVec方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemUseFinish

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) {
	Spell spell = getSpellFromItemStack(stack);
	if (spell != null && !worldIn.isRemote) {
		if (entityLiving instanceof EntityPlayer) {
			int spellCost = spell.getCost() * 80;
			Optional<IEnergy> eng = EnergyHandler.getEnergy((EntityPlayer) entityLiving);
			if (eng.isPresent() && eng.get().get() < spellCost)
				return stack;
			EnergyHandler.addEnergy((EntityPlayer) entityLiving, -spellCost);
		}
		if (spell.getType() == EnumSpellType.INSTANT)
			spell.performEffect(new RayTraceResult(Type.MISS, entityLiving.getLookVec(), EnumFacing.UP, entityLiving.getPosition()), entityLiving, worldIn);
		else {
			EntitySpellCarrier car = new EntitySpellCarrier(worldIn, entityLiving.posX + entityLiving.getLookVec().x, entityLiving.posY + entityLiving.getEyeHeight() + entityLiving.getLookVec().y, entityLiving.posZ + entityLiving.getLookVec().z);
			car.setSpell(spell);
			car.setCaster(entityLiving);
			car.shoot(entityLiving, entityLiving.rotationPitch, entityLiving.rotationYaw, 0, 2f, 0);
			worldIn.spawnEntity(car);
		}
	}
	if (entityLiving instanceof EntityPlayer && ((EntityPlayer) entityLiving).isCreative()) return stack;
	return ItemStack.EMPTY;
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:25,代码来源:ItemSpellPage.java

示例2: updateNoteLocation

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void updateNoteLocation()
{
    if(noteLocationObject instanceof EntityLivingBase)
    {
        EntityLivingBase living = (EntityLivingBase)noteLocationObject;
        Vec3d view = living.getLookVec();
        this.xPosF = (float)(living.posX + view.x * 0.3D) + (float)living.motionX;
        this.yPosF = (float)(living.posY + living.getEyeHeight() + view.y * 0.3D) + (float)living.motionY;
        this.zPosF = (float)(living.posZ + view.z * 0.3D) + (float)living.motionZ;
    }
    else if(noteLocationObject instanceof BlockPos)
    {
        BlockPos pos = (BlockPos)noteLocationObject;
        this.xPosF = pos.getX() + 0.5F;
        this.yPosF = pos.getY() + 0.5F;
        this.zPosF = pos.getZ() + 0.5F;
    }
}
 
开发者ID:iChun,项目名称:Clef,代码行数:19,代码来源:InstrumentSound.java

示例3: performEffect

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void performEffect(EntityLivingBase entityLivingBaseIn, int p_76394_2_){
    if (!entityLivingBaseIn.world.isRemote){
        EntityItem item = new EntityItem(entityLivingBaseIn.world, entityLivingBaseIn.posX + (entityLivingBaseIn.getLookVec().xCoord * 0.2F), entityLivingBaseIn.posY + entityLivingBaseIn.getEyeHeight() - 0.7F, entityLivingBaseIn.posZ + (entityLivingBaseIn.getLookVec().zCoord), new ItemStack(loot_table[(int) (Math.random() * loot_table.length)], 1));
        item.setPickupDelay(15);
        entityLivingBaseIn.world.spawnEntity(item);
    }
}
 
开发者ID:DeflatedPickles-Old-Repositories,项目名称:JustJunk,代码行数:9,代码来源:PotionSick.java

示例4: acquireAllLookTargets

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
private List<EntityLivingBase> acquireAllLookTargets(EntityLivingBase seeker, int distance, double radius) {
	
	if (distance < 0 || distance > MAX_DISTANCE) {
		distance = MAX_DISTANCE;
	}
	List<EntityLivingBase> targets = new ArrayList<EntityLivingBase>();
	Vec3d vec3 = seeker.getLookVec();
	double targetX = seeker.posX;
	double targetY = seeker.posY + seeker.getEyeHeight() - 0.10000000149011612D;
	double targetZ = seeker.posZ;
	double distanceTraveled = 0;

	while ((int) distanceTraveled < distance) {
		targetX += vec3.xCoord;
		targetY += vec3.yCoord;
		targetZ += vec3.zCoord;
		distanceTraveled += vec3.lengthVector();
		AxisAlignedBB bb = new AxisAlignedBB(targetX-radius, targetY-radius, targetZ-radius, targetX+radius, targetY+radius, targetZ+radius);
		List<EntityLivingBase> list = seeker.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bb);
		for (EntityLivingBase target : list) {
			if (target != seeker && target.canBeCollidedWith() && isTargetInSight(vec3, seeker, target)) {
				if (!targets.contains(target)) {
					targets.add(target);
				}
			}
		}
	}
	return targets;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:30,代码来源:ItemEnderSnooker.java

示例5: getMouseOverServer

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public static RayTraceResult getMouseOverServer(EntityLivingBase lookingEntity, double range) {

        RayTraceResult mop = raytraceEntityBlocks(lookingEntity, range);
        double d1 = range;
        Pair<Vec3d, Vec3d> startAndEnd = getStartAndEndLookVec(lookingEntity, (float) range);
        Vec3d vec3 = startAndEnd.getLeft();

        if (mop != null) {
            d1 = mop.hitVec.distanceTo(vec3);
        }

        Vec3d vec31 = lookingEntity.getLookVec();
        Vec3d vec32 = startAndEnd.getRight();
        Entity pointedEntity = null;
        Vec3d vec33 = null;
        float f1 = 1.0F;
        List<Entity> list = lookingEntity.world.getEntitiesWithinAABBExcludingEntity(lookingEntity, lookingEntity.getEntityBoundingBox()
                .grow(vec31.x * range, vec31.y * range, vec31.z * range).grow(f1, f1, f1));
        double d2 = d1;

        for (Entity entity : list) {
            if (entity.canBeCollidedWith()) {
                float f2 = entity.getCollisionBorderSize();
                AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().grow(f2, f2, f2);
                RayTraceResult movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);

                if (axisalignedbb.contains(vec3)) {
                    if (0.0D < d2 || d2 == 0.0D) {
                        pointedEntity = entity;
                        vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec;
                        d2 = 0.0D;
                    }
                } else if (movingobjectposition != null) {
                    double d3 = vec3.distanceTo(movingobjectposition.hitVec);

                    if (d3 < d2 || d2 == 0.0D) {
                        if (entity == entity.getRidingEntity() && !entity.canRiderInteract()) {
                            if (d2 == 0.0D) {
                                pointedEntity = entity;
                                vec33 = movingobjectposition.hitVec;
                            }
                        } else {
                            pointedEntity = entity;
                            vec33 = movingobjectposition.hitVec;
                            d2 = d3;
                        }
                    }
                }
            }
        }

        if (pointedEntity != null && (d2 < d1 || mop == null)) {
            mop = new RayTraceResult(pointedEntity, vec33);
        }
        return mop;
    }
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:57,代码来源:PneumaticCraftUtils.java


注:本文中的net.minecraft.entity.EntityLivingBase.getLookVec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。