Java 类net.minecraftforge.client.event.RenderSpecificHandEvent 实例源码

项目:Infernum    文件:RenderKnowledgeTome.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderItem(RenderSpecificHandEvent event) {
    Minecraft minecraft = Minecraft.getMinecraft();
    if (event.getHand() == EnumHand.MAIN_HAND) {
        if (minecraft.gameSettings.thirdPersonView != 0
                || minecraft.player.getHeldItem(EnumHand.MAIN_HAND).func_190916_E() <= 0
                || minecraft.player.getHeldItem(EnumHand.MAIN_HAND).getItem() != InfernumItems.KNOWLEDGE_BOOK) {
            reset();
            return;
        }
        if ((minecraft.player.getHeldItem(EnumHand.OFF_HAND).equals(ItemStack.field_190927_a))) {
            event.setCanceled(true);
            try {
                ticksOpen++;
                doRender(event.getPartialTicks(), minecraft.player.getHeldItem(event.getHand()));
            } catch (Throwable throwable) {

            }
        } else {
            reset();
        }
    }
}
项目:CrystalMod    文件:DisguiseClientHandler.java   
@SideOnly(Side.CLIENT)
  @SubscribeEvent(priority = EventPriority.HIGHEST)
  public void onRenderHand(RenderSpecificHandEvent event)
  {
Minecraft.getMinecraft();
AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer) CrystalMod.proxy.getClientPlayer();
ExtendedPlayer ePlayer = ExtendedPlayerProvider.getExtendedPlayer(abstractclientplayer);
if(ePlayer !=null && ePlayer.getPlayerDisguiseUUID() !=null)
      {
    boolean flag = event.getHand() == EnumHand.MAIN_HAND;
       EnumHandSide enumhandside = flag ? abstractclientplayer.getPrimaryHand() : abstractclientplayer.getPrimaryHand().opposite();


       if (ItemStackTools.isNullStack(event.getItemStack()))
       {
           if (flag && !abstractclientplayer.isInvisible())
           {
            event.setCanceled(true);
            GlStateManager.pushMatrix();
               renderArmFirstPerson(event.getEquipProgress(), event.getSwingProgress(), enumhandside, ePlayer.isMini());
               GlStateManager.popMatrix();
           }
       }
      }
  }
项目:ArcaneMagic    文件:ClientEvents.java   
@SubscribeEvent
public static void onRenderHand(RenderSpecificHandEvent ev)
{
    EntityPlayer player = Minecraft.getMinecraft().player;
    if (!player.isSneaking() && ev.getItemStack().getItem() instanceof ItemParchment)
    {

        float f = player.getSwingProgress(ev.getPartialTicks());
        float f1 = player.prevRotationPitch
                + (player.rotationPitch - player.prevRotationPitch) * ev.getPartialTicks();

        ItemRenderer itemrenderer = Minecraft.getMinecraft().getItemRenderer();

        float prevEquipProgress = ev.getHand() == EnumHand.MAIN_HAND ? itemrenderer.prevEquippedProgressMainHand
                : itemrenderer.prevEquippedProgressOffHand;
        float equipProgress = ev.getHand() == EnumHand.MAIN_HAND ? itemrenderer.equippedProgressMainHand
                : itemrenderer.equippedProgressOffHand;
        float f5 = 1.0F - (prevEquipProgress + (equipProgress - prevEquipProgress) * ev.getPartialTicks());

        GlStateManager.pushMatrix();
        GlStateManager.pushAttrib();

        if (ev.getHand() == EnumHand.MAIN_HAND && player.getHeldItemOffhand().isEmpty())
        {
            GLHelper.renderParchmentFirstPerson(f1, f5, f, ev.getItemStack());
        } else
        {
            EnumHandSide enumhandside = ev.getHand() == EnumHand.MAIN_HAND ? player.getPrimaryHand()
                    : player.getPrimaryHand().opposite();
            GLHelper.renderParchmentFirstPersonSide(f5, enumhandside, f, ev.getItemStack());
        }

        GlStateManager.popAttrib();
        GlStateManager.popMatrix();
        ev.setCanceled(true);
    }
}
项目:Mods    文件:TF2EventsClient.java   
@SubscribeEvent
public void renderSpecificHand(RenderSpecificHandEvent event) {
    EntityPlayer player=Minecraft.getMinecraft().player;
    if((event.getItemStack().getItem() instanceof ItemCloak && !WeaponsCapability.get(player).isFeign() 
            && ((ItemCloak)event.getItemStack().getItem()).isFeignDeath(event.getItemStack(), player))) {
        event.setCanceled(true);
    }
}
项目:iChunUtil    文件:ItemRenderingHelper.java   
public static void onRenderSpecificHand(RenderSpecificHandEvent event)
{
    if(event.getHand() == EnumHand.MAIN_HAND && event.getItemStack().isEmpty())
    {
        ItemStack is = Minecraft.getMinecraft().player.getHeldItem(EnumHand.OFF_HAND);
        if(!is.isEmpty() && ItemHandler.isItemDualHanded(is))
        {
            event.setCanceled(true);
        }
    }
}
项目:CustomWorldGen    文件:ForgeHooksClient.java   
public static boolean renderSpecificFirstPersonHand(EnumHand hand, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack)
{
    return MinecraftForge.EVENT_BUS.post(new RenderSpecificHandEvent(hand, partialTicks, interpPitch, swingProgress, equipProgress, stack));
}
项目:Aether-Legacy    文件:AetherClientEvents.java   
@SubscribeEvent
public void onRenderHand(RenderSpecificHandEvent event)
{
    PlayerGloveRenderer.renderItemFirstPerson(Minecraft.getMinecraft().thePlayer, event.getPartialTicks(), event.getInterpolatedPitch(), event.getHand(), event.getSwingProgress(), event.getItemStack(), event.getEquipProgress());
}
项目:Alchemy    文件:SingleProjection.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onRenderSpecificHand(RenderSpecificHandEvent event) { 
    if (projectionState)
        AlchemyEventSystem.markEventCanceled(event);
}
项目:iChunUtil    文件:EventHandlerClient.java   
@SubscribeEvent
public void onRenderSpecificHand(RenderSpecificHandEvent event)
{
    ItemRenderingHelper.onRenderSpecificHand(event);
}