Jump to content

Recommended Posts

Posted (edited)

Hi there so im making fluid pipes for my mod. Im very new to IBakedModel and have only started to get it to function recently. I looked at some sample code and went from there. I have a few basic renders going on but ive run into an issue.

Let me explain:

 

What i have rendering so far:

Spoiler

2017-08-06_22_31_18.thumb.png.29e9fd175928544c8cadf1cbd07c03a4.png

 

So that is easy so far, just drawing vertexes. Here is the code for these:

BakedUtils.java

Spoiler

Small snippet for one side: (didnt want to post too much code!)

 

side_base = EnumFacing.EAST;
        quadBuilder = new UnpackedBakedQuad.Builder(format);
        quadBuilder.setQuadOrientation(side_base);
        quadBuilder.setTexture(texture);
        putVertex(
                quadBuilder, side_base,
                xMain[2] , yMain[2], zMain[2],
                texture.getInterpolatedU(0),
                texture.getInterpolatedV(16 - 6),
        format, fluid);
        putVertex(
                quadBuilder, side_base,
                xMain[2] , yMain[1] , zMain[2],
                texture.getInterpolatedU(0),
                texture.getInterpolatedV(16),
        format, fluid);
        putVertex(
                quadBuilder, side_base,
                xMain[2] , yMain[1] , zMain[1],
                texture.getInterpolatedU(16),
                texture.getInterpolatedV(16),
                format, fluid);
        putVertex(
                quadBuilder, side_base,
                xMain[2] , yMain[2], zMain[1],
                texture.getInterpolatedU(16),
                texture.getInterpolatedV(16 - 6),
                format, fluid);
        faceQuads.put(side_base, ImmutableList.<BakedQuad>of(quadBuilder.build()));
        

 

Now its working perfectly so far however im having trouble figuring out how to do the follwing:

Spoiler

2017-08-06_22_31_23.thumb.png.e1e19fed5f69e9d92c5ec28be4e336e0.png

 

The problem is i dont know if/how to put more than 4 vertexes, and if that even possible, i havent tried that yet, however im having to manually set up each state of which there are 64! and ive tried stacking them together, which didnt work, the last one overrode all the sides from the previous one. Wondering if anyone can help! Thanks in advance :)

Edited by Zeher_Monkey
Posted

If they are full i mean, i haven't got to that part, Iv'e only coded 3 models so far, but i'm afraid of hitting this speed bump. I tried to stack models as in renderUp + renderDown for example but it would on render the renderDown functions, because im guessing the last function overwrote the first one. 

 

I want to do this: (Filled pipes)

Spoiler

2017-08-06_22_47_07.thumb.png.bb8867bce8a698e3b3fbdecce78a4419.png

 

But i dont see a way of making the fluid stay in the pipes with only 4 vertextes. Imagine them filled*

Posted

1. You can't put polygon to the model within MC system. Instead, draw one with several quads. In case you don't know, You can put several quads into the immutable list for each side, either with immutable list builder or with ImmutableList#of.(when there are lesser than 5 entries)

2. Do you know basics of java? You should know how to use iteration properly to set up the code. Also, I think you should organize(and clean-up) your code.

 If you don't know java, go learn it first before working on this level of modding.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted (edited)

I know java dont get me wrong. I dont know everything it has to offer. Thanks for the help. And i know my code is messy :P i cant escape that! Also yes this is advanced modding i know that too. 

So i can do something like this:

 

Spoiler

 UnpackedBakedQuad.Builder quadBuilder = null;
 UnpackedBakedQuad.Builder quadBuiler_two = null;
 ...

faceQuads.put(side_base, ImmutableList.<BakedQuad>of(quadBuilder.build(), quadBuilder_two.build()));

 

For less than 5 builders? If so that works, because the max number of builders i need is 3 per side.

 

Also yes i do know iteration, but i need to work things out beforehand so they work. Then ill cut code down.

Edited by Zeher_Monkey
Posted

Hmm then, what's your problem?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted (edited)

I couldn't figure this specific thing out. Like i said i don't know everything with Java/Minecraft. Otherwise i wouldn't come here and ask for help. So can i use the above or not?

Edited by Zeher_Monkey
Posted

Ofc you can use the code snippet above. So this is problem with a library, right?

If a code does not give error, you can assume it works. Most of the time. Though you should take care to read the javadoc of methods/classes you use.

 

For more than 5 quads, Use ImmutableList.builder() and put those quads into the builder. It'll build immutable list.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.