本文整理汇总了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);
}
示例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);
}
}
示例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));
}
});
}
示例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()));
}
};
}
示例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());
}
};
}
示例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);
}
示例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;
}
});
}
示例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;
}
});
}
示例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());
}
}
示例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;
}
});
}
示例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;
}
});
}
}
示例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]));
}
}
}
}
示例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];
}
});
}
示例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;
}
});
}
}
示例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;
}
});
}