tModLoader Official tModLoader Help Thread

I want to conditionally modify the rotation of an item's sprite when it's used, such that the position of the item is unchanged but it is rotated differently. Player.itemRotation, as far as I know, can't be used for this purpose because it rotates the item around the player, not the item's origin. I'd like to be able to modify spriteBatch, but I don't know how to access that without a hook - and there doesn't seem to be a draw hook for on use, just in inventory and in world. How might I go about rotating this item?
 
What do you mean by "define an item's texture"? Do you mean like loading a texture?
I'm not sure if he's referring to my issue, but I think what he means is that there doesn't seem to be a way to do, say:
Spritebatch itemTexture = item.texture;
There's nothing in "item" that represents its texture (as far as I know), so you need to use a hook that has it as a parameter to modify it.

I hope I'm wrong, though, since otherwise it would be pretty rough to rotate an item in use around its origin.
 
I'm not sure if he's referring to my issue, but I think what he means is that there doesn't seem to be a way to do, say:
Spritebatch itemTexture = item.texture;
There's nothing in "item" that represents its texture (as far as I know), so you need to use a hook that has it as a parameter to modify it.

I hope I'm wrong, though, since otherwise it would be pretty rough to rotate an item in use around its origin.
From all my decompiling and stuff, the item is actually drawn using the PlayerLayer, so try the player hooks and check out, if you have ilSpy or have the source, check out the DrawPlayer() method in the Player class and use the find function and search item and you'll see the whole thing.
 
Back
Top Bottom