ModItems.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:Tutorial-1.11 作者:
/**
 * The client-side initializer. Here we handle model registration. Note the @SideOnly annotation. This causes the
 * method to exist only on the client-side, preventing servers from crashing.
 * 
 * This should be called during init, calling during preInit will crash.
 */
@SideOnly(Side.CLIENT)
public static void initClient(ItemModelMesher mesher) {

  // Create a MRL for the model. Note we have two parameters and the second must be "inventory". We can reuse this
  // variable for each item of course, since most Java variables just contain a reference to an object.
  ModelResourceLocation model = new ModelResourceLocation(
      Tutorial.RESOURCE_PREFIX + Names.TUTORIAL_ITEM, "inventory");
  // Here we list all models the item can possibly have. An array will work, or just list each MRL for the final
  // parameters.
  ModelLoader.registerItemVariants(tutorialItem, model);
  // Finally, we associate each MRL (model) with different metadata values for the item. This must be called for each
  // variant! And even if the variants don't depend on metadata, I believe each variant must be registered to a unique
  // meta... In this case, there are no other variants, so we just pass in a metadata of zero.
  mesher.register(tutorialItem, 0, model);

  registerModel(mesher, tutorialPickaxe, Names.PICKAXE);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号