当前位置: 首页>>代码示例>>Java>>正文


Java ModelBakery类代码示例

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


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

示例1: registerBlockVariants

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@Override
public void registerBlockVariants(String modId)
{
    ResourceLocation[] rl = new ResourceLocation[4];
    int i = 0;
    for (BlockMetalFurnace.Types type : BlockMetalFurnace.Types.values()) {
        if (!isBurning)
            rl[i] = new ResourceLocation(modId + "upgradedFurnace_" + type.getName());
        else
            rl[i] = new ResourceLocation(modId + "upgradedFurnace_" + type.getName() + "_lit");
        i++;
    }
    if (!isBurning)
        ModelBakery.registerItemVariants(Item.getItemFromBlock(ModBlocks.MetalFurnace), rl);
    else
        ModelBakery.registerItemVariants(Item.getItemFromBlock(ModBlocks.MetalFurnace_Lit), rl);
}
 
开发者ID:GamingsModding,项目名称:LittleThings-old,代码行数:18,代码来源:BlockMetalFurnace.java

示例2: registerFluidModels

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void registerFluidModels(Fluid fluid) {
    if(fluid == null) {
      return;
    }

    Block block = fluid.getBlock();
    if(block != null) {
      Item item = Item.getItemFromBlock(block);
      FluidStateMapper mapper = new FluidStateMapper(fluid);

      // item-model
      if(item != null) {
        ModelBakery.registerItemVariants(item);
        ModelLoader.setCustomMeshDefinition(item, mapper);
      }
      // block-model
      ModelLoader.setCustomStateMapper(block, mapper);
    }
  }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:21,代码来源:ModFluids.java

示例3: initModel

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
   public void initModel() {
	final Map<WolfArmor, ModelResourceLocation> models = Maps.newHashMap();
	for(WolfArmor armor : new WolfArmor[]{WolfArmor.LEATHER, WolfArmor.CHAIN, WolfArmor.IRON, WolfArmor.DIRON, WolfArmor.DIAMOND, WolfArmor.GOLD}){
		ModelResourceLocation loc = new ModelResourceLocation("crystalmod:wolfarmor", "armor="+armor.name().toLowerCase());
		models.put(armor, loc);
		ModelBakery.registerItemVariants(this, loc);
	}
       ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
           @Override
           public ModelResourceLocation getModelLocation(ItemStack stack) {
           	return models.get(getWolfArmor(stack));
           }
       });
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:17,代码来源:ItemWolfArmor.java

示例4: getRegClient

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@Override
public Runnable getRegClient()
{
	return new Runnable()
	{
		@Override
		public void run()
		{
			Item item = getComponent();
			if (getComponent().getCreativeTab() == null)
				item.setCreativeTab(CreativeTabs.CREATIVE_TAB_ARRAY[getCreativeTabId()]);
			Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item,
					0, new ModelResourceLocation(RegistryHelper.INSTANCE.currentMod() + ":" + getRegisterName(), "inventory"));
			ModelBakery.registerItemVariants(item, new ResourceLocation(RegistryHelper.INSTANCE.currentMod(), getRegisterName()));
		}
	};
}
 
开发者ID:InfinityStudio,项目名称:InspiringWorld,代码行数:18,代码来源:RegItem.java

示例5: getRegClient

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@Override
public Runnable getRegClient()
{
	return new Runnable()
	{
		@Override
		public void run()
		{
			if (getComponent().getCreativeTabToDisplayOn() == null)
				getComponent().setCreativeTab(CreativeTabs.CREATIVE_TAB_ARRAY[getCreativeTabId()]);
			Item item = Item.getItemFromBlock(getComponent());
			Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0,
					new ModelResourceLocation(getComponent().getRegistryName(), "inventory"));
			ModelBakery.registerItemVariants(item, getComponent().getRegistryName());
		}
	};
}
 
开发者ID:InfinityStudio,项目名称:InspiringWorld,代码行数:18,代码来源:RegBlock.java

示例6: registerFluidsClient

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
public static final void registerFluidsClient()
{
    final ModelResourceLocation fluidSteamLocation = new ModelResourceLocation(QBarConstants.MODID + ":" +
            "blockfluidsteam",
            "steam");
    ModelLoader.setCustomStateMapper(QBarFluids.blockFluidSteam, new StateMapperBase()
    {
        @Override
        protected ModelResourceLocation getModelResourceLocation(final IBlockState state)
        {
            return fluidSteamLocation;
        }
    });

    ModelBakery.registerItemVariants(Item.getItemFromBlock(QBarFluids.blockFluidSteam), fluidSteamLocation);
    ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(QBarFluids.blockFluidSteam),
            stack -> fluidSteamLocation);
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:19,代码来源:ClientProxy.java

示例7: registerRenderer

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void registerRenderer() {
    IFluidBlock block = BlocksRegistry.liquidXpBlock;
    Item item = Item.getItemFromBlock((Block)block);
    assert (item == Items.AIR);

    ModelBakery.registerItemVariants(item);

    ModelResourceLocation modelResourceLocation = new ModelResourceLocation(MekfarmMod.MODID + ":fluids", this.getName());

    ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return modelResourceLocation;
        }
    });

    ModelLoader.setCustomStateMapper((Block) block, new StateMapperBase() {
        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return modelResourceLocation;
        }
    });
}
 
开发者ID:faceofcat,项目名称:Mekfarm,代码行数:25,代码来源:LiquidXPFluid.java

示例8: registerRenderer

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void registerRenderer() {
    IFluidBlock block = BlocksRegistry.sewageBlock;
    Item item = Item.getItemFromBlock((Block)block);
    assert (item == Items.AIR);

    ModelBakery.registerItemVariants(item);

    ModelResourceLocation modelResourceLocation = new ModelResourceLocation(MekfarmMod.MODID + ":fluids", this.getName());

    ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return modelResourceLocation;
        }
    });

    ModelLoader.setCustomStateMapper((Block) block, new StateMapperBase() {
        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return modelResourceLocation;
        }
    });
}
 
开发者ID:faceofcat,项目名称:Mekfarm,代码行数:25,代码来源:SewageFluid.java

示例9: registerVariantBlocks

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
private void registerVariantBlocks(ProxyModBase proxy) {
	for (InfoBlock block : proxy.blocks) {
		if (!(block instanceof InfoBlockVariant))
			continue;
		InfoBlockVariant blockVar = (InfoBlockVariant) block;
		List<String> variants = Lists.newArrayList();
		for (Object metalObj : blockVar.getVariantProp().getAllowedValues()) {
			IStringSerializable value = (IStringSerializable) metalObj;
			String name = proxy.getModId() + ":" + value.getName() + blockVar.getVariantSuffix();
			variants.add(name);
		}
		ModelBakery.registerItemVariants(Item.getItemFromBlock(block.getBlock()),
				variants.stream().map(ResourceLocation::new).toArray(ResourceLocation[]::new));

		ModelLoader.setCustomStateMapper(block.getBlock(),
				(new StateMap.Builder()).withName(blockVar.getVariantProp())
						.withSuffix(blockVar.getVariantSuffix())
						.build());
	}
}
 
开发者ID:hea3ven,项目名称:CommonUtils,代码行数:21,代码来源:ModInitializerClient.java

示例10: registerFluidModel

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
public void registerFluidModel(Block  block) {
	Item item = Item.getItemFromBlock(block);

	ModelBakery.registerItemVariants(item);

	final ModelResourceLocation loc = new ModelResourceLocation(Reference.MODID + ":fluid", "liquidmalgra");

	ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
		@Override
		public ModelResourceLocation getModelLocation(ItemStack stack) {
			return loc;
		}
	});

	ModelLoader.setCustomStateMapper(block, new StateMapperBase() {
		@Override
		protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
			return loc;
		}
	});
}
 
开发者ID:Ohrm,项目名称:Malgra,代码行数:22,代码来源:ClientProxy.java

示例11: preInit

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@Override
public void preInit(FMLPreInitializationEvent event) {
	super.preInit(event);
	for (final String name : Fluids.getFluidBlockRegistry().keySet()) {
		final Block block = Fluids.getFluidBlockByName(name);
		final Item item = Item.getItemFromBlock(block);
		if (!item.getRegistryName().getResourceDomain().equals(BaseGems.MODID))
			continue;
		final ModelResourceLocation fluidModelLocation = new ModelResourceLocation(item.getRegistryName().getResourceDomain() + ":" + name, "fluid");
		ModelBakery.registerItemVariants(item);
		ModelLoader.setCustomMeshDefinition(item, stack -> fluidModelLocation);
		ModelLoader.setCustomStateMapper(block, new StateMapperBase() {
			@Override
			protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
				return fluidModelLocation;
			}
		});
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:BaseGems,代码行数:20,代码来源:ClientProxy.java

示例12: initModelsAndVariants

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
    public void initModelsAndVariants() {
    if (getCustomMeshDefinition() != null) {

        ModelLoader.setCustomMeshDefinition(this, getCustomMeshDefinition());
        for (int i = 0; i < VARIANTS.length; i++) {
            ModelBakery.registerItemVariants(this, getCustomModelResourceLocation(VARIANTS[i]));
        }
    }
    else {
        if (!getHasSubtypes()) {
            ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName().toString()));
        }
        else {
            for (int i = 0; i < VARIANTS.length; i++) {
                ModelLoader.setCustomModelResourceLocation(this, i, getCustomModelResourceLocation(VARIANTS[i]));
            }
        }
    }
}
 
开发者ID:RootsTeam,项目名称:AdventureBags,代码行数:21,代码来源:ItemBase.java

示例13: registerRender

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void registerRender() {
	ModelResourceLocation[] locations = new ModelResourceLocation[]{
				new ModelResourceLocation(this.getRegistryName() + "_empty", "inventory"),
				new ModelResourceLocation(this.getRegistryName() + "_chest", "inventory"),
				new ModelResourceLocation(this.getRegistryName() + "_storage_core", "inventory")
			};
	ModelBakery.registerItemVariants(this, locations);
	ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
		@Override
		public ModelResourceLocation getModelLocation(ItemStack stack) {
			if(stack.hasTagCompound() && stack.getTagCompound().getBoolean("isFull")) {
				if(stack.getTagCompound().getBoolean("isChest")) {
					return locations[1];
				}
				if(stack.getTagCompound().getBoolean("isStorageCore")) {
					return locations[2];
				}
			}
			return locations[0];
		}
	});
}
 
开发者ID:zerofall,项目名称:EZStorage2,代码行数:25,代码来源:ItemDolly.java

示例14: bakeModels

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void bakeModels(String modID){
	for(Fluid fluid : fluidBlocks.keySet()){
		BlockFluidBase block = fluidBlocks.get(fluid);
		Item item = Item.getItemFromBlock(block);
		final ModelResourceLocation fluidModelLocation = new ModelResourceLocation(
				modID.toLowerCase() + ":" + fluidBlockNames.get(block), "fluid");
           ModelBakery.registerItemVariants(item);
		ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition()
		{
			public ModelResourceLocation getModelLocation(ItemStack stack)
			{
				return fluidModelLocation;
			}
		});
		ModelLoader.setCustomStateMapper(block, new StateMapperBase()
		{
			protected ModelResourceLocation getModelResourceLocation(IBlockState state)
			{
				return fluidModelLocation;
			}
		});
	}
}
 
开发者ID:cyanobacterium,项目名称:BaseMetals,代码行数:25,代码来源:Fluids.java

示例15: registerFluidModel

import net.minecraft.client.renderer.block.model.ModelBakery; //导入依赖的package包/类
private void registerFluidModel(Block fluidBlock, String name) {
	Item item = Item.getItemFromBlock(fluidBlock);

	ModelBakery.registerItemVariants(item);

	final ModelResourceLocation modelResourceLocation = new ModelResourceLocation("abyssalcraft:fluid", name);

	ModelLoader.setCustomMeshDefinition(item, stack -> modelResourceLocation);

	ModelLoader.setCustomStateMapper(fluidBlock, new StateMapperBase() {
		@Override
		protected ModelResourceLocation getModelResourceLocation(IBlockState p_178132_1_) {
			return modelResourceLocation;
		}
	});
}
 
开发者ID:Shinoow,项目名称:AbyssalCraft,代码行数:17,代码来源:AbyssalCraftClientEventHooks.java


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