Пример #1
0
  public void RenderAffinity(int i, int j) {
    AMVector2 affinityPos = getShiftedVector(AMCore.config.getAffinityPosition(), i, j);

    int x = affinityPos.iX;
    int y = affinityPos.iY;

    AffinityData ad = AffinityData.For(Minecraft.getMinecraft().thePlayer);
    for (Affinity affinity : ad.getHighestAffinities()) {
      if (affinity == null || affinity == Affinity.NONE) continue;
      GL11.glColor3f(1.0f, 1.0f, 1.0f);
      AMGuiHelper.instance.DrawIconAtXY(
          affinity.representItem.getIconFromDamage(affinity.representMeta), x, y, j, 12, 12, true);

      if (AMCore.config.getShowNumerics()) {
        String display =
            String.format(
                "%.2f%%", AffinityData.For(mc.thePlayer).getAffinityDepth(affinity) * 100);
        if (x < i / 2)
          Minecraft.getMinecraft().fontRenderer.drawString(display, x + 14, y + 2, affinity.color);
        else
          Minecraft.getMinecraft()
              .fontRenderer
              .drawString(
                  display,
                  x - 2 - Minecraft.getMinecraft().fontRenderer.getStringWidth(display),
                  y + 2,
                  affinity.color);
      }
      y += 15;
    }
  }
Пример #2
0
  public static void loadConfig() {
    if (config.exists())
      try {
        Minecraft.getMinecraft();
        FileInputStream in =
            new FileInputStream(Minecraft.getMinecraftDir() + "/MenuAPI.properties");

        menuProps.load(in);

        if (menuProps.size() <= 0) {
          resetConfig();
          return;
        }

        selectedMenuName = String.valueOf(menuProps.getProperty("selectedMenu"));
        loopMusic = menuProps.getProperty("loopMusic").equals("true");
        muteMusic = menuProps.getProperty("muteMusic").equals("true");
        lastMusicIndex = Integer.valueOf(menuProps.getProperty("lastMusicIndex")).intValue();
        musicIndex = Integer.valueOf(menuProps.getProperty("musicIndex")).intValue();
        musicSet = menuProps.getProperty("musicSet").equals("true");
        hasPlayedMusic = menuProps.getProperty("hasPlayedMusic").equals("true");
        hasStartedMusic = menuProps.getProperty("hasStartedMusic").equals("true");
      } catch (FileNotFoundException e) {
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }
    else resetConfig();
  }
  public void renderParticle(
      Tessellator tess, float ptt, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
    brightness = brightnessFade.updateFade(particleAge);

    float progress = (float) particleAge / particleMaxAge;

    // tess.draw();

    // glPushMatrix();

    glDepthMask(false);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    Minecraft.getMinecraft().renderEngine.bindTexture(tex);

    float scale = data.size;

    float[] pos = FXHelper.trackingParticleLocale(this, ptt);
    float[] rot = new float[] {rotX, rotXZ, rotZ, rotYZ, rotXY};

    pos[0] += data.xRad * Math.cos(2 * Math.PI * progress);
    pos[1] += 0.5 * data.yRad * Math.cos(2 * Math.PI * progress) * Math.sin(2 * Math.PI * progress);
    pos[2] += data.zRad * Math.sin(2 * Math.PI * progress);

    draw(tess, pos, scale, rot);

    glDisable(GL_BLEND);
    glDepthMask(true);

    // glPopMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(FXHelper.getParticleTexture());

    // tess.startDrawingQuads();
  }
Пример #4
0
  @Optional.Method(modid = Mods.OpenComputers)
  public void render(ItemStack stack, MountPoint mountPoint, Robot robot, float pt) {
    if (!isUpgrade(stack)) {
      return;
    }

    Minecraft mc = Minecraft.getMinecraft();
    TextureManager tm = mc.getTextureManager();

    switch (stack.getItemDamage()) {
      case 1:
        {
          tm.bindTexture(upgradeChatBox);
          drawSimpleBlock(mountPoint, 0, true);
          break;
        }
      case 2:
        {
          if (mountPoint.name.equals(MountPointName.TopLeft)
              || mountPoint.name.equals(MountPointName.TopRight)) {
            float degrees =
                robot.shouldAnimate()
                    ? ((robot.world().getTotalWorldTime() + (robot.hashCode() ^ 0xFF)) % 160 + pt)
                        / 160F
                        * 360F
                    : 0F;
            if (mountPoint.name.equals(MountPointName.TopRight)) {
              degrees = 360 - degrees;
            }
            GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
            tm.bindTexture(modelRadar);
            GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glRotatef(180, 1, 0, 0);
            GL11.glRotatef(
                mountPoint.rotation.getW(),
                mountPoint.rotation.getX(),
                mountPoint.rotation.getY(),
                mountPoint.rotation.getZ());
            GL11.glTranslatef(0F, -0.8F, 0F);
            GL11.glTranslatef(
                mountPoint.offset.getX(), mountPoint.offset.getY(), mountPoint.offset.getZ());
            GL11.glScalef(0.3f, 0.3f, 0.3f);
            GL11.glPushMatrix();
            radarModel.render(Math.max(degrees, 0));
            GL11.glPopMatrix();
            GL11.glPopAttrib();
          } else {
            tm.bindTexture(upgradeRadar);
            drawSimpleBlock(mountPoint, 0, true);
          }
          break;
        }
      case 5:
        {
          tm.bindTexture(beepCard);
          drawSimpleBlock(mountPoint, 0, true);
          break;
        }
    }
  }
  public void drawBars() {
    if (RLMPlayerProps.get(Minecraft.getMinecraft().thePlayer) != null) {
      bindTexture(new ResourceLocation("reallifemod:textures/gui/overlay/rim.png"));
      drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 256, 256, 256, 256);

      // bindTexture(emptybar);
      // drawModalRectWithCustomSizedTexture(20, 5, 0, 0, 49, 6, 49, 6);

      EntityPlayer player = Minecraft.getMinecraft().thePlayer;
      RLMPlayerProps props = RLMPlayerProps.get(player);

      poopbar.drawWidget(0, 0, 0F);
      peebar.drawWidget(0, 0, 0F);

      bindTexture(new ResourceLocation("reallifemod:textures/gui/overlay/lucky.png"));
      drawScaledCustomSizeModalRect(65, 1, 0, 0, 31, 31, 20, 20, 32, 32);

      drawString(
          Minecraft.getMinecraft().fontRendererObj,
          String.valueOf("Cash: " + props.cash + "$"),
          2,
          2,
          Color.white.getRGB());
      float temperature =
          TemperatureHelper.getTemperaturesForBiomes(
              player.worldObj.getBiomeGenForCoords(player.getPosition()), player);
      drawString(
          Minecraft.getMinecraft().fontRendererObj,
          String.valueOf("Temp: " + temperature + "°"),
          2,
          13,
          TemperatureHelper.getColorForTemperature(temperature));
    }
  }
Пример #6
0
  public static void playBlockBreakParticles(BlockPos pos, IBlockState state) {
    ParticleManager pm = Minecraft.getMinecraft().effectRenderer;

    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        for (int l = 0; l < 4; l++) {
          double d0 = (double) pos.getX() + ((double) j + 0.5D) / 4D;
          double d1 = (double) pos.getY() + ((double) k + 0.5D) / 4D;
          double d2 = (double) pos.getZ() + ((double) l + 0.5D) / 4D;
          Particle digging =
              diggingFactory.getEntityFX(
                  0,
                  Minecraft.getMinecraft().theWorld,
                  d0,
                  d1,
                  d2,
                  d0 - (double) pos.getX() - 0.5D,
                  d1 - (double) pos.getY() - 0.5D,
                  d2 - (double) pos.getZ() - 0.5D,
                  Block.getStateId(state));
          pm.addEffect(digging);
        }
      }
    }
  }
Пример #7
0
  @Override
  public void registerTileEntities() {
    super.registerTileEntities();

    IReloadableResourceManager IRRM =
        (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
    IRRM.registerReloadListener(this);

    RenderManager rm = Minecraft.getMinecraft().getRenderManager();

    RenderingRegistry.registerEntityRenderingHandler(EntityStone.class, new RenderEntityStone());
    RenderingRegistry.registerEntityRenderingHandler(
        EntityMobHorse.class, new RenderHorse(rm, new ModelHorse(), 0.75f));
    RenderingRegistry.registerEntityRenderingHandler(
        EntityForestSpider.class, new RenderForestSpider(rm));
    RenderingRegistry.registerEntityRenderingHandler(
        EntityCoalPoweredMinecartVC.class, new RenderMinecart(rm));
    RenderingRegistry.registerEntityRenderingHandler(
        EntityEmptyMinecartVC.class, new RenderMinecart(rm));

    RenderingRegistry.registerEntityRenderingHandler(
        EntityCowVC.class, new RenderCow(rm, new ModelCowVC(), 0.7F));
    RenderingRegistry.registerEntityRenderingHandler(
        EntitySheepVC.class, new RenderSheep(rm, new ModelSheep2(), 0.7F));
  }
Пример #8
0
 public static void bindIconSheet(int type) {
   final Minecraft mc = Minecraft.getMinecraft();
   if (mc != null) {
     TextureManager manager = mc.getTextureManager();
     bindIconSheet(manager, type);
   }
 }
  @Override
  public void onPlayerStoppedUsing(
      ItemStack weapon, World world, EntityPlayer entityPlayer, int time) {
    if (world.isRemote) {
      int maxCount = getShotCount(weapon, entityPlayer);
      int timeElapsed = (getMaxItemUseDuration(weapon) - time);
      int count = Math.max(1, (int) ((1f - (timeElapsed / (float) MAX_CHARGE_TIME)) * maxCount));
      float shotPercent = count / (float) getShotCount(weapon, entityPlayer);

      ItemRenderPlasmaShotgun.RECOIL_AMOUNT =
          15
              + (maxCount - count) * 2
              + getAccuracy(weapon, entityPlayer, isWeaponZoomed(entityPlayer, weapon)) * 2;
      ItemRenderPlasmaShotgun.RECOIL_TIME = 1 + (maxCount - count) * 0.03f;
      Minecraft.getMinecraft().renderViewEntity.hurtTime = 15 + (maxCount - count);
      Minecraft.getMinecraft().renderViewEntity.maxHurtTime = 30 + (maxCount - count);
      Vec3 dir = entityPlayer.getLook(1);
      Vec3 pos = getFirePosition(entityPlayer, dir, Mouse.isButtonDown(1));
      WeaponShot shot = createShot(weapon, entityPlayer, Mouse.isButtonDown(1));
      shot.setCount(count);
      shot.setAccuracy(shot.getAccuracy() * shotPercent);
      shot.setRange(shot.getRange() + (int) (shot.getRange() * (1 - shotPercent)));
      onClientShot(weapon, entityPlayer, pos, dir, shot);
      MatterOverdrive.packetPipeline.sendToServer(
          new PacketFirePlasmaShot(entityPlayer.getEntityId(), pos, dir, shot));
      addShootDelay(weapon);
      stopChargingSound();
      entityPlayer.clearItemInUse();
    }
  }
  public void renderItem(ItemRenderType var1, ItemStack var2, Object... var3) {
    switch (RenderHelper.newRender[var1.ordinal()]) {
      case 1:
        GL11.glPushMatrix();
        Minecraft.getMinecraft()
            .renderEngine
            .bindTexture("/blfngl/fallout/textures/AntiMaterielRifle.png");
        boolean var4 = false;

        if (var3[1] != null && var3[1] instanceof EntityPlayer) {
          float var5;

          if ((EntityPlayer) var3[1] == Minecraft.getMinecraft().renderViewEntity
              && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0
              && (!(Minecraft.getMinecraft().currentScreen instanceof GuiInventory)
                      && !(Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative)
                  || RenderManager.instance.playerViewY != 180.0F)) {
            var4 = true;
            GL11.glTranslatef(0.7F, 0.5F, -0.25F);
            GL11.glRotatef(205.0F, 0.0F, 0.0F, 1.0F);
          } else {
            var5 = 0.3F;
            GL11.glTranslatef(0.7F, 0.5F, -0.2F);
            GL11.glScalef(var5, var5, var5);
            GL11.glRotatef(295.0F, 0.0F, 0.0F, 1.0F);
          }
        }

        this.model.render((Entity) var3[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
        GL11.glPopMatrix();

      default:
    }
  }
  private void doInventoryRendering(
      ItemStack item, HeraldryData heraldryData, IHeraldryItem heraldryItem) {

    Minecraft.getMinecraft().getTextureManager().bindTexture(map_overlay);
    BattlegearRenderHelper.renderTexturedQuad(0, 0, itemRenderer.zLevel, 16, 16);

    // IIcon icon =  heraldryItem.getBaseIcon(item);
    itemRenderer.zLevel += 100;
    glPushMatrix();
    RefreshableTexture currentCrest = new RefreshableTexture(32, 32);
    currentCrest.refreshWith(heraldryData, false);
    ResourceLocation crestLocation =
        Minecraft.getMinecraft()
            .getTextureManager()
            .getDynamicTextureLocation("gui_crest", currentCrest);
    ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(crestLocation);
    if (texture == null) {
      texture = new HeraldryTextureSmall(heraldryData);
      Minecraft.getMinecraft().getTextureManager().loadTexture(crestLocation, texture);
    }
    Minecraft.getMinecraft().getTextureManager().bindTexture(crestLocation);

    BattlegearRenderHelper.renderTexturedQuad(2, 2, itemRenderer.zLevel, 12, 12);

    glPopMatrix();

    itemRenderer.zLevel -= 100;
  }
Пример #12
0
 public static void renderEnchantmentEffects(Tessellator tessellator) {
   GL11.glDepthFunc(GL11.GL_EQUAL);
   GL11.glDisable(GL11.GL_LIGHTING);
   FMLClientHandler.instance().getClient().renderEngine.bindTexture(ITEM_GLINT);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
   float f7 = 0.76F;
   GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
   GL11.glMatrixMode(GL11.GL_TEXTURE);
   GL11.glPushMatrix();
   float f8 = 0.125F;
   GL11.glScalef(f8, f8, f8);
   float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
   GL11.glTranslatef(f9, 0.0F, 0.0F);
   GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
   RenderManager.instance.itemRenderer.renderItemIn2D(
       tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
   GL11.glPopMatrix();
   GL11.glPushMatrix();
   GL11.glScalef(f8, f8, f8);
   f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
   GL11.glTranslatef(-f9, 0.0F, 0.0F);
   GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
   RenderManager.instance.itemRenderer.renderItemIn2D(
       tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
   GL11.glPopMatrix();
   GL11.glMatrixMode(GL11.GL_MODELVIEW);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_LIGHTING);
   GL11.glDepthFunc(GL11.GL_LEQUAL);
 }
  public List func_94266_e(String par1Str) {
    ArrayList var2 = new ArrayList();
    ITexturePack var3 = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack();

    try {
      BufferedImage var9 = ImageIO.read(var3.getResourceAsStream("/" + par1Str));
      int var10 = var9.getHeight();
      int var11 = var9.getWidth();
      String var12 = this.func_98146_d(par1Str);

      if (this.func_98147_a(par1Str, var3)) {
        int var13 = var11;
        int var14 = var11;
        int var15 = var10 / var11;

        for (int var16 = 0; var16 < var15; ++var16) {
          Texture var17 =
              this.func_94261_a(
                  var12,
                  2,
                  var13,
                  var14,
                  10496,
                  6408,
                  9728,
                  9728,
                  false,
                  var9.getSubimage(0, var14 * var16, var13, var14));
          var2.add(var17);
        }
      } else if (var11 == var10) {
        var2.add(this.func_94261_a(var12, 2, var11, var10, 10496, 6408, 9728, 9728, false, var9));
      } else {
        Minecraft.getMinecraft()
            .func_98033_al()
            .func_98236_b(
                "TextureManager.createTexture: Skipping "
                    + par1Str
                    + " because of broken aspect ratio and not animation");
      }

      return var2;
    } catch (FileNotFoundException var18) {
      Minecraft.getMinecraft()
          .func_98033_al()
          .func_98236_b(
              "TextureManager.createTexture called for file "
                  + par1Str
                  + ", but that file does not exist. Ignoring.");
    } catch (IOException var19) {
      Minecraft.getMinecraft()
          .func_98033_al()
          .func_98236_b(
              "TextureManager.createTexture encountered an IOException when trying to read file "
                  + par1Str
                  + ". Ignoring.");
    }

    return var2;
  }
Пример #14
0
@SideOnly(Side.CLIENT)
public final class ComponentManagerHUD {

  public static final List<Component> components = Lists.newArrayList();

  private static final Minecraft mc = Minecraft.getMinecraft();

  private static final TextureManager tex = mc.getTextureManager();

  private static final FontRenderer font = Minecraft.getMinecraft().fontRendererObj;

  private static int prevX, prevY;

  private static final HUDOverlayBase[] overlays = new HUDOverlayBase[] {new HUDOccurrence()};

  private ComponentManagerHUD() {}

  @SubscribeEvent
  public static void drawElements(RenderGameOverlayEvent.Pre event) {
    if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) {
      GlStateManager.pushMatrix();
      GlStateManager.bindTexture(UITextures.GUI.getGlTextureId());
      for (Component component : components) component.atlasPass(0, event.getPartialTicks());

      GlStateManager.enableRescaleNormal();
      GlStateManager.enableAlpha();
      GlStateManager.alphaFunc(516, 0.1F);
      GlStateManager.enableBlend();
      GlStateManager.blendFunc(
          GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);

      GlStateManager.bindTexture(mc.getTextureMapBlocks().getGlTextureId());
      for (Component component : components) component.itemPass(0, event.getPartialTicks());

      tex.bindTexture(UITextures.RSS_GLINT);
      for (Component component : components) {
        GlStateManager.pushMatrix();
        component.itemEffectPass(0, event.getPartialTicks());
        GlStateManager.popMatrix();
      }

      GlStateManager.disableAlpha();
      GlStateManager.disableRescaleNormal();
      GlStateManager.disableLighting();

      for (Component component : components) component.textPass(0, event.getPartialTicks(), font);
      GlStateManager.popMatrix();
    }
  }

  @SubscribeEvent
  public static void updateElements(TickEvent.ClientTickEvent event) {
    components.forEach(Component::tick);
  }

  public static void rebuildComponentList() {
    components.clear();
    for (HUDOverlayBase overlay : overlays) if (overlay.isEnabled()) overlay.build(components);
  }
}
Пример #15
0
  @SubscribeEvent
  public void onRenderGUI(RenderGameOverlayEvent.Pre event) {
    // we're only interested in the inventory
    if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) {
      return;
    }

    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    ItemStack stack = player.getCurrentEquippedItem();
    if (stack == null) {
      return;
    }

    // do we hold a tool that supports secondary item usage?
    if (stack.getItem() instanceof ToolCore && ((ToolCore) stack.getItem()).canUseSecondaryItem()) {
      int slot = ToolHelper.getSecondaryItemSlot(player);

      if (slot != player.inventory.currentItem) {
        // render the special border around the secondary item that would be used
        int x = event.resolution.getScaledWidth() / 2 - 90 + slot * 20 + 2;
        int y = event.resolution.getScaledHeight() - 16 - 3;

        // render a cool underlay thing
        GlStateManager.color(1, 1, 1, 0.5f);
        Minecraft.getMinecraft().getTextureManager().bindTexture(widgetsTexPath);
        Gui.drawScaledCustomSizeModalRect(x, y, 1, 23, 22, 22, 16, 16, 256, 256);
      }
    }
  }
  @Override
  @SideOnly(Side.CLIENT)
  public void onShooterClientUpdate(
      ItemStack itemStack, World world, EntityPlayer entityPlayer, boolean sendServerTick) {
    if (Mouse.isButtonDown(0) && hasShootDelayPassed()) {
      if (canFire(itemStack, world, entityPlayer)) {
        itemStack.getTagCompound().setLong("LastShot", world.getTotalWorldTime());
        ItemRenderPlasmaShotgun.RECOIL_AMOUNT =
            12 + getAccuracy(itemStack, entityPlayer, isWeaponZoomed(entityPlayer, itemStack)) * 2;
        ItemRenderPlasmaShotgun.RECOIL_TIME = 1;
        Minecraft.getMinecraft().renderViewEntity.hurtTime = 15;
        Minecraft.getMinecraft().renderViewEntity.maxHurtTime = 30;
        Vec3 dir = entityPlayer.getLook(1);
        Vec3 pos = getFirePosition(entityPlayer, dir, Mouse.isButtonDown(1));
        WeaponShot shot = createShot(itemStack, entityPlayer, Mouse.isButtonDown(1));
        onClientShot(itemStack, entityPlayer, pos, dir, shot);
        addShootDelay(itemStack);
        sendShootTickToServer(world, shot, dir, pos);
        return;
      } else if (needsRecharge(itemStack)) {
        chargeFromEnergyPack(itemStack, entityPlayer);
      }
    }

    super.onShooterClientUpdate(itemStack, world, entityPlayer, sendServerTick);
  }
Пример #17
0
  public static void renderLiquidOverlays(float partialTicks) {
    Minecraft minecraft = FMLClientHandler.instance().getClient();

    if (ClientProxyCore.isInsideOfFluid(minecraft.thePlayer, GalacticraftCore.fluidOil)) {
      minecraft.getTextureManager().bindTexture(ClientProxyCore.underOilTexture);
    } else {
      return;
    }

    Tessellator tessellator = Tessellator.instance;
    float f1 = minecraft.thePlayer.getBrightness(partialTicks) / 3.0F;
    GL11.glColor4f(f1, f1, f1, 1.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    float f2 = 4.0F;
    float f3 = -1.0F;
    float f4 = 1.0F;
    float f5 = -1.0F;
    float f6 = 1.0F;
    float f7 = -0.5F;
    float f8 = -minecraft.thePlayer.rotationYaw / 64.0F;
    float f9 = minecraft.thePlayer.rotationPitch / 64.0F;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(f3, f5, f7, f2 + f8, f2 + f9);
    tessellator.addVertexWithUV(f4, f5, f7, 0.0F + f8, f2 + f9);
    tessellator.addVertexWithUV(f4, f6, f7, 0.0F + f8, 0.0F + f9);
    tessellator.addVertexWithUV(f3, f6, f7, f2 + f8, 0.0F + f9);
    tessellator.draw();
    GL11.glPopMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
  }
Пример #18
0
  /** Handles mouse input. */
  public void handleMouseInput() throws IOException {
    int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    int k = Mouse.getEventButton();

    if (Mouse.getEventButtonState()) {
      if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0) {
        return;
      }

      this.eventButton = k;
      this.lastMouseEvent = Minecraft.getSystemTime();
      this.mouseClicked(i, j, this.eventButton);
    } else if (k != -1) {
      if (this.mc.gameSettings.touchscreen && --this.touchValue > 0) {
        return;
      }

      this.eventButton = -1;
      this.mouseReleased(i, j, k);
    } else if (this.eventButton != -1 && this.lastMouseEvent > 0L) {
      long l = Minecraft.getSystemTime() - this.lastMouseEvent;
      this.mouseClickMove(i, j, this.eventButton, l);
    }
  }
  @SideOnly(Side.CLIENT)
  private void spawnParticle(World world, int x, int y, int z) {
    int p = Minecraft.getMinecraft().gameSettings.particleSetting;
    if (rand.nextInt(1 + p / 2) == 0) {
      double d = 1.25;
      double rx = ReikaRandomHelper.getRandomPlusMinus(x + 0.5, d);
      double ry = ReikaRandomHelper.getRandomPlusMinus(y + 0.5, d);
      double rz = ReikaRandomHelper.getRandomPlusMinus(z + 0.5, d);
      EntityFlareFX fx = new EntityFlareFX(color, world, rx, ry, rz);
      Minecraft.getMinecraft().effectRenderer.addEffect(fx);
    }

    if (this.isEnhanced()) {
      int n = 2 + (int) Math.sin(Math.toRadians(this.getTicksExisted()));
      for (int i = 0; i < n; i++) {
        float s = (float) ReikaRandomHelper.getRandomPlusMinus(2D, 1);
        int l = 10 + rand.nextInt(50);
        EntityFloatingSeedsFX fx =
            new EntityFloatingSeedsFX(
                world,
                x + 0.5,
                y + 0.5,
                z + 0.5,
                rand.nextInt(360),
                ReikaRandomHelper.getRandomPlusMinus(0, 90));
        fx.fadeColors(ReikaColorAPI.mixColors(color.getColor(), 0xffffff, 0.375F), color.getColor())
            .setScale(s)
            .setLife(l)
            .setRapidExpand();
        fx.freedom *= 3;
        fx.velocity *= 3;
        Minecraft.getMinecraft().effectRenderer.addEffect(fx);
      }
    }
  }
Пример #20
0
 @Override
 public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
   this.drawDefaultBackground();
   this.drawGradientRect(
       0,
       0,
       Minecraft.getMinecraft().displayWidth,
       Minecraft.getMinecraft().displayHeight,
       0x404040FF,
       0x404040FF);
   this.drawGradientRect(
       this.guiLeft,
       this.guiTop,
       this.xSize,
       this.ySize,
       supposedBoundsColor,
       supposedBoundsColor);
   MathHelper.circle(16, 16, 8).primitiveDraw(GL11.GL_LINE_LOOP, true, windowColor, zLevel);
   RenderHelper.drawHollowCircle(
       16, 32, 8, MathHelper.getEstimatedSegmentCount("circle", 8), zLevel, windowColor);
   this.drawGradientRect(
       this.mc.displayWidth / 2 - 8,
       this.mc.displayHeight - 16,
       this.mc.displayWidth / 2 + 8,
       this.mc.displayHeight,
       supposedBoundsColor,
       supposedBoundsColor);
 }
Пример #21
0
  @SubscribeEvent
  public void onClientTicket(ClientTickEvent evt) {

    if (evt.phase == TickEvent.Phase.END && Minecraft.getMinecraft().theWorld != null) {
      Random rnd = Minecraft.getMinecraft().theWorld.rand;
      float chance = 0.004f;
      if (VintageCraft.proxy.meteorShowerDuration > 0) {
        VintageCraft.proxy.meteorShowerDuration--;
        chance = 0.11f;
      }

      if (rnd.nextFloat() < chance && RenderSkyVC.shootingStars.size() < 35) {
        RenderSkyVC.shootingStars.add(
            new ShootingStar(
                rnd.nextFloat() * 300 - 150, rnd.nextFloat() * 300 - 150, rnd.nextFloat()));
      }

      for (Iterator<ShootingStar> iterator = RenderSkyVC.shootingStars.iterator();
          iterator.hasNext(); ) {
        ShootingStar star = iterator.next();
        star.tick();
        if (star.isDead()) {
          // Remove the current element from the iterator and the list.
          iterator.remove();
        }
      }
    }
  }
Пример #22
0
  @Override
  public void updateEntity() {

    Random r = new Random();
    int i = this.xCoord;
    int j = this.yCoord;
    int k = this.zCoord;
    World world = this.worldObj;
    count = count + 1;
    if (count % 1 == 0) {

      for (int num = 0; num < Particles.INTENSITY; num++) {

        double theta = r.nextDouble() * Math.PI * 2;

        double x = Math.cos(theta) * 1.5D;
        double z = Math.sin(theta) * 1.5D;

        AcceleratedParticle p =
            new AcceleratedParticle(
                world, i + 0.5 + x, j, k + 0.5 + z, -x / 7.5D, 1.5 / 10D, -z / 7.5D);
        p.setRBGColorF((0.5F + (r.nextFloat() / 2)), 0.0F, 1.0F);
        p.setParticleTextureIndex(3);
        Minecraft.getMinecraft().effectRenderer.addEffect(p);
        AcceleratedParticle l =
            new AcceleratedParticle(
                world, i + 0.5 + x, j + 3, k + 0.5 + z, -x / 7.5D, -(1.75 / 10D), -z / 7.5D);
        l.setRBGColorF((0.5F + (r.nextFloat() / 2)), 0.0F, 1.0F);
        l.setParticleTextureIndex(3);
        Minecraft.getMinecraft().effectRenderer.addEffect(l);
      }
    }
  }
Пример #23
0
 /** {@inheritDoc} */
 @Init
 public void load(final FMLInitializationEvent event) {
   klaxon = new ItemKlaxon(klaxonId);
   LanguageRegistry.addName(klaxon, "Klaxon");
   GameRegistry.addRecipe(
       new ItemStack(klaxon),
       " x ",
       "xox",
       " x ",
       'x',
       new ItemStack(Item.stick),
       'o',
       new ItemStack(Item.leather));
   if (event.getSide() == Side.CLIENT) {
     String name = "klaxon" + Minecraft.getMinecraft().session.username;
     Minecraft.getMinecraft().sndManager.addSound(name + ".ogg", file);
     FMLLog.log(MOD_ID, Level.INFO, "klaxon name %s", name);
   }
   // Adds listeners.
   if (event.getSide() == Side.CLIENT) {
     providerListener = new MyProviderListener();
     fileListener = new MyFileListener();
     IProvider p = P2P.get(P2P.CLIENT_PROVIDER);
     p.addListener(providerListener);
     p.getFileProvider().addListener(fileListener);
   }
 }
 @Override
 public void onUpdate() {
   if (!Minecraft.getMinecraft().thePlayer.isCollidedHorizontally
       && Minecraft.getMinecraft().thePlayer.moveForward > 0
       && !Minecraft.getMinecraft().thePlayer.isSneaking())
     Minecraft.getMinecraft().thePlayer.setSprinting(true);
 }
Пример #25
0
 public static float[] getRotationsNeeded(Entity entity) {
   if (entity == null) return null;
   double diffX = entity.posX - Minecraft.getMinecraft().thePlayer.posX;
   double diffY;
   if (entity instanceof EntityLivingBase) {
     EntityLivingBase entityLivingBase = (EntityLivingBase) entity;
     diffY =
         entityLivingBase.posY
             + entityLivingBase.getEyeHeight() * 0.9
             - (Minecraft.getMinecraft().thePlayer.posY
                 + Minecraft.getMinecraft().thePlayer.getEyeHeight());
   } else
     diffY =
         (entity.boundingBox.minY + entity.boundingBox.maxY) / 2.0D
             - (Minecraft.getMinecraft().thePlayer.posY
                 + Minecraft.getMinecraft().thePlayer.getEyeHeight());
   double diffZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ;
   double dist = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);
   float yaw = (float) (Math.atan2(diffZ, diffX) * 180.0D / Math.PI) - 90.0F;
   float pitch = (float) -(Math.atan2(diffY, dist) * 180.0D / Math.PI);
   return new float[] {
     Minecraft.getMinecraft().thePlayer.rotationYaw
         + MathHelper.wrapAngleTo180_float(yaw - Minecraft.getMinecraft().thePlayer.rotationYaw),
     Minecraft.getMinecraft().thePlayer.rotationPitch
         + MathHelper.wrapAngleTo180_float(
             pitch - Minecraft.getMinecraft().thePlayer.rotationPitch)
   };
 }
Пример #26
0
 public EntityNameRenderer() {
   Field[] fields = Minecraft.getMinecraft().getClass().getDeclaredFields();
   for (Field field : fields) {
     if (field.getType().isAssignableFrom(Timer.class)) {
       try {
         field.setAccessible(true);
         timer = (Timer) field.get(Minecraft.getMinecraft());
         if (timer == null) {
           System.out.println(
               "***THIS MESSAGE SHOULD NOT APPEAR, CRASH IS IMMINENT\n***DO NOT START SINGLE/MULTIPLAYER");
           try {
             throw new Exception("NULL TIMER WTFBBQ");
           } catch (Exception e) {
             e.printStackTrace();
             System.out.println("please report to Mazetar with your logs (FULL LOG)");
           }
         }
       } catch (IllegalArgumentException e) {
         e.printStackTrace();
       } catch (IllegalAccessException e) {
         e.printStackTrace();
       }
     }
   }
 }
Пример #27
0
  public static void resetConfig() {
    try {
      menuProps.setProperty("selectedMenu", "");
      menuProps.setProperty("loopMusic", "true");
      menuProps.setProperty("muteMusic", "false");
      menuProps.setProperty("lastMusicIndex", String.valueOf(jukebox.getIndexFromName("Strad")));
      menuProps.setProperty("musicIndex", String.valueOf(jukebox.getIndexFromName("Strad")));
      menuProps.setProperty("musicSet", "false");
      menuProps.setProperty("hasPlayedMusic", "false");
      menuProps.setProperty("hasStartedMusic", "false");

      Minecraft.getMinecraft();
      menuProps.store(
          new FileOutputStream(Minecraft.getMinecraftDir() + "/MenuAPI.properties"), null);

      Minecraft.getMinecraft();
      FileInputStream in = new FileInputStream(Minecraft.getMinecraftDir() + "/MenuAPI.properties");

      menuProps.load(in);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
    public void renderIcon(float p_178663_1_, int alpha) {
      int i = -1;
      String s = FontRenderer.getFormatFromString(this.team.getColorPrefix());

      if (s.length() >= 2) {
        i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1));
      }

      if (i >= 0) {
        float f = (float) (i >> 16 & 255) / 255.0F;
        float f1 = (float) (i >> 8 & 255) / 255.0F;
        float f2 = (float) (i & 255) / 255.0F;
        Gui.drawRect(
            1,
            1,
            15,
            15,
            MathHelper.rgb(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24);
      }

      Minecraft.getMinecraft().getTextureManager().bindTexture(this.location);
      GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float) alpha / 255.0F);
      Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
      Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
    }
Пример #29
0
 @Override
 protected void drawSlot(int id, int x, int y, int var4, int var5, int var6) {
   Block block = blocks.get(id);
   ItemStack itemStack = new ItemStack(Item.getItemFromBlock(block));
   GlStateManager.enableRescaleNormal();
   GlStateManager.enableBlend();
   RenderHelper.enableGUIStandardItemLighting();
   GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
   if (itemStack.getItem() != null)
     try {
       Minecraft.getMinecraft()
           .getRenderItem()
           .renderItemAndEffectIntoGUI(itemStack, x + 4, y + 4);
     } catch (Exception e) {
       e.printStackTrace();
     }
   else mc.fontRendererObj.drawString("?", x + 10, y + 9, 10526880);
   Minecraft.getMinecraft()
       .getRenderItem()
       .func_175030_a(Minecraft.getMinecraft().fontRendererObj, itemStack, x + 4, y + 4);
   RenderHelper.disableStandardItemLighting();
   GlStateManager.disableRescaleNormal();
   GlStateManager.disableBlend();
   glDisable(GL_LIGHTING);
   mc.fontRendererObj.drawString(
       "Name: "
           + (itemStack.getItem() == null ? block.getLocalizedName() : itemStack.getDisplayName()),
       x + 31,
       y + 3,
       10526880);
   int blockID = Block.getIdFromBlock(block);
   mc.fontRendererObj.drawString("ID: " + blockID, x + 31, y + 15, 10526880);
 }
Пример #30
0
  private static void addRSPack(boolean refreash) {
    File rspack = new File(getConfigFolder(), "/resources");
    if (!rspack.exists()) return;

    if (!Arrays.asList(rspack.list()).contains("pack.mcmeta")) {
      try {
        JsonWriter writer = new JsonWriter(new FileWriter(new File(rspack, "pack.mcmeta")));
        writer.beginObject();
        writer.name("pack");
        writer.beginObject();
        writer.name("pack_format").value(1);
        writer.name("description").value("Draconic Evolution GUI Images");
        writer.endObject();
        writer.endObject();
        writer.close();
      } catch (IOException e) {
        LogHelper.error("Error creating pack.mcmeta");
        e.printStackTrace();
      }
    }

    Field f =
        ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao");
    f.setAccessible(true);
    try {
      List defaultResourcePacks = (List) f.get(Minecraft.getMinecraft());
      defaultResourcePacks.add(new FolderResourcePack(rspack));

      f.set(Minecraft.getMinecraft(), defaultResourcePacks);
      LogHelper.info("RS Added");
      if (refreash) Minecraft.getMinecraft().refreshResources();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    }
  }