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

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

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

Minecraft.getItemRenderer介绍

暂无

代码示例

代码示例来源:origin: TeamWizardry/Wizardry

@Override
  public void setItemStackHandHandler(EnumHand hand, ItemStack stack) {
    if (hand == EnumHand.MAIN_HAND)
      itemStackMainHandHandler.invoke(Minecraft.getMinecraft().getItemRenderer(), stack);
    else itemStackOffHandHandler.invoke(Minecraft.getMinecraft().getItemRenderer(), stack);
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void doRenderLayer(@Nonnull RenderPlayer renderPlayer, EntityEquipmentSlot equipmentSlot, @Nonnull ItemStack piece,
  @Nonnull AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_,
  float p_177141_7_, float scale) {
 if (equipmentSlot != null) {
  return;
 }
 GlStateManager.pushMatrix();
 if (entitylivingbaseIn.isSneaking()) {
  GlStateManager.translate(0.0F, 0.2F, 0.0F);
 }
 renderPlayer.getMainModel().bipedHead.postRender(0.0625F);
 GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
 GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
 GlStateManager.scale(0.75f, 0.9f, 2);
 GlStateManager.translate(0.0F, 2.7f * 0.0625F, .49 * 0.0625F);
 Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, piece, TransformType.NONE);
 GlStateManager.popMatrix();
}

代码示例来源:origin: jabelar/ExampleMod-1.12

itemRenderer.set(mc.getItemRenderer(), modRenderItem);

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void doRenderLayer(@Nonnull RenderPlayer renderPlayer, EntityEquipmentSlot equipmentSlot, @Nonnull ItemStack piece,
  @Nonnull AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_,
  float p_177141_7_, float scale) {
 if (equipmentSlot != EntityEquipmentSlot.HEAD) {
  return;
 }
 SolarUpgrade solarUpgrade = SolarUpgrade.loadAnyFromItem(piece);
 if (solarUpgrade == null) {
  return;
 }
 GlStateManager.pushMatrix();
 if (entitylivingbaseIn.isSneaking()) {
  GlStateManager.translate(0.0F, 0.2F, 0.0F);
 }
 renderPlayer.getMainModel().bipedHead.postRender(0.0625F);
 GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
 float f2 = 0.625F;
 GlStateManager.translate(0.0F, -0.25F, 0.0F);
 GlStateManager.translate(0.0F, -f2, 0.0F); // added
 GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
 GlStateManager.scale(f2, -f2, -f2);
 Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, solarUpgrade.getUpgradeItem(), TransformType.HEAD);
 GlStateManager.popMatrix();
}

代码示例来源:origin: Silentine/GrimoireOfGaia

private void renderHeldItem(EntityLivingBase living, ItemStack stack, ItemCameraTransforms.TransformType camera, EnumHandSide handSide) {
  if (!stack.isEmpty()) {
    GlStateManager.pushMatrix();
    if (living.isSneaking()) {
      GlStateManager.translate(0.0F, 0.2F, 0.0F);
    }
    limb.postRender(0.0625F);
    GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
    boolean flag = handSide == EnumHandSide.LEFT;
    GlStateManager.translate((float) (flag ? -1 : 1) / 16.0F, 0.125F, -0.625F);
    Minecraft.getMinecraft().getItemRenderer().renderItemSide(living, stack, camera, flag);
    GlStateManager.popMatrix();
  }
}

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

private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide) {
  if(!p_188358_2_.isEmpty()) {
    GlStateManager.pushMatrix();
    if(p_188358_1_.isSneaking())
      GlStateManager.translate(0.0F, 0.2F, 0.0F);
    // Forge: moved this call down, fixes incorrect offset while sneaking.
    ((ModelBiped)livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, handSide);
    GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
    boolean flag = handSide == EnumHandSide.LEFT;
    GlStateManager.translate((flag ? -1 : 1) / 16.0F, 0.125F, -0.625F);
    Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag);
    GlStateManager.popMatrix();
  }
}

代码示例来源:origin: TeamLapen/Vampirism

private void renderHeldItem(EntityAggressiveVillager p_188358_1_, ItemStack stack, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide p_188358_4_) {
  if (!stack.isEmpty()) {
    GlStateManager.pushMatrix();
    ((ModelVillagerWithArms) this.renderer.getMainModel()).postRenderArm(0.0625F, p_188358_4_);
    if (p_188358_1_.isSneaking()) {
      GlStateManager.translate(0.0F, 0.2F, 0.0F);
    }
    GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
    boolean flag = p_188358_4_ == EnumHandSide.LEFT;
    GlStateManager.translate(flag ? -0.0925F : 0.0925F, 0.125F, -0.525F);
    Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, stack, p_188358_3_, flag);
    GlStateManager.popMatrix();
  }
}

代码示例来源:origin: Silentine/GrimoireOfGaia

@Override
public void doRenderLayer(EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
  ItemStack headgear = getHeadgear(player);
  if (!headgear.isEmpty()) {
    GlStateManager.pushMatrix();
    if (player.isSneaking()) {
      GlStateManager.translate(0.0F, 0.2F, 0.0F);
    }
    bipedHead.postRender(0.0625F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.translate(0.0F, -0.25F, 0.0F);
    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.scale(0.625F, -0.625F, -0.625F);
    Minecraft.getMinecraft().getItemRenderer().renderItem(player, headgear, ItemCameraTransforms.TransformType.HEAD);
    GlStateManager.popMatrix();
  }
}

代码示例来源:origin: Silentine/GrimoireOfGaia

void renderHeldItem(EntityLivingBase living, ItemStack stack, ItemCameraTransforms.TransformType camera, EnumHandSide handSide) {
  if (!stack.isEmpty()) {
    GlStateManager.pushMatrix();
    if (living.isSneaking()) {
      GlStateManager.translate(0.0F, 0.2F, 0.0F);
    }
    limb.postRender(0.0625F);
    GlStateManager.rotate(-40.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.translate(0F, 0.1F, 0.15F);
    GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
    boolean flag = handSide == EnumHandSide.LEFT;
    GlStateManager.translate((float) (flag
        ? -1
        : 1) / 16.0F, 0.125F, -0.625F);
    Minecraft.getMinecraft()
        .getItemRenderer()
        .renderItemSide(living, stack, camera, flag);
    GlStateManager.popMatrix();
  }
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

private void renderHeldItem(EntityMyrmexBase myrmex, ItemStack stack, ItemCameraTransforms.TransformType transform, EnumHandSide handSide) {
  if (!stack.isEmpty()) {
    GlStateManager.pushMatrix();
    if (myrmex.isSneaking()) {
      GlStateManager.translate(0.0F, 0.2F, 0.0F);
    }
    this.translateToHand(handSide);
    if(Minecraft.getMinecraft().getRenderItem().shouldRenderItemIn3D(stack)){
      GlStateManager.translate(0F, 0.25F, -1.65F);
    }else{
      GlStateManager.translate(0F, 1F, -2F);
    }
    GlStateManager.rotate(160, 1, 0, 0);
    GlStateManager.rotate(180, 0, 1, 0);
    Minecraft.getMinecraft().getItemRenderer().renderItem(myrmex, stack, transform);
    GlStateManager.popMatrix();
  }
}

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

public static void renderItemAllPasses(EntityLivingBase livingBase, boolean inMainHand, ItemStack itemStack) {
  if (livingBase!=null)
    Minecraft.getMinecraft().getItemRenderer().renderItem(livingBase, itemStack, inMainHand ? ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND : ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND);
  else {
    GlStateManager.pushMatrix();
    boolean flag = Minecraft.getMinecraft().getRenderItem().shouldRenderItemIn3D(itemStack) && Block.getBlockFromItem(itemStack.getItem()).getBlockLayer() == BlockRenderLayer.TRANSLUCENT;
    if (flag)
    {
      GlStateManager.depthMask(false);
    }
    Minecraft.getMinecraft().getRenderItem().renderItem(itemStack, ItemCameraTransforms.TransformType.FIXED);
    if (flag)
    {
      GlStateManager.depthMask(true);
    }
    GlStateManager.popMatrix();
  }
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

if (mainHandStack != null && mainHandStack.getItem() instanceof SteamTool) {
  try {
    itemInMainHandField.set(mc.getItemRenderer(), mainHandStack);
  } catch (IllegalAccessException e) {
    e.printStackTrace();
    itemInOffHandField.set(mc.getItemRenderer(), offHandStack);
  } catch (IllegalAccessException e) {
    e.printStackTrace();

代码示例来源:origin: SleepyTrousers/EnderIO

GlStateManager.scale(f2, -f2, -f2);
Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, paintSource, TransformType.HEAD);

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

if(!player.isInvisible() && BattlegearUtils.isPlayerInBattlemode(player)) {
  GlStateManager.pushMatrix();
  Minecraft.getMinecraft().getItemRenderer().renderArmFirstPerson(event.getEquipProgress(), event.getSwingProgress(), player.getPrimaryHand().opposite());
  GlStateManager.popMatrix();
BattlegearRenderHelper.renderItemInFirstPerson(event.getEquipProgress(), player, Minecraft.getMinecraft().getItemRenderer());
event.setCanceled(true);
return;
  int slot = ((IArrowContainer2) event.getItemStack().getItem()).getSelectedSlot(event.getItemStack());
  ItemStack arrowStack = ((IArrowContainer2) event.getItemStack().getItem()).getStackInSlot(event.getItemStack(), slot);
  Minecraft.getMinecraft().getItemRenderer().renderItemInFirstPerson(player, event.getPartialTicks(), event.getInterpolatedPitch(), event.getHand(), event.getSwingProgress(), arrowStack, event.getEquipProgress());
  event.setCanceled(true);
  return;

代码示例来源:origin: Alex-the-666/Ice_and_Fire

minecraft.getItemRenderer().renderItem(entity, itemstack, ItemCameraTransforms.TransformType.GROUND);
GlStateManager.popMatrix();

代码示例来源:origin: SleepyTrousers/EnderIO

minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND);
GlStateManager.popMatrix();

代码示例来源:origin: TeamWizardry/Wizardry

GlStateManager.scale(0.625f, -0.625f, -0.625f);
Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, halo, ItemCameraTransforms.TransformType.HEAD);

代码示例来源:origin: WayofTime/BloodMagic

GlStateManager.rotate(-(mimic.prevRotationYawHead + partialTicks * (mimic.rotationYawHead - mimic.prevRotationYawHead)) - 180, 0, 1, 0);
minecraft.getItemRenderer().renderItem(mimic, itemstack, ItemCameraTransforms.TransformType.HEAD);

相关文章