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