User Tools

Site Tools


tutorial:entity-old

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:entity [2020/05/10 17:59] – Fix typo conorthedevtutorial:entity [2020/05/11 18:27] – [Entity Drops (loot tables)] conorthedev
Line 131: Line 131:
 Once this is complete, you should see the cookie creeper spawn in the wild (plains biome)! Once this is complete, you should see the cookie creeper spawn in the wild (plains biome)!
  
 +==== Entity Drops (loot tables) ====
 +When you kill the cookie creeper, at the moment it doesn't drop anything! For this example, We'll be making the cookie creeper drop 1 cookie every time you kill it.
 +
 +For this, we need to use loot tables. To get started, we're going to create the file that tells Minecraft what our entity loot table is (''resources/data/wiki_entity/loot_tables/entities/cookie_creeper.json''):
 +<code json>
 +{
 +  "type": "minecraft:entity",
 +  "pools": [
 +    {
 +      "rolls": 1,
 +      "entries": [
 +        {
 +          "type": "minecraft:item",
 +          "name": "minecraft:cookie"
 +        }
 +      ]
 +    }
 +  ]
 +}
 +</code>
 +
 +This tells Minecraft to always drop a cookie when our Cookie Creeper is killed.
 +You can add more entries by just creating another object in the ''entries'' array, e.g:
 +<code json>
 +"entries": [
 +  {
 +    "type": "minecraft:item",
 +    "name": "minecraft:cookie"
 +  },
 +  {
 +    "type": "minecraft:item",
 +    "name": "minecraft:gunpowder"
 +  }
 +]
 +</code>
 +
 +If all went well, you can start your game and start getting some cookies!
tutorial/entity-old.txt · Last modified: 2020/06/11 20:06 by draylar