本文整理了Java中net.minecraft.client.Minecraft.getItemColors()
方法的一些代码示例,展示了Minecraft.getItemColors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Minecraft.getItemColors()
方法的具体详情如下:
包路径:net.minecraft.client.Minecraft
类名称:Minecraft
方法名:getItemColors
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public void initialize( Side side )
{
Minecraft.getMinecraft().getItemColors().registerItemColorHandler( this.itemColor, this.item );
}
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
@Override
public void init() {
Minecraft minecraft = Minecraft.getMinecraft();
// slime channels
minecraft.getBlockColors().registerBlockColorHandler(
(@Nonnull IBlockState state, IBlockAccess access, BlockPos pos, int tintIndex) -> state.getValue(BlockSlimeChannel.TYPE).getColor(),
TinkerGadgets.slimeChannel);
ItemColors colors = minecraft.getItemColors();
colors.registerItemColorHandler(
(@Nonnull ItemStack stack, int tintIndex) -> BlockSlime.SlimeType.fromMeta(stack.getItemDamage()).getColor(),
TinkerGadgets.slimeChannel);
colors.registerItemColorHandler(
(@Nonnull ItemStack stack, int tintIndex) -> TinkerGadgets.slimeBoots.getColor(stack),
TinkerGadgets.slimeBoots, TinkerGadgets.slimeSling);
super.init();
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
@Override
public void init() {
final BlockColors blockColors = minecraft.getBlockColors();
// stained glass
blockColors.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess access, BlockPos pos, int tintIndex) {
EnumGlassColor type = state.getValue(BlockClearStainedGlass.COLOR);
return type.getColor();
}
},
blockClearStainedGlass);
minecraft.getItemColors().registerItemColorHandler(
new IItemColor() {
@SuppressWarnings("deprecation")
@Override
public int getColorFromItemstack(@Nonnull ItemStack stack, int tintIndex) {
IBlockState iblockstate = ((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata());
return blockColors.colorMultiplier(iblockstate, null, null, tintIndex);
}
},
blockClearStainedGlass);
super.init();
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
int color = Minecraft.getMinecraft().getItemColors().getColorFromItemstack(itemStack, i);
if(color == -1) {
continue;
代码示例来源:origin: SlimeKnights/TinkersConstruct
@Override
public void init() {
Minecraft minecraft = Minecraft.getMinecraft();
// slime channels
ItemColors colors = minecraft.getItemColors();
colors.registerItemColorHandler(
(@Nonnull ItemStack stack, int tintIndex) -> {
if(!stack.hasTagCompound()) {
return 0xFFFFFF;
}
FluidStack fluid = FluidStack.loadFluidStackFromNBT(stack.getTagCompound());
if (fluid != null && fluid.amount > 0 && fluid.getFluid() != null) {
return fluid.getFluid().getColor(fluid);
}
return 0xFFFFFF;
},
TinkerSmeltery.searedTank);
super.init();
}
}
代码示例来源:origin: Vazkii/Botania
private void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color, ItemStack stack)
{
boolean flag = color == -1 && !stack.isEmpty();
int i = 0;
for (int j = quads.size(); i < j; ++i)
{
BakedQuad bakedquad = quads.get(i);
int k = color;
if (flag && bakedquad.hasTintIndex())
{
k = Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, bakedquad.getTintIndex());
if (EntityRenderer.anaglyphEnable)
{
k = TextureUtil.anaglyphColor(k);
}
k = k | -16777216;
}
net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k);
}
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
minecraft.getItemColors().registerItemColorHandler(
(stack, tintIndex) -> {
IBlockState iblockstate = ((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata());
代码示例来源:origin: Vazkii/Botania
@Override
@SideOnly(Side.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
if(type == RenderType.BODY) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Helper.rotateIfSneaking(player);
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.26F, -0.4F, armor ? 0.2F : 0.15F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
for(TextureAtlasSprite icon : new TextureAtlasSprite[] { MiscellaneousIcons.INSTANCE.bloodPendantChain, MiscellaneousIcons.INSTANCE.bloodPendantGem }) {
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F);
Color color = new Color(Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, 1));
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
}
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255);
}
}
代码示例来源:origin: Vazkii/Botania
}, ModBlocks.platform);
ItemColors items = Minecraft.getMinecraft().getItemColors();
ItemStack lens = ItemManaGun.getLens(s);
if(!lens.isEmpty() && t == 0)
return Minecraft.getMinecraft().getItemColors().colorMultiplier(lens, t);
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
tinter.setTint( Minecraft.getMinecraft().getItemColors().colorMultiplier( textureItem, quad.getTintIndex() ) );
pipeline.enableElement( "tinter" );
代码示例来源:origin: Vazkii/Quark
@Override
public int colorMultiplier(ItemStack stack, int tintIndex) {
ItemStack baseStack = Variants.class.getEnumConstants()[Math.min(5, stack.getItemDamage())].baseStack;
return Minecraft.getMinecraft().getItemColors().colorMultiplier(baseStack, tintIndex);
}
代码示例来源:origin: raoulvdberge/refinedstorage
@Override
public void init(FMLInitializationEvent e) {
super.init(e);
RSKeyBindings.init();
itemColors.forEach(p -> Minecraft.getMinecraft().getItemColors().registerItemColorHandler(p.getRight(), p.getKey()));
}
代码示例来源:origin: TheGreyGhost/MinecraftByExample
public static void postInitClientOnly()
{
// the LiquidColour class is used to change the rendering colour of the liquid in the bottle
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new LiquidColour(), StartupCommon.itemVariants);
}
}
代码示例来源:origin: CoFH/ThermalFoundation
@Override
public void initialize(FMLInitializationEvent event) {
super.initialize(event);
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(TFItems.itemDye::colorMultiplier, TFItems.itemDye);
}
代码示例来源:origin: AlgorithmX2/Chisels-and-Bits
public static Integer getItemStackColor(
final ItemStack target,
final int tint )
{
// don't send air though to MC, some mods have registered their custom
// color handlers for it and it can crash.
if ( ModUtil.isEmpty( target ) )
return -1;
return Minecraft.getMinecraft().getItemColors().getColorFromItemstack( target, tint );
}
代码示例来源:origin: vadis365/TheErebus
/**
* Register the colour handlers.
*/
public static void registerColourHandlers() {
final BlockColors blockColors = MINECRAFT.getBlockColors();
final ItemColors itemColors = MINECRAFT.getItemColors();
registerBlockColourHandlers(blockColors);
registerItemColourHandlers(blockColors, itemColors);
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemstack(ItemStack stack, int renderPass) {
ItemColors colors = Minecraft.getMinecraft().getItemColors();
if (contained.isEmpty() || renderPass == 100) {
return -1;
}
int color = colors.colorMultiplier(contained, renderPass);
if (color != -1) {
return color;
}
return -1;
}
代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation
@SideOnly(Side.CLIENT)
@Override
public void postInitClient() {
ItemColors itemColors = Minecraft.getMinecraft().getItemColors();
itemColors.registerItemColorHandler(new SteamDrillColorHandler(), STEAM_DRILL);
itemColors.registerItemColorHandler(new SteamDrillHeadUpgradeColorHandler(), DRILL_HEAD);
}
代码示例来源:origin: squeek502/VeganOption
/**
* Registers a ColorHandler for both the block and its item version
*/
@SideOnly(Side.CLIENT)
public static <T extends IBlockColor & IItemColor> void registerSharedColorHandler(T colorHandler, Block block)
{
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(colorHandler, block);
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(colorHandler, block);
}
代码示例来源:origin: raoulvdberge/refinedstorage
@Override
public int colorMultiplier(ItemStack stack, int tintIndex) {
CraftingPattern pattern = ItemPattern.getPatternFromCache(Minecraft.getMinecraft().world, stack);
if (BakedModelPattern.canDisplayOutput(stack, pattern)) {
int color = Minecraft.getMinecraft().getItemColors().colorMultiplier(pattern.getOutputs().get(0), tintIndex);
if (color != -1) {
return color;
}
}
return 0xFFFFFF;
}
}
内容来源于网络,如有侵权,请联系作者删除!