This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KnightMiner's profile picture

[MC 1.7.10/1.8.9] Rotate a tool peripheral's model

Started by KnightMiner, 13 February 2016 - 04:02 AM
KnightMiner #1
Posted 13 February 2016 - 05:02 AM
I noticed that by default turtles rotate the tool's model by 90 degrees, which makes tools like pickaxes look great, but ones like bows look terrible. I was wondering if there is any way to manually rotate it back for a tool without using a separate texture (as I'd prefer not to have a duplicate of the vanilla texture if possible).

I am pretty sure it is possible in 1.8 at least by modifying the Martix4f values, but I do not have enough of a grasp of those to understand how to do it. Meanwhile in 1.7.10 I really cannot find any methods related to rotating an IIcon
SquidDev #2
Posted 13 February 2016 - 09:15 AM
You should be able to use the Matrix4f.setRotation to set the rotation of the model. For 1.7.10 you might be able to subscribe to texture stitch events, load the original bow texture and rotate it. This would be better than manually creating a bow texture as it would work with resource packs.

I'll agree though: most non-tool items don't look as great when rotated.
KnightMiner #3
Posted 13 February 2016 - 06:26 PM
In 1.8 I managed to get the texture properly rotated using a rotational Matrix3f of -90 degrees and a Z offset afterward, so that will save me a texture in 1.8 at least

From the looks of it in 1.7.10 though, the way Dense Ores did its transformations involved splitting the image into pixels and processing them as an array. If I can find a similar function to the one they used that outputs a Matrix instead, it should be easy enough to rotate the texture myself with a 2 dimensional rotation matrix to send back to the sprite loader, but with how complicated it will be I really don't feel like messing with it for now (it will just use a separate texture for now)