Пример #1
0
  public List getStichSlots() {
    ArrayList arraylist = Lists.newArrayList();
    Iterator iterator = this.stitchSlots.iterator();

    while (iterator.hasNext()) {
      Stitcher.Slot slot = (Stitcher.Slot) iterator.next();
      slot.getAllStitchSlots(arraylist);
    }

    ArrayList arraylist1 = Lists.newArrayList();
    Iterator iterator1 = arraylist.iterator();

    while (iterator1.hasNext()) {
      Stitcher.Slot slot1 = (Stitcher.Slot) iterator1.next();
      Stitcher.Holder holder = slot1.getStitchHolder();
      TextureAtlasSprite textureatlassprite = holder.getAtlasSprite();
      textureatlassprite.initSprite(
          this.currentWidth,
          this.currentHeight,
          slot1.getOriginX(),
          slot1.getOriginY(),
          holder.isRotated());
      arraylist1.add(textureatlassprite);
    }

    return arraylist1;
  }
Пример #2
0
 public Holder(TextureAtlasSprite p_i45094_1_, int p_i45094_2_) {
   this.theTexture = p_i45094_1_;
   this.width = p_i45094_1_.getIconWidth();
   this.height = p_i45094_1_.getIconHeight();
   this.mipmapLevelHolder = p_i45094_2_;
   this.rotated =
       Stitcher.getMipmapDimension(this.height, p_i45094_2_)
           > Stitcher.getMipmapDimension(this.width, p_i45094_2_);
 }
 // TODO update to builder
 private int[] vertexToInts(
     float x, float y, float z, int color, TextureAtlasSprite texture, float u, float v) {
   return new int[] {
     Float.floatToRawIntBits(x),
     Float.floatToRawIntBits(y),
     Float.floatToRawIntBits(z),
     color,
     Float.floatToRawIntBits(texture.getInterpolatedU(u)),
     Float.floatToRawIntBits(texture.getInterpolatedV(v)),
     0
   };
 }
Пример #4
0
  private void func_180474_b(float p_180474_1_, ScaledResolution p_180474_2_) {
    if (p_180474_1_ < 1.0F) {
      p_180474_1_ *= p_180474_1_;
      p_180474_1_ *= p_180474_1_;
      p_180474_1_ = p_180474_1_ * 0.8F + 0.2F;
    }

    GlStateManager.disableAlpha();
    GlStateManager.disableDepth();
    GlStateManager.depthMask(false);
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(1.0F, 1.0F, 1.0F, p_180474_1_);
    this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    TextureAtlasSprite var3 =
        this.mc
            .getBlockRendererDispatcher()
            .func_175023_a()
            .func_178122_a(Blocks.portal.getDefaultState());
    float var4 = var3.getMinU();
    float var5 = var3.getMinV();
    float var6 = var3.getMaxU();
    float var7 = var3.getMaxV();
    Tessellator var8 = Tessellator.getInstance();
    WorldRenderer var9 = var8.getWorldRenderer();
    var9.startDrawingQuads();
    var9.addVertexWithUV(
        0.0D, (double) p_180474_2_.getScaledHeight(), -90.0D, (double) var4, (double) var7);
    var9.addVertexWithUV(
        (double) p_180474_2_.getScaledWidth(),
        (double) p_180474_2_.getScaledHeight(),
        -90.0D,
        (double) var6,
        (double) var7);
    var9.addVertexWithUV(
        (double) p_180474_2_.getScaledWidth(), 0.0D, -90.0D, (double) var6, (double) var5);
    var9.addVertexWithUV(0.0D, 0.0D, -90.0D, (double) var4, (double) var5);
    var8.draw();
    GlStateManager.depthMask(true);
    GlStateManager.enableDepth();
    GlStateManager.enableAlpha();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  }
Пример #5
0
  public void putIntoBakedQuadBuilder(
      UnpackedBakedQuad.Builder builder, TextureAtlasSprite sprite) {
    Vertex transformed = getTransformedVertex();
    Tuple4f positionBuffer = new Vector4f();
    transformed.getPosition(positionBuffer);
    Tuple3f normalBuffer = new Vector3f();
    transformed.getNormal(normalBuffer);
    Tuple2f uvBuffer = new Vector2f();
    transformed.getUV(uvBuffer);

    VertexFormat vertexFormat = builder.getVertexFormat();
    int elementCount = vertexFormat.getElementCount();
    for (int e = 0; e < elementCount; e++) {
      VertexFormatElement element = vertexFormat.getElement(e);
      switch (element.getUsage()) {
        case POSITION:
          builder.put(e, positionBuffer.x, positionBuffer.z, -positionBuffer.y, positionBuffer.w);
          break;
        case NORMAL:
          builder.put(e, normalBuffer.x, normalBuffer.z, -normalBuffer.y, 0);
          break;
        case UV:
          if (element.getIndex() != 0) break;
          builder.put(
              e,
              sprite.getInterpolatedU(uvBuffer.x * 16),
              sprite.getInterpolatedV(uvBuffer.y * 16),
              0,
              1);
          break;
        case COLOR:
          builder.put(e, 1, 1, 1, 1);
          break;
        default:
          builder.put(e);
      }
    }
  }
Пример #6
0
  /** Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime */
  private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks) {
    GlStateManager.disableLighting();
    TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
    TextureAtlasSprite textureatlassprite =
        texturemap.getAtlasSprite("minecraft:blocks/fire_layer_0");
    TextureAtlasSprite textureatlassprite1 =
        texturemap.getAtlasSprite("minecraft:blocks/fire_layer_1");
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x, (float) y, (float) z);
    float f = entity.width * 1.4F;
    GlStateManager.scale(f, f, f);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    float f1 = 0.5F;
    float f2 = 0.0F;
    float f3 = entity.height / f;
    float f4 = (float) (entity.posY - entity.getEntityBoundingBox().minY);
    GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.translate(0.0F, 0.0F, -0.3F + (float) ((int) f3) * 0.02F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f5 = 0.0F;
    int i = 0;
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);

    while (f3 > 0.0F) {
      TextureAtlasSprite textureatlassprite2 =
          i % 2 == 0 ? textureatlassprite : textureatlassprite1;
      this.bindTexture(TextureMap.locationBlocksTexture);
      float f6 = textureatlassprite2.getMinU();
      float f7 = textureatlassprite2.getMinV();
      float f8 = textureatlassprite2.getMaxU();
      float f9 = textureatlassprite2.getMaxV();

      if (i / 2 % 2 == 0) {
        float f10 = f8;
        f8 = f6;
        f6 = f10;
      }

      worldrenderer
          .pos((double) (f1 - f2), (double) (0.0F - f4), (double) f5)
          .tex((double) f8, (double) f9)
          .endVertex();
      worldrenderer
          .pos((double) (-f1 - f2), (double) (0.0F - f4), (double) f5)
          .tex((double) f6, (double) f9)
          .endVertex();
      worldrenderer
          .pos((double) (-f1 - f2), (double) (1.4F - f4), (double) f5)
          .tex((double) f6, (double) f7)
          .endVertex();
      worldrenderer
          .pos((double) (f1 - f2), (double) (1.4F - f4), (double) f5)
          .tex((double) f8, (double) f7)
          .endVertex();
      f3 -= 0.45F;
      f4 -= 0.45F;
      f1 *= 0.9F;
      f5 += 0.03F;
      ++i;
    }

    tessellator.draw();
    GlStateManager.popMatrix();
    GlStateManager.enableLighting();
  }
Пример #7
0
    public Collection<ResourceLocation> getTextures() {
      // setting parent here to make textures resolve properly
      if (model.getParentLocation() != null) {
        if (model.getParentLocation().getResourcePath().equals("builtin/generated")) {
          model.parent = MODEL_GENERATED;
        } else {
          try {
            IModel parent = getModel(model.getParentLocation());
            if (parent instanceof VanillaModelWrapper) {
              model.parent = ((VanillaModelWrapper) parent).model;
            } else {
              throw new IllegalStateException(
                  "vanilla model '" + model + "' can't have non-vanilla parent");
            }
          } catch (IOException e) {
            FMLLog.warning(
                "Could not load vanilla model parent '"
                    + model.getParentLocation()
                    + "' for '"
                    + model
                    + "': "
                    + e.toString());
            IModel missing = ModelLoader.this.getMissingModel();
            if (missing instanceof VanillaModelWrapper) {
              model.parent = ((VanillaModelWrapper) missing).model;
            } else {
              throw new IllegalStateException(
                  "vanilla model '"
                      + model
                      + "' has missing parent, and missing model is not a vanilla model");
            }
          }
        }
      }

      ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();

      if (hasItemModel(model)) {
        for (String s : (List<String>) ItemModelGenerator.LAYERS) {
          String r = model.resolveTextureName(s);
          ResourceLocation loc = new ResourceLocation(r);
          if (!r.equals(s)) {
            builder.add(loc);
          }
          // mojang hardcode
          if (model.getRootModel() == MODEL_COMPASS
              && !loc.equals(TextureMap.LOCATION_MISSING_TEXTURE)) {
            TextureAtlasSprite.setLocationNameCompass(loc.toString());
          } else if (model.getRootModel() == MODEL_CLOCK
              && !loc.equals(TextureMap.LOCATION_MISSING_TEXTURE)) {
            TextureAtlasSprite.setLocationNameClock(loc.toString());
          }
        }
      }
      for (String s : (Iterable<String>) model.textures.values()) {
        if (!s.startsWith("#")) {
          builder.add(new ResourceLocation(s));
        }
      }
      return builder.build();
    }
Пример #8
0
 @Override
 public void generateMipmaps(int level) {
   super.generateMipmaps(level);
 }
Пример #9
0
    public BakedFluid(
        Optional<TRSRTransformation> transformation,
        ImmutableMap<TransformType, TRSRTransformation> transforms,
        VertexFormat format,
        int color,
        TextureAtlasSprite still,
        TextureAtlasSprite flowing,
        boolean gas,
        boolean statePresent,
        int[] cornerRound,
        int flowRound) {
      this.transformation = transformation;
      this.transforms = transforms;
      this.format = format;
      this.color = color;
      this.still = still;
      this.flowing = flowing;
      this.gas = gas;

      faceQuads = Maps.newEnumMap(EnumFacing.class);
      for (EnumFacing side : EnumFacing.values()) {
        faceQuads.put(side, ImmutableList.<BakedQuad>of());
      }

      if (statePresent) {
        float[] y = new float[4];
        for (int i = 0; i < 4; i++) {
          if (gas) {
            y[i] = 1 - cornerRound[i] / 768f;
          } else {
            y[i] = cornerRound[i] / 768f;
          }
        }

        float flow = (float) Math.toRadians(flowRound);

        // top

        TextureAtlasSprite topSprite = flowing;
        float scale = 4;
        if (flow < -17F) {
          flow = 0;
          scale = 8;
          topSprite = still;
        }

        float c = MathHelper.cos(flow) * scale;
        float s = MathHelper.sin(flow) * scale;

        EnumFacing side = gas ? EnumFacing.DOWN : EnumFacing.UP;
        UnpackedBakedQuad.Builder builder;
        ImmutableList.Builder<BakedQuad> topFaceBuilder = ImmutableList.builder();
        for (int k = 0; k < 2; k++) {
          builder = new UnpackedBakedQuad.Builder(format);
          builder.setQuadOrientation(side);
          builder.setTexture(topSprite);
          for (int i = gas ? 3 : 0; i != (gas ? -1 : 4); i += (gas ? -1 : 1)) {
            int l = (k * 3) + (1 - 2 * k) * i;
            putVertex(
                builder,
                side,
                x[l],
                y[l],
                z[l],
                topSprite.getInterpolatedU(8 + c * (x[l] * 2 - 1) + s * (z[l] * 2 - 1)),
                topSprite.getInterpolatedV(
                    8 + c * (x[(l + 1) % 4] * 2 - 1) + s * (z[(l + 1) % 4] * 2 - 1)));
          }
          topFaceBuilder.add(builder.build());
        }
        faceQuads.put(side, topFaceBuilder.build());

        // bottom

        side = side.getOpposite();
        builder = new UnpackedBakedQuad.Builder(format);
        builder.setQuadOrientation(side);
        builder.setTexture(still);
        for (int i = gas ? 3 : 0; i != (gas ? -1 : 4); i += (gas ? -1 : 1)) {
          putVertex(
              builder,
              side,
              z[i],
              gas ? 1 : 0,
              x[i],
              still.getInterpolatedU(z[i] * 16),
              still.getInterpolatedV(x[i] * 16));
        }
        faceQuads.put(side, ImmutableList.<BakedQuad>of(builder.build()));

        // sides

        for (int i = 0; i < 4; i++) {
          side = EnumFacing.getHorizontal((5 - i) % 4);
          BakedQuad q[] = new BakedQuad[2];

          for (int k = 0; k < 2; k++) {
            builder = new UnpackedBakedQuad.Builder(format);
            builder.setQuadOrientation(side);
            builder.setTexture(flowing);
            for (int j = 0; j < 4; j++) {
              int l = (k * 3) + (1 - 2 * k) * j;
              float yl = z[l] * y[(i + x[l]) % 4];
              if (gas && z[l] == 0) yl = 1;
              putVertex(
                  builder,
                  side,
                  x[(i + x[l]) % 4],
                  yl,
                  z[(i + x[l]) % 4],
                  flowing.getInterpolatedU(x[l] * 8),
                  flowing.getInterpolatedV((gas ? yl : 1 - yl) * 8));
            }
            q[k] = builder.build();
          }
          faceQuads.put(side, ImmutableList.of(q[0], q[1]));
        }
      } else {
        // 1 quad for inventory
        UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
        builder.setQuadOrientation(EnumFacing.UP);
        builder.setTexture(still);
        for (int i = 0; i < 4; i++) {
          putVertex(
              builder,
              EnumFacing.UP,
              z[i],
              x[i],
              0,
              still.getInterpolatedU(z[i] * 16),
              still.getInterpolatedV(x[i] * 16));
        }
        faceQuads.put(EnumFacing.SOUTH, ImmutableList.<BakedQuad>of(builder.build()));
      }
    }