Posted January 19, 201510 yr Hey folks, so I've been fiddling with custom methods but I can't quite nail it. I have a custom model rendering with a tileentity and renderer, but I need it to rotate based on the direction you're facing and what it's next to. I've done this many times with blocks (furnace type thing) but with a model the only place I can find to rotate it would be the setRotation but I can't figure a way to get the players direction into it. I've tried it the way you would a furnace, but it doesn't seem to work, so it's either not meant to with a custom rendered block or I didn't set that up quite right. Everything works fine as I said, just can't figure how to rotate it correctly or what class to stick it in. a.k.a. Sirius http://i.imgur.com/QRtYi6e.png[/img]
January 19, 201510 yr Well....you obviously know how to set the block metadata for a regular block and make the facing change. Now in your renderer you need to read that data and call GL11.gl_rotate(...) Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 19, 201510 yr Author Ahh got it! So I did have to set the meta data first then grab it from the TileEntity. Didn't think it worked that way, never worked with TEs before. Thanks. Now I have a block that's almost the exactly the same, but I need it to figure out what's around it first [it's a pipe for RF] do I do that within the blockcontainer's class itself and somehow pass that data across to the renderer or is that done someplace else? Because so far the only thing I've done it adjust furnace code to figure out what way the player is facing. How would I go about setting it's direction based on it's neighbors? Wouldn't that require me to pull different models, and how would a single TE figure out which one it is? a.k.a. Sirius http://i.imgur.com/QRtYi6e.png[/img]
January 19, 201510 yr The renderer has access to the TileEntity, so store whatever data you need there. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 19, 201510 yr Author Gotcha thanks again. Though I'm wondering if it makes more sense to make the pipe part out of vertex with UVs instead of making 10 different models. lol a.k.a. Sirius http://i.imgur.com/QRtYi6e.png[/img]
January 19, 201510 yr How are you creating the model in the first place? The answer is "yes" but in order to help I'd have to know what object type you're using. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 19, 201510 yr Author Well I've been using techne to get the java code to make life easier. Inside the renderer I reference the model class from what I've made in techne. For what I've done before it's fine, especially what I was asking about. But for an RF pipe it'd need at least 6 different models; but I've never worked with vertex or cubeface stuff in java no idea where to begin. a.k.a. Sirius http://i.imgur.com/QRtYi6e.png[/img]
January 19, 201510 yr Ah! This is easy then. Techne automatically gives names to each cuboid which is the variable names when it exports the model as a Java file. You can take the resulting code and modify it to only render those parts when conditions are true. I actually did this recently myself. https://github.com/Draco18s/HarderStuff/blob/master/main/java/com/draco18s/ores/client/ModelAxel.java#L143-145 The block actually uses two different models in total, but that's only because one position is radically different than the others (normally speaking it'd be a separate block, but as I'm not doing a full tech mod I left things abstract). Base look: http://binarymage.com/wiki/lib/exe/fetch.php?cache=&w=854&h=480&media=hardores:2014-11-28_16.20.15.png[/img] And the final look. You can see the result of line 144 towards the left (second, separate, model to the right): http://binarymage.com/wiki/lib/exe/fetch.php?cache=&w=854&h=480&media=hardores:2014-11-28_16.20.43.png[/img] The gearbox model ended up looking flimsy, it it was also a huge pain to try and fix, due to the rotations involved and I said "screw it." Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.