Posted June 13, 20214 yr I have created a Container with a FluidTank Slot. In order to draw this on the Screen, I need to get the texture of the Fluid and draw it transparently in the case of water. 1. How do I get the texture of a fluid? 2. How can I draw transparent (and animate) water?
June 13, 20214 yr Author I did a little research and coded it with reference to the mod that draws the liquid in the GUI in the same way, but the liquid is not drawn, only the noise-like thing is displayed small. What's wrong? ~~ private void renderFluid(MatrixStack matrixStack, Tank tank) { int x = tank.getXPos(); int y = tank.getYPos(); FluidStack fluidStack = tank.getStack(); this.minecraft.getTextureManager().bindTexture( this.minecraft.getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply( fluidStack.getFluid().getAttributes().getStillTexture(fluidStack) ).getAtlasTexture().getTextureLocation() ); AbstractGUI.blit(matrixStack, x, y, this.getBlitOffset(), 0, 0, 16, 16, 16, 16); } ~~
June 14, 20214 yr Author private void renderFluid(MatrixStack matrixStack, Tank tank) { // 33; int x = tank.getXPos(); int y = tank.getYPos(); // FluidStack fluidStack = tank.getStack(); FluidStack fluidStack = new FluidStack(Fluids.WATER, 1); TextureAtlasSprite fluidSprite = this.minecraft.getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE) .apply(fluidStack.getFluid().getAttributes().getStillTexture(fluidStack) ); if (!fluidStack.isEmpty()) { this.minecraft.getTextureManager().bindTexture( fluidSprite.getAtlasTexture().getTextureLocation() ); } AbstractGui.blit(matrixStack, this.guiLeft + x, this.guiTop + y, this.getBlitOffset(), 16, 16, fluidSprite); } I was able to draw the texture of water for the time being. However, I haven't drawn the overlay yet, so it remains gray. How do I apply the overlay to make it blue?
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.