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


Java IItemColor类代码示例

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


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

示例1: registerColorHandlers

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
public static void registerColorHandlers() {
    final IItemColor ammoColor = (stack, tintIndex) -> {
        switch (tintIndex) {
            case 1:
                return getAmmoColor(stack);
            default:
                return Color.WHITE.getRGB();
        }
    };
    final IItemColor plasticColor = (stack, tintIndex) -> {
        int plasticColour = ItemPlastic.getColour(stack);
        return plasticColour >= 0 ? plasticColour : 0xffffff;
    };

    Minecraft.getMinecraft().getItemColors().registerItemColorHandler(ammoColor, Itemss.GUN_AMMO);
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler(plasticColor, Itemss.PLASTIC);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:18,代码来源:ItemColorHandler.java

示例2: init

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
public static void init() {
    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    for (Map.Entry<String, Block> ent : renderMap.entrySet()) {
        renderItem.getItemModelMesher().register(Item.getItemFromBlock(ent.getValue()), 0, new ModelResourceLocation(Reference.MODID + ":" + ent.getKey(), "inventory"));
    }
    //TODO Convert to Lambda
    for (Map.Entry<Material, Block> entry : oreBlockMap.entrySet()) {
        Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() {
            @Override
            public int getColorFromItemstack(ItemStack stack, int tintIndex) {
                return entry.getKey().getColour().getRGB();
            }

        }, entry.getValue());
    }
}
 
开发者ID:The-Acronym-Coders,项目名称:T.E.C.H,代码行数:17,代码来源:BaseBlocks.java

示例3: init

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Override
public void init() 
{
	super.init();
	
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(BackpackMod.backpackItem, 0, new ModelResourceLocation("meddleBackpack", "inventory"));
	
	Minecraft.getMinecraft().itemColors.registerItemColor(new IItemColor() {

		@Override
		public int getItemColor(ItemStack arg0, int arg1) {
			Item item = arg0.getItem();
			if (item instanceof ItemBackpack) {
				return ((ItemBackpack)item).getColorFromItemStack(arg0,  arg1);
			}
			return 0xFFFFFFFF;
		}			
	}, BackpackMod.backpackItem);
	
	MeddleClient.registerGuiHandler(this);
}
 
开发者ID:FyberOptic,项目名称:JustBackpack,代码行数:22,代码来源:ClientProxy.java

示例4: registerColoredBlocksAndItems

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void registerColoredBlocksAndItems() {
  NNList<Block> blocklist = new NNList<Block>();
  NNList<Item> itemlist = new NNList<Item>();
  for (RegistrationHolder<?, ?> holder : blocks) {
    Block block = holder.block;
    Item item = Item.getItemFromBlock(block);
    if (block instanceof IPaintable || block instanceof ITintedBlock || block instanceof ITintedItem || item instanceof ITintedItem) {
      blocklist.add(block);
      if (item != Items.AIR) {
        itemlist.add(item);
      }
    } else {
      if (block instanceof IBlockColor) {
        Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((IBlockColor) block, block);
      }
      if (item instanceof IItemColor) {
        Minecraft.getMinecraft().getItemColors().registerItemColorHandler((IItemColor) item, item);
      }
    }
  }

  PaintTintHandler handler = new PaintTintHandler();
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(handler, blocklist.toArray(new Block[0]));
  Minecraft.getMinecraft().getItemColors().registerItemColorHandler(handler, itemlist.toArray(new Item[0]));
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:27,代码来源:SmartModelAttacher.java

示例5: loadColors

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Load(side = Side.CLIENT, value = LoaderState.POSTINITIALIZATION)
@SideOnly(Side.CLIENT)
public void loadColors() {
    try {
        Field field = ItemColors.class.getDeclaredField("itemColorMap");
        field.setAccessible(true);
        Map<IRegistryDelegate<Item>, IItemColor> itemColorMap = (Map<IRegistryDelegate<Item>, IItemColor>) field.get(Minecraft.getMinecraft().getItemColors());
        cachedLiqueurs.forEach(liqueur -> itemColorMap.entrySet().stream().filter(entry -> entry.getKey().get().equals(liqueur)).forEach(entry -> Minecraft.getMinecraft().getItemColors().registerItemColorHandler(entry.getValue(), entry.getKey().get())));
    } catch (Exception e) {
        FoodCraftReloaded.getLogger().error("Cannot get custom mesh definitions", e);
    }
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:13,代码来源:LiqueurLoader.java

示例6: registerItemColorHandlers

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Override
public void registerItemColorHandlers(@Nonnull FMLInitializationEvent initializationEvent) {
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() {
        @Override
        public int colorMultiplier(@Nonnull ItemStack stack, int tintIndex) {
            return tintIndex > 0 ? -1 : ((ItemWolfArmor) stack.getItem()).getColor(stack);
        }
    }, Items.LEATHER_WOLF_ARMOR);
}
 
开发者ID:CenturionFox,项目名称:wolfarmor,代码行数:10,代码来源:ClientProxy.java

示例7: getItemColor

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IItemColor getItemColor() {
	return new IItemColor() {
		@Override
		public int getColorFromItemstack(ItemStack item, int index) {
			return index == 0 ? color : -1;
		}
	};
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:11,代码来源:AlchemyItemRecord.java

示例8: getItemColor

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IItemColor getItemColor() {
	return new IItemColor() {
		
		@Override
		public int getColorFromItemstack(ItemStack item, int index) {
			return color == null ? -1 : color.getColorFromItemstack(item, index);
		}
		
	};
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:13,代码来源:AlchemyItemBlock.java

示例9: getItemColor

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IItemColor getItemColor() {
	return new IItemColor() {
		
		@Override
		public int getColorFromItemstack(ItemStack stack, int tintIndex) {
			return color;
		}
		
	};
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:13,代码来源:BlockOre.java

示例10: registerItemColor

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
private static <T extends Item & IColorItem> void registerItemColor() {
	ItemColors colors = Minecraft.getMinecraft().getItemColors();
	for (T t : (List<T>) item_color) {
		IItemColor color = t.getItemColor();
		if (color != null) {
			colors.registerItemColorHandler(color, t);
			AlchemyInitHook.push_event(t);
		}
	}
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:11,代码来源:AlchemyColorLoader.java

示例11: registerRenders

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Override
public void registerRenders()
{
    int i;
    for (i = 0; i < ItemEnderBag.COLOURS.length; ++i)
    {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.enderbag, i, new ModelResourceLocation("enderbags" + ":" + "enderbag", "inventory"));
    }

    ItemColors items = Minecraft.getMinecraft().getItemColors();

    items.registerItemColorHandler(new IItemColor()
    {
        @Override
        public int getColorFromItemstack(ItemStack stack, int tintIndex) {
            Item item = stack.getItem();
            if (item instanceof IColorable)
            {
                return ((IColorable) item).getColorFromItemStack(stack, tintIndex);
            }
            else
            {
                return 0xFFFFFF;
            }
        }
    }, ModItems.enderbag);
}
 
开发者ID:gigabit101,项目名称:EnderBags,代码行数:28,代码来源:ClientProxy.java

示例12: registerRenders

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Override
public void registerRenders()
{
    int i;
    for (i = 0; i < OpenLootBagsApi.INSTANCE.getBagManager().getBagTypes().size(); ++i)
    {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(OpenLootBags.lootbag, i, new ModelResourceLocation("openlootbags" + ":" + "lootbag", "inventory"));
    }

    ItemColors items = Minecraft.getMinecraft().getItemColors();

    items.registerItemColorHandler(new IItemColor()
    {
        @Override
        public int getColorFromItemstack(ItemStack stack, int tintIndex)
        {
            Item item = stack.getItem();
            if (item instanceof IColorable)
            {
                return ((IColorable) item).getColorFromItemStack(stack, tintIndex);
            }
            else
            {
                return 0xFFFFFF;
            }
        }
    }, OpenLootBags.lootbag);
}
 
开发者ID:gigabit101,项目名称:OpenLootBags,代码行数:29,代码来源:ClientProxy.java

示例13: registerItemColour

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void registerItemColour(Object object, IItemColor colourProvider) {
    ItemColors itemColors = Minecraft.getMinecraft().getItemColors();
    if (object instanceof Item)
        itemColors.registerItemColorHandler(colourProvider, (Item) object);
    else if (object instanceof Block)
        itemColors.registerItemColorHandler(colourProvider, (Block) object);
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:MMDLib-old,代码行数:9,代码来源:MMDLibRegistry.java

示例14: registerItemColorHandler

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
@Override
public void registerItemColorHandler(Block block){
    Item item = Item.getItemFromBlock(block);
    if (item instanceof IItemColor){
        IItemColor iItemColor = (IItemColor)item;
        itemColor.registerItemColorHandler(iItemColor,block);
    }
}
 
开发者ID:Dark32,项目名称:NordMod,代码行数:9,代码来源:RegisterColorHelper.java

示例15: init

import net.minecraft.client.renderer.color.IItemColor; //导入依赖的package包/类
public static void init()
{
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() {
        @Override
        public int colorMultiplier(ItemStack stack, int tintIndex)
        {
            return ((ItemLootBag) stack.getItem()).getColor(stack, tintIndex);
        }
    }, (Item[]) ItemLootBag.getLootBags());
}
 
开发者ID:DoubleDoorDevelopment,项目名称:JsonLootBags,代码行数:11,代码来源:ClientHelper.java


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