Class SMetadata.Condition

java.lang.Object
net.lcc.sollib.api.common.data.runtime.metadata.SMetadata.Condition
Enclosing class:
SMetadata

public static class SMetadata.Condition extends Object
To add load conditions to a data/resource pack file, add a "load_condition" object to its metadata

There currently are 5 types of conditions:
- "dependency": Takes an extra mod argument. File will only be loaded if said namespace is running.
- "config": Takes an extra entry argument. File will only be loaded if the corresponding ConfigEntry evaluates to true. - "not": Takes another condition in a value field and inverts it.
- "and": Takes a list of conditions in a values field. Yields true only if every sub condition is true.
- "or": Takes a list of conditions in a values field. Yields true if at least one sub condition is true.

For example:
 {
   // rest of your metadata file
   "load_condition": {
     "type": "and",
     "values": [
       {
         "type": "config",
         "entry": "sollib/test:test_category.nested.exists"
       },
       {
         "type": "not",
         "value: {
           "type": "dependency",
           "mod": "fabric"
         }
       }
     ]
   }
 }
 
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    shouldLoad(com.google.gson.JsonObject condition)
     
    static boolean
    shouldLoad(net.minecraft.resources.ResourceLocation id, net.minecraft.server.packs.PackResources pack, net.minecraft.server.packs.PackType type)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Condition

      public Condition()
  • Method Details

    • shouldLoad

      public static boolean shouldLoad(net.minecraft.resources.ResourceLocation id, net.minecraft.server.packs.PackResources pack, net.minecraft.server.packs.PackType type)
    • shouldLoad

      public static boolean shouldLoad(com.google.gson.JsonObject condition)