@Override
 @SuppressWarnings("deprecation")
 public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(
     TransformType cameraTransformType) {
   return IPerspectiveAwareModel.MapWrapper.handlePerspective(
       this, transforms, cameraTransformType);
 }
    public IFlexibleBakedModel bake(
        IModelState state,
        VertexFormat format,
        Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
      if (!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) {
        throw new IllegalArgumentException(
            "can't bake vanilla models to the format that doesn't fit into the default one: "
                + format);
      }
      ModelBlock model = this.model;
      if (model == null)
        return getMissingModel()
            .bake(getMissingModel().getDefaultState(), format, bakedTextureGetter);

      List<TRSRTransformation> newTransforms = Lists.newArrayList();
      for (int i = 0; i < model.getElements().size(); i++) {
        newTransforms.add(null);
      }

      ItemCameraTransforms transforms = model.func_181682_g();
      boolean uvlock = false;
      if (state instanceof UVLock) {
        uvlock = true;
        state = ((UVLock) state).getParent();
      }
      Map<TransformType, TRSRTransformation> tMap = Maps.newHashMap();
      tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(transforms));
      tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(state));
      IModelState perState = new SimpleModelState(ImmutableMap.copyOf(tMap));

      if (hasItemModel(model)) {
        return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter);
      }
      if (isCustomRenderer(model))
        return new IFlexibleBakedModel.Wrapper(new BuiltInModel(transforms), format);
      return bakeNormal(
          model,
          perState,
          state.apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity()),
          newTransforms,
          format,
          bakedTextureGetter,
          uvlock);
    }
Esempio n. 3
0
 public IBakedModel bake(
     IModelState state,
     VertexFormat format,
     Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
   ImmutableMap<TransformType, TRSRTransformation> map =
       IPerspectiveAwareModel.MapWrapper.getTransforms(state);
   return new BakedFluid(
       state.apply(Optional.<IModelPart>absent()),
       map,
       format,
       fluid.getColor(),
       bakedTextureGetter.apply(fluid.getStill()),
       bakedTextureGetter.apply(fluid.getFlowing()),
       fluid.isGaseous(),
       Optional.<IExtendedBlockState>absent());
 }
 @Override
 public IFlexibleBakedModel bake(
     IModelState state,
     VertexFormat format,
     Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
   ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
   Optional<TRSRTransformation> transform = state.apply(Optional.<IModelPart>absent());
   for (int i = 0; i < textures.size(); i++) {
     TextureAtlasSprite sprite = bakedTextureGetter.apply(textures.get(i));
     builder.addAll(getQuadsForSprite(i, sprite, format, transform));
   }
   TextureAtlasSprite particle =
       bakedTextureGetter.apply(
           textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
   ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms =
       IPerspectiveAwareModel.MapWrapper.getTransforms(state);
   IFlexibleBakedModel ret = new CustomBakedModel(builder.build(), particle, format, transforms);
   if (transforms.isEmpty()) {
     return ret;
   }
   return new IPerspectiveAwareModel.MapWrapper(ret, transforms);
 }
Esempio n. 5
0
 @Override
 public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType type) {
   return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type);
 }