use of net.minecraft.util.Identifier in project Therrassium by codeman1o1.
the class Items method registerItems.
// Registering Items
public static void registerItems() {
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_ingot"), THERRASSIUM_INGOT);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_block"), THERRASSIUM_BLOCK);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_sword"), THERRASSIUM_SWORD);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_pickaxe"), THERRASSIUM_PICKAXE);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_axe"), THERRASSIUM_AXE);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_shovel"), THERRASSIUM_SHOVEL);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_hoe"), THERRASSIUM_HOE);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_helmet"), THERRASSIUM_HELMET);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_chestplate"), THERRASSIUM_CHESTPLATE);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_leggings"), THERRASSIUM_LEGGINGS);
Registry.register(Registry.ITEM, new Identifier(Therrassium.MOD_ID, "therrassium_boots"), THERRASSIUM_BOOTS);
}
use of net.minecraft.util.Identifier in project EnvironmentZ by Globox1997.
the class ItemInit method init.
public static void init() {
// Item
Registry.register(Registry.ITEM, new Identifier("environmentz", "heating_stones"), HEATING_STONES);
Registry.register(Registry.ITEM, new Identifier("environmentz", "heated_stones"), HEATED_STONES);
Registry.register(Registry.ITEM, new Identifier("environmentz", "wolf_pelt"), WOLF_PELT_ITEM);
Registry.register(Registry.ITEM, new Identifier("environmentz", "polar_bear_fur"), POLAR_BEAR_FUR_ITEM);
// Armor
Registry.register(Registry.ITEM, new Identifier("environmentz", "wolf_helmet"), WOLF_HELMET);
Registry.register(Registry.ITEM, new Identifier("environmentz", "wolf_chestplate"), WOLF_CHESTPLATE);
Registry.register(Registry.ITEM, new Identifier("environmentz", "wolf_leggings"), WOLF_LEGGINGS);
Registry.register(Registry.ITEM, new Identifier("environmentz", "wolf_boots"), WOLF_BOOTS);
// Potion
Registry.register(Registry.POTION, "cold_resistance", COLD_RESISTANCE);
Registry.register(Registry.POTION, "long_cold_resistance", LONG_COLD_RESISTANCE);
Registry.register(Registry.POTION, "overheating_resistance", OVERHEATING_RESISTANCE);
Registry.register(Registry.POTION, "long_overheating_resistance", LONG_OVERHEATING_RESISTANCE);
}
use of net.minecraft.util.Identifier in project nbt-crafting by Siphalor.
the class MixinIngredient method advancedEntryFromJson.
@Unique
private static IngredientEntry advancedEntryFromJson(JsonObject jsonObject) {
if (jsonObject.has("item") && jsonObject.has("tag")) {
throw new JsonParseException("An ingredient entry is either a tag or an item or a potion, not both");
}
if (jsonObject.has("item")) {
final Identifier identifier = new Identifier(JsonHelper.getString(jsonObject, "item"));
try {
final Item item = Registry.ITEM.getOrEmpty(identifier).orElseThrow(() -> {
throw new JsonSyntaxException("Unknown item '" + identifier.toString() + "'");
});
IngredientStackEntry entry = new IngredientStackEntry(Registry.ITEM.getRawId(item), loadIngredientEntryCondition(jsonObject));
if (jsonObject.has("remainder")) {
entry.setRecipeRemainder(ShapedRecipe.getItemStack(JsonHelper.getObject(jsonObject, "remainder")));
}
return entry;
} catch (Throwable e) {
e.printStackTrace();
return null;
}
}
if (jsonObject.has("potion")) {
final Identifier identifier = new Identifier(JsonHelper.getString(jsonObject, "potion"));
try {
Registry.POTION.getOrEmpty(identifier).orElseThrow(() -> {
throw new JsonSyntaxException("Unknown potion '" + identifier.toString() + "'");
});
IngredientEntryCondition condition = loadIngredientEntryCondition(jsonObject);
if (condition.requiredElements == NbtUtil.EMPTY_COMPOUND)
condition.requiredElements = new CompoundTag();
condition.requiredElements.putString("Potion", identifier.toString());
IngredientStackEntry entry = new IngredientStackEntry(Registry.ITEM.getRawId(Items.POTION), condition);
if (jsonObject.has("remainder")) {
entry.setRecipeRemainder(ShapedRecipe.getItemStack(JsonHelper.getObject(jsonObject, "remainder")));
}
return entry;
} catch (Throwable e) {
e.printStackTrace();
return null;
}
}
if (!jsonObject.has("tag")) {
throw new JsonParseException("An ingredient entry needs either a tag or an item");
}
final Identifier identifier2 = new Identifier(JsonHelper.getString(jsonObject, "tag"));
final Tag<Item> tag = ItemTags.getContainer().get(identifier2);
if (tag == null) {
throw new JsonSyntaxException("Unknown item tag '" + identifier2 + "'");
}
IngredientMultiStackEntry entry = new IngredientMultiStackEntry(tag.values().stream().map(Registry.ITEM::getRawId).collect(Collectors.toList()), loadIngredientEntryCondition(jsonObject));
entry.setTag(identifier2.toString());
if (jsonObject.has("remainder")) {
entry.setRecipeRemainder(ShapedRecipe.getItemStack(JsonHelper.getObject(jsonObject, "remainder")));
}
return entry;
}
use of net.minecraft.util.Identifier in project nbt-crafting by Siphalor.
the class NbtCrafting method registerRecipeType.
public static <T extends Recipe<?>> RecipeType<T> registerRecipeType(String name) {
Identifier recipeTypeId = new Identifier(MOD_ID, name);
RecipeTypeHelper.addToSyncBlacklist(recipeTypeId);
return Registry.register(Registry.RECIPE_TYPE, recipeTypeId, new RecipeType<T>() {
@Override
public String toString() {
return MOD_ID + ":" + name;
}
});
}
use of net.minecraft.util.Identifier in project nbt-crafting by Siphalor.
the class StatChangedCriterion method conditionsFromJson.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Conditions conditionsFromJson(JsonObject obj, JsonDeserializationContext context) {
Identifier statId = new Identifier(JsonHelper.getString(obj, "stat"));
StatType<?> statType = Registry.STAT_TYPE.getOrEmpty(statId).orElseThrow(() -> new JsonSyntaxException("Unknown stat: " + statId));
Identifier id = new Identifier(JsonHelper.getString(obj, "id"));
Object object = statType.getRegistry().get(id);
return new Conditions(statType, object, NumberRange.IntRange.fromJson(obj.get("range")));
}
Aggregations