Jump to content

[1.8] Proper way to rotate a block


DJD

Recommended Posts

I need to be able to

 

1) get a block from the world (done).

2) rotate that block to the player's direction (done- but messy atm).

3) place the block back in the world (done).

 

I was wondering what the best way to rotate a block in this instance (right now I am manipulating the property "FACING" (if it exists) in its IBlockState) to face the correct direction. Is there a way to change ANY block's facing without having to manipulate the properties directly ?

 

Let me add a little more info as well:

a) I get a block from the world, save all its data to a file and bring it back. (this works)

b) I have to be able to bring the block back into existence and using the properties I've saved (this works)

c) Its when bringing back the block into the world and having to change the facing (because its not facing the original direction that it was selected from) that I am dealing with (works, but messy and has to deal directly with the FACING property).

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Link to comment
Share on other sites

Thanks, I'll give it a look see :D

 

I've got a cut/paste thing (multiple blocks) going for my mod and would prefer a better way to perform the paste portion with a rotation without having to directly manipulate the properties (which is messy)....

 

I did something similiar to your class (although not as well thought out as yours :)) for facing, but it seems messy....

 

I'm looking for a way to maybe use the block.rotateBlock instead as this will handle any other changes besides facing that have to be handled....

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Link to comment
Share on other sites

Suppose I could do that after I re-create the block. I would hope that any attachments (fences etc) are updated when the block is rotated as well. If not then it could get VERY ugly code :D

 

It does not seem to work- I set the BlockProperties correctly and it places the block, but when I attempt the rotate after that (passing block.rotateBlock(((EntityPlayer) sender).worldObj, pos, rot) it returns true but doesn't seem to update the world.

 

If its an older part of Forge, maybe its not working correctly since 1.8 ? Or is there another process to correctly using rotateBlock ?

 

 

For the record for now I've settled on a direction re-map function (I know the direction the block was "grabbed" and the player direction) and just re-map the grabbed direction based on the player direction (simple enough but it would be nice not to have to manipulate the facing property directly)....

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

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.