-
Posts
42 -
Joined
-
Last visited
Everything posted by tigres810
-
[Solved]Need help rendering fluid inside tank 1.16.4
tigres810 replied to tigres810's topic in Modder Support
How I can render a quad? idk anything about this new renderer. -
So im trying to render some fluid inside my tank but it doesnt render anything idk why, please I need some help with this here is the code package com.tigres810.testmod.tileentitys.renders; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.tigres810.testmod.tileentitys.TileFluidTankBlock; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.fluid.Fluid; import net.minecraft.inventory.container.PlayerContainer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.vector.Matrix4f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; @OnlyIn(Dist.CLIENT) public class RenderFluidTankBlock extends TileEntityRenderer<TileFluidTankBlock> { public static final float TANK_THICKNESS = 0.3f; public static final float TANK_HEIGHT = 0.2f; public static final float TANK_BOTTOM = 0.0f; public RenderFluidTankBlock(TileEntityRendererDispatcher rendererDispatcherIn) { super(rendererDispatcherIn); } private void add(IVertexBuilder renderer, MatrixStack stack, float x, float y, float z, float u, float v) { renderer.pos(stack.getLast().getMatrix(), x, y, z) .color(1.0f, 1.0f, 1.0f, 1.0f) .tex(u, v) .lightmap(0, 240) .normal(1, 0, 0) .endVertex(); } @Override public void render(TileFluidTankBlock tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { if(tileEntityIn == null || tileEntityIn.isRemoved()) return; FluidStack fluid = tileEntityIn.getTank().getFluid(); if (fluid == null) return; Fluid renderFluid = fluid.getFluid(); if (renderFluid == null) return; FluidAttributes attributes = renderFluid.getAttributes(); ResourceLocation fluidStill = attributes.getStillTexture(fluid); TextureAtlasSprite sprite = Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(fluidStill); IVertexBuilder builder = bufferIn.getBuffer(RenderType.getTranslucent()); float scale = (1.0f - TANK_THICKNESS/2 - TANK_THICKNESS) * fluid.getAmount() / (tileEntityIn.getTank().getCapacity()); matrixStackIn.push(); matrixStackIn.translate(tileEntityIn.getPos().getX()+0.5, tileEntityIn.getPos().getY()+1.01/16.0, tileEntityIn.getPos().getZ()+0.5); matrixStackIn.scale(0.25f, 10.8f/16.0f, 0.25f); float u1 = sprite.getMinU(); float v1 = sprite.getMinV(); float u2 = sprite.getMaxU(); float v2 = sprite.getMaxV(); int color = renderFluid.getAttributes().getColor(); float a = 1.0F; float r = (color >> 16 & 0xFF) / 255.0F; float g = (color >> 8 & 0xFF) / 255.0F; float b = (color & 0xFF) / 255.0F; add(builder, matrixStackIn, TANK_THICKNESS, scale + TANK_HEIGHT, TANK_THICKNESS, u1, v1); matrixStackIn.pop(); } } I got no idea why is not working, also im trying to render one side to test if it works later ill add the rest of the faces.
-
@Egor_VozhakovI have the same issue I cannot run or build my mod, found any solution?
-
@DavidM Okay thanks for the quick response here's my te: https://pastebin.com/NBsV7KHY Scale is not printing anything, idk if I did right heres my TESR again: https://pastebin.com/n8i3NA44 Also the te doesn't have a tank or anything I want to convert fe energy to fluid if that's possible? I tried with a tank of fluid u interact by right clicking on it and still doesnt work, im so lost with the TESR and never done this stuff Can I make the pipe has energy and a fluid tank? Also don't mind the copyright from jabelar I copied his code to fix the update thingy i'll remove it later! I forgot to add the log cause it gives an error but idk if is from TESR: https://pastebin.com/pxjKssah
-
@DavidM and @Cadiboo My fluid does not render, i'm using a FastTESR this is what I got so far: https://pastebin.com/aa7JE3RD and on my tileentity I did this: @Override public boolean hasFastRenderer() { return true; } The pipe is getting the energy cause the console prints it ! Heres the proof : https://gyazo.com/72c8bac8d4077bd47efb6c3c91e82182 Also I read this before doing it: https://mcforge.readthedocs.io/en/latest/tileentities/tesr/#rendertileentityat Idk what I'm doing wrong? Any guidance ?? Also let me know if I need to bump.
-
[Solved][1.12.2]How I can transfer energy using FE from a generator?
tigres810 replied to tigres810's topic in Modder Support
I did some research and found a solution for this thing thanks! -
I want to update the pipe while is being filled but if I change his blockstate the energy resets so how I can do that without resetting it? Thanks... Also if I could change from the blockstate one parameter or such it could be helpful I just don't know how to do this and is hard to do. If I update the blockstate every tick the fluid or the blockstate thingy kinda flickers if I leave it to 4 it stays but if I put 8 it disappears! ? Also I cannot show the code I want a solution for this thing, if I could put a block inside and change his size? But idk if that's even possible. I could use buildcraft pipe but I need to transfer the fluid from the generator to the pice and Idk how they connect it, so any solution for this? I need something to not update every tick this thing. Some screenies from tha pipe the repeater means where it should go the fluid in advance!:
-
[Solved][1.12.2]How I can transfer energy using FE from a generator?
tigres810 replied to tigres810's topic in Modder Support
No worries if u feel like u can check the github of the project here The only part of the code is working is the east face the other stuff I leave it blank cause if one face doesn't work the others neither. How you transfer energy from a generator to another thing? -
[Solved][1.12.2]How I can transfer energy using FE from a generator?
tigres810 replied to tigres810's topic in Modder Support
Here is the update method: Update method in pipe there I do the stuff thats on the pipe script but it doesnt seem to be working.