Java 类net.minecraftforge.client.model.IPerspectiveAwareModel 实例源码

项目:Infernum    文件:ModelSpellPage.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    if (baseSpellPageModel instanceof IPerspectiveAwareModel) {
        Matrix4f matrix4f = ((IPerspectiveAwareModel) baseSpellPageModel).handlePerspective(cameraTransformType)
                .getRight();
        return Pair.of(this, matrix4f);
    }
    ItemCameraTransforms itemCameraTransforms = baseSpellPageModel.getItemCameraTransforms();
    ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
    TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
    Matrix4f mat = null;
    if (tr != null) {
        mat = tr.getMatrix();
    }
    return Pair.of(this, mat);
}
项目:Infernum    文件:ModelKnowledgeBook.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    if (baseKnowledgeBookModel instanceof IPerspectiveAwareModel) {
        Matrix4f matrix4f = ((IPerspectiveAwareModel) baseKnowledgeBookModel).handlePerspective(cameraTransformType)
                .getRight();
        return Pair.of(this, matrix4f);
    }
    ItemCameraTransforms itemCameraTransforms = baseKnowledgeBookModel.getItemCameraTransforms();
    ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
    TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
    Matrix4f mat = null;
    if (tr != null) {
        mat = tr.getMatrix();
    }
    return Pair.of(this, mat);
}
项目:Infernum    文件:BakedModelKnowledgeBook.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    if (parentModel instanceof IPerspectiveAwareModel) {
        Matrix4f matrix4f = ((IPerspectiveAwareModel) parentModel).handlePerspective(cameraTransformType)
                .getRight();
        return Pair.of(this, matrix4f);
    }
    ItemCameraTransforms itemCameraTransforms = parentModel.getItemCameraTransforms();
    ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
    TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
    Matrix4f mat = null;
    if (tr != null) {
        mat = tr.getMatrix();
    }
    return Pair.of(this, mat);
}
项目:Infernum    文件:BakedModelSpellPage.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    if (parentModel instanceof IPerspectiveAwareModel) {
        Matrix4f matrix4f = ((IPerspectiveAwareModel) parentModel).handlePerspective(cameraTransformType)
                .getRight();
        return Pair.of(this, matrix4f);
    }
    ItemCameraTransforms itemCameraTransforms = parentModel.getItemCameraTransforms();
    ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
    TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
    Matrix4f mat = null;
    if (tr != null) {
        mat = tr.getMatrix();
    }
    return Pair.of(this, mat);
}
项目:BetterWithAddons    文件:ModelToolShardInner.java   
@Override
public IBakedModel 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++)
    {
        ResourceLocation tex = textures.get(i);
        if(tex.toString().equals("minecraft:missingno"))
            continue;
        TextureAtlasSprite sprite = bakedTextureGetter.apply(tex);

        String breakLocation = new ResourceLocation(Reference.MOD_ID,"items/breakmask").toString();
        TextureAtlasSprite breakTemplate = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(breakLocation);

        builder.addAll(getQuadsForSprite(i, breakTemplate, sprite, format, transform));
        //builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, breakTemplate, sprite, NORTH_Z + Z_OFFSET * i, EnumFacing.NORTH, 0xffffffff));
       // builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, breakTemplate, sprite, SOUTH_Z - Z_OFFSET * i, EnumFacing.SOUTH, 0xffffffff));
    }
    TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
    ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
    return new BakedItemModel(builder.build(), particle, map, null);
}
项目:CustomWorldGen    文件:ForgeHooksClient.java   
@SuppressWarnings("deprecation")
public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery)
{
    if(model instanceof IPerspectiveAwareModel)
    {
        Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType);

        if(pair.getRight() != null)
        {
            Matrix4f matrix = new Matrix4f(pair.getRight());
            if(leftHandHackery)
            {
                matrix.mul(flipX, matrix);
                matrix.mul(matrix, flipX);
            }
            multiplyCurrentGlMatrix(matrix);
        }
        return pair.getLeft();
    }
    else
    {
        //if(leftHandHackery) GlStateManager.scale(-1, 1, 1);
        ItemCameraTransforms.applyTransformSide(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery);
        //if(leftHandHackery) GlStateManager.scale(-1, 1, 1);
    }
    return model;
}
项目:BetterWithAddons    文件:ModelToolShardInner.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType type) {
    Pair<? extends IBakedModel, Matrix4f> pair = IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type);
    if(type == TransformType.GUI && !isCulled && pair.getRight() == null)
    {
        return Pair.of(otherModel, null);
    }
    else if(type != TransformType.GUI && isCulled)
    {
        return Pair.of(otherModel, pair.getRight());
    }
    return pair;
}
项目:CrystalMod    文件:ModelCustomLayers.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType type)
      {
          Pair<? extends IBakedModel, Matrix4f> pair = IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type);
          if(type == TransformType.GUI && !isCulled && pair.getRight() == null)
          {
              return Pair.of(otherModel, null);
          }
          else if(type != TransformType.GUI && isCulled)
          {
              return Pair.of(otherModel, pair.getRight());
          }
          return pair;
      }
项目:MMDLib-old    文件:RenderUtils.java   
/**
 * Creates the basic TRSRTransformations for a perspective aware model.
 *
 * @param model The model to get the transforms for.
 * @return An immutable map of all the transforms.
 */
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getBasicTransforms (IPerspectiveAwareModel model) {
    final ImmutableMap.Builder<ItemCameraTransforms.TransformType, TRSRTransformation> builder = ImmutableMap.builder();
    for (final ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) {
        final TRSRTransformation transformation = new TRSRTransformation(model.handlePerspective(type).getRight());
        if (!transformation.equals(TRSRTransformation.identity()))
            builder.put(type, TRSRTransformation.blockCenterToCorner(transformation));
    }
    return builder.build();
}
项目:TFC2    文件:BakedSmallVesselModel.java   
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getTransforms(IPerspectiveAwareModel model) {
    ImmutableMap.Builder<ItemCameraTransforms.TransformType, TRSRTransformation> builder = ImmutableMap.builder();
    for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) {
        TRSRTransformation transformation = new TRSRTransformation(model.handlePerspective(type).getRight());
        if(!transformation.equals(TRSRTransformation.identity())) {
            builder.put(type, TRSRTransformation.blockCenterToCorner(transformation));
        }
    }
    return builder.build();
}
项目:TFC2    文件:BakedPitKilnModel.java   
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getTransforms(IPerspectiveAwareModel model) {
    ImmutableMap.Builder<ItemCameraTransforms.TransformType, TRSRTransformation> builder = ImmutableMap.builder();
    for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) {
        TRSRTransformation transformation = new TRSRTransformation(model.handlePerspective(type).getRight());
        if(!transformation.equals(TRSRTransformation.identity())) {
            builder.put(type, TRSRTransformation.blockCenterToCorner(transformation));
        }
    }
    return builder.build();
}
项目:TFC2    文件:BakedAnvilModel.java   
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getTransforms(IPerspectiveAwareModel model) {
    ImmutableMap.Builder<ItemCameraTransforms.TransformType, TRSRTransformation> builder = ImmutableMap.builder();
    for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) {
        TRSRTransformation transformation = new TRSRTransformation(model.handlePerspective(type).getRight());
        if(!transformation.equals(TRSRTransformation.identity())) {
            builder.put(type, TRSRTransformation.blockCenterToCorner(transformation));
        }
    }
    return builder.build();
}
项目:TFC2    文件:ModelBakeHandler.java   
public static void replaceAnvilModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
    try {
        IModel model = ModelLoaderRegistry.getModel(modelLocation);
        IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
        if(standard instanceof IPerspectiveAwareModel) {
            IBakedModel finalModel = new BakedAnvilModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

            event.getModelRegistry().putObject(modelVariantLocation, finalModel);
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:TFC2    文件:ModelBakeHandler.java   
public static void replacePitKilnModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
    try {
        IModel model = ModelLoaderRegistry.getModel(modelLocation);
        IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
        if(standard instanceof IPerspectiveAwareModel) {
            IBakedModel finalModel = new BakedPitKilnModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

            event.getModelRegistry().putObject(modelVariantLocation, finalModel);
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:TFC2    文件:ModelBakeHandler.java   
public static void replaceSmallVesselModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
    try {
        IModel model = ModelLoaderRegistry.getModel(modelLocation);
        IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
        if(standard instanceof IPerspectiveAwareModel) {
            IBakedModel finalModel = new BakedSmallVesselModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

            event.getModelRegistry().putObject(modelVariantLocation, finalModel);
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:TFC2    文件:BakedSmallVesselModel.java   
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getTransforms(IPerspectiveAwareModel model) {
    ImmutableMap.Builder<ItemCameraTransforms.TransformType, TRSRTransformation> builder = ImmutableMap.builder();
    for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) {
        TRSRTransformation transformation = new TRSRTransformation(model.handlePerspective(type).getRight());
        if(!transformation.equals(TRSRTransformation.identity())) {
            builder.put(type, TRSRTransformation.blockCenterToCorner(transformation));
        }
    }
    return builder.build();
}
项目:TFC2    文件:BakedPitKilnModel.java   
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getTransforms(IPerspectiveAwareModel model) {
    ImmutableMap.Builder<ItemCameraTransforms.TransformType, TRSRTransformation> builder = ImmutableMap.builder();
    for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) {
        TRSRTransformation transformation = new TRSRTransformation(model.handlePerspective(type).getRight());
        if(!transformation.equals(TRSRTransformation.identity())) {
            builder.put(type, TRSRTransformation.blockCenterToCorner(transformation));
        }
    }
    return builder.build();
}
项目:TFC2    文件:BakedAnvilModel.java   
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getTransforms(IPerspectiveAwareModel model) {
    ImmutableMap.Builder<ItemCameraTransforms.TransformType, TRSRTransformation> builder = ImmutableMap.builder();
    for(ItemCameraTransforms.TransformType type : ItemCameraTransforms.TransformType.values()) {
        TRSRTransformation transformation = new TRSRTransformation(model.handlePerspective(type).getRight());
        if(!transformation.equals(TRSRTransformation.identity())) {
            builder.put(type, TRSRTransformation.blockCenterToCorner(transformation));
        }
    }
    return builder.build();
}
项目:TFC2    文件:ModelBakeHandler.java   
public static void replaceAnvilModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
    try {
        IModel model = ModelLoaderRegistry.getModel(modelLocation);
        IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
        if(standard instanceof IPerspectiveAwareModel) {
            IBakedModel finalModel = new BakedAnvilModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

            event.getModelRegistry().putObject(modelVariantLocation, finalModel);
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:TFC2    文件:ModelBakeHandler.java   
public static void replacePitKilnModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
    try {
        IModel model = ModelLoaderRegistry.getModel(modelLocation);
        IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
        if(standard instanceof IPerspectiveAwareModel) {
            IBakedModel finalModel = new BakedPitKilnModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

            event.getModelRegistry().putObject(modelVariantLocation, finalModel);
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:TFC2    文件:ModelBakeHandler.java   
public static void replaceSmallVesselModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
    try {
        IModel model = ModelLoaderRegistry.getModel(modelLocation);
        IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
        if(standard instanceof IPerspectiveAwareModel) {
            IBakedModel finalModel = new BakedSmallVesselModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

            event.getModelRegistry().putObject(modelVariantLocation, finalModel);
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:EnderIO    文件:CollectedItemQuadBakedBlockModel.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
  if (parent instanceof IPerspectiveAwareModel) {
    Pair<? extends IBakedModel, Matrix4f> perspective = ((IPerspectiveAwareModel) parent).handlePerspective(cameraTransformType);
    return Pair.of(this, perspective.getRight());
  }
  return Pair.of(this, null);
}
项目:EnderIO    文件:RotatingSmartItemModel.java   
@Override
public @Nonnull IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack, @Nullable World world,
    @Nullable EntityLivingBase entity) {
  if (originalModel != RotatingSmartItemModel.this) {
    return originalModel;
  }

  IBakedModel newBase = parent.getOverrides().handleItemState(parent, stack, world, entity);
  if (parent != newBase && newBase instanceof IPerspectiveAwareModel) {
    return new RotatingSmartItemModel((IPerspectiveAwareModel) newBase, speed);
  }
  return RotatingSmartItemModel.this;
}
项目:EnderIO    文件:RelayingBakedModel.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
  if (getDefaults() instanceof IPerspectiveAwareModel) {
    Pair<? extends IBakedModel, Matrix4f> perspective = ((IPerspectiveAwareModel) getDefaults()).handlePerspective(cameraTransformType);
    return Pair.of(this, perspective.getRight());
  }
  return Pair.of(this, null);
}
项目:EnderIO    文件:ItemModelRegistry.java   
public static void registerRotating(@Nonnull String resource, final int speed) {
  register(resource, new Registry() {
    @Override
    public @Nonnull IBakedModel wrap(@Nonnull IBakedModel model) {
      return new RotatingSmartItemModel((IPerspectiveAwareModel) model, speed);
    }
  });
}
项目:EnderIO    文件:ItemModelRegistry.java   
public static void registerFacade(@Nonnull ModelResourceLocation resource) {
  register(resource, new Registry() {
    @Override
    public @Nonnull IBakedModel wrap(@Nonnull IBakedModel model) {
      return new FacadeSmartItemModel((IPerspectiveAwareModel) model);
    }
  });
}
项目:CustomWorldGen    文件:B3DLoader.java   
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType)
{
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType);
}
项目:BetterWithAddons    文件:ModelToolShard.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
{
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
}
项目:CrystalMod    文件:ModelCoral.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, DynamicBaseModel.DEFAULT_PERSPECTIVE_TRANSFORMS, cameraTransformType);
}
项目:CrystalMod    文件:Fixed3DBlockModel.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, getBlockTransforms(), cameraTransformType);
}
项目:CrystalMod    文件:ModelCustomLayers.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType)
{
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
}
项目:CrystalMod    文件:DynamicBaseModel.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, DEFAULT_PERSPECTIVE_TRANSFORMS, cameraTransformType);
}
项目:CrystalMod    文件:ModelPipeBaked.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, DynamicBaseModel.DEFAULT_PERSPECTIVE_TRANSFORMS, cameraTransformType);
}
项目:TFC2    文件:BakedSmallVesselModel.java   
public BakedSmallVesselModel(IPerspectiveAwareModel standard,VertexFormat format) {
    this.standard = standard;
    this.format = format;
    this.transforms = getTransforms(standard);
}
项目:TFC2    文件:BakedPitKilnModel.java   
public BakedPitKilnModel(IPerspectiveAwareModel standard,VertexFormat format) {
    this.standard = standard;
    this.format = format;
    this.transforms = getTransforms(standard);
}
项目:TFC2    文件:BakedAnvilModel.java   
public BakedAnvilModel(IPerspectiveAwareModel standard,VertexFormat format) {
    this.standard = standard;
    this.format = format;
    this.transforms = getTransforms(standard);
}
项目:TFC2    文件:BakedWrapper.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
}
项目:taam    文件:OBJModel.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType)
{
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, this.state, cameraTransformType);
}
项目:taam    文件:TaamClientProxy.java   
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
    // Use forge default block transform
    return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, defaultBlockTransform, cameraTransformType);
}
项目:TFC2    文件:BakedSmallVesselModel.java   
public BakedSmallVesselModel(IPerspectiveAwareModel standard,VertexFormat format) {
    this.standard = standard;
    this.format = format;
    this.transforms = getTransforms(standard);
}