Search in sources :

Example 1 with ModResourceLocation

use of net.silentchaos512.gear.util.ModResourceLocation in project Silent-Gear by SilentChaos512.

the class PartType method create.

/**
 * Call during mod construction to create a new part type.
 *
 * @param builder Type builder
 * @return The new PartType
 * @throws IllegalArgumentException if a type with the same name already exists
 */
public static PartType create(Builder builder) {
    if (VALUES.containsKey(builder.name))
        throw new IllegalArgumentException(String.format("Already have PartType \"%s\"", builder.name));
    PartType type = new PartType(builder);
    VALUES.put(builder.name, type);
    if (!type.alias.isEmpty()) {
        VALUES.put(new ModResourceLocation(type.alias), type);
    }
    return type;
}
Also used : ModResourceLocation(net.silentchaos512.gear.util.ModResourceLocation)

Example 2 with ModResourceLocation

use of net.silentchaos512.gear.util.ModResourceLocation in project Silent-Gear by SilentChaos512.

the class PartType method fromJson.

public static PartType fromJson(JsonObject json, String key) {
    String str = GsonHelper.getAsString(json, key);
    PartType type = get(new ModResourceLocation(str));
    if (type == null) {
        throw new JsonSyntaxException("Unknown part type: " + str);
    }
    return type;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) ModResourceLocation(net.silentchaos512.gear.util.ModResourceLocation)

Example 3 with ModResourceLocation

use of net.silentchaos512.gear.util.ModResourceLocation in project Silent-Gear by SilentChaos512.

the class ModWorldFeatures method registerConfiguredFeature.

private static void registerConfiguredFeature(String name, ConfiguredFeature<?, ?> configuredFeature) {
    ModResourceLocation id = SilentGear.getId(name);
    debugLog("Register configured feature " + id);
    Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, configuredFeature);
}
Also used : ModResourceLocation(net.silentchaos512.gear.util.ModResourceLocation)

Aggregations

ModResourceLocation (net.silentchaos512.gear.util.ModResourceLocation)3 JsonSyntaxException (com.google.gson.JsonSyntaxException)1