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


Java Vec3.createVectorHelper方法代码示例

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


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

示例1: findRandomTarget

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
private static Vec3 findRandomTarget(Entity entity, int distanceXZ, int distanceY)
{
	Random random = entity.worldObj.rand;
	
	int targetX = 0;
	int targetY = 0;
	int targetZ = 0;

       for (int l1 = 0; l1 < 10; ++l1)
       {
           int rangeX = random.nextInt(2 * distanceXZ) - distanceXZ;
           int rangeY = random.nextInt(2 * distanceY) - distanceY;
           int rangeZ = random.nextInt(2 * distanceXZ) - distanceXZ;

           rangeX += MathHelper.floor_double(entity.posX);
           rangeY += MathHelper.floor_double(entity.posY);
           rangeZ += MathHelper.floor_double(entity.posZ);

           targetX = rangeX;
           targetY = rangeY;
           targetZ = rangeZ;
       }

       return Vec3.createVectorHelper((double)targetX, (double)targetY, (double)targetZ);
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:26,代码来源:AI_Movement.java

示例2: getMovingObjectPositionFromPlayer

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
public static MovingObjectPosition getMovingObjectPositionFromPlayer(World world, EntityPlayer player, double targetingDistance)
{
	float f = 1.0F;
	float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
	float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
	
	double playerX = player.prevPosX + (player.posX - player.prevPosX) * f;
	double playerY = player.prevPosY + (player.posY - player.prevPosY) * f + (world.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight()); // isRemote check to revert changes to ray trace position due to adding the eye height clientside and player yOffset differences
	double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * f;
	
	Vec3 vecPlayer = Vec3.createVectorHelper(playerX, playerY, playerZ);
	
	float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
	float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI);
	float f5 = -MathHelper.cos(-f1 * 0.017453292F);
	float f6 = MathHelper.sin(-f1 * 0.017453292F);
	float f7 = f4 * f5;
	float f8 = f3 * f5;
	
	double maxDistance = targetingDistance;
	
	Vec3 vecTarget = vecPlayer.addVector(f7 * maxDistance, f6 * maxDistance, f8 * maxDistance);
	
	return world.func_147447_a(vecPlayer, vecTarget, false, false, true);	// false, true, false
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:26,代码来源:AI_Targeting.java

示例3: ArmourStandInteractMessage

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
public ArmourStandInteractMessage(int dimID, EntityArmourStand stand, EntityPlayer player) {
	this.dimID = dimID;
	standID = stand.getEntityId();
	playerID = player.getEntityId();
	MovingObjectPosition hit = Minecraft.getMinecraft().objectMouseOver;
	hitPos = Vec3.createVectorHelper(hit.hitVec.xCoord - stand.posX, hit.hitVec.yCoord - stand.posY, hit.hitVec.zCoord - stand.posZ);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:8,代码来源:ArmourStandInteractMessage.java

示例4: fromBytes

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
	dimID = buf.readInt();
	standID = buf.readInt();
	playerID = buf.readInt();
	hitPos = Vec3.createVectorHelper(buf.readDouble(), buf.readDouble(), buf.readDouble());
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:8,代码来源:ArmourStandInteractMessage.java

示例5: doFlightSFX

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
@Override
public void doFlightSFX()
{
	if (this.shootingEntity == null) { return; }	// Shouldn't be a thing
	
	Vec3 vec_entity = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
       Vec3 vec_shooter = Vec3.createVectorHelper(this.shootingEntity.posX, this.shootingEntity.posY, this.shootingEntity.posZ);
       
       double distance = vec_entity.distanceTo(vec_shooter);	// The distance between this entity and the shooter
       
       //System.out.println("[ENTITY] Distance to shooter: " + distance);
       if (distance > this.ticksInAirMax - 2) { this.setDead(); }	// Starting 0.5 blocks in front of the player and ends one+ block after the target. So ending now
       NetHelper.sendParticleMessageToAllPlayers(this.worldObj, this.getEntityId(), (byte) 3, (byte) 1);
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:15,代码来源:FlintDust.java

示例6: getCustomSkyColor

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
private Vec3 getCustomSkyColor()
{
    return Vec3.createVectorHelper(0.26796875D, 0.1796875D, 0.0D);
}
 
开发者ID:BlesseNtumble,项目名称:TRAPPIST-1,代码行数:5,代码来源:SkyProviderTrappistOneB.java

示例7: onUpdate

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
@Override
public void onUpdate() {

	this.lastTickPosX = this.posX;
	this.lastTickPosY = this.posY;
	this.lastTickPosZ = this.posZ;
	super.onUpdate();

	this.ticksExisted++;
	this.width += 0.02;
	this.height += 0.04;

	Vec3 currentPos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
	Vec3 nextPos = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + 0.02, this.posZ + this.motionZ);
	MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(currentPos, nextPos);

	if (movingobjectposition != null) {
		if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ) == Blocks.portal) {
			this.setInPortal();
		}
		nextPos = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
	}

	AxisAlignedBB axisalignedbb = this.boundingBox.expand(this.width, this.height, this.width);
	List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, axisalignedbb.addCoord(this.motionX, 0, this.motionZ));
	EntityPlayer player = this.getOwner();

	for (Object o : list) {
		Entity entity = (Entity)o;
		if (entity == player) {
			continue;
		}
		entity.attackEntityFrom(DamageSource.causePlayerDamage(this.getOwner()).setProjectile(), getDamage(exp));
		//entity.setVelocity(this.motionX, 0.1, this.motionZ);
		//entity.isAirBorne = true;
		entity.addVelocity(this.motionX / 10, 0.02, this.motionZ / 10);
		entity.fallDistance = 0;
	}	

       this.posX = nextPos.xCoord;
       this.posY = nextPos.yCoord;
       this.posZ = nextPos.zCoord;

       float f2 = velocityDecreaseRate;
       if (this.isInWater()) {
           for (int i = 0; i < 4; ++i) {
               float f4 = 0.25F;
               this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ);
           }

           f2 = 0.8F;
       }

       this.motionX *= (double)f2;
       this.motionY *= (double)f2;
       this.motionZ *= (double)f2;
       
       this.setPosition(this.posX, this.posY, this.posZ);
       
       this.rotationYaw += 5;

       if (this.ticksExisted >= this.age)
       	this.setDead();
   }
 
开发者ID:Kanbe-Kotori,项目名称:ExtraAcC,代码行数:65,代码来源:EntityUpdraft.java

示例8: updateAITasks

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
@Override
public void updateAITasks() {
	super.updateAITasks();

	if (getMoveHelper().getSpeed() > 0.8D)
		setMoveType(EntityRabbit.EnumMoveType.SPRINT);
	else if (moveType != EntityRabbit.EnumMoveType.ATTACK)
		setMoveType(EntityRabbit.EnumMoveType.HOP);

	if (currentMoveTypeDuration > 0)
		currentMoveTypeDuration--;

	if (carrotTicks > 0) {
		carrotTicks -= rand.nextInt(3);

		if (carrotTicks < 0)
			carrotTicks = 0;
	}

	if (onGround) {
		if (!field_175537_bp) {
			setJumping(false, EntityRabbit.EnumMoveType.NONE);
			func_175517_cu();
		}

		EntityRabbit.RabbitJumpHelper rabbitjumphelper = getJumpHelper();

		if (!rabbitjumphelper.getIsJumping()) {
			if (!getNavigator().noPath() && currentMoveTypeDuration == 0) {
				PathEntity pathentity = getNavigator().getPath();
				Vec3 vec3 = Vec3.createVectorHelper(getMoveHelper().getX(), getMoveHelper().getY(), getMoveHelper().getZ());

				if (pathentity != null && pathentity.getCurrentPathIndex() < pathentity.getCurrentPathLength())
					vec3 = pathentity.getPosition(this);

				calculateRotationYaw(vec3.xCoord, vec3.zCoord);
				doMovementAction(moveType);
			}
		} else if (!rabbitjumphelper.func_180065_d())
			func_175518_cr();
	}

	field_175537_bp = onGround;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:45,代码来源:EntityRabbit.java


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