Confirmedusers
536
edits
m (→Common) |
m (Updated navbox to new content navbox.) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
{{GameVersion|uknown}} | {{GameVersion|uknown}} | ||
<languages/><translate> | |||
<!--T:1--> | |||
We highly recommend to read about {{ll|Modding:Asset_System#Domains|domains}} first. This tutorial will cover the basics of adding an entity to the game using JSON files. There is a full list of all properties which can be defined inside the json file {{ll|Modding:Entity Json Properties|here}}. | |||
= Little Figure = <!--T:2--> | |||
= Little Figure = | |||
<!--T:3--> | |||
The idea is create a little passive figure, made out of wood. The modid of our mod will be <code>figure</code>. | The idea is create a little passive figure, made out of wood. The modid of our mod will be <code>figure</code>. | ||
== EntityType == | == EntityType == <!--T:4--> | ||
=== Common === | === Common === <!--T:5--> | ||
<!--T:6--> | |||
So first of all we have to create the entity type file <code>assets/figure/entities/land/littlefigure.json</code>. Now we go through all the properties: | So first of all we have to create the entity type file <code>assets/figure/entities/land/littlefigure.json</code>. Now we go through all the properties: | ||
<!--T:7--> | |||
<code>code</code>: The unique identifier for your entity. A prefix of your mod id will be added automatically. Our case its <code>figure:littlefigure</code>. | <code>code</code>: The unique identifier for your entity. A prefix of your mod id will be added automatically. Our case its <code>figure:littlefigure</code>. | ||
<!--T:8--> | |||
<code>class</code>: The class of the entity, it can be used to program special features for it. We don't need it at the moment, so we set it to <code>EntityAgent</code>. | <code>class</code>: The class of the entity, it can be used to program special features for it. We don't need it at the moment, so we set it to <code>EntityAgent</code>. | ||
<!--T:9--> | |||
<code>hitboxSize</code>: The size of the hitbox. | <code>hitboxSize</code>: The size of the hitbox. | ||
<!--T:10--> | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
"hitboxSize": { | "hitboxSize": { | ||
Line 28: | Line 35: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:11--> | |||
<code>deadHitboxSize</code>: The size of the hitbox when the entity has died. | <code>deadHitboxSize</code>: The size of the hitbox when the entity has died. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 36: | Line 44: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:12--> | |||
<code>eyeHeight</code>: The height of the eyes, which is <code>0.4</code> for the little figure. | <code>eyeHeight</code>: The height of the eyes, which is <code>0.4</code> for the little figure. | ||
<!--T:13--> | |||
<code>drops</code>: A list of items to be dropped (can also include chances). We leave it empty for now: <code>[]</code>. | <code>drops</code>: A list of items to be dropped (can also include chances). We leave it empty for now: <code>[]</code>. | ||
<!--T:14--> | |||
<code>sounds</code>: Set the sounds for the entity | <code>sounds</code>: Set the sounds for the entity | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 47: | Line 58: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Client === | === Client === <!--T:15--> | ||
<!--T:16--> | |||
The client type has different properties for client and server. This will cover the client side (rendering, shape, texture) | The client type has different properties for client and server. This will cover the client side (rendering, shape, texture) | ||
<!--T:17--> | |||
(please note that // comments are actually not a valid json syntax, so if you want to use this json code in your projects, you'd have to remove these first) | (please note that // comments are actually not a valid json syntax, so if you want to use this json code in your projects, you'd have to remove these first) | ||
</translate> | |||
<syntaxhighlight lang=" | <syntaxhighlight lang="c#"> | ||
"client": { | "client": { | ||
"renderer": "Shape", // How the entity will be rendered, "Shape" is the right one in almost all cases. | "renderer": "Shape", // How the entity will be rendered, "Shape" is the right one in almost all cases. | ||
Line 380: | Line 393: | ||
{{Navbox/ | {{Navbox/contentmodding}} |