Jump to content

Recommended Posts

Posted

I have come across yet another problem: rotating blocks.

EDIT: This bit is fixed, but it throws an error on this line in the TileEntityRender Class:

        int facing = TileEntityThisEndUpSeat.getFacingDirection();

 

 

Block Class:

 

  Reveal hidden contents

 

 

TileEntity Class:

 

  Reveal hidden contents

 

 

TileEntityRender Class:

 

  Reveal hidden contents

 

Posted

You are using the static modifier wrong, if you use the static modifier on a variable or method, you are setting that variable or methods value universally. In your case, this means that all instances of your block are going to have the same orientation. So when you place a new block, it will update the orientation of all other instances of that block in the world.

 

To fix this, you need to remove the static modifiers.

 

So for example instead of:

public static void onBlockPlacedBy(...)

 

change it to:

public void onBlockPlacedBy(...)

 

Please research what the static modifiers mean. This is basic java.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Posted
  On 8/31/2014 at 4:24 PM, Chibill said:

Remove static from all the functions that us it..... and learn some basic java.

I DID, and it throws an error on this line:

        int facing = TileEntityThisEndUpSeat.getFacingDirection();

It says needs one of them to be static: the very one that is causing the problem: getFacingDirection.

Posted
  On 8/31/2014 at 7:36 PM, ThePhysician2000 said:

int facing = TileEntityThisEndUpSeat.getFacingDirection();

  Quote

Remove static from all the functions that us it..... and learn some basic java.

The answer is obvious when you do as Chibill said and then look at what you just posted.

Don't be an ass just because you don't know what you're doing and are being told that you don't.

 

(Edit: I even made an attempt to point it out for you.)

Posted
  On 8/31/2014 at 7:54 PM, TehSeph said:

  Quote

int facing = TileEntityThisEndUpSeat.getFacingDirection();

  Quote

Remove static from all the functions that us it..... and learn some basic java.

The answer is obvious when you do as Chibill said and then look at what you just posted.

Don't be an ass just because you don't know what you're doing and are being told that you don't.

 

(Edit: I even made an attempt to point it out for you.)

 

1. I am attempting to learn Java through modding. So, yeah, I am a noob.

2. I am not "being an ass" because everyone is telling me I don't know Java, all I said was when I remove all static from functions, it throws an error because it needs a global variable. To put it another way: "How do I stop this error?"

3. You are contradicting yourself. You first say: "you don't know what you're doing" and then you attempt to "point it out" where my error is. Now, if I am a noob, like both of us agree, how am I going to understand where I went wrong by simply italicizing a .class name of all things?

Posted

Learning Java through modding is not necessarily a bad idea, you just have to be cautious and make sure you know what code means. I learned Java through modding, which got me interested in programming, and I now know several other languages. Making a minecraft mod is more rewarding than making the console say "Hello, World."

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.