/** Renders block with offset x/y/z from x1/y1/z1 to x2/y2/z2 inside the block local coordinates, so from 0-1 */ public static void renderFluidCuboid(FluidStack fluid, BlockPos pos, double x, double y, double z, double x1, double y1, double z1, double x2, double y2, double z2, int color) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder renderer = tessellator.getBuffer(); renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); //RenderUtil.setColorRGBA(color); int brightness = mc.world.getCombinedLight(pos, fluid.getFluid().getLuminosity()); boolean upsideDown = fluid.getFluid().isGaseous(fluid); pre(x, y, z); TextureAtlasSprite still = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getStill(fluid).toString()); TextureAtlasSprite flowing = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getFlowing(fluid).toString()); // x/y/z2 - x/y/z1 is because we need the width/height/depth putTexturedQuad(renderer, still, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.DOWN, color, brightness, false, upsideDown); putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.NORTH, color, brightness, true, upsideDown); putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.EAST, color, brightness, true, upsideDown); putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.SOUTH, color, brightness, true, upsideDown); putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.WEST, color, brightness, true, upsideDown); putTexturedQuad(renderer, still, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.UP, color, brightness, false, upsideDown); tessellator.draw(); post(); }
int color = te.drained.getFluid().getColor(te.drained); int brightness = te.getWorld().getCombinedLight(te.getPos(), te.drained.getFluid().getLuminosity()); TextureAtlasSprite flowing = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(te.drained.getFluid().getFlowing(te.drained).toString());
TextureAtlasSprite flowing = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getFlowing(fluid).toString());
TextureMap map = mc.getTextureMapBlocks(); TextureAtlasSprite still = map.getTextureExtry(fluid.getStill(fluidStack).toString()); TextureAtlasSprite flowing = map.getTextureExtry(fluid.getFlowing(fluidStack).toString());
@SubscribeEvent @SideOnly(Side.CLIENT) public void onTextureStitchPre(TextureStitchEvent.Pre event) { event.getMap().registerSprite(HONEY.getStill()); event.getMap().registerSprite(HONEY.getFlowing()); event.getMap().registerSprite(ANTI_VENOM.getStill()); event.getMap().registerSprite(ANTI_VENOM.getFlowing()); event.getMap().registerSprite(BEETLE_JUICE.getStill()); event.getMap().registerSprite(BEETLE_JUICE.getFlowing()); event.getMap().registerSprite(FORMIC_ACID.getStill()); event.getMap().registerSprite(FORMIC_ACID.getFlowing()); event.getMap().registerSprite(MILK.getStill()); event.getMap().registerSprite(MILK.getFlowing()); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void registerTextures(TextureStitchEvent.Pre event) { TextureMap map = event.getMap(); for (Fluids fluids : Fluids.values()) { Fluid fluid = fluids.getFluid(); if (fluid != null) { map.registerSprite(fluid.getStill()); map.registerSprite(fluid.getFlowing()); } } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public static void onIconLoad(TextureStitchEvent.Pre event) { event.getMap().registerSprite(XP_JUICE.getFluid().getStill()); event.getMap().registerSprite(XP_JUICE.getFluid().getFlowing()); }
mp[0].sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getFlowing().toString() ); mp[0].uvs = new float[] { U, 0, U, V, 0, 0, 0, V }; mp[0].sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getFlowing().toString() ); mp[0].uvs = new float[] { U, 0, 0, 0, U, V, 0, V };
/** * Renders a fluid at the given position. * * @param fluid The fluid to render. * @param pos The position in the world to render the fluid. * @param x The base X position. * @param y The base Y position. * @param z The base Z position. * @param x1 The middle X position. * @param y1 The middle Y position. * @param z1 The middle Z position. * @param x2 The max X position. * @param y2 The max Y position. * @param z2 The max Z position. * @param color The color offset used by the fluid. Default is white. */ public static void renderFluid (FluidStack fluid, BlockPos pos, double x, double y, double z, double x1, double y1, double z1, double x2, double y2, double z2, int color) { final Minecraft mc = Minecraft.getMinecraft(); final TextureAtlasSprite still = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getStill(fluid).toString()); final TextureAtlasSprite flowing = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getFlowing(fluid).toString()); renderFluid(fluid, pos, x, y, z, x1, y1, z1, x2, y2, z2, color, still, flowing); }
public static void renderFluidCuboid(FluidStack fluid, BlockPos pos, double x, double y, double z, double x1, double y1, double z1, double x2, double y2, double z2, int color) { BufferBuilder renderer = Tessellator.getInstance().getBuffer(); renderer.begin(7, DefaultVertexFormats.BLOCK); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); int brightness = Minecraft.getMinecraft().world.getCombinedLight(pos, fluid.getFluid().getLuminosity()); TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(fluid.getFluid().getStill(fluid).toString()); TextureAtlasSprite flowing = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(fluid.getFluid().getFlowing(fluid).toString()); putTexturedQuad(renderer, still, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.DOWN, color, brightness, false); putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.NORTH, color, brightness, true); putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.EAST, color, brightness, true); putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.SOUTH, color, brightness, true); putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.WEST, color, brightness, true); putTexturedQuad(renderer, still, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.UP, color, brightness, false); Tessellator.getInstance().draw(); }
TextureAtlasSprite tex1 = RenderUtil.getStillTexture(FluidRegistry.WATER); ResourceLocation iconKey = FluidRegistry.WATER.getFlowing(); final TextureAtlasSprite tex = NullHelper.first(Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(iconKey.toString()), tex1);
@SubscribeEvent public static void preDrawHud(RenderGameOverlayEvent.Pre event) { if (event.getType() == ElementType.CROSSHAIRS) { if (transmutationResult != null) { if (FluidRegistry.lookupFluidForBlock(transmutationResult.getBlock()) != null) { TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite(FluidRegistry.lookupFluidForBlock(transmutationResult.getBlock()).getFlowing().toString()); mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); BufferBuilder wr = Tessellator.getInstance().getBuffer(); wr.begin(7, DefaultVertexFormats.POSITION_TEX); wr.pos(0, 0, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex(); wr.pos(0, 16, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex(); wr.pos(16, 16, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex(); wr.pos(16, 0, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex(); Tessellator.getInstance().draw(); } else { RenderHelper.enableStandardItemLighting(); IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(transmutationResult); Minecraft.getMinecraft().getRenderItem().renderItemModelIntoGUI(ItemHelper.stateToDroppedStack(transmutationResult, 1), 0, 0, model); RenderHelper.disableStandardItemLighting(); } } } }
GlStateManager.translate((float) from.getX(), (float) from.getY(), (float) from.getZ()); TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(fluid.getFluid().getStill(fluid).toString()); TextureAtlasSprite flowing = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(fluid.getFluid().getFlowing(fluid).toString()); if (still == null) { still = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
final TextureAtlasSprite flowing = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getFlowing().toString() );
TextureAtlasSprite flow = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getFlowing().toString());