Implement rotation logic
nevercast opened this issue ยท 4 comments
Add Forge rotation logic to OpenBlock and then make some nice abstraction across the board for all the in game blocks.
Then check that all their rendering and logic complies.
Assigned: MEEE
Things to consider:
Rotation is currently stored in metadata (4 directions, plus 2 flags, sometimes used for up/down)
Code for finding 2d and 3d rotations from a player angle are in BlockUtils. It also has methods for reversing that, and it has methods for getting the 2d or 3d rotation from the metadata.
ISurfaceAttachment also comes into this a bit, where if a block is an ISurfaceAttachment, it'll automatically break if its surface is broken.
Some blocks have even more rotation, but this might need to be dealt with differently. Lightbox, for example, can be placed on any surface but ALSO be rotated 4 directions on the up/down surface.
Finally, nice helper for managing textures on sides could be nice for this. SimpleBlockTextureHelper is a start, but it assumes that there's a 'top', 'bottom' and all sides are the same. Ideally it'd be much cleverer than that.
Oh, and double finally, if when blocks render in the inventory/hand, it'd be nice if they showed the 'front' of the block as the default. The way we have it set up currently it renders the back (i think?, I dunno).
This is completely different to the original concept. Care to share some information about the current implementation for us developers @mikeemoo ?
All blocks store their rotation in metadata. Its all just completely automatic now, just set the rotation mode and placement mode in the contructor. 24-rotation blocks arent really used yet so that functionality will prolly have bugs, however those extra levels of rotation are automatically injected into syncable objects.
Its all whizz bang now. Block breaker is the best block to look at to see how to manage textures.