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


Java Vector3.translate方法代码示例

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


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

示例1: colorMultiplier

import micdoodle8.mods.galacticraft.api.vector.Vector3; //导入方法依赖的package包/类
@Override
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
    TileEntity tile = par1IBlockAccess.getTileEntity(par2, par3, par4);

    if (tile instanceof TileEntityFallenMeteor)
    {
        TileEntityFallenMeteor meteor = (TileEntityFallenMeteor) tile;

        Vector3 col = new Vector3(198, 108, 58);
        col.translate(200 - meteor.getScaledHeatLevel() * 200);
        col.x = Math.min(255, col.x);
        col.y = Math.min(255, col.y);
        col.z = Math.min(255, col.z);

        return ColorUtil.to32BitColor(255, (byte) col.x, (byte) col.y, (byte) col.z);
    }

    return super.colorMultiplier(par1IBlockAccess, par2, par3, par4);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:21,代码来源:BlockFallenMeteor.java

示例2: getInputPoint

import micdoodle8.mods.galacticraft.api.vector.Vector3; //导入方法依赖的package包/类
@Override
public Vector3 getInputPoint()
{
    float distance = 0.15F;
    Vector3 deviation = new Vector3(Math.sin(Math.toRadians(this.yaw - 180)) * distance, 0, Math.cos(Math.toRadians(this.yaw - 180)) * distance);
    Vector3 headVec = new Vector3(this.xCoord + 0.5, this.yCoord + 1.13228 / 2.0, this.zCoord + 0.5);
    headVec.translate(deviation.clone().invert());
    return headVec;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:10,代码来源:TileEntityBeamReflector.java

示例3: onUpdate

import micdoodle8.mods.galacticraft.api.vector.Vector3; //导入方法依赖的package包/类
@Override
public void onUpdate()
{
    super.onUpdate();

    if ((this.ticksExisted - 1) % 20 == 0 && this.worldObj.isRemote)
    {
        this.flagData = ClientUtil.updateFlagData(this.getOwner(), Minecraft.getMinecraft().thePlayer.getDistanceToEntity(this) < 50.0D);
    }

    Vector3 vec = new Vector3(this.posX, this.posY, this.posZ);
    vec = vec.translate(new Vector3(0, -1, 0));
    final Block blockAt = vec.getBlock(this.worldObj);

    if (blockAt != null)
    {
        if (blockAt instanceof BlockFence)
        {

        }
        else if (blockAt.isAir(this.worldObj, vec.intX(), vec.intY(), vec.intZ()))
        {
            this.motionY -= 0.02F;
        }
    }

    this.moveEntity(this.motionX, this.motionY, this.motionZ);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:29,代码来源:EntityFlag.java

示例4: getNearestOilBlock

import micdoodle8.mods.galacticraft.api.vector.Vector3; //导入方法依赖的package包/类
private Vector3 getNearestOilBlock(EntityPlayer par1EntityPlayer)
{
    final float var4 = 1.0F;
    final float var5 = par1EntityPlayer.prevRotationPitch + (par1EntityPlayer.rotationPitch - par1EntityPlayer.prevRotationPitch) * var4;
    final float var6 = par1EntityPlayer.prevRotationYaw + (par1EntityPlayer.rotationYaw - par1EntityPlayer.prevRotationYaw) * var4;
    final double var7 = par1EntityPlayer.prevPosX + (par1EntityPlayer.posX - par1EntityPlayer.prevPosX) * var4;
    final double var9 = par1EntityPlayer.prevPosY + (par1EntityPlayer.posY - par1EntityPlayer.prevPosY) * var4 + 1.62D - par1EntityPlayer.yOffset;
    final double var11 = par1EntityPlayer.prevPosZ + (par1EntityPlayer.posZ - par1EntityPlayer.prevPosZ) * var4;
    final Vector3 var13 = new Vector3(var7, var9, var11);
    final float var14 = MathHelper.cos(-var6 * 0.017453292F - (float) Math.PI);
    final float var15 = MathHelper.sin(-var6 * 0.017453292F - (float) Math.PI);
    final float var16 = -MathHelper.cos(-var5 * 0.017453292F);
    final float var17 = MathHelper.sin(-var5 * 0.017453292F);
    final float var18 = var15 * var16;
    final float var20 = var14 * var16;
    double var21 = 5.0D;

    if (par1EntityPlayer instanceof EntityPlayerMP)
    {
        var21 = ((EntityPlayerMP) par1EntityPlayer).theItemInWorldManager.getBlockReachDistance();
    }

    for (double dist = 0.0; dist <= var21; dist += 1D)
    {
        final Vector3 var23 = var13.translate(new Vector3(var18 * dist, var17 * dist, var20 * dist));

        if (this.isOilBlock(par1EntityPlayer, par1EntityPlayer.worldObj, MathHelper.floor_double(var23.x), MathHelper.floor_double(var23.y), MathHelper.floor_double(var23.z), false))
        {
            return var23;
        }
    }

    return null;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:35,代码来源:ItemOilExtractor.java

示例5: updateFeet

import micdoodle8.mods.galacticraft.api.vector.Vector3; //导入方法依赖的package包/类
private void updateFeet(EntityPlayerSP player, double motionX, double motionZ)
{
    GCPlayerStatsClient stats = GCPlayerStatsClient.get(player);
    double motionSqrd = motionX * motionX + motionZ * motionZ;

    // If the player is on the moon, not airbourne and not riding anything
    if (motionSqrd > 0.001 && player.worldObj != null && player.worldObj.provider instanceof WorldProviderMoon && player.ridingEntity == null && !player.capabilities.isFlying)
    {
        int iPosX = (int) Math.floor(player.posX);
        int iPosY = (int) Math.floor(player.posY - 2);
        int iPosZ = (int) Math.floor(player.posZ);

        // If the block below is the moon block
        if (player.worldObj.getBlock(iPosX, iPosY, iPosZ) == GCBlocks.blockMoon)
        {
            // And is the correct metadata (moon turf)
            if (player.worldObj.getBlockMetadata(iPosX, iPosY, iPosZ) == 5)
            {
                // If it has been long enough since the last step
                if (stats.distanceSinceLastStep > 0.35)
                {
                    Vector3 pos = new Vector3(player);
                    // Set the footprint position to the block below and add random number to stop z-fighting
                    pos.y = MathHelper.floor_double(player.posY - 1) + player.getRNG().nextFloat() / 100.0F;

                    // Adjust footprint to left or right depending on step count
                    switch (stats.lastStep)
                    {
                    case 0:
                        pos.translate(new Vector3(Math.sin(Math.toRadians(-player.rotationYaw + 90)) * 0.25, 0, Math.cos(Math.toRadians(-player.rotationYaw + 90)) * 0.25));
                        break;
                    case 1:
                        pos.translate(new Vector3(Math.sin(Math.toRadians(-player.rotationYaw - 90)) * 0.25, 0, Math.cos(Math.toRadians(-player.rotationYaw - 90)) * 0.25));
                        break;
                    }

                    pos = WorldUtil.getFootprintPosition(player.worldObj, player.rotationYaw - 180, pos, new BlockVec3(player));

                    long chunkKey = ChunkCoordIntPair.chunkXZ2Int(pos.intX() >> 4, pos.intZ() >> 4);
                    ClientProxyCore.footprintRenderer.addFootprint(chunkKey, player.worldObj.provider.dimensionId, pos, player.rotationYaw, player.getCommandSenderName());

                    // Increment and cap step counter at 1
                    stats.lastStep++;
                    stats.lastStep %= 2;
                    stats.distanceSinceLastStep = 0;
                }
                else
                {
                    stats.distanceSinceLastStep += motionSqrd;
                }
            }
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:55,代码来源:PlayerClient.java

示例6: updateFeet

import micdoodle8.mods.galacticraft.api.vector.Vector3; //导入方法依赖的package包/类
protected static void updateFeet(EntityPlayerMP player, double motionX, double motionZ)
{
    double motionSqrd = motionX * motionX + motionZ * motionZ;
    if (motionSqrd > 0.001D && !player.capabilities.isFlying)
    {
        int iPosX = MathHelper.floor_double(player.posX);
        int iPosY = MathHelper.floor_double(player.posY) - 1;
        int iPosZ = MathHelper.floor_double(player.posZ);

        // If the block below is the moon block
        if (player.worldObj.getBlock(iPosX, iPosY, iPosZ) == GCBlocks.blockMoon)
        {
            // And is the correct metadata (moon turf)
            if (player.worldObj.getBlockMetadata(iPosX, iPosY, iPosZ) == 5)
            {
                GCPlayerStats playerStats = GCPlayerStats.get(player);
                // If it has been long enough since the last step
                if (playerStats.distanceSinceLastStep > 0.35D)
                {
                    Vector3 pos = new Vector3(player);
                    // Set the footprint position to the block below and add random number to stop z-fighting
                    pos.y = MathHelper.floor_double(player.posY - 1D) + player.worldObj.rand.nextFloat() / 100.0F;

                    // Adjust footprint to left or right depending on step count
                    switch (playerStats.lastStep)
                    {
                    case 0:
                        float a = (-player.rotationYaw + 90F) / 57.295779513F;
                        pos.translate(new Vector3(MathHelper.sin(a) * 0.25F, 0, MathHelper.cos(a) * 0.25F));
                        break;
                    case 1:
                        a = (-player.rotationYaw - 90F) / 57.295779513F;
                        pos.translate(new Vector3(MathHelper.sin(a) * 0.25, 0, MathHelper.cos(a) * 0.25));
                        break;
                    }

                    float rotation = player.rotationYaw - 180;
                    pos = WorldUtil.getFootprintPosition(player.worldObj, rotation, pos, new BlockVec3(player));

                    long chunkKey = ChunkCoordIntPair.chunkXZ2Int(pos.intX() >> 4, pos.intZ() >> 4);
                    TickHandlerServer.addFootprint(chunkKey, new Footprint(player.worldObj.provider.dimensionId, pos, rotation, player.getCommandSenderName()), player.worldObj.provider.dimensionId);

                    // Increment and cap step counter at 1
                    playerStats.lastStep++;
                    playerStats.lastStep %= 2;
                    playerStats.distanceSinceLastStep = 0;
                }
                else
                {
                    playerStats.distanceSinceLastStep += motionSqrd;
                }
            }
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:56,代码来源:GCPlayerHandler.java


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