本文整理匯總了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);
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
}
示例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;
}
示例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());
}
示例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();
}
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
});
}