PaintTintHandler.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:EnderIO 作者:
@Override
public int colorMultiplier(@Nonnull IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
  if (world == null || pos == null) {
    return -1;
  }
  Block block = state.getBlock();

  IBlockState paintSource = null;
  if (block instanceof IPaintable) {
    paintSource = ((IPaintable) block).getPaintSource(state, world, pos);
    if (paintSource != null && paintSource.getBlock() != block) {
      block = paintSource.getBlock();
      state = paintSource;
    } else {
      paintSource = null;
    }
  }
  if (block instanceof ITintedBlock) {
    return ((ITintedBlock) block).getBlockTint(state, world, pos, tintIndex);
  }
  if (block instanceof IBlockColor) {
    return ((IBlockColor) block).colorMultiplier(state, world, pos, tintIndex);
  }
  if (paintSource != null) {
    return Minecraft.getMinecraft().getBlockColors().colorMultiplier(paintSource, world, pos, tintIndex);
  }
  return -1;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号