private void renderTankFluid(SmartTank tank, Set<EnumFacing> mergers, World world, BlockPos pos) {
final FluidStack fluid = tank.getFluid();
if (fluid != null) {
TextureAtlasSprite icon = RenderUtil.getStillTexture(fluid);
int color = fluid.getFluid().getColor(fluid);
float fullness = tank.getFilledRatio();
boolean[][][] merge = getMergers9(world, pos);
VertexBuffer tes = Tessellator.getInstance().getBuffer();
float minU = icon.getMinU(), maxU = icon.getMaxU(), minV = icon.getMinV(), maxV = icon.getMaxV();
for (int i = 0; i <= 1; i++) {
if (i == 0) {
GlStateManager.cullFace(CullFace.FRONT);
} else {
GlStateManager.cullFace(CullFace.BACK);
}
for (NNIterator<EnumFacing> facings = NNList.FACING.fastIterator(); facings.hasNext();) {
EnumFacing dir = facings.next();
float fullness2 = 0;
if (mergers.contains(dir)) {
BlockPos pos2 = pos.offset(dir);
TileEntity tileEntity = world.getTileEntity(pos2);
if (tileEntity instanceof TileReservoir) {
TileReservoir res2 = (TileReservoir) tileEntity;
fullness2 = res2.tank.getFilledRatio();
}
}
BoundingBox bb = mkFace(merge, dir, fullness, fullness2);
if (bb != null) {
float minVx = minV, maxVx = maxV;
if (dir.getAxis() != EnumFacing.Axis.Y) {
minVx = icon.getInterpolatedV((1 - fullness) * 16);
maxVx = icon.getInterpolatedV((1 - fullness2) * 16);
}
renderFace(tes, bb, dir, minU, maxU, minVx, maxVx, color);
}
}
}
}
}
ReservoirRenderer.java 文件源码
java
阅读 15
收藏 0
点赞 0
评论 0
项目:EnderIO
作者:
评论列表
文章目录