Mambo_Dancer Posted March 12, 2018 Share Posted March 12, 2018 (edited) Help sos pls with my TESR class when im placing my InfusionAltar, all particles are disapearing, and >2 altars dont want to render, and speed of spinning and hovering are too dam fast, help pls https://github.com/MamboDancer/minecraftmod/tree/master/src/main/java/ua/mambodancer/theterrifyingbeats/blocks/tileentities - link to problem code (TESRAltar) Edited March 12, 2018 by Mambo_Dancer Quote Link to comment Share on other sites More sharing options...
Draco18s Posted March 12, 2018 Share Posted March 12, 2018 55 minutes ago, Mambo_Dancer said: when im placing my InfusionAltar my another entity, that should hovering above is stucks to me What? Quote 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. Link to comment Share on other sites More sharing options...
Mambo_Dancer Posted March 12, 2018 Author Share Posted March 12, 2018 1 minute ago, Draco18s said: What? ive got a bit of progress, now its hovering properly, but all particles are disapearing when i am looking on this block, and when i place >2 of this blocks only 2 blocks are rendering with TESR Quote Link to comment Share on other sites More sharing options...
Matryoshika Posted March 12, 2018 Share Posted March 12, 2018 You are rendering your item outside the pushed matrix. Move it to be rendered inside of it. TESR's are also singletons. There is only one TESR that does the work for rendering every single tile-entity that it is bound to. If there are several loaded at the same time, then you need to compensate the rotation, either by using a variable from the TE itself, or any other "outside" data, otherwise it'll speed up by +1x times for each tile. I would also recommend that you start to undo whatever you rendered after you are done. "Artifacts" are a type of behaviour when rendering isn't stopped once you think it has, and starts interfering with other's rendering. OpenGL artifacts are annoying and hard to track down. GLStateManager helps out a bit, but in the end artifacts shouldn't exist. An example of "undoing" would be to translate your TESR to where you want it, render the item, then translate again with negative values, to reset it. This goes for every action you do with OpenGL. I have a TESR that spins in all axii, as well as bobbing up and down here. You can take a look and see where your code differentiates. Do note, I'm calling other methods as well so a pure copy/paste will lead to unintended behaviour. Quote Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials. Link to comment Share on other sites More sharing options...
Mambo_Dancer Posted March 12, 2018 Author Share Posted March 12, 2018 11 minutes ago, Matryoshika said: You are rendering your item outside the pushed matrix. Move it to be rendered inside of it. TESR's are also singletons. There is only one TESR that does the work for rendering every single tile-entity that it is bound to. If there are several loaded at the same time, then you need to compensate the rotation, either by using a variable from the TE itself, or any other "outside" data, otherwise it'll speed up by +1x times for each tile. I would also recommend that you start to undo whatever you rendered after you are done. "Artifacts" are a type of behaviour when rendering isn't stopped once you think it has, and starts interfering with other's rendering. OpenGL artifacts are annoying and hard to track down. GLStateManager helps out a bit, but in the end artifacts shouldn't exist. An example of "undoing" would be to translate your TESR to where you want it, render the item, then translate again with negative values, to reset it. This goes for every action you do with OpenGL. I have a TESR that spins in all axii, as well as bobbing up and down here. You can take a look and see where your code differentiates. Do note, I'm calling other methods as well so a pure copy/paste will lead to unintended behaviour. thanks alot, but most of it seems to be hard to understand coz im a beginner, i will appreciate any help with undoing as example Quote Link to comment Share on other sites More sharing options...
Mambo_Dancer Posted March 12, 2018 Author Share Posted March 12, 2018 36 minutes ago, Matryoshika said: You are rendering your item outside the pushed matrix. Move it to be rendered inside of it. TESR's are also singletons. There is only one TESR that does the work for rendering every single tile-entity that it is bound to. If there are several loaded at the same time, then you need to compensate the rotation, either by using a variable from the TE itself, or any other "outside" data, otherwise it'll speed up by +1x times for each tile. I would also recommend that you start to undo whatever you rendered after you are done. "Artifacts" are a type of behaviour when rendering isn't stopped once you think it has, and starts interfering with other's rendering. OpenGL artifacts are annoying and hard to track down. GLStateManager helps out a bit, but in the end artifacts shouldn't exist. An example of "undoing" would be to translate your TESR to where you want it, render the item, then translate again with negative values, to reset it. This goes for every action you do with OpenGL. I have a TESR that spins in all axii, as well as bobbing up and down here. You can take a look and see where your code differentiates. Do note, I'm calling other methods as well so a pure copy/paste will lead to unintended behaviour. Still cant get rid of no particles, moved to inside matrix (x=0,y=0.4,z=0) and trouble still in Quote Link to comment Share on other sites More sharing options...
Mambo_Dancer Posted March 12, 2018 Author Share Posted March 12, 2018 54 minutes ago, Matryoshika said: You are rendering your item outside the pushed matrix. Move it to be rendered inside of it. TESR's are also singletons. There is only one TESR that does the work for rendering every single tile-entity that it is bound to. If there are several loaded at the same time, then you need to compensate the rotation, either by using a variable from the TE itself, or any other "outside" data, otherwise it'll speed up by +1x times for each tile. I would also recommend that you start to undo whatever you rendered after you are done. "Artifacts" are a type of behaviour when rendering isn't stopped once you think it has, and starts interfering with other's rendering. OpenGL artifacts are annoying and hard to track down. GLStateManager helps out a bit, but in the end artifacts shouldn't exist. An example of "undoing" would be to translate your TESR to where you want it, render the item, then translate again with negative values, to reset it. This goes for every action you do with OpenGL. I have a TESR that spins in all axii, as well as bobbing up and down here. You can take a look and see where your code differentiates. Do note, I'm calling other methods as well so a pure copy/paste will lead to unintended behaviour. and i will be very happy if you help me with that fast rotation, cant get rid of it too(( Quote Link to comment Share on other sites More sharing options...
Matryoshika Posted March 12, 2018 Share Posted March 12, 2018 well, can you post your current code/update your github? Can't help if I don't know what you have & what you have done. Quote Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials. Link to comment Share on other sites More sharing options...
Mambo_Dancer Posted March 12, 2018 Author Share Posted March 12, 2018 39 minutes ago, Matryoshika said: well, can you post your current code/update your github? Can't help if I don't know what you have & what you have done. done https://github.com/MamboDancer/minecraftmod Quote Link to comment Share on other sites More sharing options...
Matryoshika Posted March 12, 2018 Share Posted March 12, 2018 You are constantly creating a new EntityItem every frame. These will stack up, and just cause excessive cleanup for the GarbageCollector (which cleans up used memory). Declare a final EntityItem outside the method and just reference whenever you want to render. You are completely missing a pushMatrix call. You need to revert the rotation & the translation after you have rendered the EntityItem An example of reverting the rotation would be as I did in my code I linked earlier GlStateManager.rotate(angle, 1, 1, 1); //Rotating everything renderBody(te, x, y, z, partialTicks, destroyStage); //render the thing GlStateManager.rotate(-angle, 1, 1, 1); //reverting the rotation with an equal but negative angle If you want to use the same logic as I do for calculating the angle, then instead of multiplying by 100 (what you changed) you should divide by a larger number than 40 (what I used). Quote Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials. Link to comment Share on other sites More sharing options...
Matryoshika Posted March 12, 2018 Share Posted March 12, 2018 Just now, Matryoshika said: You are constantly creating a new EntityItem every frame. These will stack up, and just cause excessive cleanup for the GarbageCollector (which cleans up used memory). Declare a final EntityItem outside the method and just reference whenever you want to render. You are completely missing a pushMatrix call. You need to revert the rotation & the translation after you have rendered the EntityItem An example of reverting the rotation would be as I did in my code I linked earlier GlStateManager.rotate(angle, 1, 1, 1); //Rotating everything renderBody(te, x, y, z, partialTicks, destroyStage); //render the thing GlStateManager.rotate(-angle, 1, 1, 1); //reverting the rotation with an equal but negative angle If you want to use the same logic as I do for calculating the angle (but slow it down), then instead of multiplying by 100 (what you changed) you should divide by a larger number than 40 (what I used). Quote Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials. Link to comment Share on other sites More sharing options...
Mambo_Dancer Posted March 12, 2018 Author Share Posted March 12, 2018 9 minutes ago, Matryoshika said: so changed all, but renderBody is missing (changed to entityItem - my infusionthing ) but doesnt want to work. Im missing smthng,yes? (in my mind and skill lel) Quote Link to comment Share on other sites More sharing options...
Draco18s Posted March 12, 2018 Share Posted March 12, 2018 (edited) 13 minutes ago, Matryoshika said: GlStateManager.rotate(angle, 1, 1, 1); //Rotating everything renderBody(te, x, y, z, partialTicks, destroyStage); //render the thing GlStateManager.rotate(-angle, 1, 1, 1); //reverting the rotation with an equal but negative angle This is what pushMatrix and popMatrix do. GLStateManager.pushMatrix(); GlStateManager.rotate(angle, 1, 1, 1); //Rotating everything renderBody(te, x, y, z, partialTicks, destroyStage); //render the thing GLStateManager.popMatrix(); //undo to the last pushMatrix Edited March 12, 2018 by Draco18s Quote 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. Link to comment Share on other sites More sharing options...
Mambo_Dancer Posted March 12, 2018 Author Share Posted March 12, 2018 17 minutes ago, Matryoshika said: so it worked, particularry, it doesnt want to rotate, and i have annoying name hovering above block when u lookng on block (container.infusionaltar) tried to look where it is called but my mission failed) i do not know about forge modding so much stuff, could you recommend me some stuff where i can learn more about? thanks for help btw Quote Link to comment Share on other sites More sharing options...
sir_titi Posted March 14, 2018 Share Posted March 14, 2018 (edited) On 12-3-2018 at 10:47 PM, Mambo_Dancer said: so it worked, particularry, it doesnt want to rotate, and i have annoying name hovering above block when u lookng on block (container.infusionaltar) tried to look where it is called but my mission failed) i do not know about forge modding so much stuff, could you recommend me some stuff where i can learn more about? thanks for help btw Heya, i have taken a quick look at your TESR and you are setting the value in the render method, I would recommenced you to do this for example in the update method in your tileEntity (to update the value) and make setters and getters for that value in your tile. So then you can call this from your TESR. But you should also take care of the latency. Example to explain better : tile.getModelAngle() * partialTickTime <- if you are actually rotating the model and if the data (angle) doesn't change you give it just the tile.getModelAngle() real example : float rotation = tile.isModelRotating() ? tile.getModelAngle() + (tile.getModelAngle() - tile.getModelPrevAngle()) *partialTickTime : tile.getModelPrevAngle() + ( tile.getModelAngle() - tile.getModelPrevAngle()); GlStateManager.rotate(rotation, 0, 0, 1); Hope this helps you somehow. (NOTE: TESR is as far as i know multi-threaded meaning the same render method is called in "independent" threads so your "angle" in the TESR will have different values, cuss the different threads don't share there values/data to each other. So your rotation will always be broke. And the render method is only called when the player is actually looking at the block/tile, so is not rotating which is fine if it's just for aesthetic purpose ) Greets Sir_titi Edited March 14, 2018 by sir_titi Quote Always looking for new challenges, and happy to help the people where ever I can Link to comment Share on other sites More sharing options...
Draco18s Posted March 14, 2018 Share Posted March 14, 2018 3 minutes ago, sir_titi said: (NOTE: TESR is as far as i know multi-threaded meaning the same render method is called in "independent" threads so your "angle" in the TESR will have different values, cuss the different threads don't share there values/data to each other. What? This is literally nonsense. "Two instances of the class" and "two threads" are completely and utterly different concepts. Quote 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. Link to comment Share on other sites More sharing options...
sir_titi Posted March 14, 2018 Share Posted March 14, 2018 1 minute ago, Draco18s said: What? This is literally nonsense. "Two instances of the class" and "two threads" are completely and utterly different concepts. Wait what do you mean? Sorry me for being stupid Quote Always looking for new challenges, and happy to help the people where ever I can Link to comment Share on other sites More sharing options...
Draco18s Posted March 14, 2018 Share Posted March 14, 2018 46 minutes ago, sir_titi said: Wait what do you mean? Sorry me for being stupid https://en.wikipedia.org/wiki/Multithreading_(computer_architecture) Quote 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. Link to comment Share on other sites More sharing options...
Mambo_Dancer Posted March 14, 2018 Author Share Posted March 14, 2018 Guys,thanks a lot, im updated my github so u can look how my "final" code of TESR are Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.