Jump to content

[1.7.10] Fluid in pipes


KeeganDeathman

Recommended Posts

In my efforts to make a pipe, I am attempting to do a multi-layered texure. A pipe texture and a fluid texture.

Since my pipe is open to all fluids, I am trying to be as vague as possible.

I use the code

mc.renderEngine.bindTexture(...);

to set the texture of my TESR models. However, all I can find in the fluid is an IIcon.

Is there a way to convert this to resource location, or a different version of bindTexture that excepts IIcons?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

I tried what the code you linked to did, but it renders as a smushed up sprite sheet in game still. :(

 

That would suggest your trying to draw the whole texture rather than just the 16x16 image in the texture. The UV Coordinates determine the area of the texture that is used.

 

How do I select the texture from the sheet?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

fillAreaWithIcon is 2D drawing (And its meant for things like a bar that shows how much fluid a block has in a GUI). Your also supplying it the wrong parameters, it wants X,Y, width and height. Your sending it the UV coordinates which are the texture coordinates (Which are between 0 and 1).

 

You can render it using the standard block rendering in minecraft. fluid.getBlock() will get you the block of the fluid. You can then render that using the render.setRenderBounds() to define the area.

 

Something like the following:

renderer.setRenderBounds(0,0,0,1,1,1);
renderer.renderAllFaces = true;
renderer.renderStandardBlock(fluid.getBlock(), tile.xCoord, tile.yCoord, tile.zCoord);
renderer.renderAllFaces = false;

 

You can also use the different renderFace methods (like renderFaceYNeg) to render individual faces with specific IIcon's for each side.

 

Note: SetRenderBounds goes from 0 to 1 for sizes. You would need to have it use different values for different orientations of your pipe.

Link to comment
Share on other sites

fillAreaWithIcon is 2D drawing (And its meant for things like a bar that shows how much fluid a block has in a GUI). Your also supplying it the wrong parameters, it wants X,Y, width and height. Your sending it the UV coordinates which are the texture coordinates (Which are between 0 and 1).

 

You can render it using the standard block rendering in minecraft. fluid.getBlock() will get you the block of the fluid. You can then render that using the render.setRenderBounds() to define the area.

 

Something like the following:

renderer.setRenderBounds(0,0,0,1,1,1);
renderer.renderAllFaces = true;
renderer.renderStandardBlock(fluid.getBlock(), tile.xCoord, tile.yCoord, tile.zCoord);
renderer.renderAllFaces = false;

 

You can also use the different renderFace methods (like renderFaceYNeg) to render individual faces with specific IIcon's for each side.

 

Note: SetRenderBounds goes from 0 to 1 for sizes. You would need to have it use different values for different orientations of your pipe.

 

What is the renderer variable refering to?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

Found out you can just do

RenderBlocks renderer = new RenderBlocks();

So I did that, but I now get

java.lang.NullPointerException: Rendering Block Entity
at net.minecraft.block.BlockLiquid.colorMultiplier(BlockLiquid.java:77)
at net.minecraft.client.renderer.RenderBlocks.renderBlockLiquid(RenderBlocks.java:4141)
at keegan.labstuff.render.TileEntityRenderLiquidPipe.renderPipe(TileEntityRenderLiquidPipe.java:75)
at keegan.labstuff.render.TileEntityRenderLiquidPipe.renderTileEntityAt(TileEntityRenderLiquidPipe.java:139)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

You can't do that. RenderBlocks needs a world.

 

in my tileentity i did:

@Override
public void func_147496_a(World world)
    {
	this.world = world;
	this.rb  = new RenderBlocks(world);
    }

 

where rb is the RenderBlocks;

 

Note that func_147496_a may be different for you (My forge installation was likely at the start of 2015 for the code i am using). It is however the only method of TileEntitySpecialRenderer which uses World as an input parameter so it wouldn't be hard to work out its new name if it has one.

 

Note: Minecraft uses this method rather than using the world given by the TileEntity you get from renderTileEntityAt, i am unsure if the TileEntity contains a valid world object but it could simply be so that RenderBlock's is only created once instead of each time the TileEntity is rendered.

Link to comment
Share on other sites

You can't do that. RenderBlocks needs a world.

 

in my tileentity i did:

@Override
public void func_147496_a(World world)
    {
	this.world = world;
	this.rb  = new RenderBlocks(world);
    }

 

where rb is the RenderBlocks;

 

Note that func_147496_a may be different for you (My forge installation was likely at the start of 2015 for the code i am using). It is however the only method of TileEntitySpecialRenderer which uses World as an input parameter so it wouldn't be hard to work out its new name if it has one.

 

Note: Minecraft uses this method rather than using the world given by the TileEntity you get from renderTileEntityAt, i am unsure if the TileEntity contains a valid world object but it could simply be so that RenderBlock's is only created once instead of each time the TileEntity is rendered.

 

You are a life saver. May the goddess be with you in your endevors.

That said, your code doesn't appear to do much.

Everything's synced on github if you want to find where I went horribly wrong.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

Remove all the rotate/translate opengl stuff. When you translate and then you tell it to draw the block at a certain location your telling it to draw it further away as you move it by say 100 and then you tell it to draw something 100 away from its current position (So your telling it to draw at 200 instead of 100).

 

setRenderBounds is the only thing you need to change based on the blocks direction.

 

P.S Your also binding a texture for some reason when you should have the Blocks texture bound. It won't render right unless you use the blocks texture.

Link to comment
Share on other sites

The Renderer uses the main Block spritemap for all of its drawing. If you set a custom texture before calling it then it will not look right as it will use the texture coordinates from the spritemap.

 

BTW, they pipe isn't restricted to being straight, as you seem to have inferred.

 

I inferred nothing, i only stated that you would need to change the size of whats being rendered based on the direction it faces(Your pipe model for example seems to be rotated based on direction). You may need to render the fluid multiple times, i didn't bother looking at your full code.

 

The code i supply won't do the full job for you, you need to modify it to suit your exact needs.

Link to comment
Share on other sites

I've tried it before rendering the pipe, after, with and without binding TextureMap.locationBlocksTexture, and even commented out the pipe model rendering matrix.

No fluid.

Funny thing is, if I wrap the renderer.renderStandardBlock(...) in System.out.println(...), it prints true.

So, where is it?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello there! I am trying to make custom dimensions for a modpack I am making in an older minecraft version, 1.16.5. I like that version and it has a few other mods that have not been updated that I would still like to use. Anyway, I am having a terrible time with getting my dimension to work and have tried using code from other peoples projects to at least figure out what I'm supposed to be doing but it has not been as helpful as I would have liked. If anyone could help that would be greatly appreciated! Here is my github with all the code as I am using it: https://github.com/BladeColdsteel/InvigoratedDimensionsMod I have also included the last log, https://pastebin.com/zX9vsDSq, I had when I tried to load up a world, let me know if there is anything else I should send though, thank you!
    • Whether you are a fan of Hypixel Bedwars, SkyWars and PvP gamemodes like that, well you would enjoy this server! We have a very fun and unique style of PvP that a lot of our players really enjoy and we want to bring this server to more players like you! Yes you reading this post haha. Introducing, the Minezone Network, home of SUPER CRAFT BLOCKS. We've been working on this server for over 4 years now. Here is what we have to offer: SUPER CRAFT BLOCKS: This has 3 different gamemodes you can play, Classic, Duels and Frenzy. Each mode offers over 60 kits to choose from, along with a total of over 60 maps, allowing for various different playstyles on each map. There are also random powerups that spawn on the map which can include Health Pots, Bazookas, Nukes, Extra Lives and way way more! There is also double jump in this gamemode as well, which makes PvP a lot more fun & unique. You only need a minimum of 2 players to start any mode! Classic: Choose a kit, 5 lives for each player, fight it out and claim the #1 spot! Look out for lightning as they can spawn powerups to really give you an advantage in the game! Duels: Fight against another random player or one of your friends and see who is the best! Frenzy: Your kit is randomly selected for you, each life you will have a different kit. You can fight with up to 100 players in this mode and lets see who will be the best out of that 100! All the other stuff from Classic/Duels apply to this mode as well like powerups. We have 2 ranks on this server too, VIP and CAPTAIN which has a bunch of different perks for SCB and other things like Cosmetics and more.   SERVER IP: If this server has caught your interest in any way, please consider joining and you will NOT regret it! Bring some of your friends online for an even better experience and join in on the fun at: IP: minezone.club Hope to see you online!   SERVER TRAILER: https://www.youtube.com/watch?v=0phpMgu1mH0
    • The mod give new blocks  
    • I will a Mode for 1.21 in this Mod give new block, items and dimensions   
  • Topics

×
×
  • Create New...

Important Information

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