net.minecraft.client.Minecraft.getRenderViewEntity()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中net.minecraft.client.Minecraft.getRenderViewEntity()方法的一些代码示例,展示了Minecraft.getRenderViewEntity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Minecraft.getRenderViewEntity()方法的具体详情如下:
包路径:net.minecraft.client.Minecraft
类名称:Minecraft
方法名:getRenderViewEntity

Minecraft.getRenderViewEntity介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
protected ResourceLocation getEntityTexture(@Nonnull EntityDoppleganger entity) {
  Minecraft mc = Minecraft.getMinecraft();
  if(!(mc.getRenderViewEntity() instanceof AbstractClientPlayer))
    return DefaultPlayerSkin.getDefaultSkinLegacy();
  return ((AbstractClientPlayer) mc.getRenderViewEntity()).getLocationSkin();
}

代码示例来源:origin: Vazkii/Botania

@Override
  public void renderSkull(float x, float y, float z, @Nonnull EnumFacing facing, float rotation, int skullType, @Nullable GameProfile profile, int destroyStage, float animateTicks) {
    Minecraft mc = Minecraft.getMinecraft();
    Entity view = mc.getRenderViewEntity();

    profile = null;

    if(view instanceof EntityPlayer) {
      skullType = 3;
      profile = ((EntityPlayer) mc.getRenderViewEntity()).getGameProfile();
    } else if (view instanceof EntitySkeleton)
      skullType = 0;
    else if(view instanceof EntityWitherSkeleton)
      skullType = 1;
    else if(view instanceof EntityWither)
      skullType = 1;
    else if(view instanceof EntityZombie)
      skullType = 2;
    else if(view instanceof EntityCreeper)
      skullType = 4;
    else if(view instanceof EntityDragon)
      skullType = 5;

    super.renderSkull(x, y, z, facing, rotation, skullType, profile, destroyStage, animateTicks);
  }
}

代码示例来源:origin: Vazkii/Botania

private static Vector3 getRelativeViewVector(Vector3 pos) {
  Entity renderEntity = Minecraft.getMinecraft().getRenderViewEntity();
  return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
}

代码示例来源:origin: Vazkii/Botania

public FXWisp(World world, double d, double d1, double d2,  float size, float red, float green, float blue, boolean distanceLimit, boolean depthTest, float maxAgeMul) {
  super(world, d, d1, d2, 0.0D, 0.0D, 0.0D);
  particleRed = red;
  particleGreen = green;
  particleBlue = blue;
  particleAlpha = 0.5F; // So MC renders us on the alpha layer, value not actually used
  particleGravity = 0;
  motionX = motionY = motionZ = 0;
  particleScale *= size;
  moteParticleScale = particleScale;
  particleMaxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAgeMul);
  this.depthTest = depthTest;
  moteHalfLife = particleMaxAge / 2;
  setSize(0.01F, 0.01F);
  Entity renderentity = FMLClientHandler.instance().getClient().getRenderViewEntity();
  if(distanceLimit) {
    int visibleDistance = 50;
    if (!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics)
      visibleDistance = 25;
    if (renderentity == null || renderentity.getDistance(posX, posY, posZ) > visibleDistance)
      particleMaxAge = 0;
  }
  prevPosX = posX;
  prevPosY = posY;
  prevPosZ = posZ;
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Nonnull
@SuppressWarnings("ConstantConditions")
public static Entity getRenderViewEntity() {
  return Minecraft.getMinecraft().getRenderViewEntity();
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

private void drawCompas() {
  int rad = 74;
  mc.fontRenderer.drawString("S", (int) (Math.sin(Math.toRadians(180 - mc.getRenderViewEntity().rotationYaw)) * rad), (int) (Math.cos(Math.toRadians(180 - mc.getRenderViewEntity().rotationYaw)) * rad), Reference.COLOR_MATTER.getColor());
  mc.fontRenderer.drawString("N", (int) (Math.sin(Math.toRadians(-mc.getRenderViewEntity().rotationYaw)) * rad), (int) (Math.cos(Math.toRadians(-mc.getRenderViewEntity().rotationYaw)) * 64), Reference.COLOR_MATTER.getColor());
  mc.fontRenderer.drawString("E", (int) (Math.sin(Math.toRadians(90 - mc.getRenderViewEntity().rotationYaw)) * rad), (int) (Math.cos(Math.toRadians(90 - mc.getRenderViewEntity().rotationYaw)) * rad), Reference.COLOR_MATTER.getColor());
  mc.fontRenderer.drawString("W", (int) (Math.sin(Math.toRadians(-mc.getRenderViewEntity().rotationYaw - 90)) * rad), (int) (Math.cos(Math.toRadians(-mc.getRenderViewEntity().rotationYaw - 90)) * rad), Reference.COLOR_MATTER.getColor());
}

代码示例来源:origin: TehNut/HWYLA

public void fire() {
  if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY) {
    this.target = mc.objectMouseOver;
    this.targetStack = ItemStack.EMPTY;
    return;
  }
  Entity viewpoint = mc.getRenderViewEntity();
  if (viewpoint == null) return;
  this.target = this.rayTrace(viewpoint, mc.playerController.getBlockReachDistance(), 0);
}

代码示例来源:origin: TehNut/HWYLA

public static void drawBillboard(float posX, float posY, float posZ, float offX, float offY, float offZ, double x1, double y1, double x2, double y2, int r, int g, int b, int a, double partialFrame) {
  Entity player = Minecraft.getMinecraft().getRenderViewEntity();
  float playerViewY = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * (float) partialFrame;
  float playerViewX = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * (float) partialFrame;
  UIHelper.drawBillboard(posX, posY, posZ, offX, offY, offZ, playerViewX, playerViewY * -1.0F, 0.0F, x1, y1, x2, y2, r, g, b, a);
}

代码示例来源:origin: TehNut/HWYLA

public static void drawBillboardText(String text, float posX, float posY, float posZ, float offX, float offY, float offZ, double partialFrame) {
  Entity player = Minecraft.getMinecraft().getRenderViewEntity();
  float playerViewY = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * (float) partialFrame;
  float playerViewX = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * (float) partialFrame;
  UIHelper.drawFloatingText(text, posX, posY, posZ, offX, offY, offZ, playerViewX, playerViewY * -1.0F, 0.0F);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

final Vec3d vec3 = mc.getRenderViewEntity().getPositionEyes( f );

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

private static Optional<Tuple<Double, Entity>> getClosestCollidedEntity(Entity excludedEntity, Vec3d playerEyesPos, Vec3d lookVector, Vec3d endVector) {
  Minecraft mc = Minecraft.getMinecraft();
  //noinspection ConstantConditions
  List<Entity> possibleHitEntities = mc.world.getEntitiesWithinAABBExcludingEntity(mc.getRenderViewEntity(),
      mc.getRenderViewEntity().getEntityBoundingBox().expand(lookVector.x * MAX_RANGE, lookVector.y * MAX_RANGE, lookVector.z * MAX_RANGE)
          .grow(1, 1, 1));
  return possibleHitEntities.stream().filter(e -> e != excludedEntity && e.canBeCollidedWith())
      .map(e -> new Tuple<>(getDistanceToCollidedEntity(e, playerEyesPos, endVector), e)).filter(t -> t.getFirst() < Double.MAX_VALUE)
      .sorted(Comparator.comparing(Tuple::getFirst)).findFirst();
}

代码示例来源:origin: Vazkii/Psi

public FXWisp(World world, double d, double d1, double d2,  float size, float red, float green, float blue, boolean distanceLimit, boolean depthTest, float maxAgeMul) {
  super(world, d, d1, d2, size, red, green, blue, (int) (28 / (Math.random() * 0.3D + 0.7D) * maxAgeMul));
  moteParticleScale = particleScale;
  this.depthTest = depthTest;
  moteHalfLife = particleMaxAge / 2;
  Entity viewEntity = Minecraft.getMinecraft().getRenderViewEntity();
  if (distanceLimit) {
    int visibleDistance = 50;
    if (!Minecraft.getMinecraft().gameSettings.fancyGraphics)
      visibleDistance = 25;
    if (viewEntity == null || viewEntity.getDistance(posX, posY, posZ) > visibleDistance)
      particleMaxAge = 0;
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@SideOnly(Side.CLIENT)
@Override
public EnumFacing getSideMouseover(int max) {
 RayTraceResult mouseOver = Minecraft.getMinecraft().getRenderViewEntity().rayTrace(max, 1f);
 // now get whatever block position we are mousing over if anything
 if (mouseOver != null) {
  // Get the block position and make sure it is a block
  return mouseOver.sideHit;
 }
 return null;
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

private void billBoard(
    final EntityPlayer player,
    final float partialTicks )
{
  final Entity view = Minecraft.getMinecraft().getRenderViewEntity();
  if ( view != null )
  {
    final float yaw = view.prevRotationYaw + ( view.rotationYaw - view.prevRotationYaw ) * partialTicks;
    GlStateManager.rotate( 180 + -yaw, 0f, 1f, 0f );
    final float pitch = view.prevRotationPitch + ( view.rotationPitch - view.prevRotationPitch ) * partialTicks;
    GlStateManager.rotate( -pitch, 1f, 0f, 0f );
  }
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

public static void tessalateParticleIcon(TextureAtlasSprite icon, double x, double y, double z, float size, Color color) {
  RenderUtils.tessalateParticle(Minecraft.getMinecraft().getRenderViewEntity(), icon, size, new Vec3d(x, y, z), color);
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

private void setupViewBobbing(float partialTicks) {
  if (this.mc.getRenderViewEntity() instanceof EntityPlayer) {
    EntityPlayer entityplayer = (EntityPlayer) this.mc.getRenderViewEntity();
    float f = entityplayer.distanceWalkedModified - entityplayer.prevDistanceWalkedModified;
    float f1 = -(entityplayer.distanceWalkedModified + f * partialTicks);
    float f2 = entityplayer.prevCameraYaw + (entityplayer.cameraYaw - entityplayer.prevCameraYaw) * partialTicks;
    float f3 = entityplayer.prevCameraPitch + (entityplayer.cameraPitch - entityplayer.prevCameraPitch) * partialTicks;
    GlStateManager.translate(MathHelper.sin(f1 * (float) Math.PI) * f2 * 0.05F, -Math.abs(MathHelper.cos(f1 * (float) Math.PI) * f2) * 0.1f, 0.0F);
    GlStateManager.rotate(MathHelper.sin(f1 * (float) Math.PI) * f2 * 0f, 0.0F, 0.0F, 1.0F);
    GlStateManager.rotate(Math.abs(MathHelper.cos(f1 * (float) Math.PI - 0.2F) * f2) * 1f, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(f3, 1.0F, 0.0F, 0.0F);
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@SideOnly(Side.CLIENT)
@Override
public BlockPos getBlockMouseoverExact(int max) {
 // Get the player and their held item
 RayTraceResult mouseOver = Minecraft.getMinecraft().getRenderViewEntity().rayTrace(max, 1f);
 // now get whatever block position we are mousing over if anything
 if (mouseOver != null) {
  // Get the block position and make sure it is a block
  return mouseOver.getBlockPos();
 }
 return null;
}

代码示例来源:origin: Vazkii/Botania

Vec3d vec3d = world.getSkyColor(mc.getRenderViewEntity(), partialTicks);
float f = (float)vec3d.x;
float f1 = (float)vec3d.y;

代码示例来源:origin: lawremi/CustomOreGen

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onRenderWorldLast(RenderWorldLastEvent event)
{
  ClientState.onRenderWorld(Minecraft.getMinecraft().getRenderViewEntity(), (double)event.getPartialTicks());
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

protected void drawStarParticle(Quadrant quadrant, Star star, Vec3d pos, EntityPlayer player, TileEntityMachineStarMap starMap, double starSizeMultiply) {
    Color color = getStarColor(star, player);
    double size = 0.01;
    if (starMap.getDestination().equals(star)) {
      size = 0.035;
      RenderUtils.tessalateParticle(Minecraft.getMinecraft().getRenderViewEntity(), selectedIcon, star.getSize() * 0.05 * starSizeMultiply, pos, color);
    }
    if (starMap.getGalaxyPosition().equals(star)) {
      size = 0.035;
      RenderUtils.tessalateParticle(Minecraft.getMinecraft().getRenderViewEntity(), currentIcon, star.getSize() * 0.05 * starSizeMultiply, pos, color);
    }
    if (star.isClaimed(player) == 3) {
      size = 0.025;
    }
    RenderUtils.tessalateParticle(Minecraft.getMinecraft().getRenderViewEntity(), star_icon, star.getSize() * size * starSizeMultiply, pos, color);
  }
}

相关文章