Jump to content

directional problem


xgravebornx

Recommended Posts

  • 2 weeks later...

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?).

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

  • 2 weeks later...

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.

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

Link to comment
Share on other sites

  • 2 weeks later...

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.

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

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!

Link to comment
Share on other sites

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 :D

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 xD

Link to comment
Share on other sites

Well I'm trying, but with no luck.....lol this is driving me nuts!

 

world.getBlockMetadata((int)x, (int)y, (int)z)?

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

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

Link to comment
Share on other sites

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.

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

it says world cannot be resolved...lol

 

Gee.  Did you try declaring it and defining it first?  Variables aren't magic.

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

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.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Link to comment
Share on other sites

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*

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

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.