Looking for feedback - Entity loot tables


  • Admin

    So, we need to sort of loot table system for Glowstone. Currently, Mojang uses a JSON-based, “pool” system file format. For example, this is the loot table for Cows in Vanilla (insert asset copyrighted by Mojang blah blah).

    Now, I suggested this file format for the Sheep loot. It has a YAML and a JSON version:

    YAML version

    # Entity Loot Table: SHEEP
    
    items: # Item drops
      -
        default:
          item: mutton
          count:
            min: 1
            max: 2
        conditions:
          - condition: ENTITY_ONFIRE # The mob is on fire
            item: cooked_mutton
      -
        default:
          item: wool
          count: 1
          data: $.getColor().getData() # byte Sheep.getColor().getData()
        conditions:
          - condition: $.isSheared() # boolean Sheep.isSheared()
            count: 0
    
    experience: # Experience drops
      count:
        min: 1
        max: 3
    

    JSON version

    {
      "items": [
        {
          "default": {
            "count": {
              "max": 2, 
              "min": 1
            }, 
            "item": "mutton"
          }, 
          "conditions": [
            {
              "item": "cooked_mutton", 
              "condition": "ENTITY_ONFIRE"
            }
          ]
        }, 
        {
          "default": {
            "count": 1, 
            "item": "wool", 
            "data": "$.getColor().getData()"
          }, 
          "conditions": [
            {
              "count": 0, 
              "condition": "$.isSheared()"
            }
          ]
        }
      ], 
      "experience": {
        "count": {
          "max": 3, 
          "min": 1
        }
      }
    }
    

    Note some characteristics of this format:

    • It uses Java reflection injection for some values ($.getColor().getData() and $.isSheared()). This is a format I created along with my utility, OneLineReflection. It allows getting values from the entity, the “context”, which is represented as $. For instance, the condition
    • Certain conditions and values are mapped. For example, ENTITY_ONFIRE is the equivalent of $.getFireTicks() > 0
    • For randomization, you can put children max and min (latter is not required). If the result is expected to be of fixed value, simply put it directly.

    Basically, I am asking for feedback on this format (the idea itself, the JSON/YAML format choice, etc.). What do you think?


  • Contributor

    #TeamJSON



  • #TeamJSON


  • Admin

    #TeamJSON


  • Admin

    OKAY OKAY I GET IT WE PICK JSON!!


  • Admin

    I’m with Jayson.


Log in to reply
 

Looks like your connection to Glowstone was lost, please wait while we try to reconnect.