當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。