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


Java EntityPlayer.getLook方法代码示例

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


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

示例1: renderParticles

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void renderParticles(EntityPlayer dumbplayer, float partialTicks) {
	float f = ActiveRenderInfo.getRotationX();
	float f1 = ActiveRenderInfo.getRotationZ();
	float f2 = ActiveRenderInfo.getRotationYZ();
	float f3 = ActiveRenderInfo.getRotationXY();
	float f4 = ActiveRenderInfo.getRotationXZ();
	EntityPlayer player = EasyMappings.player();
	if (player != null) {
		Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
		Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
		Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;

		Particle.cameraViewDir = player.getLook(partialTicks);
		//GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
		//GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
		GlStateManager.enableAlpha();
		GlStateManager.enableBlend();
		GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
		//GlStateManager.alphaFunc(GL11.GL_GREATER, 0F);
		GlStateManager.disableCull();

		GlStateManager.depthMask(false);

		Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
		Tessellator tess = Tessellator.getInstance();
		BufferBuilder buffer = tess.getBuffer();
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
		for (int i = 0; i < particles.size(); i++) {
			particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
		}
		tess.draw();

		GlStateManager.enableCull();
		GlStateManager.depthMask(true);
		GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
		GlStateManager.disableBlend();
		//GlStateManager.alphaFunc(516, 0.1F);
	}
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:40,代码来源:ParticleRenderer.java

示例2: rayTrace

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public RayTraceResult rayTrace(EntityPlayer player, double blockReachDistance, float partialTicks) {
	Vec3d vec3d = player.getPositionEyes(partialTicks);
	Vec3d vec3d1 = player.getLook(partialTicks);
	Vec3d vec3d2 = vec3d.addVector(vec3d1.x * blockReachDistance, vec3d1.y * blockReachDistance, vec3d1.z * blockReachDistance);
	return player.world.rayTraceBlocks(vec3d, vec3d2, false, false, true);
}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:7,代码来源:ItemDankNull.java

示例3: renderParticles

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void renderParticles(EntityPlayer dumbplayer, float partialTicks) {
	float f = ActiveRenderInfo.getRotationX();
       float f1 = ActiveRenderInfo.getRotationZ();
       float f2 = ActiveRenderInfo.getRotationYZ();
       float f3 = ActiveRenderInfo.getRotationXY();
       float f4 = ActiveRenderInfo.getRotationXZ();
       EntityPlayer player = Minecraft.getMinecraft().player;
       if (player != null){
        Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
        Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
        Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
        Particle.cameraViewDir = player.getLook(partialTicks);
        GlStateManager.enableAlpha();
        GlStateManager.enableBlend();
        GlStateManager.alphaFunc(516, 0.003921569F);
           GlStateManager.disableCull();

        GlStateManager.depthMask(false);
        
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
		Tessellator tess = Tessellator.getInstance();
		VertexBuffer buffer = tess.getBuffer();
		
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
		for (int i = 0; i < particles.size(); i ++){
			if (particles.get(i) instanceof IParticle){
				if (!((IParticle)particles.get(i)).isAdditive()){
					particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
				}
			}
		}
		tess.draw();

        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
		for (int i = 0; i < particles.size(); i ++){
			if (particles.get(i) != null){
				if (((IParticle)particles.get(i)).isAdditive()){
					particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
				}
			}
		}
		tess.draw();
		
        GlStateManager.disableDepth();
		GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
		for (int i = 0; i < particles.size(); i ++){
			if (particles.get(i) instanceof IParticle){
				if (!((IParticle)particles.get(i)).isAdditive() && ((IParticle)particles.get(i)).renderThroughBlocks()){
					particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
				}
			}
		}
		tess.draw();

        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
		for (int i = 0; i < particles.size(); i ++){
			if (particles.get(i) != null){
				if (((IParticle)particles.get(i)).isAdditive() && ((IParticle)particles.get(i)).renderThroughBlocks()){
					particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
				}
			}
		}
		tess.draw();
		GlStateManager.enableDepth();

           GlStateManager.enableCull();
           GlStateManager.depthMask(true);
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.disableBlend();
        GlStateManager.alphaFunc(516, 0.1F);
       }
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:77,代码来源:ParticleRenderer.java

示例4: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(@Nonnull ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
    float f1 = playerIn.prevRotationPitch + (playerIn.rotationPitch - playerIn.prevRotationPitch) * 1.0F;
    float f2 = playerIn.prevRotationYaw + (playerIn.rotationYaw - playerIn.prevRotationYaw) * 1.0F;
    double d0 = playerIn.prevPosX + (playerIn.posX - playerIn.prevPosX) * 1.0D;
    double d1 = playerIn.prevPosY + (playerIn.posY - playerIn.prevPosY) * 1.0D + (double)playerIn.getEyeHeight();
    double d2 = playerIn.prevPosZ + (playerIn.posZ - playerIn.prevPosZ) * 1.0D;
    Vec3d vec3d = new Vec3d(d0, d1, d2);
    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;
    Vec3d vec3d1 = vec3d.addVector((double)f7 * 5.0D, (double)f6 * 5.0D, (double)f8 * 5.0D);
    RayTraceResult raytraceresult = worldIn.rayTraceBlocks(vec3d, vec3d1, false);

    if (raytraceresult == null)
    {
        return new ActionResult<>(EnumActionResult.PASS, itemStackIn);
    }
    else
    {
        Vec3d vec3d2 = playerIn.getLook(1.0F);
        boolean flag = false;
        List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity(playerIn, playerIn.getEntityBoundingBox().addCoord(vec3d2.xCoord * 5.0D, vec3d2.yCoord * 5.0D, vec3d2.zCoord * 5.0D).expandXyz(1.0D));

        for (int i = 0; i < list.size(); ++i)
        {
            Entity entity = list.get(i);

            if (entity.canBeCollidedWith())
            {
                AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().expandXyz((double)entity.getCollisionBorderSize());

                if (axisalignedbb.isVecInside(vec3d))
                {
                    flag = true;
                }
            }
        }

        if (flag)
        {
            return new ActionResult<>(EnumActionResult.PASS, itemStackIn);
        }
        else if (raytraceresult.typeOfHit != RayTraceResult.Type.BLOCK)
        {
            return new ActionResult<>(EnumActionResult.PASS, itemStackIn);
        }
        else
        {
            EntityTractor entityTractor = new EntityTractor(worldIn, raytraceresult.hitVec.xCoord, raytraceresult.hitVec.yCoord, raytraceresult.hitVec.zCoord);
            entityTractor.rotationYaw = playerIn.rotationYaw;

            if (!worldIn.getCollisionBoxes(entityTractor, entityTractor.getEntityBoundingBox().expandXyz(-0.1D)).isEmpty())
            {
                return new ActionResult<>(EnumActionResult.FAIL, itemStackIn);
            }
            else
            {
                if (!worldIn.isRemote)
                {
                    worldIn.spawnEntity(entityTractor);
                }

                if (!playerIn.capabilities.isCreativeMode)
                {
                    --itemStackIn.stackSize;
                }

                playerIn.addStat(StatList.getObjectUseStats(this));
                return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
            }
        }
    }
}
 
开发者ID:CJ-MC-Mods,项目名称:SimpleTractor,代码行数:79,代码来源:ItemTractor.java


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