本文整理汇总了Java中net.minecraftforge.client.model.ModelLoader.setCustomMeshDefinition方法的典型用法代码示例。如果您正苦于以下问题:Java ModelLoader.setCustomMeshDefinition方法的具体用法?Java ModelLoader.setCustomMeshDefinition怎么用?Java ModelLoader.setCustomMeshDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.client.model.ModelLoader
的用法示例。
在下文中一共展示了ModelLoader.setCustomMeshDefinition方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
public static void register(IFCustomFluidBlock base) {
Item fluid = Item.getItemFromBlock(base);
ModelBakery.registerItemVariants(fluid);
FluidStateMapper mapper = new FluidStateMapper(base.getName());
ModelLoader.setCustomMeshDefinition(fluid, mapper);
ModelLoader.setCustomStateMapper(base, mapper);
}
示例2: registerModels
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
private void registerModels() {
ModelRegistryHelper.registerItemRenderer(ModItems.itemWireless, new RenderItemWireless());
ModItems.itemMaterial.registerModels();
ModelResourceLocation location = new ModelResourceLocation("wrcbe:material", "type=rep");
ModelLoader.setCustomModelResourceLocation(ModItems.itemRep, 0, location);
ModelLoader.setCustomMeshDefinition(ModItems.itemRemote, stack -> new ModelResourceLocation("wrcbe:device", "type=wireless_remote"));
ModelLoader.registerItemVariants(ModItems.itemRemote, new ModelResourceLocation("wrcbe:device", "type=wireless_remote"));
ModelBakery.registerItemKeyGenerator(ModItems.itemRemote, stack -> stack.getItem().getRegistryName().toString() + "|" + stack.getMetadata() + "," + ItemWirelessRemote.getTransmitting(stack));
ModelLoader.setCustomMeshDefinition(ModItems.itemTriangulator, stack -> new ModelResourceLocation("wrcbe:device", "type=wireless_triangulator"));
ModelLoader.registerItemVariants(ModItems.itemTriangulator, new ModelResourceLocation("wrcbe:device", "type=wireless_triangulator"));
ModelBakery.registerItemKeyGenerator(ModItems.itemTriangulator, stack -> {
int damage = stack.getItemDamage();
if (damage < 0 || damage > RedstoneEther.numfreqs) {
damage = 0;
}
//I know, random call to a thing, used to update textures.
TriangTexManager.getIconIndexFromDamage(damage);
return ModelBakery.defaultItemKeyGenerator.generateKey(stack);
});
ModelLoader.setCustomModelResourceLocation(ModItems.itemSniffer, 0, new ModelResourceLocation("wrcbe:device", "type=sniffer"));
ModelLoader.setCustomModelResourceLocation(ModItems.itemPrivateSniffer, 0, new ModelResourceLocation("wrcbe:device", "type=private_sniffer"));
ModelRegistryHelper.registerItemRenderer(ModItems.itemTracker, new RenderItemTracker());
ModelLoader.setCustomModelResourceLocation(ModItems.itemEmptyWirelessMap, 0, new ModelResourceLocation("wrcbe:device", "type=empty_wireless_map"));
ModelLoader.registerItemVariants(ModItems.itemWirelessMap, new ModelResourceLocation("wrcbe:device", "type=wireless_map"));
ModelLoader.setCustomMeshDefinition(ModItems.itemWirelessMap, stack -> new ModelResourceLocation("wrcbe:device", "type=wireless_map"));
}
示例3: initModels
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public static void initModels()
{
Item item = Item.getItemFromBlock(ModBlocks.liquid_butter);
ModelBakery.registerItemVariants(item);
ModelResourceLocation location = new ModelResourceLocation("btweagles:fluid", "liquid_butter");
ModelLoader.setCustomMeshDefinition(item, stack -> location);
ModelLoader.setCustomStateMapper(ModBlocks.liquid_butter, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return location;
}
});
}
示例4: initModel
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void initModel(){
ModelBakery.registerItemVariants(this, new ModelResourceLocation(Melodium.MODID+":composition_paper"), new ModelResourceLocation(Melodium.MODID+":song_paper"));
ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition(){
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
if (isLearned(stack)){
return new ModelResourceLocation(Melodium.MODID+":song_paper");
}
return new ModelResourceLocation(Melodium.MODID+":composition_paper");
}
});
}
示例5: registerFluidRender
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
protected void registerFluidRender(BlockFluidBase blockFluid, String blockStateName) {
final String location = FoodCraftReloaded.MODID + ":" + blockStateName;
final Item itemFluid = Item.getItemFromBlock(blockFluid);
ModelLoader.setCustomMeshDefinition(itemFluid, stack -> new ModelResourceLocation(location, "fluid"));
ModelLoader.setCustomStateMapper(blockFluid, new StateMapperBase() {
@Nonnull
@Override
protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) {
return new ModelResourceLocation(location, "fluid");
}
});
}
示例6: onModelRegistry
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@SubscribeEvent
public static void onModelRegistry(ModelRegistryEvent event) {
//Registries for mooncakes
ModelResourceLocation[] modelLocationArray = new ModelResourceLocation[MooncakeFillingType.VALUES.length];
for (int i = 0; i < MooncakeFillingType.VALUES.length; i++) {
modelLocationArray[i] = new ModelResourceLocation("mooncakecraft:mooncake_" + MooncakeFillingType.getByOrdinal(i).getLocalizationKey(), "inventory");
}
ModelBakery.registerItemVariants(MooncakeConstants.MOONCAKE_ITEM, modelLocationArray);
ModelLoader.setCustomMeshDefinition(MooncakeConstants.MOONCAKE_ITEM, itemStack -> new ModelResourceLocation("mooncakecraft:mooncake_" + MooncakeFillingType.getByOrdinal(itemStack.getMetadata()).getLocalizationKey(), "inventory"));
//Registries for mooncake fillings
ModelResourceLocation[] modelLocationArray1 = new ModelResourceLocation[MooncakeFillingType.VALUES.length];
for (int i = 0; i < MooncakeFillingType.VALUES.length; i++) {
modelLocationArray1[i] = new ModelResourceLocation("mooncakecraft:mooncake_filling_" + MooncakeFillingType.getByOrdinal(i).getLocalizationKey(), "inventory");
}
ModelBakery.registerItemVariants(MooncakeConstants.MOONCAKE_FILLING, modelLocationArray1);
ModelLoader.setCustomMeshDefinition(MooncakeConstants.MOONCAKE_FILLING, itemStack -> new ModelResourceLocation("mooncakecraft:mooncake_filling_" + MooncakeFillingType.getByOrdinal(itemStack.getMetadata()).getLocalizationKey(), "inventory"));
//Registries for raw mooncakes
ModelResourceLocation[] modelLocationArray2 = new ModelResourceLocation[MooncakeFillingType.VALUES.length];
for (int i = 0; i < MooncakeFillingType.VALUES.length; i++) {
modelLocationArray2[i] = new ModelResourceLocation("mooncakecraft:mooncake_raw_" + MooncakeFillingType.getByOrdinal(i).getLocalizationKey(), "inventory");
}
ModelBakery.registerItemVariants(MooncakeConstants.RAW_MOONCAKE_ITEM, modelLocationArray2);
ModelLoader.setCustomMeshDefinition(MooncakeConstants.RAW_MOONCAKE_ITEM, itemStack -> new ModelResourceLocation("mooncakecraft:mooncake_raw_" + MooncakeFillingType.getByOrdinal(itemStack.getMetadata()).getLocalizationKey(), "inventory"));
//Registries for unshaped mooncakes
ModelResourceLocation[] modelLocationArray3 = new ModelResourceLocation[MooncakeFillingType.VALUES.length];
for (int i = 0; i < MooncakeFillingType.VALUES.length; i++) {
modelLocationArray3[i] = new ModelResourceLocation("mooncakecraft:mooncake_unshaped_" + MooncakeFillingType.getByOrdinal(i).getLocalizationKey(), "inventory");
}
ModelBakery.registerItemVariants(MooncakeConstants.UNSHAPED_MOONCAKE_ITEM, modelLocationArray3);
ModelLoader.setCustomMeshDefinition(MooncakeConstants.UNSHAPED_MOONCAKE_ITEM, itemStack -> new ModelResourceLocation("mooncakecraft:mooncake_unshaped_" + MooncakeFillingType.getByOrdinal(itemStack.getMetadata()).getLocalizationKey(), "inventory"));
//Registries for other things
ModelLoader.setCustomModelResourceLocation(MooncakeConstants.WHEAT_FLOUR, 0, new ModelResourceLocation("mooncakecraft:wheat_flour", "inventory"));
ModelLoader.setCustomModelResourceLocation(MooncakeConstants.SESAME_SEED, 0, new ModelResourceLocation("mooncakecraft:sesame_seeds", "inventory"));
ModelLoader.setCustomModelResourceLocation(MooncakeConstants.PEANUT_SEED, 0, new ModelResourceLocation("mooncakecraft:peanut_seeds", "inventory"));
ModelLoader.setCustomModelResourceLocation(MooncakeConstants.LOTUS_SEED, 0, new ModelResourceLocation("mooncakecraft:lotus_seeds", "inventory"));
ModelLoader.setCustomModelResourceLocation(MooncakeConstants.JUJUBE, 0, new ModelResourceLocation("mooncakecraft:jujube", "inventory"));
//Registries for mooncake mold
ModelLoader.setCustomModelResourceLocation(MooncakeConstants.MOONCAKE_MOLD, 0, new ModelResourceLocation("mooncakecraft:mooncake_mold_empty", "inventory"));
ModelLoader.setCustomModelResourceLocation(MooncakeConstants.MOONCAKE_MOLD, 1, new ModelResourceLocation("mooncakecraft:mooncake_mold_full", "inventory"));
//ICON
ModelLoader.setCustomModelResourceLocation(MooncakeConstants.ICON, 0, new ModelResourceLocation("mooncakecraft:icon", "inventory"));
}
示例7: registerRender
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@Override
public void registerRender() {
models = new HashMap<String, ModelResourceLocation>();
String[] modelPaths = new String[] { "rafradek_blocklauncher:block_cannon",
"rafradek_blocklauncher:block_rifle", "rafradek_blocklauncher:block_shotgun",
"rafradek_blocklauncher:block_thrower", "rafradek_blocklauncher:tnt_launcher",
"rafradek_blocklauncher:tnt_launcher_2", "rafradek_blocklauncher:block_chaingun",
"rafradek_blocklauncher:block_sniper", "rafradek_blocklauncher:tnt_mines" };
for (String string : modelPaths) {
ModelResourceLocation model = new ModelResourceLocation(string, "inventory");
models.put(string, model);
ModelBakery.registerItemVariants(BlockLauncher.cannon, model);
}
ModelLoader.setCustomMeshDefinition(BlockLauncher.cannon, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack p_178113_1_) {
int type = BlockLauncher.cannon.getType(p_178113_1_);
if (type == 0)
return models.get("rafradek_blocklauncher:block_rifle");
else if (type == 1)
return models.get("rafradek_blocklauncher:block_cannon");
else if (type == 2)
return models.get("rafradek_blocklauncher:block_shotgun");
else if (type == 3)
return models.get("rafradek_blocklauncher:block_thrower");
else if (type == 4)
return models.get("rafradek_blocklauncher:block_chaingun");
else if (type == 5)
return models.get("rafradek_blocklauncher:block_sniper");
else if (type == 16)
return models.get("rafradek_blocklauncher:tnt_launcher");
else if (type == 17)
// if(stack.getTagCompound().getInteger("wait")<=0)
return models.get("rafradek_blocklauncher:tnt_launcher_2");
// else
// return this.tntlauncherEmptyIcon;
else if (type == 18)
// if(stack.getTagCompound().getInteger("wait")<=0)
return models.get("rafradek_blocklauncher:tnt_mines");
// else
// return this.tntlauncherEmptyIcon;
return models.get("rafradek_blocklauncher:block_cannon");
}
});
// ModelBakery.addVariantName(BlockLauncher.launchpart,
// "rafradek_blocklauncher:launchpart","rafradek_blocklauncher:launchpart_better");
ModelLoader.setCustomModelResourceLocation(BlockLauncher.launchpart, 0,
new ModelResourceLocation("rafradek_blocklauncher:launchpart", "inventory"));
ModelLoader.setCustomModelResourceLocation(BlockLauncher.launchpartBetter, 0,
new ModelResourceLocation("rafradek_blocklauncher:launchpart_better", "inventory"));
RenderingRegistry.registerEntityRenderingHandler(EntityFallingEnchantedBlock.class,
new IRenderFactory<EntityFallingEnchantedBlock>() {
@Override
public RenderFallingBlock createRenderFor(RenderManager manager) {
// TODO Auto-generated method stub
return new RenderFallingBlock(manager);
}
});
}
示例8: setModelLocation
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static void setModelLocation(Item item, String variantSettings) {
ModelLoader.setCustomMeshDefinition(item, stack -> new ModelResourceLocation(item.getRegistryName().toString(), variantSettings));
}
示例9: registerRender
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
protected void registerRender(Item item, int meta, ModelResourceLocation location) {
ModelBakery.registerItemVariants(item, location);
ModelLoader.setCustomModelResourceLocation(item, meta, location);
ModelLoader.setCustomMeshDefinition(item, stack -> location);
}
示例10: registerRender
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void registerRender() {
ModelLoader.setCustomMeshDefinition(this, (stack) -> new ModelResourceLocation(FoodCraftReloaded.MODID + ":" + getUnlocalizedName(stack), "inventory"));
}
示例11: registerStaticModel
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
public static void registerStaticModel(Item item, ModelResourceLocation staticLocation)
{
ModelLoader.setCustomMeshDefinition(item, i -> staticLocation);
ModelBakery.registerItemVariants(item, staticLocation);
}
示例12: preInit
import net.minecraftforge.client.model.ModelLoader; //导入方法依赖的package包/类
@Override
public void preInit() {
ModelLoader.setCustomMeshDefinition(PonySocks.sock, stack -> modelTypes[stack.getMetadata() % modelTypes.length]);
ModelBakery.registerItemVariants(PonySocks.sock, modelTypes);
}