net.minecraft.client.Minecraft.getBlockColors()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中net.minecraft.client.Minecraft.getBlockColors()方法的一些代码示例,展示了Minecraft.getBlockColors()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Minecraft.getBlockColors()方法的具体详情如下:
包路径:net.minecraft.client.Minecraft
类名称:Minecraft
方法名:getBlockColors

Minecraft.getBlockColors介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void initialize( Side side )
{
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( this.blockColor, this.block );
}

代码示例来源:origin: Vazkii/Botania

public static void init() {
  BlockColors blocks = Minecraft.getMinecraft().getBlockColors();
  Map<IRegistryDelegate<Block>, IBlockColor> map = ReflectionHelper.getPrivateValue(BlockColors.class, blocks, "blockColorMap");
              return camoState.getBlock() instanceof BlockCamo
                  ? 0xFFFFFF
                      : Minecraft.getMinecraft().getBlockColors().colorMultiplier(camoState, world, pos, tintIndex);
  items.registerItemColorHandler((s, t) -> Minecraft.getMinecraft().getBlockColors().colorMultiplier(((ItemBlock)s.getItem()).getBlock().getStateFromMeta(s.getMetadata()), null, null, t),
      ModBlocks.petalBlock, ModBlocks.pool, ModBlocks.spreader);

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

VertexLighterFlat trans = new VertexLighterFlat( Minecraft.getMinecraft().getBlockColors() )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

IBlockAccess parentWorld = renderState.getWorld();
BlockPos pos = renderState.getPos();
BlockColors blockColors = Minecraft.getMinecraft().getBlockColors();
boolean thinFacades = isUseThinFacades( partBoxes );

代码示例来源:origin: ldtteam/minecolonies

private static int getTint(final World world, final IBlockState actualState, final BlockPos pos, final int alpha, final int tintIndex)
  {
    return alpha | Minecraft.getMinecraft().getBlockColors().colorMultiplier(actualState, world, pos, tintIndex);
  }
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public void init() {
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((s, w, p, i) -> i, MCMultiPart.multipart);
}

代码示例来源: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: TheGreyGhost/MinecraftByExample

public static void postInitClientOnly()
 {
  // the LampColour class is used to change the rendering colour of the RedstoneColouredLamp
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new LampColour(), StartupCommon.blockRedstoneColouredLamp);
 }
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

@Override
public int colorMultiplier(
    final IBlockState state,
    final IBlockAccess worldIn,
    final BlockPos pos,
    final int tint )
{
  final IBlockState tstate = ModUtil.getStateById( tint >> TINT_BITS );
  int tintValue = tint & TINT_MASK;
  return Minecraft.getMinecraft().getBlockColors().colorMultiplier( tstate, worldIn, pos, tintValue );
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
public void init() {
  super.init();
  ResourceUtils.registerReloadListener(new SoundLoader());
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, world, pos, tintIndex) -> {
    IBlockState disguiseState = WorldTools.getTile(world, pos, TileSoundBlock.class).filter(t -> t.getDisguiseState() != null)
        .map(TileSoundBlock::getDisguiseState).orElse(Blocks.JUKEBOX.getDefaultState());
    return Minecraft.getMinecraft().getBlockColors().colorMultiplier(disguiseState, world, pos, 0);
  }, AWStructureBlocks.SOUND_BLOCK);
}

代码示例来源:origin: Vazkii/Quark

@SideOnly(Side.CLIENT)
private void registerGreenerColor(Block... blocks) {
  BlockColors colors = Minecraft.getMinecraft().getBlockColors();
  Map<IRegistryDelegate<Block>, IBlockColor> map = ReflectionHelper.getPrivateValue(BlockColors.class, colors, "blockColorMap"); // This is a forge field so obfuscation is meaningless
  for(Block b : blocks) {
    IBlockColor color = map.get(b.delegate);
    if(color != null)
      colors.registerBlockColorHandler(getGreenerColor(color), b);
  }
}

代码示例来源:origin: Vazkii/Quark

@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
  IBlockState base = ((Variants) state.getValue(getVariantProp())).baseState;
  return Minecraft.getMinecraft().getBlockColors().colorMultiplier(base, worldIn, pos, tintIndex);
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

public static int getTint(
    final int alpha,
    final int tintIndex,
    final World worldObj,
    final BlockPos blockPos )
{
  return alpha | Minecraft.getMinecraft().getBlockColors().colorMultiplier( ChiselsAndBits.getBlocks().getChiseledDefaultState(), worldObj, blockPos, tintIndex );
}

代码示例来源:origin: OpenModularTurretsTeam/OpenModularTurrets

@Override
public void init() {
  super.init();
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new CamoBlockColor(), ModBlocks.turretBase);
}

代码示例来源:origin: Vazkii/Quark

@Override
@SideOnly(Side.CLIENT)
public IBlockColor getBlockColor() {
  return (state, world, pos, i) -> Minecraft.getMinecraft().getBlockColors().colorMultiplier(Blocks.FLOWER_POT.getDefaultState(), world, pos, i);
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

public void registerBlockColors() {
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, p_186720_2_, pos, tintIndex) -> {
    EnumDyeColor color = state.getValue(BlockDecorativeColored.COLOR);
    return ItemDye.DYE_COLORS[MathHelper.clamp(color.getMetadata(), 0, ItemDye.DYE_COLORS.length - 1)];
  }, MatterOverdrive.BLOCKS.decorative_tritanium_plate_colored);
}

代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod

public void registerColorHandlerForBlock(Block block, IBlockColor blockColor, IItemColor itemColor)
{
  FMLClientHandler.instance().getClient().getItemColors().registerItemColorHandler(itemColor, Item.getItemFromBlock(block));
  FMLClientHandler.instance().getClient().getBlockColors().registerBlockColorHandler(blockColor, block);
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int renderPass) {
  if (block instanceof BlockDecorativeColored) {
    return Minecraft.getMinecraft().getBlockColors().colorMultiplier(block.getStateFromMeta(stack.getMetadata()), null, null, renderPass);
  }
  return Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, renderPass);
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@SideOnly(Side.CLIENT)
public static void initClient() {
  Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
    Crop crop = HFCrops.SEEDS.getCropFromStack(stack);
    return crop != null ? crop.getColor() : -1;
  }, SEEDS);
  IBlockColor block = (state, worldIn, pos, tintIndex) -> tintIndex == 0 ? (worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic()) : -1;
  IItemColor item = (stack, index) -> ColorizerFoliage.getFoliageColorBasic();
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(block, LEAVES_FRUIT);
  Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(block, LEAVES_TROPICAL);
  Minecraft.getMinecraft().getItemColors().registerItemColorHandler(item, Item.getItemFromBlock(LEAVES_FRUIT));
  Minecraft.getMinecraft().getItemColors().registerItemColorHandler(item, Item.getItemFromBlock(LEAVES_TROPICAL));
}

代码示例来源:origin: Ellpeck/ActuallyAdditions

@SideOnly(Side.CLIENT)
public static void renderStateInWorld(IBlockState state, IBlockAccess world, BlockPos pos, float brightness){
  Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
  IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
  GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
  int i = Minecraft.getMinecraft().getBlockColors().colorMultiplier(state, world, pos, 0);
  float r = (float) (i >> 16 & 255) / 255F;
  float g = (float) (i >> 8 & 255) / 255F;
  float b = (float) (i & 255) / 255F;
  Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(state, model, brightness, r, g, b);
}

相关文章