當前位置: 首頁>>代碼示例>>Java>>正文


Java ModelLoaderRegistry類代碼示例

本文整理匯總了Java中net.minecraftforge.client.model.ModelLoaderRegistry的典型用法代碼示例。如果您正苦於以下問題:Java ModelLoaderRegistry類的具體用法?Java ModelLoaderRegistry怎麽用?Java ModelLoaderRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ModelLoaderRegistry類屬於net.minecraftforge.client.model包,在下文中一共展示了ModelLoaderRegistry類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: bake

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    try
    {
        IModel sub = ModelLoaderRegistry.getModel(handle);
        IBakedModel baked = sub.bake(state, format, bakedTextureGetter);

        return new BakedModelCH(baked, ModelRegistry.getInstance().bake(state, format, bakedTextureGetter));
    } catch (Exception e)
    {
        e.printStackTrace();
    }

    return ModelLoaderRegistry.getMissingModel().bake(state, format, bakedTextureGetter);
}
 
開發者ID:cubex2,項目名稱:chesttransporter,代碼行數:17,代碼來源:ModelCT.java

示例2: preInit

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public void preInit(FMLPreInitializationEvent event) {
	super.preInit(event);
	ModelLoaderRegistry.registerLoader(ToolHeadModel.LoaderToolHead.INSTANCE);
	
	ModelLoaderRegistry.registerLoader(PickaxeModel.LoaderPickaxe.INSTANCE);
	ModelLoaderRegistry.registerLoader(AxeModel.LoaderAxe.INSTANCE);
	ModelLoaderRegistry.registerLoader(ShovelModel.LoaderShovel.INSTANCE);
	ModelLoaderRegistry.registerLoader(HoeModel.LoaderHoe.INSTANCE);
	ModelLoaderRegistry.registerLoader(HandpickModel.LoaderHandpick.INSTANCE);
	ModelLoaderRegistry.registerLoader(HammerModel.LoaderHammer.INSTANCE);
	
	ModelLoaderRegistry.registerLoader(SwordModel.LoaderSword.INSTANCE);
	ModelLoaderRegistry.registerLoader(DaggerModel.LoaderDagger.INSTANCE);
	ModelLoaderRegistry.registerLoader(MaceModel.LoaderMace.INSTANCE);
	
	ModEntities.initRenderers();
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:19,代碼來源:ClientProxy.java

示例3: getModelClipNode

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
/**
 * Retrieves the clip from the model.
 */
@SideOnly(Side.CLIENT)
public static IClip getModelClipNode(ResourceLocation modelLocation, String clipName)
{
    IModel model = ModelLoaderRegistry.getModelOrMissing(modelLocation);
    if(model instanceof IAnimatedModel)
    {
        Optional<? extends IClip> clip = ((IAnimatedModel)model).getClip(clipName);
        if(clip.isPresent())
        {
            return new ModelClip(clip.get(), modelLocation, clipName);
        }
        FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation);
    }
    // FIXME: missing clip?
    return new ModelClip(IdentityClip.INSTANCE, modelLocation, clipName);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:Clips.java

示例4: preInit

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public void preInit(FMLPreInitializationEvent e) {
    super.preInit(e);
    ModItems.initClient();
    ModelLoaderRegistry.registerLoader(new BakedModelLoader());
    ModelLoaderRegistry.registerLoader(ModelSeed.LoaderSeeds.INSTANCE);
    ModelLoaderRegistry.registerLoader(ModelWrappedFood.LoaderWrappedFood.INSTANCE);
    IResourceManager manager = FMLClientHandler.instance().getClient().getResourceManager();
    if(manager !=null && manager instanceof IReloadableResourceManager){
    	((IReloadableResourceManager)manager).registerReloadListener(new GuidePageLoader());
    	((IReloadableResourceManager)manager).registerReloadListener(this);
    }
    MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
    MinecraftForge.EVENT_BUS.register(new DisguiseClientHandler());
    ModBlocks.initClient();
    ModEntites.initClient();
    OBJLoader.INSTANCE.addDomain(CrystalMod.MODID);
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:19,代碼來源:ClientProxy.java

示例5: onModelBake

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@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();
    }
}
 
開發者ID:M4thG33k,項目名稱:TombManyGraves,代碼行數:19,代碼來源:TombManyGravesClientEvents.java

示例6: bake

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
                        Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    try
    {
        IModel model = ModelLoaderRegistry.getModel(sourceModel);
        if (model instanceof QBarOBJModel)
        {
            model = ((QBarOBJModel) model).retexture(replacedTextures);

            return model.bake(state, format, bakedTextureGetter);
        }
    } catch (Exception e)
    {
        throw new RuntimeException(e);
    }
    return null;
}
 
開發者ID:OPMCorp,項目名稱:Qbar,代碼行數:20,代碼來源:RetexturedOBJModel.java

示例7: preInit

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public void preInit(final FMLPreInitializationEvent e)
{
    OBJLoader.INSTANCE.addDomain(QBarConstants.MODID);
    ModelLoaderRegistry.registerLoader(QBarOBJLoader.INSTANCE);
    QBarOBJLoader.INSTANCE.addDomain(QBarConstants.MODID);

    MinecraftForge.EVENT_BUS.register(this);
    super.preInit(e);

    QBarOBJLoader.INSTANCE.addRetexturedModel("_belt_animated.mwm",
            new ResourceLocation(QBarConstants.MODID + ":block/belt.mwm"), new String[]{"Top"},
            new String[]{"qbar:blocks/belt_top_anim"});
    QBarOBJLoader.INSTANCE.addRetexturedModel("_belt_slope_animated.mwm",
            new ResourceLocation(QBarConstants.MODID + ":block/belt_slope.mwm"), new String[]{"None"},
            new String[]{"qbar:blocks/belt_slope_anim"});
    QBarOBJLoader.INSTANCE.addRetexturedModel("_belt_slope2_animated.mwm",
            new ResourceLocation(QBarConstants.MODID + ":block/belt_slope2.mwm"), new String[]{"None"},
            new String[]{"qbar:blocks/belt_slope_anim"});

    ClientProxy.registerFluidsClient();
    MinecraftForge.EVENT_BUS.register(new ClientTickHandler());

    QBarItems.ITEMS.stream().filter(item -> item instanceof IItemModelProvider)
            .forEach(item -> ((IItemModelProvider) item).registerVariants());
}
 
開發者ID:OPMCorp,項目名稱:Qbar,代碼行數:27,代碼來源:ClientProxy.java

示例8: getModel

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
protected IModel getModel(ResourceLocation modelLoc, ResourceLocation fallback) {
	try {
		return ModelLoaderRegistry.getModel(modelLoc);
	} catch (Exception e) {
		if (fallback != null) {
			try {
				return ModelLoaderRegistry.getModel(fallback);
			} catch (Exception e2) {
				logger.warn("Could not find model {} or fallback {}", modelLoc, fallback);
				return ModelLoaderRegistry.getMissingModel();
			}
		}
		logger.warn("Could not find model {}", modelLoc);
		return ModelLoaderRegistry.getMissingModel();
	}
}
 
開發者ID:hea3ven,項目名稱:CommonUtils,代碼行數:17,代碼來源:ModelBakerBase.java

示例9: process

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public IModel process(IModel base) {
    boolean hasBase = base != ModelLoaderRegistry.getMissingModel();
    if (hasBase) {
        base = baseVariant.process(base);
    }

    List<IModel> subModels = new LinkedList<>();
    for (Variant variant : finalVariants) {
        if (!variant.getModelLocation().equals(new ResourceLocation("builtin/missing"))) {
            IModel subModel = ModelLoaderRegistry.getModelOrLogError(variant.getModelLocation(), "Unable to load subModel's Model: " + variant.getModelLocation());
            subModels.add(variant.process(new StateOverrideIModel(subModel, variant.getState())));
        }
    }

    return new CCMultiModel(hasBase ? base : null, baseProperties, subModels);
}
 
開發者ID:TheCBProject,項目名稱:CodeChickenLib,代碼行數:18,代碼來源:CCFinalMultiVariant.java

示例10: getBakedModel

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
protected IBakedModel getBakedModel() {
  // Since we cannot bake in preInit() we do lazy baking of the model as soon as we need it
  if (bakedModel == null && resource != null) {
    try {
      model = ModelLoaderRegistry.getModel(new ResourceLocation(Const.MODID, resource));
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
    bakedModel = model.bake(TRSRTransformation.identity(), DefaultVertexFormats.ITEM,
        new Function<ResourceLocation, TextureAtlasSprite>() {
          @Override
          public TextureAtlasSprite apply(ResourceLocation location) {
            return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
          }
        });
  }
  return bakedModel;
}
 
開發者ID:PrinceOfAmber,項目名稱:Cyclic,代碼行數:20,代碼來源:BaseTESR.java

示例11: bake

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    IModel baseModel = null;
    IModel sideModel = null;

    try
    {
        baseModel = ModelLoaderRegistry.getModel(BASE_MODEL);
        sideModel = ModelLoaderRegistry.getModel(SIDE_MODEL);
    }
    catch (Exception e)
    {
        EnderUtilities.logger.warn("Failed to load a model for the Inserter!");
    }

    return new BakedModelInserter(this, baseModel, sideModel, state, format, bakedTextureGetter);
}
 
開發者ID:maruohon,項目名稱:enderutilities,代碼行數:19,代碼來源:BakedModelInserter.java

示例12: ModelCamouflageBlockBase

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
protected ModelCamouflageBlockBase(ResourceLocation baseModelLocation, @Nullable ResourceLocation overlayModelLocation)
{
    this.baseModelLocation = baseModelLocation;
    this.overlayModelLocation = overlayModelLocation;
    this.textures = ImmutableMap.of();

    IModel baseModel    = ModelLoaderRegistry.getMissingModel();
    IModel overlayModel = null;

    try
    {
        baseModel = ModelLoaderRegistry.getModel(this.baseModelLocation);

        if (this.overlayModelLocation != null)
        {
            overlayModel = ModelLoaderRegistry.getModel(this.overlayModelLocation);
        }
    }
    catch (Exception e)
    {
        EnderUtilities.logger.warn("Failed to load a model for a camouflage block", e);
    }

    this.baseModel = baseModel;
    this.overlayModel = overlayModel;
}
 
開發者ID:maruohon,項目名稱:enderutilities,代碼行數:27,代碼來源:ModelCamouflageBlock.java

示例13: bake

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    IModel baseModel = null;

    try
    {
        baseModel = ModelLoaderRegistry.getModel(BASE_MODEL);
    }
    catch (Exception e)
    {
        EnderUtilities.logger.warn("Failed to load a model for the Barrel!");
    }

    return new BakedModelBarrel(this, baseModel, state, format, bakedTextureGetter);
}
 
開發者ID:maruohon,項目名稱:enderutilities,代碼行數:17,代碼來源:BakedModelBarrel.java

示例14: bake

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    IModel baseModel = null;
    IModel lockedModel = null;

    try
    {
        baseModel   = ModelLoaderRegistry.getModel(BASE_MODEL);
        lockedModel = ModelLoaderRegistry.getModel(LOCKED_MODEL);
        lockedModel = lockedModel.retexture(ImmutableMap.of("layer0", TEX_LOCKED));
    }
    catch (Exception e)
    {
        EnderUtilities.logger.warn("Failed to load a model for the Nullifier!");
    }

    return new ModelNullifierBaked(baseModel, lockedModel, state, format, bakedTextureGetter);
}
 
開發者ID:maruohon,項目名稱:enderutilities,代碼行數:20,代碼來源:ModelNullifierBaked.java

示例15: onModelBake

import net.minecraftforge.client.model.ModelLoaderRegistry; //導入依賴的package包/類
@SubscribeEvent
public void onModelBake(ModelBakeEvent evt) {
	final IModel model = ModelLoaderRegistry.getModelOrMissing(MARKER_MODEL_LOCATION);

	final TextureMap textureMapBlocks = Minecraft.getMinecraft().getTextureMapBlocks();
	final IBakedModel bakedModel = model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM,
			input -> textureMapBlocks.getAtlasSprite(input.toString()));

	renderer.onModelBake(() -> {
		final Tessellator tessellator = Tessellator.getInstance();

		BufferBuilder vertexBuffer = tessellator.getBuffer();
		vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);

		for (EnumFacing enumfacing : EnumFacing.values())
			renderQuads(vertexBuffer, bakedModel.getQuads(null, enumfacing, 0L));

		renderQuads(vertexBuffer, bakedModel.getQuads(null, null, 0L));

		vertexBuffer.finishDrawing();

		return vertexBuffer;
	});
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:25,代碼來源:TileEntityGuideRenderer.java


注:本文中的net.minecraftforge.client.model.ModelLoaderRegistry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。