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

项目:TombManyGraves    文件:TombManyGravesClientEvents.java   
@SubscribeEvent
public void onModelBake(ModelBakeEvent event)
{
    try
    {
        IModel model = ModelLoaderRegistry.getModel(MODEL_grave);
        if (model instanceof IRetexturableModel)
        {
            IRetexturableModel graveModel = (IRetexturableModel) model;
            IBakedModel standard = event.getModelRegistry().getObject(locGrave);
            IBakedModel finalModel = new GoodGraveModel(standard, graveModel);
            event.getModelRegistry().putObject(locGrave, finalModel);
        }
    } catch (Exception e)
    {
        e.printStackTrace();
    }
}
项目:Battlegear2    文件:ShieldModelLoader.java   
@SubscribeEvent
public void onModelBaked(ModelBakeEvent modelBakeEvent){
    setLoader(modelBakeEvent.getModelLoader());
    for(Item shield : BattlegearConfig.shield) {
        if(shield!=null) {
            ModelResourceLocation mainLoc = DefaultMesh.INVENTORY.getModelLocation(new ItemStack(shield));
            ResourceLocation itemLoc = new ResourceLocation(mainLoc.getResourceDomain(), "item/" + mainLoc.getResourcePath());
            IModel originalModel = getModel(itemLoc);
            if(originalModel instanceof IRetexturableModel){
                ModelBlock internalFrontModel = getInternalModel(originalModel);
                if (internalFrontModel != null) {
                    ModelBlock front = makeItem(internalFrontModel);
                    IBakedModel baked = wrap(join((IRetexturableModel) originalModel, front), itemLoc);
                    if(baked != null)
                        modelBakeEvent.getModelRegistry().putObject(mainLoc, baked);
                }
            }
        }
    }
    setLoader(null);
}
项目:CommonUtils    文件:BakerUtil.java   
public static IModel retexture(Map<String, String> textures, IModel blockModel) {
        if (blockModel instanceof IRetexturableModel)
            return ((IRetexturableModel) blockModel).retexture(ImmutableMap.copyOf(textures));
//      else if (blockModel instanceof MultiModel) {
//          Map<String, Pair<IModel, IModelState>> parts = Maps.newHashMap();
//          for (Entry<String, Pair<IModel, IModelState>> entry : ((MultiModel) blockModel).getParts()
//                  .entrySet()) {
//              parts.put(entry.getKey(), Pair.of(retexture(textures, entry.getValue().getLeft()),
//                      entry.getValue().getRight()));
//          }
//          return new MultiModel(retexture(textures, ((MultiModel) blockModel).getBaseModel()),
//                  blockModel.getDefaultState(), parts);
//      }
        return blockModel;
    }
项目:Factorization    文件:FactorizationClientProxy.java   
@SubscribeEvent
public void onTextureStitch(TextureStitchEvent.Pre event) {
    RenderUtil.loadSprites("factorization", FzIcons.class, "", event);
    RenderUtil.loadSprites("factorization", BarrelModel.class, "blocks/storage/", event);
    try {
        BarrelModel.template = (IRetexturableModel) ModelLoaderRegistry.getModel(new ResourceLocation("factorization:block/barrel_template"));
        IModel socketBase = ModelLoaderRegistry.getModel(new ResourceLocation("factorization:block/socket"));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
项目:TombManyGraves    文件:GoodGraveModel.java   
public GoodGraveModel(IBakedModel standard, IRetexturableModel retexturableModel)
{
    this.standard = standard;
    this.retexturableModel = retexturableModel;
}