xgravebornx Posted May 7, 2013 Posted May 7, 2013 Why do all of my tile entities face the same way? Can someone help? Maybe just point me in the right direction? Thanks! Quote
Naiten Posted May 7, 2013 Posted May 7, 2013 Do you render them with TileEntitySpecialRenderer? If yes, then check this out: http://www.minecraftforge.net/wiki/Custom_Tile_Entity_Renderer Quote If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
xgravebornx Posted May 22, 2013 Author Posted May 22, 2013 I still cant figure it out, I've tried a million times! Could you please help? this is how im doing my code https://github.com/xgravebornx/TileEntity-EXAMPLE Quote
mnn Posted May 22, 2013 Posted May 22, 2013 Look (again) at the wiki post. There's all the code you need. Pay attention mainly to this parts: /*This will rotate your model corresponding to player direction that was when you placed the block. If you want this to work, add these lines to onBlockPlacedBy method in your block class. int dir = MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 0);*/ GL11.glRotatef(dir * (-90F), 0F, 1F, 0F); If you still have a problem, try to write what exactly isn't working (the code in git repo doen't seem to implement any of those, didn't you forget to push your code?). Quote mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
xgravebornx Posted May 22, 2013 Author Posted May 22, 2013 I'll try it again, I've tried it quite a few times but I want to learn it! And I'm sorry but what do you mean by push code? Quote
mnn Posted May 23, 2013 Posted May 23, 2013 I meant push in a git way . Quote mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
redria7 Posted June 4, 2013 Posted June 4, 2013 You need this method in your Grave1Block.java class. This tells the block which direction you were facing when you placed the block. @Override public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack) { int l = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2); } Next, you need to change your renderAModelAt method in your RenderGrave1.java class to this. All I did was add couple lines that rotate it depending on the meta data. I don't know which way it it supposed to rotate, so you will have to fiddle a little bit to make it work correctly. To that end, you should just be able to add 90 to the start variable until it works correctly. (or if it continues not working, change to (start + meta * 90)F ) public void renderAModelAt(TileEntityGrave1 tileentity1, double x, double y, double z, float f){ int meta = world.getBlockMetadata(x, y, z); int start = 0; GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.5F, (float)y + 1.52F, (float)z + 0.5F); GL11.glRotatef((start - meta * 90)F, 0F, 0F, 1F); bindTextureByName("/mods/tutorial/textures/blocks/grave1.png"); GL11.glPushMatrix(); aModel.renderAll(0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } These are the same things mnn said, just more specific. Quote Read my thoughts on my summer mod work and tell me what you think! http://www.minecraftforge.net/forum/index.php/topic,8396.0.html I absolutely love her when she smiles
xgravebornx Posted June 17, 2013 Author Posted June 17, 2013 Thank you for replying! I tried this but get an error on line int meta = world.getBlockMetadata(x, y, z) the world.getMetadata is underlined, I'm not quite sure what to do with it? I'm sorry to be a pain, I'm still learning! Quote
Draco18s Posted June 17, 2013 Posted June 17, 2013 Thank you for replying! I tried this but get an error on line int meta = world.getBlockMetadata(x, y, z) the world.getMetadata is underlined, I'm not quite sure what to do with it? I'm sorry to be a pain, I'm still learning! Mouseover that underline and it'll tell you what the problem is. 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.
xgravebornx Posted June 18, 2013 Author Posted June 18, 2013 it says The method getBlockMetadata(int, int, int) in the type World is not applicable for the arguments (double, double, double), but all the options change the world.java file....I don't think I wanna change the world.java do I? I know I'm a pain in the butt, but I've been trying to figure this out for awhile! Quote
Mew Posted June 18, 2013 Posted June 18, 2013 the problem is you have but in double variables into int variable placeholders. Try casting them all to int's or just make them ints in the first place Quote I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
xgravebornx Posted June 18, 2013 Author Posted June 18, 2013 Well I'm trying, but with no luck.....lol this is driving me nuts! Quote
Draco18s Posted June 18, 2013 Posted June 18, 2013 Well I'm trying, but with no luck.....lol this is driving me nuts! world.getBlockMetadata((int)x, (int)y, (int)z)? 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.
redria7 Posted June 18, 2013 Posted June 18, 2013 MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)? Quote Read my thoughts on my summer mod work and tell me what you think! http://www.minecraftforge.net/forum/index.php/topic,8396.0.html I absolutely love her when she smiles
xgravebornx Posted June 18, 2013 Author Posted June 18, 2013 Draco, I kinda tried that before, but I tried your method too and got," Cannot make a static reference to the non-static method getBlockMetadata(int, int, int) from the type World", which changes the world.java again.... Redria7--I'm using my newly found skills lol and guessing that goes in the block class replacing my code-- int l = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);---which brings up a ton of errors....I really appreciate everyone's help, I know this is annoying...is there something i can do to help with helping? lol Quote
Draco18s Posted June 18, 2013 Posted June 18, 2013 Draco, I kinda tried that before, but I tried your method too and got," Cannot make a static reference to the non-static method getBlockMetadata(int, int, int) from the type World" world != World. The first is an instance the second is the class. 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.
xgravebornx Posted June 18, 2013 Author Posted June 18, 2013 it says world cannot be resolved...lol Quote
Draco18s Posted June 18, 2013 Posted June 18, 2013 it says world cannot be resolved...lol Gee. Did you try declaring it and defining it first? Variables aren't magic. 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.
xgravebornx Posted June 18, 2013 Author Posted June 18, 2013 No, I'm still learning all of this....not even sure I know how lol, but I guess I will work on that now! Quote
ObsequiousNewt Posted June 18, 2013 Posted June 18, 2013 it says world cannot be resolved...lol Gee. Did you try declaring it and defining it first? Variables aren't magic. Variables... aren't magic? You mean they LIED to me?! Draco, you've just ruined my childhood. Next thing you'll be telling me Santa Claus isn't real either. Quote BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
Draco18s Posted June 18, 2013 Posted June 18, 2013 Variables... aren't magic? You mean they LIED to me?! Draco, you've just ruined my childhood. Next thing you'll be telling me Santa Claus isn't real either. *Pokerface* 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.
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.