Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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]

  • Author

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

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

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.

  • Author

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]

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.

  • Author

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]

  • Author

I have looked every which way to sunday, and I can't figure out where that renderer variable comes from in your snippet. I think it's renderblocks.

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

  • Author

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]

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.

  • Author

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]

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.

  • Author

The pipe's texture? Okay.

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

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

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.

  • Author

Okay. The configureSides function actually sets booleans that control whether a section is rendered.

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

  • Author

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]

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.