Search in sources :

Example 1 with EntityPredicate

use of net.minecraft.advancements.critereon.EntityPredicate in project Railcraft by Railcraft.

the class CartPredicate method deserialize.

public static CartPredicate deserialize(@Nullable JsonElement element) {
    if (element == null || element.isJsonNull()) {
        return CartPredicate.ANY;
    }
    JsonObject object = JsonUtils.getJsonObject(element, "a cart predicate");
    Boolean highSpeed = JsonTools.nullableBoolean(object, CartConstants.TAG_HIGH_SPEED);
    Boolean launched = JsonTools.nullableBoolean(object, CartConstants.TAG_LAUNCHED);
    Boolean elevator = JsonTools.nullableBoolean(object, CartConstants.TAG_ELEVATOR);
    Boolean derail = JsonTools.nullableBoolean(object, CartConstants.TAG_DERAIL);
    Boolean canMount = JsonTools.nullableBoolean(object, "canMount");
    Boolean checksOwner = JsonTools.nullableBoolean(object, "check_owner");
    MinMaxBounds speed = MinMaxBounds.deserialize(object.get("speed"));
    EntityPredicate parent = EntityPredicate.deserialize(object);
    return new CartPredicate(highSpeed, launched, elevator, derail, canMount, checksOwner, speed, parent);
}
Also used : MinMaxBounds(net.minecraft.advancements.critereon.MinMaxBounds) EntityPredicate(net.minecraft.advancements.critereon.EntityPredicate) JsonObject(com.google.gson.JsonObject)

Aggregations

JsonObject (com.google.gson.JsonObject)1 EntityPredicate (net.minecraft.advancements.critereon.EntityPredicate)1 MinMaxBounds (net.minecraft.advancements.critereon.MinMaxBounds)1