Пример #1
0
  @Override
  public void startFlash(EntityPlayer player, float damage) {
    if (player
        .getCommandSenderName()
        .equals(Minecraft.getMinecraft().thePlayer.getCommandSenderName())) {
      BattlegearClientTickHandeler.resetFlash();
      ItemStack offhand = ((InventoryPlayerBattle) player.inventory).getCurrentOffhandWeapon();

      if (offhand != null && offhand.getItem() instanceof IShield)
        BattlegearClientTickHandeler.reduceBlockTime(
            ((IShield) offhand.getItem()).getDamageDecayRate(offhand, damage));
    }
  }
  /** Render quiver on skeletons if possible */
  @SubscribeEvent
  public void renderLiving(RenderLivingEvent.Post event) {

    if (BattlegearConfig.enableSkeletonQuiver
        && event.entity instanceof EntitySkeleton
        && event.renderer instanceof RenderSkeleton) {

      GL11.glPushMatrix();
      GL11.glDisable(GL11.GL_CULL_FACE);

      GL11.glColor3f(1, 1, 1);
      Minecraft.getMinecraft().getTextureManager().bindTexture(quiverDetails);

      GL11.glTranslatef((float) event.x, (float) event.y, (float) event.z);

      GL11.glScalef(1, -1, 1);

      float f2 =
          interpolateRotation(event.entity.prevRenderYawOffset, event.entity.renderYawOffset, 0);

      GL11.glRotatef(180.0F - f2, 0.0F, 1.0F, 0.0F);

      if (event.entity.deathTime > 0) {
        float f3 =
            ((float) event.entity.deathTime + BattlegearClientTickHandeler.getPartialTick() - 1.0F)
                / 20.0F
                * 1.6F;
        f3 = MathHelper.sqrt_float(f3);

        if (f3 > 1.0F) {
          f3 = 1.0F;
        }

        GL11.glRotatef(-f3 * 90, 0.0F, 0.0F, 1.0F);
      }

      GL11.glTranslatef(0, -1.5F, 0);

      GL11.glRotatef(event.entity.rotationPitch, 0, 1, 0);

      if (event.entity.getEquipmentInSlot(3) != null) { // chest armor
        GL11.glTranslatef(0, 0, BattlegearRenderHelper.RENDER_UNIT);
      }
      ((ModelBiped) event.renderer.mainModel)
          .bipedBody.postRender(BattlegearRenderHelper.RENDER_UNIT);
      GL11.glScalef(1.05F, 1.05F, 1.05F);
      quiverModel.render(SKELETON_ARROW, BattlegearRenderHelper.RENDER_UNIT);

      Minecraft.getMinecraft().getTextureManager().bindTexture(quiverBase);
      GL11.glColor3f(0.10F, 0.10F, 0.10F);
      quiverModel.render(0, BattlegearRenderHelper.RENDER_UNIT);
      GL11.glColor3f(1, 1, 1);

      GL11.glEnable(GL11.GL_CULL_FACE);
      GL11.glPopMatrix();
    }
  }
 public static void reduceBlockTime(float value) {
   INSTANCE.blockBar -= value;
 }
 public static void resetFlash() {
   INSTANCE.flashTimer = FLASH_MAX;
 }