Export as Java  [Solved]

Post ideas to make Cubik Studio even better.

Re: Export as Java

Post by JTK222 » 25 Apr 2017, 06:34

@Sphax I think the best for this would be to make it more of a raw format and giving users the possibility to add a template where the raw data is pasted into.
like for a template:

%originX%, %originY%, %originZ%, %width%, %height%, %depth%; %offsetX%, %offsetY%, %offsetZ%, %rotX%, %rotY%, %rotZ%, (UV:) %u%, %v% and %name% (each element requires a unique name).

Here is an example how a template might look: https://pastebin.com/u3wNCS3F
(Oh and Model_Fox should of course be a custom name :P For the whole model.)
x
User avatar
JTK222
Supporter
Posts: 51
Joined: 02 Nov 2016, 08:35

Re: Export as Java

Post by Sphax » 18 May 2017, 14:38

If someone is interested for JAVA exporter in Cubik Studio, please tell me if you know a way to test exported .java + .png files ;)
x
User avatar
Sphax
Admin
Posts: 1314
Joined: 10 Nov 2011, 10:44

Re: Export as Java

Post by JTK222 » 20 May 2017, 18:31

It wouldn't be an easy way, but... would it be ok if somebody creates a mod work space where you have just to paste the code to be able to test it?
x
User avatar
JTK222
Supporter
Posts: 51
Joined: 02 Nov 2016, 08:35

Re: Export as Java

Post by Sphax » 20 May 2017, 19:44

Yes of course :)

Also, you said that:

Code: Select all

Shape1.addBox(-1F, 0F, 0F, 1, 1, 2);
Why size can't be a float? That looks strange knowing several entities in Minecraft are using half cubes... :/

Also, is it possible to add several boxes to same shape? If so, how does the texture works in that case?
x
User avatar
Sphax
Admin
Posts: 1314
Joined: 10 Nov 2011, 10:44

Re: Export as Java

Post by JTK222 » 20 May 2017, 21:01

Ehm... took a look at it and nope, Minecraft doesn't allow half cubes (unless I and a giant amount of other modders missed something)
However I noticed there is an other vvariant of this method that might be even better.

Code: Select all

addBox(String partName, float offX, float offY, float offZ, int width, int height, int depth)
I am not sure for what that can be used, but I think it shouldn't cause any trouble, and might be useful for some advanced features.

Here is a template: https://www.dropbox.com/s/stpauumufsawf ... e.zip?dl=0
Just unzip it into an empty folder. Open your command line there and execute "gradlew setupDecomWorkspace" in case you have eclipse "gradlew eclipse" or intelliJ (don't know that command D:)
In case you don't use any of them and just have notepad you just need a command to launch minecraft but I have no Idea what the command is D:

Ok so the explanation:
The model itself should be pasted into "Model_Random_Entity.java" you shouldn't remove the imports and maybe also don't include them into cubik studio export as it might cause additional work for new minecraft versions.
The "Render_Random_Entity" class contains things like the texture path and some other things, that also shouldn't be in Cubik Studio as it's mainly for additional rendering information.
Basicly that's all, just don't change anything else and it should work ^^
The texture path is also set up.

Edit: Oh and for the thing with entities using half pixels, they are probably made with a higher scale and just scaled down for rendering.
Which entities do you mean with that? I would take a look at their model code to be sure.

Edit2: Oh and if you have 2 exactly same cubes with the same texture you can just assign the same UV for them. But they still need to be 2 seperate cubes with their corresponding positions and stuff.
x
User avatar
JTK222
Supporter
Posts: 51
Joined: 02 Nov 2016, 08:35

Re: Export as Java

Post by JTK222 » 20 May 2017, 21:13

Ehm... I just noticed that you should uncomment the code that I have commented for animations only. market a little bit to much of it D:
(Just setupRotationAngles is for animations), And instead of just

Code: Select all

this.BodyCenter.render(scale);
This should be done for every element except you want to add support for minecrafts parent system. (What I think we could live without)
x
User avatar
JTK222
Supporter
Posts: 51
Joined: 02 Nov 2016, 08:35

Re: Export as Java

Post by Sphax » 23 May 2017, 20:21

JTK222 wrote: 20 May 2017, 21:01 Edit: Oh and for the thing with entities using half pixels, they are probably made with a higher scale and just scaled down for rendering.
Which entities do you mean with that? I would take a look at their model code to be sure.
I think the parrot has a non full cube for the beak.


Also another question:
- Where do you find doc for 3D models in JAVA?
- How to make a bone attached to another bone?
x
User avatar
Sphax
Admin
Posts: 1314
Joined: 10 Nov 2011, 10:44

Re: Export as Java

Post by JTK222 » 23 May 2017, 20:45

Oh, yeah the parrot. that's a thickness of 0, you can have everything from -32^something and 32^something (or something around that) but just no float values.

And I think there isn't a real doc, you would have to look directly into Minecrafts model code. I can write a better explanation of everything if you want ^^

And the bone thing is already contained in the example I send you. It's the setParent thing, if you do these you only need to render the model parts that don't have a parent/are not attached to something else. But if you do this the position of the child part equals 0 0 0 if it's in the same spot as the parent. And it uses it's origin as a rotation point and all that.
x
User avatar
JTK222
Supporter
Posts: 51
Joined: 02 Nov 2016, 08:35

Re: Export as Java  [Solved]

Post by Sphax » 19 Jun 2017, 09:45

Done in 2.7

Not tested
x
User avatar
Sphax
Admin
Posts: 1314
Joined: 10 Nov 2011, 10:44

Re: Export as Java

Post by Geekpower14 » 21 Aug 2017, 18:06

The exportation is doing very weird things in-game.

Image

Image

As you can see, the entity is upside-down. But more importantly, the exported model is incorrect. We can see a regular space between each 'elements'.

Here is the generated java model: https://i.blueslime.fr/5q230a5c.txt.

I suppose there is still work on this exportation 'format'. Hope that these information will help you.
x
User avatar
Geekpower14
Early Adopter
Posts: 2
Joined: 22 Feb 2015, 14:22

Post Reply

Return to “Suggestions”