本文整理汇总了Java中net.minecraft.client.renderer.ItemModelMesher类的典型用法代码示例。如果您正苦于以下问题:Java ItemModelMesher类的具体用法?Java ItemModelMesher怎么用?Java ItemModelMesher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemModelMesher类属于net.minecraft.client.renderer包,在下文中一共展示了ItemModelMesher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RenderItem
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
public RenderItem(TextureManager textureManager, ModelManager modelManager)
{
this.textureManager = textureManager;
Config.setModelManager(modelManager);
if (Reflector.ItemModelMesherForge_Constructor.exists())
{
this.itemModelMesher = (ItemModelMesher)Reflector.newInstance(Reflector.ItemModelMesherForge_Constructor, new Object[] {modelManager});
}
else
{
this.itemModelMesher = new ItemModelMesher(modelManager);
}
this.registerItems();
}
示例2: isValidItemState
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
/**
* Resolve item state validity
* @param meta Item metadata
* @return Is item state valid
*/
@SuppressWarnings({"ConstantConditions"})
public boolean isValidItemState(int meta) {
if (!isValid()) {
return false;
}
try {
ItemModelMesher models = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
TextureAtlasSprite sprite = models.getParticleIcon(item, meta);
return sprite != null &&
sprite.getIconName() != null &&
!sprite.getIconName().equalsIgnoreCase("") &&
!sprite.getIconName().equalsIgnoreCase("missingno");
} catch (Throwable ignored) {
return false;
}
}
示例3: initClient
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
/**
* 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);
}
示例4: putItem
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
@Override
public void putItem(ItemStack theItem, String link) {
String imgType = "item";
String found_icon;
if (theItem == null) {
found_icon = "factorization:transparent_item";
} else {
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
IBakedModel ibm = mesher.getItemModel(theItem);
if (ibm == null) {
found_icon = "error";
} else {
found_icon = ibm.getParticleTexture().getIconName();
}
if (theItem.getItem() instanceof ItemBlock) {
imgType = "block";
}
}
html("<img class=\"" + imgType + "\" src=\"" + img(found_icon) + "\" />");
found_icon = null;
// TODO (and this is crazy!) render the item to a texture
// Would be good to do this only if it isn't a standard item texture, maybe.
// Same mechanism could probably be used for docfigures; maybe make an animated gif? Would be rad.
}
示例5: render
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
public static void render() {
net.minecraft.client.renderer.color.IItemColor colour = new net.minecraft.client.renderer.color.IItemColor() {
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
if (stack.getTagCompound() != null) {
// Checks to make sure all stats are less than or equal too 255
if (stack.getTagCompound().getInteger("Strength") <= 255 && stack.getTagCompound().getInteger("Durability") <= 255 && stack.getTagCompound().getInteger("Enchantability") <= 255) {
return new Color(stack.getTagCompound().getInteger("Strength"), stack.getTagCompound().getInteger("Durability"), stack.getTagCompound().getInteger("Enchantability")).getRGB();
}
}
return new Color(255,255,255).getRGB();
}
};
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(colour, new Item[] {AlloycraftItems.alloy, AlloycraftItems.alloysword, AlloycraftItems.alloyaxe, AlloycraftItems.alloyhoe, AlloycraftItems.alloyshovel, AlloycraftItems.alloypickaxe, AlloycraftItems.alloyhelmet, AlloycraftItems.alloychestplate, AlloycraftItems.alloyleggings, AlloycraftItems.alloyboots});
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
mesher.register(AlloycraftItems.alloy, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloy", "inventory"));
mesher.register(AlloycraftItems.alloysword, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloysword", "inventory"));
mesher.register(AlloycraftItems.alloyaxe, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyaxe", "inventory"));
mesher.register(AlloycraftItems.alloyhoe, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyhoe", "inventory"));
mesher.register(AlloycraftItems.alloyshovel, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyshovel", "inventory"));
mesher.register(AlloycraftItems.alloypickaxe, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloypickaxe", "inventory"));
mesher.register(AlloycraftItems.alloyhelmet, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyhelm", "inventory"));
mesher.register(AlloycraftItems.alloychestplate, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloychestplate", "inventory"));
mesher.register(AlloycraftItems.alloyleggings, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyleggings", "inventory"));
mesher.register(AlloycraftItems.alloyboots, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyboots", "inventory"));
}
示例6: registerRenderers
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
@Override
public void registerRenderers(){
// More info on proxy rendering
// http://www.minecraftforge.net/forum/index.php?topic=27684.0
// http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
String name;
Item item;
for(Block b : BlockRegistry.blocks){
item = Item.getItemFromBlock(b);
name = ModBucketBlocks.TEXTURE_LOCATION + b.getUnlocalizedName().replaceAll("tile.", "");
mesher.register(item, 0, new ModelResourceLocation(name, "inventory"));
}
}
示例7: initModels
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void initModels() {
woodenGearSwapperBlock.initModel();
ironGearSwapperBlock.initModel();
lapisGearSwapperBlock.initModel();
stoneGearSwapperBlock.initModel();
glassGearSwapperBlock.initModel();
if (!Config.customBlockName.isEmpty()) {
Block b = Block.blockRegistry.getObject(new ResourceLocation(Config.customBlockName));
if (b != null) {
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
mesher.register(Item.getItemFromBlock(moddedGearSwapperBlock), 0, new ModelResourceLocation(b.getRegistryName(), "inventory"));
// moddedGearSwapperBlock.initModel();
}
}
}
示例8: registerRenderers
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
@Override
public void registerRenderers(){
// More info on proxy rendering
// http://www.minecraftforge.net/forum/index.php?topic=27684.0
// http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
String name;
for(Item i : ItemRegistry.items){
name = TEXTURE_LOCATION + i.getUnlocalizedName().replaceAll("item.", "");
mesher.register(i, 0, new ModelResourceLocation(name, "inventory"));
}
}
示例9: registerTextures
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
public static void registerTextures() {
ItemModelMesher itemModelMesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
// Items
registerItem(itemModelMesher, ModItems.TITANIUM_AXE);
registerItem(itemModelMesher, ModItems.TITANIUM_BOOTS);
registerItem(itemModelMesher, ModItems.TITANIUM_CHESTPLATE);
registerItem(itemModelMesher, ModItems.TITANIUM_HELMET);
registerItem(itemModelMesher, ModItems.TITANIUM_HOE);
registerItem(itemModelMesher, ModItems.TITANIUM_HORSE_ARMOR);
registerItem(itemModelMesher, ModItems.TITANIUM_INGOT);
registerItem(itemModelMesher, ModItems.TITANIUM_LEGGINGS);
registerItem(itemModelMesher, ModItems.TITANIUM_PICKAXE);
registerItem(itemModelMesher, ModItems.TITANIUM_SHOVEL);
registerItem(itemModelMesher, ModItems.TITANIUM_SWORD);
// Blocks
registerBlock(itemModelMesher, ModBlocks.TITANIUM_ORE);
registerBlock(itemModelMesher, ModBlocks.TITANIUM_BLOCK);
}
示例10: reflectMaps
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void reflectMaps()
{
if (LOCATIONS == null || SHAPERS == null)
{
try
{
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
Field locs = ReflectionHelper.findField(ItemModelMesherForge.class, "locations");
LOCATIONS = (Map<IRegistryDelegate<Item>, TIntObjectHashMap<ModelResourceLocation>>) locs.get(mesher);
Field shapers = ReflectionHelper.findField(ItemModelMesher.class, "field_178092_c", "shapers");
SHAPERS = (Map<Item, ItemMeshDefinition>) shapers.get(mesher);
Field models = ReflectionHelper.findField(ModelLoader.class, "stateModels");
STATE_MODELS = (Map<ModelResourceLocation, IModel>) models.get(MODEL_LOADER);
}
catch (Exception e)
{
EnderUtilities.logger.warn("ModelNullifierBaked: Failed to reflect model maps", e);
}
}
}
示例11: registerModels
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
private void registerModels()
{
//More info on proxy rendering
//http://www.minecraftforge.net/forum/index.php?topic=27684.0
//http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
String name;
for(Item i : ItemRegistry.items)
{
name = ModSpells.TEXTURE_LOCATION + i.getUnlocalizedName().replaceAll("item.", "");
mesher.register(i, 0, new ModelResourceLocation( name , "inventory"));
}
/*
if(ModMain.cfg.respawn_egg)
{
for(Object key : EntityList.entityEggs.keySet())
{
mesher.register(ItemRegistry.respawn_egg, (Integer)key, new ModelResourceLocation(ModSpells.TEXTURE_LOCATION + "respawn_egg" , "inventory"));
}
}
*/
}
示例12: registerRenderers
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
@Override
public void registerRenderers()
{
//More info on proxy rendering
//http://www.minecraftforge.net/forum/index.php?topic=27684.0
//http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
String name;
for(Item i : ItemRegistry.items)
{
name = ModArmor.TEXTURE_LOCATION + i.getUnlocalizedName().replaceAll("item.", "");
mesher.register(i, 0, new ModelResourceLocation( name , "inventory"));
}
}
示例13: registerRenderers
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
@Override
public void registerRenderers()
{
//More info on proxy rendering
//http://www.minecraftforge.net/forum/index.php?topic=27684.0
//http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
String name;
Item item;
for(Block b : BlockRegistry.blocks)
{
item = Item.getItemFromBlock(b);
name = ModFarmingBlocks.TEXTURE_LOCATION + b.getUnlocalizedName().replaceAll("tile.", "");
mesher.register(item, 0, new ModelResourceLocation( name , "inventory"));
}
}
示例14: initializeRenderers
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
@Override
public void initializeRenderers(){
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
mesher.register(Item.getItemFromBlock(blockLemonTreePlanks), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_TREE_PLANKS, "inventory"));
mesher.register(Item.getItemFromBlock(blockLemonTreeLog), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_TREE_LOG, "inventory"));
mesher.register(Item.getItemFromBlock(blockLemonLeavesHarvested), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_LEAVES_HARVESTED, "inventory"));
mesher.register(Item.getItemFromBlock(blockLemonLeaves), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_LEAVES, "inventory"));
mesher.register(Item.getItemFromBlock(blockLemonTreeSapling), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_TREE_SAPLING, "inventory"));
mesher.register(itemLemon, 0, new ModelResourceLocation(MOD_ID + ":" + ITEM_LEMON, "inventory"));
mesher.register(itemLemonExplosive, 0, new ModelResourceLocation(MOD_ID + ":" + ITEM_LEMON_EXPLOSIVE, "inventory"));
mesher.register(itemCombustibleLemonLauncher, 0, new ModelResourceLocation(MOD_ID + ":" + ITEM_COMBUSTIBLE_LEMON_LAUNCHER.toLowerCase(), "inventory"));
MinecraftForge.EVENT_BUS.register(new HoldLikeBowHook());
MinecraftForge.EVENT_BUS.register(new CLLConfig());
}
示例15: renderItem
import net.minecraft.client.renderer.ItemModelMesher; //导入依赖的package包/类
private void renderItem(ItemStack itemStack) {
parent.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
final RenderItem itemRenderer = parent.getItemRenderer();
final ItemModelMesher itemModelMesher = itemRenderer.getItemModelMesher();
final IBakedModel model = itemModelMesher.getItemModel(stack);
GlStateManager.disableLighting();
GlStateManager.enableRescaleNormal();
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.pushMatrix();
itemRenderer.renderItem(stack, model);
GlStateManager.cullFace(CullFace.BACK);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
}