MadAlchemist Posted December 15, 2021 Report Posted December 15, 2021 How can I attach an integer attribute to player or entity? For example, count how long player is under water?
DArkHekRoMaNT Posted December 16, 2021 Report Posted December 16, 2021 (edited) You can use WatchedAttributes for any Entity. Edited December 16, 2021 by DArkHekRoMaNT
MadAlchemist Posted December 17, 2021 Author Report Posted December 17, 2021 Found it, in jakecool19's mod "Lands of Chaos", which has more complex version of feature I want. It uses harmony, and I didn't fully understood how it works (I know java enough to mod minecraft, but new to C#). Are there some tutorials or examples of simple way to use it?
DArkHekRoMaNT Posted December 17, 2021 Report Posted December 17, 2021 1 hour ago, MadAlchemist said: Found it, in jakecool19's mod "Lands of Chaos", which has more complex version of feature I want. It uses harmony, and I didn't fully understood how it works (I know java enough to mod minecraft, but new to C#). Are there some tutorials or examples of simple way to use it? To store a value in an entity, you just need WatchedAttributes. If you need behavior, make a custom EntityBehavior and patch the player entity json. You can look at PlayerCorpse for an example: behavior, patch. All tutorials are on the wiki, but if it is possible not to use harmony, it is best not to use it. It makes the mod very fragile and sensitive to game updates (especially transpilers).
Recommended Posts