Posted January 10, 20178 yr I am trying to render fluid inside a tank block with a TESR. The fluid I am trying to render in my tests is either water or lava. This is my TESR: public void renderTileEntityAt(TileEntityFluidTank te, double x, double y, double z, float partialTicks, int destroyStage) { GlStateManager.pushMatrix(); int capacity = te.getFluidHandler().getCapacity(); FluidStack fluid = te.getFluidHandler().getFluid(); if (fluid != null) { Tessellator tess = Tessellator.getInstance(); VertexBuffer buffer = tess.getBuffer(); buffer.setTranslation(x, y, z); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getFluid().getStill().toString()); TextureAtlasSprite flow = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getFluid().getFlowing().toString()); double posY = .1 + (.8 * ((float) fluid.amount / (float) capacity)); float[] color = ClientUtils.getRGBAFloatArrayFromHexColor(fluid.getFluid().getColor(fluid)); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos( 4/16, posY, 4/16).tex(still.getInterpolatedU( 4), still.getInterpolatedV( 4)).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(12/16, posY, 4/16).tex(still.getInterpolatedU(12), still.getInterpolatedV( 4)).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(12/16, posY, 12/16).tex(still.getInterpolatedU(12), still.getInterpolatedV(12)).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos( 4/16, posY, 12/16).tex(still.getInterpolatedU( 4), still.getInterpolatedV(12)).color(color[0], color[1], color[2], color[3]).endVertex(); tess.draw(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(12/16, 1/16, 12/16).tex(flow.getInterpolatedU(12), flow.getInterpolatedV(15)).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(12/16, posY, 12/16).tex(flow.getInterpolatedU(12), flow.getInterpolatedV( 1)).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos( 4/16, posY, 12/16).tex(flow.getInterpolatedU( 4), flow.getInterpolatedV( 1)).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos( 4/16, 1/16, 12/16).tex(flow.getInterpolatedU( 4), flow.getInterpolatedV(15)).color(color[0], color[1], color[2], color[3]).endVertex(); tess.draw(); buffer.setTranslation(0, 0, 0); } GlStateManager.popMatrix(); } This code currently only renders two sides of the five sides that need to be rendered (or at least it should). Instead of rendering the water or lava texture, it renders nothing.
January 11, 20178 yr Two things, did you bind the TESR, and the next being did you let the client know that there is a fluid inside of it. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
January 11, 20178 yr The client is properly updated. I will recheck if I bound it correctly, I might have forgotten that this time .
January 11, 20178 yr I checked again and the TESR is properly bound and the call even enters into the if statement. So there must be something off with my use of the tesselator.
January 12, 20178 yr You are using integer division everywhere ( 12/16 ), which will always be rounded down (12/16 = 0.75 = 0). To do proper division with decimals, use floats (12F/16F = 0.75F). Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.