本文整理汇总了Java中net.minecraft.util.Vec3类的典型用法代码示例。如果您正苦于以下问题:Java Vec3类的具体用法?Java Vec3怎么用?Java Vec3使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Vec3类属于net.minecraft.util包,在下文中一共展示了Vec3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldAttackPlayer
import net.minecraft.util.Vec3; //导入依赖的package包/类
/**
* Checks to see if this enderman should be attacking this player
*/
private boolean shouldAttackPlayer(EntityPlayer player)
{
ItemStack itemstack = player.inventory.armorInventory[3];
if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
{
return false;
}
else
{
Vec3 vec3 = player.getLook(1.0F).normalize();
Vec3 vec31 = new Vec3(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
double d0 = vec31.lengthVector();
vec31 = vec31.normalize();
double d1 = vec3.dotProduct(vec31);
return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
}
}
示例2: getMovingObjectPositionFromPlayer
import net.minecraft.util.Vec3; //导入依赖的package包/类
protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids)
{
float f = playerIn.rotationPitch;
float f1 = playerIn.rotationYaw;
double d0 = playerIn.posX;
double d1 = playerIn.posY + (double)playerIn.getEyeHeight();
double d2 = playerIn.posZ;
Vec3 vec3 = new Vec3(d0, d1, d2);
float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
float f4 = -MathHelper.cos(-f * 0.017453292F);
float f5 = MathHelper.sin(-f * 0.017453292F);
float f6 = f3 * f4;
float f7 = f2 * f4;
double d3 = 5.0D;
Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
}
示例3: updateRenderInfo
import net.minecraft.util.Vec3; //导入依赖的package包/类
/**
* Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
*/
public static void updateRenderInfo(EntityPlayer entityplayerIn, boolean p_74583_1_)
{
GlStateManager.getFloat(2982, MODELVIEW);
GlStateManager.getFloat(2983, PROJECTION);
GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT);
float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2);
float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2);
GLU.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS);
position = new Vec3((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2));
int i = p_74583_1_ ? 1 : 0;
float f2 = entityplayerIn.rotationPitch;
float f3 = entityplayerIn.rotationYaw;
rotationX = MathHelper.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
rotationZ = MathHelper.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
rotationYZ = -rotationZ * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
rotationXY = rotationX * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
rotationXZ = MathHelper.cos(f2 * (float)Math.PI / 180.0F);
}
示例4: findPossibleShelter
import net.minecraft.util.Vec3; //导入依赖的package包/类
private Vec3 findPossibleShelter()
{
Random random = this.theCreature.getRNG();
BlockPos blockpos = new BlockPos(this.theCreature.posX, this.theCreature.getEntityBoundingBox().minY, this.theCreature.posZ);
for (int i = 0; i < 10; ++i)
{
BlockPos blockpos1 = blockpos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10);
if (!this.theWorld.canSeeSky(blockpos1) && this.theCreature.getBlockPathWeight(blockpos1) < 0.0F)
{
return new Vec3((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ());
}
}
return null;
}
示例5: shouldExecute
import net.minecraft.util.Vec3; //导入依赖的package包/类
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
if (this.theEntity.isWithinHomeDistanceCurrentPosition())
{
return false;
}
else
{
BlockPos blockpos = this.theEntity.getHomePosition();
Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()));
if (vec3 == null)
{
return false;
}
else
{
this.movePosX = vec3.xCoord;
this.movePosY = vec3.yCoord;
this.movePosZ = vec3.zCoord;
return true;
}
}
}
示例6: pathFollow
import net.minecraft.util.Vec3; //导入依赖的package包/类
protected void pathFollow()
{
Vec3 vec3 = this.getEntityPosition();
float f = this.theEntity.width * this.theEntity.width;
int i = 6;
if (vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex())) < (double)f)
{
this.currentPath.incrementPathIndex();
}
for (int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j)
{
Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, j);
if (vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0))
{
this.currentPath.setCurrentPathIndex(j);
break;
}
}
this.checkForStuck(vec3);
}
示例7: getWorldSkyColor
import net.minecraft.util.Vec3; //导入依赖的package包/类
public static Vec3 getWorldSkyColor(Vec3 p_getWorldSkyColor_0_, WorldClient p_getWorldSkyColor_1_, Entity p_getWorldSkyColor_2_, float p_getWorldSkyColor_3_)
{
int i = p_getWorldSkyColor_1_.provider.getDimensionId();
switch (i)
{
case 0:
Minecraft minecraft = Minecraft.getMinecraft();
p_getWorldSkyColor_0_ = getSkyColor(p_getWorldSkyColor_0_, minecraft.theWorld, p_getWorldSkyColor_2_.posX, p_getWorldSkyColor_2_.posY + 1.0D, p_getWorldSkyColor_2_.posZ);
break;
case 1:
p_getWorldSkyColor_0_ = getSkyColorEnd(p_getWorldSkyColor_0_);
}
return p_getWorldSkyColor_0_;
}
示例8: shouldExecute
import net.minecraft.util.Vec3; //导入依赖的package包/类
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
if (!this.horseHost.isTame() && this.horseHost.riddenByEntity != null)
{
Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.horseHost, 5, 4);
if (vec3 == null)
{
return false;
}
else
{
this.targetX = vec3.xCoord;
this.targetY = vec3.yCoord;
this.targetZ = vec3.zCoord;
return true;
}
}
else
{
return false;
}
}
示例9: getEntityHit
import net.minecraft.util.Vec3; //导入依赖的package包/类
private static Entity getEntityHit(ProjectileType type, Vec3 source, Vec3 destination) {
for (Object o : Minecraft.getMinecraft().theWorld.loadedEntityList) {
if (o == Minecraft.getMinecraft().getRenderViewEntity())
continue;
if (o instanceof EntityLivingBase) {
EntityLivingBase entity = (EntityLivingBase) o;
double expander = (type == ProjectileType.ARROW) ? 0.2 : 0.125;
AxisAlignedBB boundingBox = entity.getEntityBoundingBox().expand(expander, expander, expander);
MovingObjectPosition raytraceResult = boundingBox.calculateIntercept(source, destination);
if (raytraceResult != null) {
return entity;
}
}
}
return null;
}
示例10: shouldExecute
import net.minecraft.util.Vec3; //导入依赖的package包/类
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
if (this.theEntityCreature.getAITarget() == null && !this.theEntityCreature.isBurning())
{
return false;
}
else
{
Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.theEntityCreature, 5, 4);
if (vec3 == null)
{
return false;
}
else
{
this.randPosX = vec3.xCoord;
this.randPosY = vec3.yCoord;
this.randPosZ = vec3.zCoord;
return true;
}
}
}
示例11: renderBrokenItemStack
import net.minecraft.util.Vec3; //导入依赖的package包/类
/**
* Renders broken item particles using the given ItemStack
*/
public void renderBrokenItemStack(ItemStack stack)
{
this.playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F);
for (int i = 0; i < 5; ++i)
{
Vec3 vec3 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
vec3 = vec3.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F);
vec3 = vec3.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F);
double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
Vec3 vec31 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
vec31 = vec31.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F);
vec31 = vec31.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F);
vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
}
}
示例12: getFogColor
import net.minecraft.util.Vec3; //导入依赖的package包/类
public static Vec3 getFogColor(Vec3 p_getFogColor_0_, IBlockAccess p_getFogColor_1_, double p_getFogColor_2_, double p_getFogColor_4_, double p_getFogColor_6_)
{
if (fogColors == null)
{
return p_getFogColor_0_;
}
else
{
int i = getSmoothColor(fogColors, p_getFogColor_1_, p_getFogColor_2_, p_getFogColor_4_, p_getFogColor_6_, 7, 1);
int j = i >> 16 & 255;
int k = i >> 8 & 255;
int l = i & 255;
float f = (float)j / 255.0F;
float f1 = (float)k / 255.0F;
float f2 = (float)l / 255.0F;
float f3 = (float)p_getFogColor_0_.xCoord / 0.753F;
float f4 = (float)p_getFogColor_0_.yCoord / 0.8471F;
float f5 = (float)p_getFogColor_0_.zCoord;
f = f * f3;
f1 = f1 * f4;
f2 = f2 * f5;
return new Vec3((double)f, (double)f1, (double)f2);
}
}
示例13: isPositionClear
import net.minecraft.util.Vec3; //导入依赖的package包/类
/**
* Returns true if an entity does not collide with any solid blocks at the position.
*/
private boolean isPositionClear(int p_179692_1_, int p_179692_2_, int p_179692_3_, int p_179692_4_, int p_179692_5_, int p_179692_6_, Vec3 p_179692_7_, double p_179692_8_, double p_179692_10_)
{
for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(p_179692_1_, p_179692_2_, p_179692_3_), new BlockPos(p_179692_1_ + p_179692_4_ - 1, p_179692_2_ + p_179692_5_ - 1, p_179692_3_ + p_179692_6_ - 1)))
{
double d0 = (double)blockpos.getX() + 0.5D - p_179692_7_.xCoord;
double d1 = (double)blockpos.getZ() + 0.5D - p_179692_7_.zCoord;
if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D)
{
Block block = this.worldObj.getBlockState(blockpos).getBlock();
if (!block.isPassable(this.worldObj, blockpos))
{
return false;
}
}
}
return true;
}
示例14: getObjectMouseOver
import net.minecraft.util.Vec3; //导入依赖的package包/类
private MovingObjectPosition getObjectMouseOver(DiscreteMovementCommand command)
{
MovingObjectPosition mop = null;
if (command.equals(DiscreteMovementCommand.USE))
mop = Minecraft.getMinecraft().objectMouseOver;
else if (command.equals(DiscreteMovementCommand.JUMPUSE))
{
long partialTicks = 0; //Minecraft.timer.renderPartialTicks
Entity viewer = Minecraft.getMinecraft().thePlayer;
double blockReach = Minecraft.getMinecraft().playerController.getBlockReachDistance();
Vec3 eyePos = viewer.getPositionEyes(partialTicks);
Vec3 lookVec = viewer.getLook(partialTicks);
int yOffset = 1; // For the jump
Vec3 searchVec = eyePos.addVector(lookVec.xCoord * blockReach, yOffset + lookVec.yCoord * blockReach, lookVec.zCoord * blockReach);
mop = Minecraft.getMinecraft().theWorld.rayTraceBlocks(eyePos, searchVec, false, false, false);
}
return mop;
}
示例15: getWorldFogColor
import net.minecraft.util.Vec3; //导入依赖的package包/类
public static Vec3 getWorldFogColor(Vec3 p_getWorldFogColor_0_, WorldClient p_getWorldFogColor_1_, Entity p_getWorldFogColor_2_, float p_getWorldFogColor_3_)
{
int i = p_getWorldFogColor_1_.provider.getDimensionId();
switch (i)
{
case -1:
p_getWorldFogColor_0_ = getFogColorNether(p_getWorldFogColor_0_);
break;
case 0:
Minecraft minecraft = Minecraft.getMinecraft();
p_getWorldFogColor_0_ = getFogColor(p_getWorldFogColor_0_, minecraft.theWorld, p_getWorldFogColor_2_.posX, p_getWorldFogColor_2_.posY + 1.0D, p_getWorldFogColor_2_.posZ);
break;
case 1:
p_getWorldFogColor_0_ = getFogColorEnd(p_getWorldFogColor_0_);
}
return p_getWorldFogColor_0_;
}