mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +01:00
Migrate conventional tags
This commit is contained in:
parent
d67d4362ad
commit
79030b43c7
20 changed files with 182 additions and 98 deletions
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.unicopia;
|
package com.minelittlepony.unicopia;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
@ -10,8 +9,7 @@ import net.minecraft.util.Identifier;
|
||||||
public interface UConventionalTags {
|
public interface UConventionalTags {
|
||||||
interface Blocks {
|
interface Blocks {
|
||||||
TagKey<Block> CONCRETE_POWDERS = block("concrete_powders");
|
TagKey<Block> CONCRETE_POWDERS = block("concrete_powders");
|
||||||
TagKey<Block> CONCRETES = ConventionalBlockTags.CONCRETES;
|
|
||||||
TagKey<Block> GLAZED_TERRACOTTAS = ConventionalBlockTags.GLAZED_TERRACOTTAS;
|
|
||||||
TagKey<Block> CORAL_BLOCKS = block("coral_blocks");
|
TagKey<Block> CORAL_BLOCKS = block("coral_blocks");
|
||||||
TagKey<Block> CORAL_FANS = block("coral_fans");
|
TagKey<Block> CORAL_FANS = block("coral_fans");
|
||||||
TagKey<Block> CORALS = block("corals");
|
TagKey<Block> CORALS = block("corals");
|
||||||
|
@ -22,45 +20,38 @@ public interface UConventionalTags {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Items {
|
interface Items {
|
||||||
TagKey<Item> CONCRETE_POWDERS = item("concrete_powders");
|
|
||||||
TagKey<Item> CONCRETES = item("concretes");
|
TagKey<Item> CONCRETES = item("concretes");
|
||||||
TagKey<Item> GLAZED_TERRACOTTAS = item("glazed_terracottas");
|
|
||||||
TagKey<Item> CORAL_BLOCKS = item("coral_blocks");
|
TagKey<Item> CORAL_BLOCKS = item("coral_blocks");
|
||||||
TagKey<Item> CORAL_FANS = item("coral_fans");
|
TagKey<Item> CORAL_FANS = item("coral_fans");
|
||||||
TagKey<Item> CORALS = item("corals");
|
TagKey<Item> CORALS = item("corals");
|
||||||
|
|
||||||
TagKey<Item> APPLES = item("apples");
|
TagKey<Item> APPLES = item("foods/apple");
|
||||||
TagKey<Item> ACORNS = item("acorns");
|
TagKey<Item> ACORNS = item("foods/acorn");
|
||||||
TagKey<Item> PINECONES = item("pinecones");
|
TagKey<Item> PINECONES = item("foods/pinecone");
|
||||||
TagKey<Item> PINEAPPLES = item("pineapples");
|
TagKey<Item> PINEAPPLES = item("foods/pineapple");
|
||||||
TagKey<Item> BANANAS = item("bananas");
|
TagKey<Item> BANANAS = item("foods/banana");
|
||||||
TagKey<Item> STICKS = item("sticks");
|
|
||||||
TagKey<Item> SEEDS = item("seeds");
|
TagKey<Item> SEEDS = item("seeds");
|
||||||
TagKey<Item> GRAIN = item("grain");
|
TagKey<Item> GRAIN = item("grain");
|
||||||
TagKey<Item> NUTS = item("nuts");
|
TagKey<Item> NUTS = item("nuts");
|
||||||
TagKey<Item> MUSHROOMS = item("mushrooms");
|
TagKey<Item> MUSHROOMS = item("foods/mushroom");
|
||||||
TagKey<Item> MUFFINS = item("muffins");
|
TagKey<Item> MUFFINS = item("foods/muffin");
|
||||||
TagKey<Item> MANGOES = item("mangoes");
|
TagKey<Item> MANGOES = item("foods/mango");
|
||||||
TagKey<Item> OATMEALS = item("oatmeals");
|
TagKey<Item> OATMEALS = item("foods/oatmeal");
|
||||||
TagKey<Item> COOKIES = item("cookies");
|
TagKey<Item> COOKIES = item("foods/cookie");
|
||||||
|
|
||||||
TagKey<Item> FRUITS = item("fruits");
|
|
||||||
TagKey<Item> WORMS = item("worms");
|
TagKey<Item> WORMS = item("worms");
|
||||||
TagKey<Item> ROCKS = item("rocks");
|
TagKey<Item> ROCKS = item("rocks");
|
||||||
TagKey<Item> GEMS = item("gems");
|
TagKey<Item> GEMS = item("gems");
|
||||||
|
|
||||||
TagKey<Item> RAW_INSECT = item("raw_insect");
|
TagKey<Item> RAW_INSECT = item("foods/raw_insect");
|
||||||
TagKey<Item> COOKED_INSECT = item("cooked_insect");
|
TagKey<Item> COOKED_INSECT = item("foods/cooked_insect");
|
||||||
TagKey<Item> ROTTEN_INSECT = item("rotten_insect");
|
TagKey<Item> ROTTEN_INSECT = item("foods/rotten_insect");
|
||||||
|
|
||||||
TagKey<Item> RAW_FISH = item("raw_fish");
|
TagKey<Item> ROTTEN_FISH = item("foods/rotten_fish");
|
||||||
TagKey<Item> COOKED_FISH = item("cooked_fish");
|
|
||||||
TagKey<Item> ROTTEN_FISH = item("rotten_fish");
|
TagKey<Item> ROTTEN_MEAT = item("foods/rotten_meat");
|
||||||
TagKey<Item> RAW_MEAT = item("raw_meat");
|
TagKey<Item> DESSERTS = item("foods/dessert");
|
||||||
TagKey<Item> COOKED_MEAT = item("cooked_meat");
|
|
||||||
TagKey<Item> ROTTEN_MEAT = item("rotten_meat");
|
|
||||||
TagKey<Item> DESSERTS = item("desserts");
|
|
||||||
TagKey<Item> CANDY = item("candy");
|
|
||||||
|
|
||||||
TagKey<Item> CROPS_PEANUTS = item("crops/peanuts");
|
TagKey<Item> CROPS_PEANUTS = item("crops/peanuts");
|
||||||
TagKey<Item> TOOL_KNIVES = item("tools/knives");
|
TagKey<Item> TOOL_KNIVES = item("tools/knives");
|
||||||
|
|
|
@ -76,7 +76,7 @@ public interface UTags {
|
||||||
TagKey<Item> FORAGE_PRICKLY = item("forage/prickly");
|
TagKey<Item> FORAGE_PRICKLY = item("forage/prickly");
|
||||||
TagKey<Item> FORAGE_GLOWING = item("forage/glowing");
|
TagKey<Item> FORAGE_GLOWING = item("forage/glowing");
|
||||||
TagKey<Item> FORAGE_RISKY = item("forage/risky");
|
TagKey<Item> FORAGE_RISKY = item("forage/risky");
|
||||||
TagKey<Item> FORAGE_STRENGHENING = item("forage/strenghtening");
|
TagKey<Item> FORAGE_STRENGHENING = item("forage/strengthening");
|
||||||
TagKey<Item> FORAGE_SEVERE_NAUSEATING = item("forage/severe/nauseating");
|
TagKey<Item> FORAGE_SEVERE_NAUSEATING = item("forage/severe/nauseating");
|
||||||
TagKey<Item> FORAGE_SEVERE_PRICKLY = item("forage/severe/prickly");
|
TagKey<Item> FORAGE_SEVERE_PRICKLY = item("forage/severe/prickly");
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,11 @@ public class ModifierTooltipRenderer {
|
||||||
appendTooltip(stack, UDataComponentTypes.BUTTERFLY_VARIANT, context, textConsumer, type);
|
appendTooltip(stack, UDataComponentTypes.BUTTERFLY_VARIANT, context, textConsumer, type);
|
||||||
EnchantableItem.getSpellEffect(stack).appendTooltip(context, textConsumer, type);
|
EnchantableItem.getSpellEffect(stack).appendTooltip(context, textConsumer, type);
|
||||||
if (GlowableItem.isGlowing(stack)) {
|
if (GlowableItem.isGlowing(stack)) {
|
||||||
lines.add(Text.translatable("item.unicopia.friendship_bracelet.glowing").formatted(Formatting.ITALIC, Formatting.GRAY));
|
textConsumer.accept(Text.translatable("item.unicopia.friendship_bracelet.glowing").formatted(Formatting.ITALIC, Formatting.GRAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pony != null) {
|
if (pony != null) {
|
||||||
PonyDiets.getInstance().getDiet(pony).appendTooltip(stack, pony, lines, type);
|
PonyDiets.getInstance().getDiet(pony).appendTooltip(stack, pony, textConsumer, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.minelittlepony.unicopia.diet.affliction.StatusEffectAffliction;
|
||||||
import com.minelittlepony.unicopia.entity.effect.UEffects;
|
import com.minelittlepony.unicopia.entity.effect.UEffects;
|
||||||
import com.minelittlepony.unicopia.item.UFoodComponents;
|
import com.minelittlepony.unicopia.item.UFoodComponents;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags;
|
||||||
import net.minecraft.component.type.FoodComponent;
|
import net.minecraft.component.type.FoodComponent;
|
||||||
import net.minecraft.component.type.FoodComponents;
|
import net.minecraft.component.type.FoodComponents;
|
||||||
import net.minecraft.entity.effect.StatusEffects;
|
import net.minecraft.entity.effect.StatusEffects;
|
||||||
|
@ -28,9 +29,9 @@ public class FoodGroupsGenerator {
|
||||||
public void generate(BiConsumer<Identifier, FoodGroupEffects.Builder> exporter) {
|
public void generate(BiConsumer<Identifier, FoodGroupEffects.Builder> exporter) {
|
||||||
exporter.accept(Unicopia.id("baked_goods"), new FoodGroupEffects.Builder().tag(UTags.Items.BAKED_GOODS).food(FoodComponents.BREAD));
|
exporter.accept(Unicopia.id("baked_goods"), new FoodGroupEffects.Builder().tag(UTags.Items.BAKED_GOODS).food(FoodComponents.BREAD));
|
||||||
exporter.accept(Unicopia.id("bat_ponys_delight"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.MANGOES).food(UFoodComponents.MANGO));
|
exporter.accept(Unicopia.id("bat_ponys_delight"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.MANGOES).food(UFoodComponents.MANGO));
|
||||||
exporter.accept(Unicopia.id("candy"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.CANDY).food(UFoodComponents.CANDY));
|
exporter.accept(Unicopia.id("candy"), new FoodGroupEffects.Builder().tag(ConventionalItemTags.CANDY_FOODS).food(UFoodComponents.CANDY));
|
||||||
exporter.accept(Unicopia.id("desserts"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.DESSERTS).food(FoodComponents.COOKIE));
|
exporter.accept(Unicopia.id("desserts"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.DESSERTS).food(FoodComponents.COOKIE));
|
||||||
exporter.accept(Unicopia.id("fruit"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.FRUITS).food(UFoodComponents.BANANA));
|
exporter.accept(Unicopia.id("fruit"), new FoodGroupEffects.Builder().tag(ConventionalItemTags.FRUIT_FOODS).food(UFoodComponents.BANANA));
|
||||||
exporter.accept(Unicopia.id("rocks"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.ROCKS).tag(UTags.Items.ROCK_STEWS).food(FoodComponents.MUSHROOM_STEW));
|
exporter.accept(Unicopia.id("rocks"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.ROCKS).tag(UTags.Items.ROCK_STEWS).food(FoodComponents.MUSHROOM_STEW));
|
||||||
exporter.accept(Unicopia.id("gems"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.GEMS));
|
exporter.accept(Unicopia.id("gems"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.GEMS));
|
||||||
exporter.accept(Unicopia.id("shells"), new FoodGroupEffects.Builder().tag(UTags.Items.SHELLS).food(UFoodComponents.SHELL));
|
exporter.accept(Unicopia.id("shells"), new FoodGroupEffects.Builder().tag(UTags.Items.SHELLS).food(UFoodComponents.SHELL));
|
||||||
|
@ -46,10 +47,10 @@ public class FoodGroupsGenerator {
|
||||||
exporter.accept(Unicopia.id("pinecone"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.PINECONES).food(UFoodComponents.PINECONE).ailment(new HealingAffliction(1)));
|
exporter.accept(Unicopia.id("pinecone"), new FoodGroupEffects.Builder().tag(UConventionalTags.Items.PINECONES).food(UFoodComponents.PINECONE).ailment(new HealingAffliction(1)));
|
||||||
|
|
||||||
provideMeatCategory("fish",
|
provideMeatCategory("fish",
|
||||||
UConventionalTags.Items.COOKED_FISH, UConventionalTags.Items.RAW_FISH, UConventionalTags.Items.ROTTEN_FISH,
|
ConventionalItemTags.COOKED_FISH_FOODS, ConventionalItemTags.RAW_FISH_FOODS, UConventionalTags.Items.ROTTEN_FISH,
|
||||||
FoodComponents.COOKED_COD, FoodComponents.COD, FoodComponents.ROTTEN_FLESH, exporter);
|
FoodComponents.COOKED_COD, FoodComponents.COD, FoodComponents.ROTTEN_FLESH, exporter);
|
||||||
provideMeatCategory("meat",
|
provideMeatCategory("meat",
|
||||||
UConventionalTags.Items.COOKED_MEAT, UConventionalTags.Items.RAW_MEAT, UConventionalTags.Items.ROTTEN_MEAT,
|
ConventionalItemTags.COOKED_MEAT_FOODS, ConventionalItemTags.RAW_MEAT_FOODS, UConventionalTags.Items.ROTTEN_MEAT,
|
||||||
FoodComponents.COOKED_BEEF, FoodComponents.BEEF, FoodComponents.ROTTEN_FLESH, exporter);
|
FoodComponents.COOKED_BEEF, FoodComponents.BEEF, FoodComponents.ROTTEN_FLESH, exporter);
|
||||||
provideMeatCategory("insect",
|
provideMeatCategory("insect",
|
||||||
UConventionalTags.Items.COOKED_INSECT, UConventionalTags.Items.RAW_INSECT, UConventionalTags.Items.ROTTEN_INSECT,
|
UConventionalTags.Items.COOKED_INSECT, UConventionalTags.Items.RAW_INSECT, UConventionalTags.Items.ROTTEN_INSECT,
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import com.minelittlepony.unicopia.UConventionalTags;
|
|
||||||
import com.minelittlepony.unicopia.UTags;
|
import com.minelittlepony.unicopia.UTags;
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellDuplicatingRecipe;
|
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellDuplicatingRecipe;
|
||||||
|
@ -102,7 +101,7 @@ public class URecipeProvider extends FabricRecipeProvider {
|
||||||
.input(UTags.Items.MAGIC_FEATHERS)
|
.input(UTags.Items.MAGIC_FEATHERS)
|
||||||
.offerTo(exporter);
|
.offerTo(exporter);
|
||||||
ShapedRecipeJsonBuilder.create(RecipeCategory.COMBAT, Items.ARROW, 4)
|
ShapedRecipeJsonBuilder.create(RecipeCategory.COMBAT, Items.ARROW, 4)
|
||||||
.input('#', UConventionalTags.Items.STICKS)
|
.input('#', ConventionalItemTags.WOODEN_RODS)
|
||||||
.input('X', Items.FLINT).criterion("has_flint", conditionsFromItem(Items.FLINT))
|
.input('X', Items.FLINT).criterion("has_flint", conditionsFromItem(Items.FLINT))
|
||||||
.input('Y', UTags.Items.MAGIC_FEATHERS).criterion("has_feather", conditionsFromTag(UTags.Items.MAGIC_FEATHERS))
|
.input('Y', UTags.Items.MAGIC_FEATHERS).criterion("has_feather", conditionsFromTag(UTags.Items.MAGIC_FEATHERS))
|
||||||
.pattern("X")
|
.pattern("X")
|
||||||
|
@ -227,7 +226,7 @@ public class URecipeProvider extends FabricRecipeProvider {
|
||||||
// magic staff
|
// magic staff
|
||||||
ShapedRecipeJsonBuilder.create(RecipeCategory.TOOLS, UItems.MAGIC_STAFF)
|
ShapedRecipeJsonBuilder.create(RecipeCategory.TOOLS, UItems.MAGIC_STAFF)
|
||||||
.input('*', UItems.GEMSTONE).criterion("has_gemstone", conditionsFromItem(UItems.GEMSTONE))
|
.input('*', UItems.GEMSTONE).criterion("has_gemstone", conditionsFromItem(UItems.GEMSTONE))
|
||||||
.input('#', UConventionalTags.Items.STICKS).criterion("has_stick", conditionsFromTag(UConventionalTags.Items.STICKS))
|
.input('#', ConventionalItemTags.WOODEN_RODS).criterion("has_stick", conditionsFromTag(ConventionalItemTags.WOODEN_RODS))
|
||||||
.pattern(" *")
|
.pattern(" *")
|
||||||
.pattern(" # ")
|
.pattern(" # ")
|
||||||
.pattern("# ")
|
.pattern("# ")
|
||||||
|
@ -269,7 +268,7 @@ public class URecipeProvider extends FabricRecipeProvider {
|
||||||
// meadowbrook's staff
|
// meadowbrook's staff
|
||||||
ShapedRecipeJsonBuilder.create(RecipeCategory.TOOLS, UItems.MEADOWBROOKS_STAFF)
|
ShapedRecipeJsonBuilder.create(RecipeCategory.TOOLS, UItems.MEADOWBROOKS_STAFF)
|
||||||
.input('*', UItems.GEMSTONE).criterion(hasItem(UItems.GEMSTONE), conditionsFromItem(UItems.GEMSTONE))
|
.input('*', UItems.GEMSTONE).criterion(hasItem(UItems.GEMSTONE), conditionsFromItem(UItems.GEMSTONE))
|
||||||
.input('/', UConventionalTags.Items.STICKS).criterion(hasItem(Items.STICK), conditionsFromTag(UConventionalTags.Items.STICKS))
|
.input('/', ConventionalItemTags.WOODEN_RODS).criterion(hasItem(Items.STICK), conditionsFromTag(ConventionalItemTags.WOODEN_RODS))
|
||||||
.pattern(" *")
|
.pattern(" *")
|
||||||
.pattern(" / ")
|
.pattern(" / ")
|
||||||
.pattern("/ ")
|
.pattern("/ ")
|
||||||
|
@ -378,7 +377,7 @@ public class URecipeProvider extends FabricRecipeProvider {
|
||||||
appendIngredients(ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, UItems.MUFFIN), Items.SUGAR, Items.EGG, Items.POTATO, UItems.JUICE, UItems.WHEAT_WORMS).offerTo(exporter);
|
appendIngredients(ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, UItems.MUFFIN), Items.SUGAR, Items.EGG, Items.POTATO, UItems.JUICE, UItems.WHEAT_WORMS).offerTo(exporter);
|
||||||
ShapedRecipeJsonBuilder.create(RecipeCategory.MISC, UItems.MUG)
|
ShapedRecipeJsonBuilder.create(RecipeCategory.MISC, UItems.MUG)
|
||||||
.input('*', Items.IRON_NUGGET).criterion(hasItem(Items.IRON_NUGGET), conditionsFromItem(Items.IRON_NUGGET))
|
.input('*', Items.IRON_NUGGET).criterion(hasItem(Items.IRON_NUGGET), conditionsFromItem(Items.IRON_NUGGET))
|
||||||
.input('#', UConventionalTags.Items.STICKS).criterion(hasItem(Items.STICK), conditionsFromTag(UConventionalTags.Items.STICKS))
|
.input('#', ConventionalItemTags.WOODEN_RODS).criterion(hasItem(Items.STICK), conditionsFromTag(ConventionalItemTags.WOODEN_RODS))
|
||||||
.pattern("# #")
|
.pattern("# #")
|
||||||
.pattern("* *")
|
.pattern("* *")
|
||||||
.pattern(" # ")
|
.pattern(" # ")
|
||||||
|
@ -442,7 +441,7 @@ public class URecipeProvider extends FabricRecipeProvider {
|
||||||
.input(UItems.TOAST, 8)
|
.input(UItems.TOAST, 8)
|
||||||
.offerTo(exporter);
|
.offerTo(exporter);
|
||||||
ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, UItems.CANDIED_APPLE)
|
ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, UItems.CANDIED_APPLE)
|
||||||
.input(UConventionalTags.Items.STICKS)
|
.input(ConventionalItemTags.WOODEN_RODS)
|
||||||
.input(UTags.Items.FRESH_APPLES).criterion(hasItem(Items.APPLE), conditionsFromTag(UTags.Items.FRESH_APPLES))
|
.input(UTags.Items.FRESH_APPLES).criterion(hasItem(Items.APPLE), conditionsFromTag(UTags.Items.FRESH_APPLES))
|
||||||
.input(Items.SUGAR, 4)
|
.input(Items.SUGAR, 4)
|
||||||
.offerTo(exporter);
|
.offerTo(exporter);
|
||||||
|
@ -610,7 +609,7 @@ public class URecipeProvider extends FabricRecipeProvider {
|
||||||
public static void offerPolearmRecipe(RecipeExporter exporter, ItemConvertible output, Either<ItemConvertible, TagKey<Item>> input) {
|
public static void offerPolearmRecipe(RecipeExporter exporter, ItemConvertible output, Either<ItemConvertible, TagKey<Item>> input) {
|
||||||
CraftingMaterialHelper
|
CraftingMaterialHelper
|
||||||
.input(ShapedRecipeJsonBuilder.create(RecipeCategory.TOOLS, output), 'o', input).criterion(CraftingMaterialHelper.hasEither(input), CraftingMaterialHelper.conditionsFromEither(input))
|
.input(ShapedRecipeJsonBuilder.create(RecipeCategory.TOOLS, output), 'o', input).criterion(CraftingMaterialHelper.hasEither(input), CraftingMaterialHelper.conditionsFromEither(input))
|
||||||
.input('#', UConventionalTags.Items.STICKS)
|
.input('#', ConventionalItemTags.WOODEN_RODS)
|
||||||
.pattern(" o")
|
.pattern(" o")
|
||||||
.pattern(" # ")
|
.pattern(" # ")
|
||||||
.pattern("# ")
|
.pattern("# ")
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.minelittlepony.unicopia.server.world.UTreeGen;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
||||||
|
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags;
|
||||||
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags;
|
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.data.family.BlockFamily;
|
import net.minecraft.data.family.BlockFamily;
|
||||||
|
@ -228,8 +229,8 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
.toArray(Item[]::new))
|
.toArray(Item[]::new))
|
||||||
.add(UBlocks.UNSTABLE_CLOUD.asItem(), UBlocks.CLOUD_PILLAR.asItem(), UBlocks.CLOUD_DOOR.asItem(), UBlocks.CLOUD_BED.asItem())
|
.add(UBlocks.UNSTABLE_CLOUD.asItem(), UBlocks.CLOUD_PILLAR.asItem(), UBlocks.CLOUD_DOOR.asItem(), UBlocks.CLOUD_BED.asItem())
|
||||||
.forceAddTag(UTags.Items.BED_SHEETS)
|
.forceAddTag(UTags.Items.BED_SHEETS)
|
||||||
.forceAddTag(UConventionalTags.Items.RAW_FISH)
|
.forceAddTag(ConventionalItemTags.RAW_FISH_FOODS)
|
||||||
.forceAddTag(UConventionalTags.Items.COOKED_FISH)
|
.forceAddTag(ConventionalItemTags.COOKED_FISH_FOODS)
|
||||||
.forceAddTag(UConventionalTags.Items.ROTTEN_FISH)
|
.forceAddTag(UConventionalTags.Items.ROTTEN_FISH)
|
||||||
.forceAddTag(UTags.Items.CLOUD_JARS)
|
.forceAddTag(UTags.Items.CLOUD_JARS)
|
||||||
.add(UItems.LIGHTNING_JAR)
|
.add(UItems.LIGHTNING_JAR)
|
||||||
|
@ -287,8 +288,8 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
UBlocks.MYSTERIOUS_EGG.asItem(), UItems.GREEN_FRIED_EGG,
|
UBlocks.MYSTERIOUS_EGG.asItem(), UItems.GREEN_FRIED_EGG,
|
||||||
UBlocks.HIVE.asItem()
|
UBlocks.HIVE.asItem()
|
||||||
)
|
)
|
||||||
.forceAddTag(UConventionalTags.Items.RAW_MEAT)
|
.forceAddTag(ConventionalItemTags.RAW_MEAT_FOODS)
|
||||||
.forceAddTag(UConventionalTags.Items.COOKED_MEAT)
|
.forceAddTag(ConventionalItemTags.COOKED_MEAT_FOODS)
|
||||||
.forceAddTag(UConventionalTags.Items.ROTTEN_MEAT)
|
.forceAddTag(UConventionalTags.Items.ROTTEN_MEAT)
|
||||||
.forceAddTag(UConventionalTags.Items.RAW_INSECT)
|
.forceAddTag(UConventionalTags.Items.RAW_INSECT)
|
||||||
.forceAddTag(UConventionalTags.Items.COOKED_INSECT)
|
.forceAddTag(UConventionalTags.Items.COOKED_INSECT)
|
||||||
|
@ -303,9 +304,7 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exportConventionalTags() {
|
private void exportConventionalTags() {
|
||||||
copy(UConventionalTags.Blocks.CONCRETES, UConventionalTags.Items.CONCRETES);
|
copy(ConventionalBlockTags.CONCRETES, UConventionalTags.Items.CONCRETES);
|
||||||
copy(UConventionalTags.Blocks.CONCRETE_POWDERS, UConventionalTags.Items.CONCRETE_POWDERS);
|
|
||||||
copy(UConventionalTags.Blocks.GLAZED_TERRACOTTAS, UConventionalTags.Items.GLAZED_TERRACOTTAS);
|
|
||||||
copy(UConventionalTags.Blocks.CORAL_BLOCKS, UConventionalTags.Items.CORAL_BLOCKS);
|
copy(UConventionalTags.Blocks.CORAL_BLOCKS, UConventionalTags.Items.CORAL_BLOCKS);
|
||||||
copy(UConventionalTags.Blocks.CORAL_FANS, UConventionalTags.Items.CORAL_FANS);
|
copy(UConventionalTags.Blocks.CORAL_FANS, UConventionalTags.Items.CORAL_FANS);
|
||||||
copy(UConventionalTags.Blocks.CORALS, UConventionalTags.Items.CORALS);
|
copy(UConventionalTags.Blocks.CORALS, UConventionalTags.Items.CORALS);
|
||||||
|
@ -316,15 +315,14 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
.addOptionalTag(Identifier.of("c", "pyrite_apples")) // no idea which mod add pyrite apples
|
.addOptionalTag(Identifier.of("c", "pyrite_apples")) // no idea which mod add pyrite apples
|
||||||
;
|
;
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.BANANAS).add(UItems.BANANA);
|
getOrCreateTagBuilder(UConventionalTags.Items.BANANAS).add(UItems.BANANA);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.RAW_FISH).add(Items.COD, Items.SALMON, Items.PUFFERFISH, Items.TROPICAL_FISH).addOptionalTag(Identifier.of("c", "mollusks"));
|
getOrCreateTagBuilder(ConventionalItemTags.RAW_FISH_FOODS).addOptionalTag(Identifier.of("c", "mollusks"));
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_FISH).add(Items.COOKED_COD, Items.COOKED_SALMON, UItems.COOKED_TROPICAL_FISH, UItems.COOKED_PUFFERFISH, UItems.FRIED_AXOLOTL);
|
getOrCreateTagBuilder(ConventionalItemTags.COOKED_FISH_FOODS).add(UItems.COOKED_TROPICAL_FISH, UItems.COOKED_PUFFERFISH, UItems.FRIED_AXOLOTL);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.ROTTEN_FISH).add(UItems.ROTTEN_COD, UItems.ROTTEN_TROPICAL_FISH, UItems.ROTTEN_SALMON, UItems.ROTTEN_PUFFERFISH);
|
getOrCreateTagBuilder(UConventionalTags.Items.ROTTEN_FISH).add(UItems.ROTTEN_COD, UItems.ROTTEN_TROPICAL_FISH, UItems.ROTTEN_SALMON, UItems.ROTTEN_PUFFERFISH);
|
||||||
getOrCreateTagBuilder(ItemTags.FISHES).add(
|
getOrCreateTagBuilder(ItemTags.FISHES).add(
|
||||||
UItems.COOKED_TROPICAL_FISH, UItems.COOKED_PUFFERFISH, UItems.FRIED_AXOLOTL,
|
UItems.COOKED_TROPICAL_FISH, UItems.COOKED_PUFFERFISH, UItems.FRIED_AXOLOTL,
|
||||||
UItems.ROTTEN_COD, UItems.ROTTEN_TROPICAL_FISH, UItems.ROTTEN_SALMON, UItems.ROTTEN_PUFFERFISH
|
UItems.ROTTEN_COD, UItems.ROTTEN_TROPICAL_FISH, UItems.ROTTEN_SALMON, UItems.ROTTEN_PUFFERFISH
|
||||||
);
|
);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_MEAT)
|
getOrCreateTagBuilder(ConventionalItemTags.COOKED_MEAT_FOODS)
|
||||||
.add(Items.COOKED_PORKCHOP, Items.COOKED_BEEF, Items.COOKED_MUTTON, Items.COOKED_RABBIT, Items.COOKED_CHICKEN, Items.RABBIT_STEW)
|
|
||||||
.addOptionalTag(Identifier.of("c", "cooked_bacon"))
|
.addOptionalTag(Identifier.of("c", "cooked_bacon"))
|
||||||
.addOptionalTag(Identifier.of("c", "cooked_beef"))
|
.addOptionalTag(Identifier.of("c", "cooked_beef"))
|
||||||
.addOptionalTag(Identifier.of("c", "cooked_chicken"))
|
.addOptionalTag(Identifier.of("c", "cooked_chicken"))
|
||||||
|
@ -335,8 +333,7 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
.addOptionalTag(Identifier.of("c", "pork_and_beans"))
|
.addOptionalTag(Identifier.of("c", "pork_and_beans"))
|
||||||
.addOptionalTag(Identifier.of("c", "pork_jerkies"))
|
.addOptionalTag(Identifier.of("c", "pork_jerkies"))
|
||||||
.addOptionalTag(Identifier.of("c", "protien"));
|
.addOptionalTag(Identifier.of("c", "protien"));
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.RAW_MEAT)
|
getOrCreateTagBuilder(ConventionalItemTags.RAW_MEAT_FOODS)
|
||||||
.add(Items.PORKCHOP, Items.BEEF, Items.MUTTON, Items.RABBIT, Items.CHICKEN)
|
|
||||||
.addOptionalTag(Identifier.of("c", "raw_bacon"))
|
.addOptionalTag(Identifier.of("c", "raw_bacon"))
|
||||||
.addOptionalTag(Identifier.of("c", "raw_beef"))
|
.addOptionalTag(Identifier.of("c", "raw_beef"))
|
||||||
.addOptionalTag(Identifier.of("c", "raw_chicken"))
|
.addOptionalTag(Identifier.of("c", "raw_chicken"))
|
||||||
|
@ -348,7 +345,6 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_INSECT).add(UItems.COOKED_FROG_LEGS);
|
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_INSECT).add(UItems.COOKED_FROG_LEGS);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.RAW_INSECT).add(Items.SPIDER_EYE, UItems.BUTTERFLY, UItems.FROG_LEGS, UItems.WHEAT_WORMS, UBlocks.WORM_BLOCK.asItem());
|
getOrCreateTagBuilder(UConventionalTags.Items.RAW_INSECT).add(Items.SPIDER_EYE, UItems.BUTTERFLY, UItems.FROG_LEGS, UItems.WHEAT_WORMS, UBlocks.WORM_BLOCK.asItem());
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.WORMS).add(UItems.WHEAT_WORMS);
|
getOrCreateTagBuilder(UConventionalTags.Items.WORMS).add(UItems.WHEAT_WORMS);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.STICKS).add(Items.STICK);
|
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.ROCKS).add(UItems.ROCK);
|
getOrCreateTagBuilder(UConventionalTags.Items.ROCKS).add(UItems.ROCK);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.GEMS).add(UItems.GEMSTONE, UItems.BOTCHED_GEM);
|
getOrCreateTagBuilder(UConventionalTags.Items.GEMS).add(UItems.GEMSTONE, UItems.BOTCHED_GEM);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.PINECONES).add(UItems.PINECONE);
|
getOrCreateTagBuilder(UConventionalTags.Items.PINECONES).add(UItems.PINECONE);
|
||||||
|
@ -368,7 +364,7 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
.addOptional(Identifier.of("garnished", "nuts"))
|
.addOptional(Identifier.of("garnished", "nuts"))
|
||||||
.addOptional(Identifier.of("garnished", "nut_mix"))
|
.addOptional(Identifier.of("garnished", "nut_mix"))
|
||||||
.addOptional(Identifier.of("garnished", "neverable_delecacies"));
|
.addOptional(Identifier.of("garnished", "neverable_delecacies"));
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.FRUITS)
|
getOrCreateTagBuilder(ConventionalItemTags.FRUIT_FOODS)
|
||||||
.add(Items.MELON_SLICE, Items.SWEET_BERRIES, Items.GLOW_BERRIES, Items.CHORUS_FRUIT)
|
.add(Items.MELON_SLICE, Items.SWEET_BERRIES, Items.GLOW_BERRIES, Items.CHORUS_FRUIT)
|
||||||
.add(UItems.JUICE, UItems.ZAP_APPLE, UItems.ZAP_BULB)
|
.add(UItems.JUICE, UItems.ZAP_APPLE, UItems.ZAP_BULB)
|
||||||
.forceAddTag(UConventionalTags.Items.MANGOES)
|
.forceAddTag(UConventionalTags.Items.MANGOES)
|
||||||
|
@ -377,7 +373,7 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
.forceAddTag(UConventionalTags.Items.BANANAS)
|
.forceAddTag(UConventionalTags.Items.BANANAS)
|
||||||
.addOptionalTag(Identifier.of("garnished", "berries"));
|
.addOptionalTag(Identifier.of("garnished", "berries"));
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.DESSERTS).add(Items.CAKE, UItems.APPLE_PIE_SLICE).forceAddTag(UTags.Items.PIES);
|
getOrCreateTagBuilder(UConventionalTags.Items.DESSERTS).add(Items.CAKE, UItems.APPLE_PIE_SLICE).forceAddTag(UTags.Items.PIES);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.CANDY).add(Items.SUGAR, UItems.ROCK_CANDY, UItems.CANDIED_APPLE);
|
getOrCreateTagBuilder(ConventionalItemTags.CANDY_FOODS).add(Items.SUGAR, UItems.ROCK_CANDY, UItems.CANDIED_APPLE);
|
||||||
getOrCreateTagBuilder(UTags.Items.BAKED_GOODS).add(
|
getOrCreateTagBuilder(UTags.Items.BAKED_GOODS).add(
|
||||||
Items.BREAD, Items.COOKIE, Items.PUMPKIN_PIE,
|
Items.BREAD, Items.COOKIE, Items.PUMPKIN_PIE,
|
||||||
UItems.MUFFIN, UItems.SCONE, UItems.COOKED_ZAP_APPLE, UItems.TOAST, UItems.BURNED_TOAST, UItems.JAM_TOAST, UItems.IMPORTED_OATS,
|
UItems.MUFFIN, UItems.SCONE, UItems.COOKED_ZAP_APPLE, UItems.TOAST, UItems.BURNED_TOAST, UItems.JAM_TOAST, UItems.IMPORTED_OATS,
|
||||||
|
@ -392,18 +388,18 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
.addOptional(Identifier.of("farmersdelight", "melon_juice"));
|
.addOptional(Identifier.of("farmersdelight", "melon_juice"));
|
||||||
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("farmersdelight", "cabbage_roll_ingredients"))).add(UItems.OATS, UItems.ROCK, UItems.WHEAT_WORMS);
|
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("farmersdelight", "cabbage_roll_ingredients"))).add(UItems.OATS, UItems.ROCK, UItems.WHEAT_WORMS);
|
||||||
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("farmersdelight", "comfort_foods"))).add(UItems.OATMEAL, UItems.ROCK_STEW, UItems.MUFFIN);
|
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("farmersdelight", "comfort_foods"))).add(UItems.OATMEAL, UItems.ROCK_STEW, UItems.MUFFIN);
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.RAW_FISH)
|
getOrCreateTagBuilder(ConventionalItemTags.RAW_FISH_FOODS)
|
||||||
.addOptional(Identifier.of("farmersdelight", "cod_roll"))
|
.addOptional(Identifier.of("farmersdelight", "cod_roll"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "salmon_roll"))
|
.addOptional(Identifier.of("farmersdelight", "salmon_roll"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "cod_slice"))
|
.addOptional(Identifier.of("farmersdelight", "cod_slice"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "salmon_slice"));
|
.addOptional(Identifier.of("farmersdelight", "salmon_slice"));
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_FISH)
|
getOrCreateTagBuilder(ConventionalItemTags.COOKED_FISH_FOODS)
|
||||||
.addOptional(Identifier.of("farmersdelight", "fish_stew"))
|
.addOptional(Identifier.of("farmersdelight", "fish_stew"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "baked_cod_stew"))
|
.addOptional(Identifier.of("farmersdelight", "baked_cod_stew"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "grilled_salmon"));
|
.addOptional(Identifier.of("farmersdelight", "grilled_salmon"));
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.RAW_MEAT)
|
getOrCreateTagBuilder(ConventionalItemTags.RAW_MEAT_FOODS)
|
||||||
.addOptional(Identifier.of("farmersdelight", "ham"));
|
.addOptional(Identifier.of("farmersdelight", "ham"));
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_MEAT)
|
getOrCreateTagBuilder(ConventionalItemTags.COOKED_MEAT_FOODS)
|
||||||
.addOptional(Identifier.of("farmersdelight", "chicken_soup"))
|
.addOptional(Identifier.of("farmersdelight", "chicken_soup"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "bacon_and_eggs"))
|
.addOptional(Identifier.of("farmersdelight", "bacon_and_eggs"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "pasta_with_meatballs"))
|
.addOptional(Identifier.of("farmersdelight", "pasta_with_meatballs"))
|
||||||
|
@ -422,7 +418,7 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||||
.addOptional(Identifier.of("farmersdelight", "steak_and_potatoes"))
|
.addOptional(Identifier.of("farmersdelight", "steak_and_potatoes"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "roasted_mutton_chops"))
|
.addOptional(Identifier.of("farmersdelight", "roasted_mutton_chops"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "pasta_with_mutton_chop"));
|
.addOptional(Identifier.of("farmersdelight", "pasta_with_mutton_chop"));
|
||||||
getOrCreateTagBuilder(UConventionalTags.Items.FRUITS)
|
getOrCreateTagBuilder(ConventionalItemTags.FRUIT_FOODS)
|
||||||
.addOptional(Identifier.of("farmersdelight", "pumpkin_slice"))
|
.addOptional(Identifier.of("farmersdelight", "pumpkin_slice"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "tomato"))
|
.addOptional(Identifier.of("farmersdelight", "tomato"))
|
||||||
.addOptional(Identifier.of("farmersdelight", "melon_juice"))
|
.addOptional(Identifier.of("farmersdelight", "melon_juice"))
|
||||||
|
|
|
@ -25,7 +25,6 @@ import net.minecraft.network.codec.PacketCodecs;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.UseAction;
|
|
||||||
|
|
||||||
public record DietProfile(
|
public record DietProfile(
|
||||||
float defaultMultiplier,
|
float defaultMultiplier,
|
||||||
|
@ -122,34 +121,31 @@ public record DietProfile(
|
||||||
return Pair.of(hungerMultiplier, saturationMultiplier);
|
return Pair.of(hungerMultiplier, saturationMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void appendTooltip(ItemStack stack, @Nullable Pony pony, List<Text> tooltip, TooltipType context) {
|
public void appendTooltip(ItemStack stack, @Nullable Pony pony, Consumer<Text> tooltip, TooltipType context) {
|
||||||
if (this == EMPTY) {
|
if (this == EMPTY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltip.add(Text.translatable("unicopia.diet.information").formatted(Formatting.DARK_PURPLE));
|
|
||||||
findEffect(stack).orElseGet(() -> PonyDiets.getInstance().getEffects(stack)).appendTooltip(stack, tooltip, context);
|
|
||||||
|
|
||||||
var food = stack.get(DataComponentTypes.FOOD);
|
var food = stack.get(DataComponentTypes.FOOD);
|
||||||
var ratios = getRatios(stack);
|
var ratios = getRatios(stack);
|
||||||
|
|
||||||
if (food == null || isInedible(ratios)) {
|
if (food == null || isInedible(ratios)) {
|
||||||
if (stack.getUseAction() != UseAction.DRINK) {
|
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable("unicopia.diet.not_edible")).formatted(Formatting.DARK_GRAY));
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tooltip.accept(Text.translatable("unicopia.diet.information").formatted(Formatting.DARK_PURPLE));
|
||||||
|
findEffect(stack).orElseGet(() -> PonyDiets.getInstance().getEffects(stack)).appendTooltip(stack, tooltip, context);
|
||||||
|
|
||||||
float baseMultiplier = (isForaged(stack) ? foragingMultiplier() : defaultMultiplier());
|
float baseMultiplier = (isForaged(stack) ? foragingMultiplier() : defaultMultiplier());
|
||||||
|
|
||||||
if (context.isAdvanced()) {
|
if (context.isAdvanced()) {
|
||||||
var nonAdjustedFood = getNonAdjustedFoodComponent(stack, pony).orElse(food);
|
var nonAdjustedFood = getNonAdjustedFoodComponent(stack, pony).orElse(food);
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable("unicopia.diet.base_multiplier", baseMultiplier).formatted(Formatting.DARK_GRAY)));
|
tooltip.accept(Text.literal(" ").append(Text.translatable("unicopia.diet.base_multiplier", baseMultiplier).formatted(Formatting.DARK_GRAY)));
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable("unicopia.diet.hunger.detailed", food.nutrition(), nonAdjustedFood.nutrition(), (int)(ratios.getFirst() * 100))).formatted(Formatting.DARK_GRAY));
|
tooltip.accept(Text.literal(" ").append(Text.translatable("unicopia.diet.hunger.detailed", food.nutrition(), nonAdjustedFood.nutrition(), (int)(ratios.getFirst() * 100))).formatted(Formatting.DARK_GRAY));
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable("unicopia.diet.saturation.detailed", food.saturation(), nonAdjustedFood.saturation(), (int)(ratios.getSecond() * 100))).formatted(Formatting.DARK_GRAY));
|
tooltip.accept(Text.literal(" ").append(Text.translatable("unicopia.diet.saturation.detailed", food.saturation(), nonAdjustedFood.saturation(), (int)(ratios.getSecond() * 100))).formatted(Formatting.DARK_GRAY));
|
||||||
} else {
|
} else {
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable("unicopia.diet.hunger", (int)(ratios.getFirst() * 100))).formatted(Formatting.DARK_GRAY));
|
tooltip.accept(Text.literal(" ").append(Text.translatable("unicopia.diet.hunger", (int)(ratios.getFirst() * 100))).formatted(Formatting.DARK_GRAY));
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable("unicopia.diet.saturation", (int)(ratios.getSecond() * 100))).formatted(Formatting.DARK_GRAY));
|
tooltip.accept(Text.literal(" ").append(Text.translatable("unicopia.diet.saturation", (int)(ratios.getSecond() * 100))).formatted(Formatting.DARK_GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.diet;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import net.minecraft.component.DataComponentTypes;
|
import net.minecraft.component.DataComponentTypes;
|
||||||
|
@ -21,18 +22,18 @@ public interface Effect extends Predicate<ItemStack> {
|
||||||
|
|
||||||
Ailment ailment();
|
Ailment ailment();
|
||||||
|
|
||||||
default void appendTooltip(ItemStack stack, List<Text> tooltip, TooltipType context) {
|
default void appendTooltip(ItemStack stack, Consumer<Text> tooltip, TooltipType context) {
|
||||||
if (!test(stack)) {
|
if (!test(stack)) {
|
||||||
if (stack.contains(DataComponentTypes.FOOD)) {
|
if (stack.contains(DataComponentTypes.FOOD)) {
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable("food_group.unicopia.misc")).formatted(Formatting.GRAY));
|
tooltip.accept(Text.literal(" ").append(Text.translatable("food_group.unicopia.misc")).formatted(Formatting.GRAY));
|
||||||
} else if (stack.getUseAction() == UseAction.DRINK) {
|
} else if (stack.getUseAction() == UseAction.DRINK) {
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable("food_group.unicopia.drinks")).formatted(Formatting.GRAY));
|
tooltip.accept(Text.literal(" ").append(Text.translatable("food_group.unicopia.drinks")).formatted(Formatting.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.isAdvanced() && stack.contains(DataComponentTypes.FOOD)) {
|
if (context.isAdvanced() && stack.contains(DataComponentTypes.FOOD)) {
|
||||||
if (!ailment().effects().isEmpty()) {
|
if (!ailment().effects().isEmpty()) {
|
||||||
tooltip.add(Text.translatable("unicopia.diet.side_effects").formatted(Formatting.DARK_PURPLE));
|
tooltip.accept(Text.translatable("unicopia.diet.side_effects").formatted(Formatting.DARK_PURPLE));
|
||||||
ailment().effects().appendTooltip(tooltip);
|
ailment().effects().appendTooltip(tooltip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.diet;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import net.minecraft.component.type.FoodComponent;
|
import net.minecraft.component.type.FoodComponent;
|
||||||
|
@ -39,8 +40,8 @@ public record FoodGroup(
|
||||||
return attributes.ailment();
|
return attributes.ailment();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void appendTooltip(ItemStack stack, List<Text> tooltip, TooltipType context) {
|
public void appendTooltip(ItemStack stack, Consumer<Text> tooltip, TooltipType context) {
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable(Util.createTranslationKey("food_group", id()))).formatted(Formatting.GRAY));
|
tooltip.accept(Text.literal(" ").append(Text.translatable(Util.createTranslationKey("food_group", id()))).formatted(Formatting.GRAY));
|
||||||
Effect.super.appendTooltip(stack, tooltip, context);
|
Effect.super.appendTooltip(stack, tooltip, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.minelittlepony.unicopia.diet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.diet.affliction.Affliction;
|
import com.minelittlepony.unicopia.diet.affliction.Affliction;
|
||||||
import com.minelittlepony.unicopia.item.UFoodComponents;
|
import com.minelittlepony.unicopia.item.UFoodComponents;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
|
@ -45,10 +47,10 @@ public record FoodGroupEffects(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendTooltip(ItemStack stack, List<Text> tooltip, TooltipType context) {
|
public void appendTooltip(ItemStack stack, Consumer<Text> tooltip, TooltipType context) {
|
||||||
tags.forEach(tag -> {
|
tags.forEach(tag -> {
|
||||||
if (tag.contains(stack)) {
|
if (tag.contains(stack)) {
|
||||||
tooltip.add(Text.literal(" ").append(Text.translatable(Util.createTranslationKey("tag", tag.id()))).formatted(Formatting.GRAY));
|
tooltip.accept(Text.literal(" ").append(Text.translatable(Util.createTranslationKey("tag", tag.id()))).formatted(Formatting.GRAY));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Effect.super.appendTooltip(stack, tooltip, context);
|
Effect.super.appendTooltip(stack, tooltip, context);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.diet.affliction;
|
package com.minelittlepony.unicopia.diet.affliction;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -14,8 +14,8 @@ public interface Affliction {
|
||||||
return getType() == AfflictionType.EMPTY;
|
return getType() == AfflictionType.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
default void appendTooltip(List<Text> tooltip) {
|
default void appendTooltip(Consumer<Text> tooltip) {
|
||||||
tooltip.add(Text.literal(" ").append(getName()).formatted(Formatting.DARK_GRAY));
|
tooltip.accept(Text.literal(" ").append(getName()).formatted(Formatting.DARK_GRAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
default Text getName() {
|
default Text getName() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.diet.affliction;
|
package com.minelittlepony.unicopia.diet.affliction;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
@ -36,7 +37,7 @@ public record CompoundAffliction (List<Affliction> afflictions) implements Affli
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendTooltip(List<Text> tooltip) {
|
public void appendTooltip(Consumer<Text> tooltip) {
|
||||||
afflictions.forEach(i -> i.appendTooltip(tooltip));
|
afflictions.forEach(i -> i.appendTooltip(tooltip));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.item.ItemConvertible;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.RegistryWrapper.WrapperLookup;
|
import net.minecraft.registry.RegistryWrapper.WrapperLookup;
|
||||||
|
|
||||||
|
@ -25,7 +26,8 @@ public class ItemTracker implements NbtSerialisable, Copyable<ItemTracker>, Tick
|
||||||
public static final long HOURS = 1000 * TICKS;
|
public static final long HOURS = 1000 * TICKS;
|
||||||
public static final long DAYS = 24 * HOURS;
|
public static final long DAYS = 24 * HOURS;
|
||||||
|
|
||||||
public static String formatTicks(long ticks) {
|
public static String formatTicks(long ticks, float tickRate) {
|
||||||
|
ticks = MathHelper.floor(ticks / tickRate);
|
||||||
long days = ticks / (SECONDS * 60 * 24);
|
long days = ticks / (SECONDS * 60 * 24);
|
||||||
ticks %= (SECONDS * 60 * 60 * 24);
|
ticks %= (SECONDS * 60 * 60 * 24);
|
||||||
long hours = ticks / (SECONDS * 60 * 60);
|
long hours = ticks / (SECONDS * 60 * 60);
|
||||||
|
|
|
@ -430,7 +430,7 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
||||||
return Stream.of(entity.getStackInHand(Hand.MAIN_HAND), entity.getStackInHand(Hand.OFF_HAND));
|
return Stream.of(entity.getStackInHand(Hand.MAIN_HAND), entity.getStackInHand(Hand.OFF_HAND));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Stream<ItemStack> getArmourStacks() {
|
public Stream<ItemStack> getArmourStacks() {
|
||||||
if (!TrinketsDelegate.hasTrinkets()) {
|
if (!TrinketsDelegate.hasTrinkets()) {
|
||||||
return StreamSupport.stream(entity.getArmorItems().spliterator(), false);
|
return StreamSupport.stream(entity.getArmorItems().spliterator(), false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import it.unimi.dsi.fastutil.objects.Object2FloatMaps;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2FloatOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2FloatOpenHashMap;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.component.EnchantmentEffectComponentTypes;
|
import net.minecraft.component.EnchantmentEffectComponentTypes;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
import net.minecraft.enchantment.Enchantments;
|
||||||
|
@ -78,14 +77,14 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
|
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
|
||||||
Pony pony = Pony.of(MinecraftClient.getInstance().player);
|
ItemStackDuck.of(stack).getTransientComponents().getCarrier().flatMap(Pony::of).ifPresent(pony -> {
|
||||||
|
if (pony.getArmourStacks().anyMatch(i -> i == stack)) {
|
||||||
if (pony != null) {
|
long ticks = pony.getArmour().getTicks(this);
|
||||||
long ticks = pony.getArmour().getTicks(this);
|
if (ticks > 0) {
|
||||||
if (ticks > 0) {
|
tooltip.add(Text.literal(ItemTracker.formatTicks(ticks, context.getUpdateTickRate()).formatted(Formatting.GRAY)));
|
||||||
tooltip.add(Text.literal(ItemTracker.formatTicks(ticks).formatted(Formatting.GRAY)));
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -789,6 +789,101 @@
|
||||||
"respawn.reason.joined_new_tribe": "%1$s was reborn as a %2$s",
|
"respawn.reason.joined_new_tribe": "%1$s was reborn as a %2$s",
|
||||||
"respawn.reason.illegal_race": "The %s race is not permitted by your server's configuration.",
|
"respawn.reason.illegal_race": "The %s race is not permitted by your server's configuration.",
|
||||||
|
|
||||||
|
"tag.item.unicopia.groups.foraging": "Creative Tabs: Foraging",
|
||||||
|
"tag.item.unicopia.groups.sea_pony": "Creative Tabs: Seapony",
|
||||||
|
"tag.item.unicopia.groups.earth_pony": "Creative Tabs: Earth Pony",
|
||||||
|
"tag.item.unicopia.groups.bat_pony": "Creative Tabs: Bat Pony",
|
||||||
|
"tag.item.unicopia.groups.changeling": "Creative Tabs: Changeling",
|
||||||
|
"tag.item.unicopia.groups.pegasus": "Creative Tabs: Pegasus",
|
||||||
|
"tag.item.unicopia.groups.unicorn": "Creative Tabs: Unicorn",
|
||||||
|
|
||||||
|
"tag.item.unicopia.forage.severe.prickly": "Foraged with high chance of harming",
|
||||||
|
"tag.item.unicopia.forage.dangerous": "Dangerous to Forage",
|
||||||
|
"tag.item.unicopia.forage.blinding": "Foraged with chance to blinding",
|
||||||
|
"tag.item.unicopia.forage.nauseating": "Foraged with chance of nausea",
|
||||||
|
"tag.item.unicopia.forage.prickly": "Foraged with chance of harm",
|
||||||
|
"tag.item.unicopia.forage.severe.nauseating": "Foraged with high chance of nausea",
|
||||||
|
"tag.item.unicopia.forage.risky": "Foraged with Minor Risk",
|
||||||
|
"tag.item.unicopia.forage.safe": "Safe to Forage",
|
||||||
|
"tag.item.unicopia.forage.filling": "Safe to Forage (Filling)",
|
||||||
|
"tag.item.unicopia.forage.glowing": "Foraged with change of glowing",
|
||||||
|
"tag.item.unicopia.forage.strengthening": "Foraged with chance of strength",
|
||||||
|
|
||||||
|
"tag.item.unicopia.food_types.high_quality_sea_vegetables": "High Quality Sea Vegetables",
|
||||||
|
"tag.item.unicopia.food_types.low_quality_sea_vegetables": "Low Quality Sea Vegetables",
|
||||||
|
|
||||||
|
"tag.item.unicopia.polearms": "Polearms",
|
||||||
|
"tag.item.unicopia.magic_feathers": "Magic Feathers",
|
||||||
|
"tag.item.unicopia.can_cut_pie": "Can Cut Pie",
|
||||||
|
"tag.item.unicopia.cloud_jars": "Cloud Jars",
|
||||||
|
"tag.item.unicopia.baskets": "Baskets",
|
||||||
|
"tag.item.unicopia.shades": "Shades",
|
||||||
|
"tag.item.unicopia.shells": "Shells",
|
||||||
|
"tag.item.unicopia.zap_logs": "Apple Apple Logs",
|
||||||
|
"tag.item.unicopia.spooked_mob_drops": "Dropped by spooked mobs",
|
||||||
|
"tag.item.unicopia.wool_bed_sheets": "Wool bed Sheets",
|
||||||
|
"tag.item.unicopia.is_delivered_aggressively": "Aggressively Delivered",
|
||||||
|
"tag.item.unicopia.cools_off_kirins": "Cools off kirins",
|
||||||
|
"tag.item.unicopia.loot_bug_common_drops": "Common Loot Bug Drops",
|
||||||
|
"tag.item.unicopia.loot_bug_rare_drops": "Rare Loot Bug Drops",
|
||||||
|
"tag.item.unicopia.loot_bug_epic_drops": "Epic Loot Bug Drops",
|
||||||
|
"tag.item.unicopia.badges": "Tribe Badges",
|
||||||
|
"tag.item.unicopia.apple_seeds": "Apple Seeds",
|
||||||
|
"tag.item.unicopia.bed_sheets": "Bed Sheets",
|
||||||
|
"tag.item.unicopia.cloud_blocks": "Cloud Blocks",
|
||||||
|
"tag.item.unicopia.cloud_slabs": "Cloud Slabs",
|
||||||
|
"tag.item.unicopia.pies": "Pies",
|
||||||
|
"tag.item.unicopia.palm_logs": "Palm Logs",
|
||||||
|
"tag.item.unicopia.special_shells": "Special Shells",
|
||||||
|
"tag.item.unicopia.rock_stews": "Rock Stews",
|
||||||
|
"tag.item.unicopia.chitin_blocks": "Chitin Blocks",
|
||||||
|
"tag.item.unicopia.floats_on_clouds": "Floats on Clouds",
|
||||||
|
"tag.item.unicopia.falls_slowly": "Falls Slowly",
|
||||||
|
"tag.item.unicopia.container_with_love": "Filled Love Container",
|
||||||
|
"tag.item.unicopia.baked_goods": "Baked Goods",
|
||||||
|
"tag.item.unicopia.horse_shoes": "Horseshoes",
|
||||||
|
"tag.item.unicopia.cloud_beds": "Cloud beds",
|
||||||
|
"tag.item.unicopia.waxed_zap_logs": "Waxed Zap Logs",
|
||||||
|
"tag.item.unicopia.cloud_stairs": "Cloud Stairs",
|
||||||
|
"tag.item.unicopia.fresh_apples": "Fresh Apples",
|
||||||
|
"tag.item.unicopia.has_no_traits": "Has No Traits",
|
||||||
|
|
||||||
|
"tag.item.c.foods.acorn": "Acorns",
|
||||||
|
"tag.item.c.foods.apple": "Apples",
|
||||||
|
"tag.item.c.foods.dessert": "Desserts",
|
||||||
|
"tag.item.c.foods.banana": "Bananas",
|
||||||
|
"tag.item.c.foods.pinecone": "Pinecones",
|
||||||
|
"tag.item.c.rocks": "Rocks",
|
||||||
|
"tag.item.c.nuts": "Nuts",
|
||||||
|
"tag.item.c.worms": "Worms",
|
||||||
|
"tag.item.c.foods.pineapple": "Pineapples",
|
||||||
|
"tag.item.c.foods.mushroom": "Mushrooms",
|
||||||
|
"tag.item.c.foods.raw_insect": "Raw Insects",
|
||||||
|
"tag.item.c.coral_blocks": "Coral Blocks",
|
||||||
|
"tag.item.c.foods.muffin": "Muffins",
|
||||||
|
"tag.item.c.foods.mango": "Mangoes",
|
||||||
|
"tag.item.c.foods.rotten_meat": "Rotten Meat",
|
||||||
|
"tag.item.c.coral_fans": "Coral Fans",
|
||||||
|
"tag.item.c.corals": "Corals",
|
||||||
|
"tag.item.c.foods.rotten_insect": "Rotten Insects",
|
||||||
|
"tag.item.c.foods.cooked_insect": "Cooked Incest",
|
||||||
|
"tag.item.c.foods.rotten_fish": "Rotten Fish",
|
||||||
|
"tag.item.c.foods.oatmeal": "Oatmeals",
|
||||||
|
"tag.item.c.grain": "Grain",
|
||||||
|
|
||||||
|
"tag.item.farmersdelight.cabbage_roll_ingredients": "Farmer's Delight Cabbage Role Ingredients",
|
||||||
|
"tag.item.farmersdelight.comfort_foods": "Farmer's Delight Comfort Foods",
|
||||||
|
|
||||||
|
"tag.item.trinkets.offhand.glove": "Offhand Glove Trinket",
|
||||||
|
"tag.item.trinkets.hand.glove": "Mainhand Glove Trinket",
|
||||||
|
"tag.item.trinkets.chest.necklace": "Necklace Trinket",
|
||||||
|
"tag.item.trinkets.head.face": "Face Trinket",
|
||||||
|
|
||||||
|
"tag.item.sereneseasons.spring_crops": "Serene Seasons' Spring Crops",
|
||||||
|
"tag.item.sereneseasons.summer_crops": "Serene Seasons' Summer Crops",
|
||||||
|
"tag.item.sereneseasons.autumn_crops": "Serene Seasons' Autumn Crops",
|
||||||
|
"tag.item.sereneseasons.winter_crops": "Serene Seasons' Winter Crops",
|
||||||
|
|
||||||
"gui.unicopia.tribe_selection.respawn": "You have died.",
|
"gui.unicopia.tribe_selection.respawn": "You have died.",
|
||||||
"gui.unicopia.tribe_selection.respawn.journey": "But the end is not all, for at the end of every end is another beginning.",
|
"gui.unicopia.tribe_selection.respawn.journey": "But the end is not all, for at the end of every end is another beginning.",
|
||||||
"gui.unicopia.tribe_selection.respawn.choice": "Choose wisely, for the choice you make now will change the world around you and the paths you may take.",
|
"gui.unicopia.tribe_selection.respawn.choice": "Choose wisely, for the choice you make now will change the world around you and the paths you may take.",
|
||||||
|
|
Loading…
Reference in a new issue