Jump to content

[1.12.2] Need help rendering a fluid inside a pipe or change his blockstate!


Recommended Posts

Posted
  1. 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...
  2. 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.
  3. 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! ?
  4. 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.
  5. 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?
  6. I need something to not update every tick this thing.
  7. Some screenies from tha pipe the repeater means where it should go the fluid in advance!:

 

2019-02-13_07.23.01.png

2019-02-13_07.23.31.png

2019-02-13_07.24.14.png

Posted (edited)

You HAVE to submit your code for others to help you. You need to show your code for your block, tileentity, and tesr, otherwise other people will have to guess what you are trying to do and what you did wrong.

 

From my understanding, you are trying to render flowing liquid inside your pipe. The easiest way would be to attach a TileEntitySpecialRenderer to your pipe, get the amount of liquid in the pipe, and render the height of the liquid according to the amount of liquid (draw a rectangle inside the pipe with the texture of the desired liquid; its height should increase as the amount of liquid increase, and decrease when the amount of liquid decrease).

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted

Use a FastTESR too

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

@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.

Edited by tigres810
The paste wasnt working so I changed and the gif image.
Posted (edited)

1. No you don't need to bump.

2. Use for loops to clean up your rendering code.

3. Please post your code for your tile entity.

4. Line 55:

float scale = (1.0f) * fluid.amount / (te.energy);

Yes I see, you are trying to get the scaled amount of your liquid, but this line has problems.

Dividing the fluid amount by the energy amount makes no sense. You are trying to get how full the pipe is, so you need to doing something like

fluid.amount / te.maximunFluidAmount

5. The FastTESR#renderTileEntityFast has x, y, and z as parameters. Use them instead of the xyz from TileEntity.pos.

6. Since your fluid isn't rendering at all, I would suggest you to add a debug line after Line 55 to print out the value of 

scale

, just in case it is 0 the whole time.

7. That is not how a FastTESR is to be used. Read https://mcforge.readthedocs.io/en/latest/tileentities/tesr/#fasttesr again. FastTESR#renderTileEntityFast provides a bufferbuilder. Use the provided bufferbuilder. Moreover, GlStateManager and GLXX cannot be used in FastTESR.

8.

FluidStack fluid = new FluidStack(ModFluids.FLUX_FLUID, 1);
if (fluid == null) {
	return;
}

This null check is pointless. You just assigned an instance of FluidStack to fluid on the previous line.

 

Again, since you did not post your code for your tile entity, we cannot be sure what went wrong. "Fluid not rendering" is too vague, as many things can cause that problem. Posting your full code helps us to find out all the problems that lead to "fluid not rendering".

Edited by DavidM
  • Like 1

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted (edited)

@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

Edited by tigres810
forgot something whoops!
Posted (edited)
Quote

FastTESR#renderTileEntityFast provides a bufferbuilder. Use the provided bufferbuilder. Moreover, GlStateManager and GLXX cannot be used in FastTESR.

This issue still exists. 

Again, since FastTESR are batched together to improve performance, it does NOT support access to GlStateManager and GLXX.

I would suggest you to use the normal TileEntitySpecialRenderer just for now and come back to FastTESR when you are more familiar with rendering. The render method in TileEntitySpecialRenderer and FastTESR are different. Your current code has many reference to the GlStateManager as well as getting the bufferbuilder from the tessellator. A FastTESR should NOT have those.

 

Quote

Can I make the pipe has energy and a fluid tank?

To be honest you are quite lost here. You need to understand that the TileEntitySpecialRenderer is for rendering ONLY. It should not (and cannot) do anything apart from rendering. It is possible to convert FE to fluid, but you have to do so in the tile entity. The line

fluid.amount / te.maximunFluidAmount

is for getting the height of the liquid in order to render it. It has nothing to do with the conversion, so you shouldn't be putting te.energy in the denominator.

In short, the tile entity does all the "real" work while the TESR just makes everything prettier.

 

Lastly and most importantly, since your debug line in your TESR is not printing anything, I suspect that you forgot to bind your TESR to your TileEntity. Register your TESR with ClientRegistry.bindTileEntitySpecialRenderer. Put the code for registering TESR in your client proxy (TESRs should only exist in the client).

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted

1. Your ClientRegistry.bindTileEntitySpecialRenderer should be called once per TESR. Therefore, you should put it in one of the inits in your client proxy.

2. Add debug lines to help figure out why your TESR is not being called.

3. The name tag is from your tile entity (custom name). You can delete all custom name related code for now, as you won't need it.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted

You just need to draw a box in your TESR. Multiple examples can be found in many open source mods. You should use the debugger to step through your code.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.