• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.util.registry.IRegistry的典型用法代码示例。如果您正苦于以下问题:Java IRegistry类的具体用法?Java IRegistry怎么用?Java IRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IRegistry类属于net.minecraft.util.registry包,在下文中一共展示了IRegistry类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: debugOutput

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
@SuppressWarnings("null")
private static String debugOutput(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelResourceLocation defaultMrl, IBakedModel missingModel) {
  String prefix = defaultMrl.getResourceDomain() + ":" + defaultMrl.getResourcePath();
  if (modelRegistry instanceof RegistrySimple) {
    RegistrySimple<?, ?> rg = (RegistrySimple<?, ?>) modelRegistry;
    StringBuilder sb = new StringBuilder();
    for (Object key : rg.getKeys()) {
      if (modelRegistry.getObject((ModelResourceLocation) key) != missingModel && key.toString().startsWith(prefix)) {
        sb.append(key + "; ");
      }
    }
    if (sb.length() > 0) {
      sb.setLength(sb.length() - 2);
    } else {
      sb.append("(none)");
    }
    return "Loaded states for " + prefix + " are: " + sb.toString();
  } else {
    return "Loaded states could not be determined because modelRegistry is not a RegistrySimple.";
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:22,代码来源:SmartModelAttacher.java


示例2: setupModelRegistry

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
public IRegistry<ModelResourceLocation, IBakedModel> setupModelRegistry()
{
    this.loadBlocks();
    this.loadVariantItemModels();
    this.loadModelsCheck();
    this.loadSprites();
    this.makeItemModels();
    this.bakeBlockModels();
    this.bakeItemModels();
    return this.bakedRegistry;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:ModelBakery.java


示例3: atModelsBaked

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
@SubscribeEvent
public static void atModelsBaked(ModelBakeEvent bakeEvent) {
	IRegistry<ModelResourceLocation, IBakedModel> modelRegistry = bakeEvent.getModelRegistry();
	Map<ModelResourceLocation, IBakedModel> dependencies = new HashMap<>();
	for (IBakedModel model : modelRegistry) {
		if (!(model instanceof BakedModelWrapper)) {
			continue;
		}

		BakedModelWrapper bakedModel = (BakedModelWrapper) model;
		Set<ResourceLocation> overrideLocations = getDependencies(bakedModel);
		for (ResourceLocation dep : overrideLocations) {
			ModelResourceLocation actualDep = net.minecraftforge.client.model.ModelLoader
					.getInventoryVariant(dep.toString());
			if (modelRegistry.getKeys().contains(actualDep)) {
				continue;
			}

			IModel depModel = ModelLoaderRegistry.getModelOrLogError(dep, "Missing dependency model");
			IBakedModel depBakedModel = depModel.bake(
					depModel.getDefaultState(),
					DefaultVertexFormats.ITEM,
					EventListener::getTextureAtlas);
			dependencies.put(actualDep, depBakedModel);
		}
	}

	for (Entry<ModelResourceLocation, IBakedModel> entry : dependencies.entrySet()) {
		modelRegistry.putObject(entry.getKey(), entry.getValue());
	}
}
 
开发者ID:WorldSEnder,项目名称:MCAnm,代码行数:32,代码来源:ModelLoader.java


示例4: onModelBake

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
public static void onModelBake(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
{
    MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, modelLoader));
    modelLoader.onPostBakeEvent(modelRegistry);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:6,代码来源:ForgeHooksClient.java


示例5: setupModelRegistry

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
@Override
public IRegistry<ModelResourceLocation, IBakedModel> setupModelRegistry()
{
    isLoading = true;
    loadBlocks();
    loadVariantItemModels();
    missingModel = ModelLoaderRegistry.getMissingModel();
    stateModels.put(MODEL_MISSING, missingModel);

    final Set<ResourceLocation> textures = Sets.newHashSet(ModelLoaderRegistry.getTextures());
    textures.remove(TextureMap.LOCATION_MISSING_TEXTURE);
    textures.addAll(LOCATIONS_BUILTIN_TEXTURES);

    textureMap.loadSprites(resourceManager, new ITextureMapPopulator()
    {
        public void registerSprites(TextureMap map)
        {
            for(ResourceLocation t : textures)
            {
                map.registerSprite(t);
            }
        }
    });

    IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE);
    Map<IModel, IBakedModel> bakedModels = Maps.newHashMap();
    HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create();
    Multimaps.invertFrom(Multimaps.forMap(stateModels), models);

    if (firstLoad)
    {
        firstLoad = false;
        for (ModelResourceLocation mrl : stateModels.keySet())
        {
            bakedRegistry.putObject(mrl, missingBaked);
        }
        return bakedRegistry;
    }

    ProgressBar bakeBar = ProgressManager.push("ModelLoader: baking", models.keySet().size());

    for(IModel model : models.keySet())
    {
        bakeBar.step("[" + Joiner.on(", ").join(models.get(model)) + "]");
        if(model == getMissingModel())
        {
            bakedModels.put(model, missingBaked);
        }
        else
        {
            bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE));
        }
    }

    ProgressManager.pop(bakeBar);

    for (Entry<ModelResourceLocation, IModel> e : stateModels.entrySet())
    {
        bakedRegistry.putObject(e.getKey(), bakedModels.get(e.getValue()));
    }
    return bakedRegistry;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:63,代码来源:ModelLoader.java


示例6: ModelBakeEvent

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
public ModelBakeEvent(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
{
    this.modelManager = modelManager;
    this.modelRegistry = modelRegistry;
    this.modelLoader = modelLoader;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:ModelBakeEvent.java


示例7: getModelRegistry

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
public IRegistry<ModelResourceLocation, IBakedModel> getModelRegistry()
{
    return modelRegistry;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:ModelBakeEvent.java


示例8: onModelBakeEvent

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
@SubscribeEvent
	public void onModelBakeEvent(ModelBakeEvent event) {
		Log.debug("Beginning onModelBakeEvent");

		/*
		 * We need to set the "flip-v" flag.. As the inventory-variant is
		 * "generated" above, MC will ignore what we have in the blockstates
		 * json & render the textures flipped in the inventory...
		 *
		 * Doing it via reflection, as we'd need to redefine the original
		 * OBJModel somewhere (OBJModel.process() will do that) but I have no
		 * idea WHERE!
		 */

		// Currently not required due to custom replacement of OBJModel (Hacky workaround replaces Hacky Workaround)
//		Field customDataField = null;
//		Field customDataFlipVField = null;
//		try {
//			customDataField = OBJModel.class.getDeclaredField("customData");
//			customDataField.setAccessible(true);
//			Class<?> customDataType = customDataField.getType();
//			customDataFlipVField = customDataType.getDeclaredField("flipV");
//			customDataFlipVField.setAccessible(true);
//		} catch (Exception e) {
//			Log.error(
//					"Failed to make OBJModel.customData accessible or access other reflection stuff. Inventory items will have wrong textures.",
//					e);
//		}

		/*
		 * Go through all registered locations from above & replace the baked
		 * model with one that understands our items
		 */

		IRegistry<ModelResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
		for (ModelResourceLocation resourceLocation : locationsToReplace) {
			IBakedModel bakedModel = modelRegistry.getObject(resourceLocation);
			if (bakedModel instanceof OBJBakedModel) {
				Log.debug("Replacing " + resourceLocation);

				OBJBakedModel bakedAsObj = (OBJBakedModel) bakedModel;
				OBJModel obj = bakedAsObj.getModel();

				/*
				 * Set flip-v flag
				 */
				obj.customData.processUVData.put(OBJCustomData.Keys.FLIP_UVS, Pair.of(false, true));
				obj.customData.hasProcessed = true;
//				try {
//					Object customData = customDataField.get(obj);
//					customDataFlipVField.set(customData, true);
//				} catch (Exception e) {
//					Log.error("Failed to adjust custom data. Inventory items will have wrong textures.", e);
//				}

				/*
				 * Create custom baked model as replacement
				 */

				bakedModel = new ItemAwareOBJBakedModel(bakedAsObj);
				modelRegistry.putObject(resourceLocation, bakedModel);
			}
		}

		//		if(Config.multipart_load) {
		//			MultipartHandlerClient.onModelBakeEvent(event);
		//		}

		Log.debug("Completed onModelBakeEvent");
	}
 
开发者ID:Team-IO,项目名称:taam,代码行数:71,代码来源:TaamClientProxy.java


示例9: onModelBakePre

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
/**
 * Called before CCL does anything to the ModelRegistry.
 * Useful for wrapped models, Use this in the constructor of the wrapped model.
 *
 * @param modelRegistry The Model registry.
 */
void onModelBakePre(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry);
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:8,代码来源:ModelRegistryHelper.java


示例10: onModelBake

import net.minecraft.util.registry.IRegistry; //导入依赖的package包/类
/**
 * A Simple callback for model baking.
 *
 * @param modelRegistry The Model registry.
 */
void onModelBake(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry);
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:7,代码来源:ModelRegistryHelper.java



注:本文中的net.minecraft.util.registry.IRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RoleLocalServiceUtil类代码示例发布时间:2022-05-23
下一篇:
Java Neg类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap