當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。