Datagen loot tables and partially rewrite food

This commit is contained in:
Sollace 2024-04-01 23:39:21 +01:00
parent 77d1d62494
commit 3bc1628fd4
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
117 changed files with 809 additions and 2328 deletions

View file

@ -10,6 +10,10 @@ public interface UConventionalTags {
interface Blocks { interface Blocks {
TagKey<Block> CONCRETE_POWDERS = block("concrete_powders"); TagKey<Block> CONCRETE_POWDERS = block("concrete_powders");
TagKey<Block> CONCRETES = block("concretes"); TagKey<Block> CONCRETES = block("concretes");
TagKey<Block> GLAZED_TERRACOTTAS = block("glazed_terracottas");
TagKey<Block> CORAL_BLOCKS = block("coral_blocks");
TagKey<Block> CORAL_FANS = block("coral_fans");
TagKey<Block> CORALS = block("corals");
private static TagKey<Block> block(String name) { private static TagKey<Block> block(String name) {
return TagKey.of(RegistryKeys.BLOCK, new Identifier("c", name)); return TagKey.of(RegistryKeys.BLOCK, new Identifier("c", name));
@ -19,6 +23,10 @@ public interface UConventionalTags {
interface Items { interface Items {
TagKey<Item> CONCRETE_POWDERS = item("concrete_powders"); 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_FANS = item("coral_fans");
TagKey<Item> CORALS = item("corals");
TagKey<Item> APPLES = item("apples"); TagKey<Item> APPLES = item("apples");
TagKey<Item> ACORNS = item("acorns"); TagKey<Item> ACORNS = item("acorns");
@ -35,8 +43,18 @@ public interface UConventionalTags {
TagKey<Item> OATMEALS = item("oatmeals"); TagKey<Item> OATMEALS = item("oatmeals");
TagKey<Item> FRUITS = item("fruits"); TagKey<Item> FRUITS = item("fruits");
TagKey<Item> WORMS = item("worms");
TagKey<Item> ROCKS = item("rocks");
TagKey<Item> RAW_INSECT = item("raw_insect");
TagKey<Item> COOKED_INSECT = item("cooked_insect");
TagKey<Item> RAW_FISH = item("raw_fish");
TagKey<Item> COOKED_FISH = item("cooked_fish"); TagKey<Item> COOKED_FISH = item("cooked_fish");
TagKey<Item> ROTTEN_FISH = item("rotten_fish");
TagKey<Item> RAW_MEAT = item("raw_meat");
TagKey<Item> COOKED_MEAT = item("cooked_meat");
TagKey<Item> ROTTEN_MEAT = item("rotten_meat");
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");

View file

@ -34,9 +34,12 @@ public interface UTags {
TagKey<Item> SPOOKED_MOB_DROPS = item("spooked_mob_drops"); TagKey<Item> SPOOKED_MOB_DROPS = item("spooked_mob_drops");
TagKey<Item> HAS_NO_TRAITS = item("has_no_traits"); TagKey<Item> HAS_NO_TRAITS = item("has_no_traits");
TagKey<Item> IS_DELIVERED_AGGRESSIVELY = item("is_delivered_aggressively"); TagKey<Item> IS_DELIVERED_AGGRESSIVELY = item("is_delivered_aggressively");
TagKey<Item> CONTAINER_WITH_LOVE = item("container_with_love");
TagKey<Item> FLOATS_ON_CLOUDS = item("floats_on_clouds"); TagKey<Item> FLOATS_ON_CLOUDS = item("floats_on_clouds");
TagKey<Item> COOLS_OFF_KIRINS = item("cools_off_kirins"); TagKey<Item> COOLS_OFF_KIRINS = item("cools_off_kirins");
TagKey<Item> LOOT_BUG_HIGH_VALUE_DROPS = item("loot_bug_high_value_drops"); TagKey<Item> LOOT_BUG_COMMON_DROPS = item("loot_bug_common_drops");
TagKey<Item> LOOT_BUG_RARE_DROPS = item("loot_bug_rare_drops");
TagKey<Item> LOOT_BUG_EPIC_DROPS = item("loot_bug_epic_drops");
TagKey<Item> SHELLS = item("food_types/shells"); TagKey<Item> SHELLS = item("food_types/shells");

View file

@ -8,7 +8,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
public class EnchantedFruitBlock extends FruitBlock { public class EnchantedFruitBlock extends FruitBlock {
static final BooleanProperty ENCHANTED = BooleanProperty.of("enchanted"); public static final BooleanProperty ENCHANTED = BooleanProperty.of("enchanted");
public EnchantedFruitBlock(Settings settings, Direction attachmentFace, Block stem, VoxelShape shape) { public EnchantedFruitBlock(Settings settings, Direction attachmentFace, Block stem, VoxelShape shape) {
super(settings, attachmentFace, stem, shape); super(settings, attachmentFace, stem, shape);

View file

@ -204,4 +204,8 @@ public class SegmentedCropBlock extends CropBlock implements SegmentedBlock {
return state.getBlock() == this || (nextSegmentSupplier != null && nextSegmentSupplier.get().isNext(state)); return state.getBlock() == this || (nextSegmentSupplier != null && nextSegmentSupplier.get().isNext(state));
} }
@Nullable
public SegmentedCropBlock getNext() {
return nextSegmentSupplier == null ? null : nextSegmentSupplier.get();
}
} }

View file

@ -3,12 +3,15 @@ package com.minelittlepony.unicopia.datagen;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.minelittlepony.unicopia.block.EdibleBlock;
import com.minelittlepony.unicopia.datagen.providers.SeasonsGrowthRatesProvider; import com.minelittlepony.unicopia.datagen.providers.SeasonsGrowthRatesProvider;
import com.minelittlepony.unicopia.datagen.providers.UAdvancementsProvider; import com.minelittlepony.unicopia.datagen.providers.UAdvancementsProvider;
import com.minelittlepony.unicopia.datagen.providers.UModelProvider; import com.minelittlepony.unicopia.datagen.providers.UModelProvider;
import com.minelittlepony.unicopia.datagen.providers.loot.UBlockAdditionsLootTableProvider; import com.minelittlepony.unicopia.datagen.providers.loot.UBlockAdditionsLootTableProvider;
import com.minelittlepony.unicopia.datagen.providers.loot.UBlockLootTableProvider; import com.minelittlepony.unicopia.datagen.providers.loot.UBlockLootTableProvider;
import com.minelittlepony.unicopia.datagen.providers.loot.UChestAdditionsLootTableProvider; import com.minelittlepony.unicopia.datagen.providers.loot.UChestAdditionsLootTableProvider;
import com.minelittlepony.unicopia.datagen.providers.loot.UChestLootTableProvider;
import com.minelittlepony.unicopia.datagen.providers.loot.UEntityLootTableProvider;
import com.minelittlepony.unicopia.datagen.providers.recipe.URecipeProvider; import com.minelittlepony.unicopia.datagen.providers.recipe.URecipeProvider;
import com.minelittlepony.unicopia.datagen.providers.tag.UBlockTagProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UBlockTagProvider;
import com.minelittlepony.unicopia.datagen.providers.tag.UDamageTypeProvider; import com.minelittlepony.unicopia.datagen.providers.tag.UDamageTypeProvider;
@ -18,13 +21,30 @@ import com.minelittlepony.unicopia.server.world.UWorldGen;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryBuilder; import net.minecraft.registry.RegistryBuilder;
import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.biome.OverworldBiomeCreator; import net.minecraft.world.biome.OverworldBiomeCreator;
public class Datagen implements DataGeneratorEntrypoint { public class Datagen implements DataGeneratorEntrypoint {
public static final Logger LOGGER = LogManager.getLogger(); public static final Logger LOGGER = LogManager.getLogger();
public static Block getOrCreateBaleBlock(Identifier id) {
return Registries.BLOCK.getOrEmpty(id).orElseGet(() -> {
return Registry.register(Registries.BLOCK, id, new EdibleBlock(id, id, false));
});
}
public static Item getOrCreateItem(Identifier id) {
return Registries.ITEM.getOrEmpty(id).orElseGet(() -> {
return Registry.register(Registries.ITEM, id, new Item(new Item.Settings()));
});
}
@Override @Override
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
final var pack = fabricDataGenerator.createPack(); final var pack = fabricDataGenerator.createPack();
@ -35,6 +55,8 @@ public class Datagen implements DataGeneratorEntrypoint {
pack.addProvider(UModelProvider::new); pack.addProvider(UModelProvider::new);
pack.addProvider(URecipeProvider::new); pack.addProvider(URecipeProvider::new);
pack.addProvider(UBlockLootTableProvider::new); pack.addProvider(UBlockLootTableProvider::new);
pack.addProvider(UEntityLootTableProvider::new);
pack.addProvider(UChestLootTableProvider::new);
pack.addProvider(UBlockAdditionsLootTableProvider::new); pack.addProvider(UBlockAdditionsLootTableProvider::new);
pack.addProvider(UChestAdditionsLootTableProvider::new); pack.addProvider(UChestAdditionsLootTableProvider::new);
pack.addProvider(SeasonsGrowthRatesProvider::new); pack.addProvider(SeasonsGrowthRatesProvider::new);

View file

@ -16,6 +16,7 @@ import com.minelittlepony.unicopia.block.ShellsBlock;
import com.minelittlepony.unicopia.block.SlimePustuleBlock; import com.minelittlepony.unicopia.block.SlimePustuleBlock;
import com.minelittlepony.unicopia.block.UBlocks; import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.block.zap.ZapAppleLeavesBlock; import com.minelittlepony.unicopia.block.zap.ZapAppleLeavesBlock;
import com.minelittlepony.unicopia.datagen.Datagen;
import com.minelittlepony.unicopia.datagen.UBlockFamilies; import com.minelittlepony.unicopia.datagen.UBlockFamilies;
import com.minelittlepony.unicopia.server.world.Tree; import com.minelittlepony.unicopia.server.world.Tree;
@ -41,7 +42,6 @@ import net.minecraft.data.client.When;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.Properties; import net.minecraft.state.property.Properties;
@ -429,9 +429,7 @@ public class UBlockStateModelGenerator extends BlockStateModelGenerator {
Identifier side = baseBlockId.withPath(p -> "block/" + p + "_side"); Identifier side = baseBlockId.withPath(p -> "block/" + p + "_side");
TextureMap textures = new TextureMap().put(TOP, top).put(SIDE, side); TextureMap textures = new TextureMap().put(TOP, top).put(SIDE, side);
MultipartBlockStateSupplier supplier = MultipartBlockStateSupplier.create(Registries.BLOCK.getOrEmpty(blockId).orElseGet(() -> { MultipartBlockStateSupplier supplier = MultipartBlockStateSupplier.create(Datagen.getOrCreateBaleBlock(blockId));
return Registry.register(Registries.BLOCK, blockId, new EdibleBlock(blockId, blockId, false));
}));
Map<Integer, Identifier> uploadedModels = new HashMap<>(); Map<Integer, Identifier> uploadedModels = new HashMap<>();
for (Direction.Axis axis : Direction.Axis.VALUES) { for (Direction.Axis axis : Direction.Axis.VALUES) {

View file

@ -2,8 +2,16 @@ package com.minelittlepony.unicopia.datagen.providers.loot;
import java.util.List; import java.util.List;
import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.block.EdibleBlock;
import com.minelittlepony.unicopia.block.EnchantedFruitBlock;
import com.minelittlepony.unicopia.block.PieBlock; import com.minelittlepony.unicopia.block.PieBlock;
import com.minelittlepony.unicopia.block.PileBlock;
import com.minelittlepony.unicopia.block.SegmentedCropBlock;
import com.minelittlepony.unicopia.block.ShellsBlock;
import com.minelittlepony.unicopia.block.SlimePustuleBlock;
import com.minelittlepony.unicopia.block.UBlocks; import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.datagen.Datagen;
import com.minelittlepony.unicopia.datagen.providers.UModelProvider; import com.minelittlepony.unicopia.datagen.providers.UModelProvider;
import com.minelittlepony.unicopia.item.UItems; import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.server.world.Tree; import com.minelittlepony.unicopia.server.world.Tree;
@ -11,29 +19,44 @@ 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.FabricBlockLootTableProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions;
import net.minecraft.block.BedBlock; import net.minecraft.block.BedBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.CarrotsBlock;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.enums.BedPart; import net.minecraft.block.enums.BedPart;
import net.minecraft.block.enums.BlockHalf;
import net.minecraft.block.enums.SlabType;
import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.loot.LootPool; import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTable; import net.minecraft.loot.LootTable;
import net.minecraft.loot.condition.BlockStatePropertyLootCondition; import net.minecraft.loot.condition.BlockStatePropertyLootCondition;
import net.minecraft.loot.condition.LootConditionConsumingBuilder; import net.minecraft.loot.condition.LootConditionConsumingBuilder;
import net.minecraft.loot.condition.RandomChanceLootCondition;
import net.minecraft.loot.condition.TableBonusLootCondition; import net.minecraft.loot.condition.TableBonusLootCondition;
import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.function.ApplyBonusLootFunction;
import net.minecraft.loot.function.ConditionalLootFunction;
import net.minecraft.loot.function.SetCountLootFunction; import net.minecraft.loot.function.SetCountLootFunction;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider; import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
import net.minecraft.loot.provider.number.LootNumberProvider;
import net.minecraft.loot.provider.number.UniformLootNumberProvider; import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import net.minecraft.predicate.StatePredicate; import net.minecraft.predicate.StatePredicate;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.IntProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.state.property.Property; import net.minecraft.state.property.Property;
import net.minecraft.util.Identifier;
import net.minecraft.util.StringIdentifiable; import net.minecraft.util.StringIdentifiable;
public class UBlockLootTableProvider extends FabricBlockLootTableProvider { public class UBlockLootTableProvider extends FabricBlockLootTableProvider {
private static final ConditionalLootFunction.Builder<?> FORTUNE_BONUS = ApplyBonusLootFunction.binomialWithBonusCount(Enchantments.FORTUNE, 0.5714286F, 3);
public UBlockLootTableProvider(FabricDataOutput output) { public UBlockLootTableProvider(FabricDataOutput output) {
super(output); super(output);
} }
@ -72,13 +95,22 @@ public class UBlockLootTableProvider extends FabricBlockLootTableProvider {
UBlocks.CHISELLED_CHITIN_SLAB, UBlocks.CLOUD_BRICK_SLAB, UBlocks.CHISELLED_CHITIN_SLAB, UBlocks.CLOUD_BRICK_SLAB,
UBlocks.CLOUD_PLANK_SLAB, UBlocks.PALM_SLAB, UBlocks.ZAP_SLAB, UBlocks.WAXED_ZAP_SLAB UBlocks.CLOUD_PLANK_SLAB, UBlocks.PALM_SLAB, UBlocks.ZAP_SLAB, UBlocks.WAXED_ZAP_SLAB
).forEach(slab -> addDrop(slab, this::slabDrops)); ).forEach(slab -> addDrop(slab, this::slabDrops));
addDrop(UBlocks.CLOUD_SLAB, slab -> decomposingSlabDrops(slab, UItems.CLOUD_LUMP, 2));
addDrop(UBlocks.SOGGY_CLOUD_SLAB, slab -> decomposingSlabDrops(slab, UItems.CLOUD_LUMP, 2));
addDrop(UBlocks.DENSE_CLOUD_SLAB, slab -> decomposingSlabDrops(slab, UItems.CLOUD_LUMP, 4));
addDrop(UBlocks.ETCHED_CLOUD_SLAB, slab -> decomposingSlabDrops(slab, UItems.CLOUD_LUMP, 4));
// fruit // fruit
UModelProvider.FRUITS.forEach((block, drop) -> { UModelProvider.FRUITS.forEach((block, drop) -> {
if (block != UBlocks.GOLDEN_APPLE) { if (block != UBlocks.GOLDEN_APPLE) {
addDrop(block, drop); addDrop(block, fortuneBonusDrops(drop));
} }
}); });
addDrop(UBlocks.GOLDEN_APPLE, LootTable.builder().pool(LootPool.builder()
.rolls(exactly(1))
.with(applyStateCondition(UBlocks.GOLDEN_APPLE, EnchantedFruitBlock.ENCHANTED, false, applyExplosionDecay(UBlocks.GOLDEN_APPLE, ItemEntry.builder(Items.GOLDEN_APPLE))).apply(FORTUNE_BONUS))
.with(applyStateCondition(UBlocks.GOLDEN_APPLE, EnchantedFruitBlock.ENCHANTED, true, applyExplosionDecay(UBlocks.GOLDEN_APPLE, ItemEntry.builder(Items.ENCHANTED_GOLDEN_APPLE))).apply(FORTUNE_BONUS))
));
List.of(UBlocks.GREEN_APPLE_LEAVES, UBlocks.SOUR_APPLE_LEAVES, UBlocks.SWEET_APPLE_LEAVES, UBlocks.GOLDEN_OAK_LEAVES).forEach(block -> addDrop(block, this::fruitLeavesDrops)); List.of(UBlocks.GREEN_APPLE_LEAVES, UBlocks.SOUR_APPLE_LEAVES, UBlocks.SWEET_APPLE_LEAVES, UBlocks.GOLDEN_OAK_LEAVES).forEach(block -> addDrop(block, this::fruitLeavesDrops));
addDrop(UBlocks.MANGO_LEAVES, block -> leavesDrops(block, UTreeGen.MANGO_TREE.sapling().get(), 0.025F, 0.027777778F, 0.03125F, 0.041666668F, 0.1F)); // same chance as jungle addDrop(UBlocks.MANGO_LEAVES, block -> leavesDrops(block, UTreeGen.MANGO_TREE.sapling().get(), 0.025F, 0.027777778F, 0.03125F, 0.041666668F, 0.1F)); // same chance as jungle
addDrop(UBlocks.ZAP_LEAVES, block -> leavesDrops(block, UTreeGen.ZAP_APPLE_TREE.sapling().get(), SAPLING_DROP_CHANCE)); addDrop(UBlocks.ZAP_LEAVES, block -> leavesDrops(block, UTreeGen.ZAP_APPLE_TREE.sapling().get(), SAPLING_DROP_CHANCE));
@ -106,63 +138,197 @@ public class UBlockLootTableProvider extends FabricBlockLootTableProvider {
UBlocks.CLOUD_BED, UBlocks.CLOTH_BED UBlocks.CLOUD_BED, UBlocks.CLOTH_BED
).forEach(bed -> addDrop(bed, b -> dropsWithProperty(b, BedBlock.PART, BedPart.HEAD))); ).forEach(bed -> addDrop(bed, b -> dropsWithProperty(b, BedBlock.PART, BedPart.HEAD)));
addDrop(UBlocks.CHITIN_SPIKES, drops(UBlocks.CHITIN_SPIKES, UItems.CARAPACE, ConstantLootNumberProvider.create(6))); addDrop(UBlocks.CHITIN_SPIKES, drops(UBlocks.CHITIN_SPIKES, UItems.CARAPACE, exactly(6)));
addDrop(UBlocks.CHITIN, drops(UBlocks.CHITIN, UItems.CARAPACE, ConstantLootNumberProvider.create(9))); addDrop(UBlocks.CHITIN, drops(UBlocks.CHITIN, UItems.CARAPACE, exactly(9)));
addDrop(UBlocks.SURFACE_CHITIN, drops(UBlocks.SURFACE_CHITIN, UItems.CARAPACE, ConstantLootNumberProvider.create(9))); addDrop(UBlocks.SURFACE_CHITIN, drops(UBlocks.SURFACE_CHITIN, UItems.CARAPACE, exactly(9)));
addDrop(UBlocks.CHISELLED_CHITIN_HULL, hullDrops(UBlocks.CHISELLED_CHITIN_HULL, UBlocks.CHITIN, UBlocks.CHISELLED_CHITIN));
addDrop(UBlocks.CLOUD, drops(UBlocks.CLOUD, UItems.CLOUD_LUMP, ConstantLootNumberProvider.create(4))); addDrop(UBlocks.SLIME_PUSTULE, LootTable.builder()
addDrop(UBlocks.CLOUD_STAIRS, drops(UBlocks.CLOUD_STAIRS, UItems.CLOUD_LUMP, ConstantLootNumberProvider.create(6))); .pool(applyStateCondition(UBlocks.SLIME_PUSTULE, SlimePustuleBlock.SHAPE, SlimePustuleBlock.Shape.POD,
addSurvivesExplosionCondition(UBlocks.SLIME_PUSTULE, LootPool.builder()
.rolls(exactly(1))
.with(ItemEntry.builder(UBlocks.SLIME_PUSTULE)).conditionally(WITH_SILK_TOUCH_OR_SHEARS))
)));
addDrop(UBlocks.MYSTERIOUS_EGG, LootTable.builder()
.pool(addSurvivesExplosionCondition(UBlocks.MYSTERIOUS_EGG, LootPool.builder()
.rolls(exactly(1))
.with(ItemEntry.builder(UBlocks.MYSTERIOUS_EGG))
.apply(PileBlock.COUNT.getValues(), count -> applyStateCondition(UBlocks.MYSTERIOUS_EGG, PileBlock.COUNT, count, SetCountLootFunction.builder(exactly(count)))))));
addDrop(UBlocks.SOGGY_CLOUD, drops(UBlocks.CLOUD, UItems.CLOUD_LUMP, ConstantLootNumberProvider.create(4))); addDrop(UBlocks.CLOUD, drops(UBlocks.CLOUD, UItems.CLOUD_LUMP, exactly(4)));
addDrop(UBlocks.SOGGY_CLOUD_STAIRS, drops(UBlocks.CLOUD_STAIRS, UItems.CLOUD_LUMP, ConstantLootNumberProvider.create(6))); addDrop(UBlocks.CLOUD_STAIRS, drops(UBlocks.CLOUD_STAIRS, UItems.CLOUD_LUMP, exactly(6)));
addDrop(UBlocks.DENSE_CLOUD, drops(UBlocks.DENSE_CLOUD, UItems.CLOUD_LUMP, ConstantLootNumberProvider.create(9))); addDrop(UBlocks.SOGGY_CLOUD, drops(UBlocks.CLOUD, UItems.CLOUD_LUMP, exactly(4)));
addDrop(UBlocks.DENSE_CLOUD_STAIRS, drops(UBlocks.DENSE_CLOUD_STAIRS, UItems.CLOUD_LUMP, ConstantLootNumberProvider.create(13))); addDrop(UBlocks.SOGGY_CLOUD_STAIRS, drops(UBlocks.CLOUD_STAIRS, UItems.CLOUD_LUMP, exactly(6)));
addDrop(UBlocks.ETCHED_CLOUD, drops(UBlocks.ETCHED_CLOUD, UItems.CLOUD_LUMP, ConstantLootNumberProvider.create(9)));
addDrop(UBlocks.ETCHED_CLOUD_STAIRS, drops(UBlocks.ETCHED_CLOUD_STAIRS, UItems.CLOUD_LUMP, ConstantLootNumberProvider.create(13))); addDrop(UBlocks.DENSE_CLOUD, drops(UBlocks.DENSE_CLOUD, UItems.CLOUD_LUMP, exactly(9)));
addDrop(UBlocks.DENSE_CLOUD_STAIRS, drops(UBlocks.DENSE_CLOUD_STAIRS, UItems.CLOUD_LUMP, exactly(13)));
addDrop(UBlocks.ETCHED_CLOUD, drops(UBlocks.ETCHED_CLOUD, UItems.CLOUD_LUMP, exactly(9)));
addDrop(UBlocks.ETCHED_CLOUD_STAIRS, drops(UBlocks.ETCHED_CLOUD_STAIRS, UItems.CLOUD_LUMP, exactly(13)));
// recipe produces: 6 blocks -> 3 pillars means: 6/3 = 2 // recipe produces: 6 blocks -> 3 pillars means: 6/3 = 2
addDrop(UBlocks.CLOUD_PILLAR, drops(UBlocks.CLOUD_PILLAR, UBlocks.CLOUD, ConstantLootNumberProvider.create(2))); addDrop(UBlocks.CLOUD_PILLAR, drops(UBlocks.CLOUD_PILLAR, UBlocks.CLOUD, exactly(2)));
addDrop(UBlocks.FROSTED_OBSIDIAN, Blocks.OBSIDIAN); addDrop(UBlocks.FROSTED_OBSIDIAN, Blocks.OBSIDIAN);
addDrop(UBlocks.APPLE_PIE, pieDrops(UBlocks.APPLE_PIE, UItems.APPLE_PIE, UItems.APPLE_PIE_HOOF)); addDrop(UBlocks.APPLE_PIE, pieDrops(UBlocks.APPLE_PIE, UItems.APPLE_PIE, UItems.APPLE_PIE_HOOF));
// crops
addTallCropDrops(UBlocks.OATS, UItems.OATS);
addDrop(UBlocks.BANANAS, LootTable.builder()
.pool(addSurvivesExplosionCondition(UBlocks.BANANAS, LootPool.builder()
.rolls(exactly(1))
.with(item(UItems.BANANA, between(6, 12F)).apply(FORTUNE_BONUS))
)));
addDrop(UBlocks.PINEAPPLE, LootTable.builder()
.pool(addSurvivesExplosionCondition(UBlocks.PINEAPPLE, LootPool.builder()
.rolls(exactly(1))
.with(item(UItems.PINEAPPLE, between(6, 12F))
.apply(FORTUNE_BONUS)
.conditionally(BlockStatePropertyLootCondition.builder(UBlocks.PINEAPPLE).properties(StatePredicate.Builder.create()
.exactMatch(Properties.BLOCK_HALF, BlockHalf.TOP)
.exactMatch(Properties.AGE_7, Properties.AGE_7_MAX))))
)));
addDrop(UBlocks.ROCKS, applyExplosionDecay(UBlocks.ROCKS, LootTable.builder()
.pool(applyStateCondition(UBlocks.ROCKS, Properties.AGE_7, Properties.AGE_7_MAX, LootPool.builder()
.rolls(exactly(1))
.with(ItemEntry.builder(UItems.WEIRD_ROCK).conditionally(RandomChanceLootCondition.builder(0.25F)).apply(FORTUNE_BONUS))
.with(ItemEntry.builder(UItems.ROCK).apply(FORTUNE_BONUS))))
.pool(LootPool.builder()
.rolls(exactly(1))
.with(ItemEntry.builder(UItems.PEBBLES)))
));
addDrop(UBlocks.GOLD_ROOT, applyExplosionDecay(UBlocks.GOLD_ROOT, LootTable.builder()
.pool(LootPool.builder().with(ItemEntry.builder(Items.GOLDEN_CARROT)))
.pool(applyStateCondition(UBlocks.GOLD_ROOT, CarrotsBlock.AGE, 7, LootPool.builder())
.with(ItemEntry.builder(Items.GOLDEN_CARROT).apply(FORTUNE_BONUS)))));
addDrop(UBlocks.PLUNDER_VINE, applyExplosionDecay(UBlocks.PLUNDER_VINE, LootTable.builder()
.pool(LootPool.builder().rolls(exactly(4))
.with(ItemEntry.builder(Items.STICK))
.with(ItemEntry.builder(Items.DEAD_BUSH)))
.pool(LootPool.builder().rolls(exactly(1))
.with(ItemEntry.builder(Items.STICK))
.with(ItemEntry.builder(Items.DEAD_BUSH))
.with(ItemEntry.builder(UItems.GRYPHON_FEATHER)))
));
// hay
addDrop(UBlocks.HAY_BLOCK, b -> edibleBlockDrops(b, Items.WHEAT));
// shells
addDrop(UBlocks.CLAM_SHELL, shellDrops(UBlocks.CLAM_SHELL, UItems.CLAM_SHELL));
addDrop(UBlocks.SCALLOP_SHELL, shellDrops(UBlocks.SCALLOP_SHELL, UItems.SCALLOP_SHELL));
addDrop(UBlocks.TURRET_SHELL, shellDrops(UBlocks.TURRET_SHELL, UItems.TURRET_SHELL));
var farmersDelightGenerator = withConditions(DefaultResourceConditions.allModsLoaded("farmersdelight"));
farmersDelightGenerator.addDrop(Datagen.getOrCreateBaleBlock(Unicopia.id("rice_block")), b -> edibleBlockDrops(b, Datagen.getOrCreateItem(new Identifier("farmersdelight", "rice_panicle"))));
farmersDelightGenerator.addDrop(Datagen.getOrCreateBaleBlock(Unicopia.id("straw_block")), b -> edibleBlockDrops(b, Datagen.getOrCreateItem(new Identifier("farmersdelight", "straw"))));
}
private void addTallCropDrops(SegmentedCropBlock baseCrop, ItemConvertible crop) {
addDrop(baseCrop, applyExplosionDecay(baseCrop, LootTable.builder()
.pool(LootPool.builder()
.rolls(exactly(1))
.with(ItemEntry.builder(baseCrop.getSeedsItem()))))
.pool(applyStateCondition(baseCrop, baseCrop.getAgeProperty(), baseCrop.getMaxAge(), LootPool.builder()
.rolls(exactly(1))
.with(ItemEntry.builder(baseCrop.getSeedsItem()).apply(FORTUNE_BONUS)))));
SegmentedCropBlock stage = baseCrop;
while ((stage = stage.getNext()) != null) {
addDrop(stage, applyExplosionDecay(stage, LootTable.builder()
.pool(LootPool.builder()
.rolls(exactly(1))
.with(applyStateCondition(stage, stage.getAgeProperty(), stage.getMaxAge(), ItemEntry.builder(crop))))));
}
}
private LootTable.Builder decomposingSlabDrops(Block slab, ItemConvertible drop, int count) {
return LootTable.builder()
.pool(applyExplosionDecay(slab, LootPool.builder()
.rolls(exactly(1))
.with(item(drop, exactly(count))
.apply(applyStateCondition(slab, SlabBlock.TYPE, SlabType.DOUBLE, SetCountLootFunction.builder(exactly(count * 2)))))));
} }
private LootTable.Builder fruitLeavesDrops(Block leaves) { private LootTable.Builder fruitLeavesDrops(Block leaves) {
return LootTable.builder() return LootTable.builder()
.pool(LootPool.builder() .pool(LootPool.builder()
.rolls(ConstantLootNumberProvider.create(1)) .rolls(exactly(1))
.with(ItemEntry.builder(leaves).conditionally(WITH_SILK_TOUCH_OR_SHEARS)) .with(ItemEntry.builder(leaves).conditionally(WITH_SILK_TOUCH_OR_SHEARS)))
) .pool(applyExplosionDecay(leaves, LootPool.builder()
.pool(LootPool.builder() .rolls(exactly(1))
.rolls(ConstantLootNumberProvider.create(1))
.conditionally(WITHOUT_SILK_TOUCH_NOR_SHEARS) .conditionally(WITHOUT_SILK_TOUCH_NOR_SHEARS)
.with( .with(item(Items.STICK, between(1, 2)).conditionally(TableBonusLootCondition.builder(Enchantments.FORTUNE, LEAVES_STICK_DROP_CHANCE)))));
applyExplosionDecay(leaves, ItemEntry.builder(Items.STICK) }
.apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(1, 2)))
) private LootTable.Builder hullDrops(Block hull, ItemConvertible inner, ItemConvertible outer) {
.conditionally(TableBonusLootCondition.builder(Enchantments.FORTUNE, LEAVES_STICK_DROP_CHANCE)) return LootTable.builder()
) .pool(addSurvivesExplosionCondition(hull, LootPool.builder()
); .rolls(exactly(1))
.with(item(hull, exactly(2)).conditionally(WITHOUT_SILK_TOUCH))
.with(item(inner, exactly(2)).conditionally(WITHOUT_SILK_TOUCH))
.with(item(outer, exactly(2)).conditionally(WITH_SILK_TOUCH))));
}
private LootTable.Builder edibleBlockDrops(Block block, ItemConvertible drop) {
LootTable.Builder builder = LootTable.builder();
for (BooleanProperty segment : EdibleBlock.SEGMENTS) {
builder
.pool(addSurvivesExplosionCondition(block, LootPool.builder()
.rolls(exactly(1))
.with(applyStateCondition(block, segment, true, ItemEntry.builder(drop)))));
}
return builder;
} }
private LootTable.Builder pieDrops(Block block, Item drop, Item stomped) { private LootTable.Builder pieDrops(Block block, Item drop, Item stomped) {
return LootTable.builder().pool(LootPool.builder() return LootTable.builder()
.rolls(ConstantLootNumberProvider.create(1)).conditionally(WITH_SILK_TOUCH) .pool(applyExplosionDecay(block, LootPool.builder()
.with(addStateCondition(block, PieBlock.STOMPED, false, applyExplosionDecay(block, ItemEntry.builder(drop)))) .rolls(exactly(1)).conditionally(WITH_SILK_TOUCH)
.with(addStateCondition(block, PieBlock.STOMPED, true, applyExplosionDecay(block, ItemEntry.builder(stomped)))) .with(applyStateCondition(block, PieBlock.STOMPED, false, ItemEntry.builder(drop)))
); .with(applyStateCondition(block, PieBlock.STOMPED, true, ItemEntry.builder(stomped)))));
} }
public static <T extends LootConditionConsumingBuilder<T>, P extends Comparable<P> & StringIdentifiable> T addStateCondition(Block block, private LootTable.Builder shellDrops(Block block, Item shell) {
Property<P> property, P value, return LootTable.builder()
LootConditionConsumingBuilder<T> builder) { .pool(applyExplosionDecay(block, LootPool.builder()
.rolls(exactly(1))
.with(ItemEntry.builder(shell))
.apply(ShellsBlock.COUNT.getValues(), count -> applyStateCondition(block, ShellsBlock.COUNT, count, SetCountLootFunction.builder(exactly(count))))
.apply(FORTUNE_BONUS)));
}
public LootTable.Builder fortuneBonusDrops(ItemConvertible drop) {
return LootTable.builder().pool(addSurvivesExplosionCondition(drop, LootPool.builder()
.rolls(exactly(1))
.with(ItemEntry.builder(drop).apply(FORTUNE_BONUS))));
}
public static ConstantLootNumberProvider exactly(float n) {
return ConstantLootNumberProvider.create(n);
}
public static UniformLootNumberProvider between(float from, float to) {
return UniformLootNumberProvider.create(from, to);
}
public static ItemEntry.Builder<?> item(ItemConvertible item, LootNumberProvider count) {
return ItemEntry.builder(item).apply(SetCountLootFunction.builder(count));
}
public static <T extends LootConditionConsumingBuilder<T>, P extends Comparable<P> & StringIdentifiable> T applyStateCondition(Block block,
Property<P> property, P value, LootConditionConsumingBuilder<T> builder) {
return builder.conditionally(BlockStatePropertyLootCondition.builder(block).properties(StatePredicate.Builder.create().exactMatch(property, value))); return builder.conditionally(BlockStatePropertyLootCondition.builder(block).properties(StatePredicate.Builder.create().exactMatch(property, value)));
} }
public static <T extends LootConditionConsumingBuilder<T>> T addStateCondition(Block block, public static <T extends LootConditionConsumingBuilder<T>> T applyStateCondition(Block block,
BooleanProperty property, boolean value, BooleanProperty property, boolean value, LootConditionConsumingBuilder<T> builder) {
LootConditionConsumingBuilder<T> builder) { return builder.conditionally(BlockStatePropertyLootCondition.builder(block).properties(StatePredicate.Builder.create().exactMatch(property, value)));
}
public static <T extends LootConditionConsumingBuilder<T>> T applyStateCondition(Block block,
IntProperty property, int value, LootConditionConsumingBuilder<T> builder) {
return builder.conditionally(BlockStatePropertyLootCondition.builder(block).properties(StatePredicate.Builder.create().exactMatch(property, value))); return builder.conditionally(BlockStatePropertyLootCondition.builder(block).properties(StatePredicate.Builder.create().exactMatch(property, value)));
} }
} }

View file

@ -24,6 +24,10 @@ public class UChestAdditionsLootTableProvider extends SimpleFabricLootTableProvi
super(dataOutput, LootContextTypes.CHEST); super(dataOutput, LootContextTypes.CHEST);
} }
@Override
public String getName() {
return super.getName() + " Additions";
}
@Override @Override
public void accept(BiConsumer<Identifier, Builder> exporter) { public void accept(BiConsumer<Identifier, Builder> exporter) {

View file

@ -0,0 +1,56 @@
package com.minelittlepony.unicopia.datagen.providers.loot;
import java.util.function.BiConsumer;
import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.entity.effect.UPotions;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.SimpleFabricLootTableProvider;
import net.minecraft.item.Items;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTable.Builder;
import net.minecraft.loot.context.LootContextTypes;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.function.SetCountLootFunction;
import net.minecraft.loot.function.SetPotionLootFunction;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import net.minecraft.potion.Potion;
import net.minecraft.util.Identifier;
public class UChestLootTableProvider extends SimpleFabricLootTableProvider {
public UChestLootTableProvider(FabricDataOutput output) {
super(output, LootContextTypes.CHEST);
}
@Override
public void accept(BiConsumer<Identifier, Builder> exporter) {
exporter.accept(Unicopia.id("chests/changeling_hive_trap"), LootTable.builder()
.pool(LootPool.builder()
.rolls(ConstantLootNumberProvider.create(6))
.with(createTippedArrowEntry(UPotions.MORPH_EARTH_PONY.shortEffect(), 3))
.with(createTippedArrowEntry(UPotions.MORPH_UNICORN.shortEffect(), 1))
.with(createTippedArrowEntry(UPotions.MORPH_PEGASUS.shortEffect(), 1))
.with(createTippedArrowEntry(UPotions.MORPH_BAT.shortEffect(), 1))
.with(createTippedArrowEntry(UPotions.MORPH_KIRIN.shortEffect(), 1))
.with(createTippedArrowEntry(UPotions.MORPH_HIPPOGRIFF.shortEffect(), 1))
.with(createTippedArrowEntry(UPotions.MORPH_EARTH_PONY.longEffect(), 5))
.with(createTippedArrowEntry(UPotions.MORPH_UNICORN.longEffect(), 2))
.with(createTippedArrowEntry(UPotions.MORPH_PEGASUS.longEffect(), 2))
.with(createTippedArrowEntry(UPotions.MORPH_BAT.longEffect(), 2))
.with(createTippedArrowEntry(UPotions.MORPH_KIRIN.longEffect(), 2))
.with(createTippedArrowEntry(UPotions.MORPH_HIPPOGRIFF.longEffect(), 2))
));
}
private static ItemEntry.Builder<?> createTippedArrowEntry(Potion potion, int weight) {
return ItemEntry.builder(Items.TIPPED_ARROW)
.weight(weight)
.apply(SetPotionLootFunction.builder(potion))
.apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(3, 9)));
}
}

View file

@ -0,0 +1,63 @@
package com.minelittlepony.unicopia.datagen.providers.loot;
import java.util.function.BiConsumer;
import com.minelittlepony.unicopia.UTags;
import com.minelittlepony.unicopia.entity.mob.UEntities;
import com.minelittlepony.unicopia.item.UItems;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.SimpleFabricLootTableProvider;
import net.minecraft.entity.EntityType;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTable.Builder;
import net.minecraft.loot.condition.RandomChanceLootCondition;
import net.minecraft.loot.context.LootContextTypes;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.entry.TagEntry;
import net.minecraft.loot.function.LootingEnchantLootFunction;
import net.minecraft.loot.function.SetCountLootFunction;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import net.minecraft.util.Identifier;
public class UEntityLootTableProvider extends SimpleFabricLootTableProvider {
public UEntityLootTableProvider(FabricDataOutput output) {
super(output, LootContextTypes.ENTITY);
}
@Override
public void accept(BiConsumer<Identifier, Builder> exporter) {
generate((type, builder) -> exporter.accept(EntityType.getId(type).withPrefixedPath("entities/"), builder));
}
protected void generate(BiConsumer<EntityType<?>, Builder> exporter) {
exporter.accept(UEntities.BUTTERFLY, LootTable.builder()
.pool(LootPool.builder()
.rolls(ConstantLootNumberProvider.create(1))
.with(ItemEntry.builder(UItems.BUTTERFLY)
.apply(LootingEnchantLootFunction.builder(UniformLootNumberProvider.create(0, 1))))));
exporter.accept(UEntities.STORM_CLOUD, LootTable.builder()
.pool(LootPool.builder()
.rolls(ConstantLootNumberProvider.create(1))
.with(ItemEntry.builder(UItems.CLOUD_LUMP)
.apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(6, 12)))
.apply(LootingEnchantLootFunction.builder(UniformLootNumberProvider.create(0, 1))))));
exporter.accept(UEntities.LOOT_BUG, LootTable.builder()
.pool(LootPool.builder()
.rolls(ConstantLootNumberProvider.create(1))
.with(TagEntry.builder(UTags.Items.LOOT_BUG_COMMON_DROPS)
.apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(6, 12)))
.apply(LootingEnchantLootFunction.builder(UniformLootNumberProvider.create(0, 3))))
.with(TagEntry.builder(UTags.Items.LOOT_BUG_RARE_DROPS)
.conditionally(RandomChanceLootCondition.builder(0.25F))
.apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(1, 3)))
.apply(LootingEnchantLootFunction.builder(UniformLootNumberProvider.create(0, 6))))
.with(TagEntry.builder(UTags.Items.LOOT_BUG_EPIC_DROPS)
.conditionally(RandomChanceLootCondition.builder(0.1F))
.apply(SetCountLootFunction.builder(ConstantLootNumberProvider.create(1)))
.apply(LootingEnchantLootFunction.builder(UniformLootNumberProvider.create(0, 2))))
));
}
}

View file

@ -214,5 +214,9 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider {
private void populateConventionalTags() { private void populateConventionalTags() {
getOrCreateTagBuilder(UConventionalTags.Blocks.CONCRETES).add(Arrays.stream(DyeColor.values()).map(i -> Registries.BLOCK.get(new Identifier(i.getName() + "_concrete"))).toArray(Block[]::new)); getOrCreateTagBuilder(UConventionalTags.Blocks.CONCRETES).add(Arrays.stream(DyeColor.values()).map(i -> Registries.BLOCK.get(new Identifier(i.getName() + "_concrete"))).toArray(Block[]::new));
getOrCreateTagBuilder(UConventionalTags.Blocks.CONCRETE_POWDERS).add(Arrays.stream(DyeColor.values()).map(i -> Registries.BLOCK.get(new Identifier(i.getName() + "_concrete_powder"))).toArray(Block[]::new)); getOrCreateTagBuilder(UConventionalTags.Blocks.CONCRETE_POWDERS).add(Arrays.stream(DyeColor.values()).map(i -> Registries.BLOCK.get(new Identifier(i.getName() + "_concrete_powder"))).toArray(Block[]::new));
getOrCreateTagBuilder(UConventionalTags.Blocks.GLAZED_TERRACOTTAS).add(Arrays.stream(DyeColor.values()).map(i -> Registries.BLOCK.get(new Identifier(i.getName() + "_glazed_terracotta"))).toArray(Block[]::new));
getOrCreateTagBuilder(UConventionalTags.Blocks.CORAL_BLOCKS).add(Blocks.TUBE_CORAL_BLOCK, Blocks.BRAIN_CORAL_BLOCK, Blocks.BUBBLE_CORAL_BLOCK, Blocks.FIRE_CORAL_BLOCK, Blocks.HORN_CORAL_BLOCK);
getOrCreateTagBuilder(UConventionalTags.Blocks.CORAL_FANS).add(Blocks.TUBE_CORAL_FAN, Blocks.BRAIN_CORAL_FAN, Blocks.BUBBLE_CORAL_FAN, Blocks.FIRE_CORAL_FAN, Blocks.HORN_CORAL_FAN);
getOrCreateTagBuilder(UConventionalTags.Blocks.CORALS).add(Blocks.TUBE_CORAL, Blocks.BRAIN_CORAL, Blocks.BUBBLE_CORAL, Blocks.FIRE_CORAL, Blocks.HORN_CORAL);
} }
} }

View file

@ -102,6 +102,7 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
.forceAddTag(UTags.Items.CLOUD_STAIRS) .forceAddTag(UTags.Items.CLOUD_STAIRS)
.forceAddTag(UTags.Items.CLOUD_BLOCKS) .forceAddTag(UTags.Items.CLOUD_BLOCKS)
.add(UItems.CLOUD_LUMP); .add(UItems.CLOUD_LUMP);
getOrCreateTagBuilder(UTags.Items.CONTAINER_WITH_LOVE).add(UItems.LOVE_BOTTLE, UItems.LOVE_BUCKET, UItems.LOVE_MUG);
getOrCreateTagBuilder(UTags.Items.HAS_NO_TRAITS).add( getOrCreateTagBuilder(UTags.Items.HAS_NO_TRAITS).add(
Items.AIR, Items.SPAWNER, Items.STRUCTURE_VOID, Items.STRUCTURE_BLOCK, Items.AIR, Items.SPAWNER, Items.STRUCTURE_VOID, Items.STRUCTURE_BLOCK,
Items.COMMAND_BLOCK, Items.CHAIN_COMMAND_BLOCK, Items.REPEATING_COMMAND_BLOCK, Items.COMMAND_BLOCK, Items.CHAIN_COMMAND_BLOCK, Items.REPEATING_COMMAND_BLOCK,
@ -109,16 +110,23 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
Items.DEBUG_STICK, Items.COMMAND_BLOCK_MINECART, Items.DEBUG_STICK, Items.COMMAND_BLOCK_MINECART,
UItems.PLUNDER_VINE UItems.PLUNDER_VINE
).forceAddTag(UTags.Items.BADGES); ).forceAddTag(UTags.Items.BADGES);
getOrCreateTagBuilder(UTags.Items.LOOT_BUG_HIGH_VALUE_DROPS).add( getOrCreateTagBuilder(UTags.Items.LOOT_BUG_COMMON_DROPS).forceAddTag(ConventionalItemTags.NUGGETS);
getOrCreateTagBuilder(UTags.Items.LOOT_BUG_RARE_DROPS).add(
Items.DIAMOND, Items.GOLDEN_APPLE, Items.GOLDEN_CARROT, Items.DIAMOND, Items.GOLDEN_APPLE, Items.GOLDEN_CARROT,
Items.GOLDEN_HELMET, Items.GOLDEN_BOOTS, Items.GOLDEN_LEGGINGS, Items.GOLDEN_CHESTPLATE, Items.GOLDEN_HELMET, Items.GOLDEN_BOOTS, Items.GOLDEN_LEGGINGS, Items.GOLDEN_CHESTPLATE,
Items.GOLDEN_HORSE_ARMOR, Items.GOLDEN_HORSE_ARMOR,
Items.GOLDEN_PICKAXE, Items.GOLDEN_SHOVEL, Items.GOLDEN_AXE, Items.GOLDEN_SWORD, Items.GOLDEN_HOE, Items.GOLDEN_PICKAXE, Items.GOLDEN_SHOVEL, Items.GOLDEN_AXE, Items.GOLDEN_SWORD, Items.GOLDEN_HOE,
UItems.GOLDEN_HORSE_SHOE, UItems.GOLDEN_POLEARM, UItems.GOLDEN_FEATHER, UItems.GOLDEN_WING, UItems.GOLDEN_HORSE_SHOE, UItems.GOLDEN_POLEARM, UItems.GOLDEN_FEATHER, UItems.GOLDEN_WING,
UItems.GOLDEN_OAK_SEEDS UItems.GOLDEN_OAK_SEEDS
).forceAddTag(ConventionalItemTags.NUGGETS) ).forceAddTag(ConventionalItemTags.GOLD_INGOTS).forceAddTag(ConventionalItemTags.RAW_GOLD_ORES).forceAddTag(ConventionalItemTags.RAW_GOLD_BLOCKS)
.forceAddTag(ConventionalItemTags.GOLD_INGOTS).forceAddTag(ConventionalItemTags.RAW_GOLD_ORES).forceAddTag(ConventionalItemTags.RAW_GOLD_BLOCKS)
.addOptionalTag(new Identifier("farmersdelight:golden_knife")); .addOptionalTag(new Identifier("farmersdelight:golden_knife"));
getOrCreateTagBuilder(UTags.Items.LOOT_BUG_EPIC_DROPS).add(
Items.DIAMOND_BLOCK,
Items.DIAMOND_HELMET, Items.DIAMOND_BOOTS, Items.DIAMOND_LEGGINGS, Items.DIAMOND_CHESTPLATE,
Items.DIAMOND_HORSE_ARMOR,
Items.DIAMOND_PICKAXE, Items.DIAMOND_SHOVEL, Items.DIAMOND_AXE, Items.DIAMOND_SWORD, Items.DIAMOND_HOE,
UItems.DIAMOND_POLEARM
).forceAddTag(UTags.Items.BADGES).forceAddTag(ConventionalItemTags.GOLD_INGOTS);
exportFarmersDelightItems(); exportFarmersDelightItems();
} }
@ -154,6 +162,10 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
private void exportConventionalTags() { private void exportConventionalTags() {
copy(UConventionalTags.Blocks.CONCRETES, UConventionalTags.Items.CONCRETES); copy(UConventionalTags.Blocks.CONCRETES, UConventionalTags.Items.CONCRETES);
copy(UConventionalTags.Blocks.CONCRETE_POWDERS, UConventionalTags.Items.CONCRETE_POWDERS); 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_FANS, UConventionalTags.Items.CORAL_FANS);
copy(UConventionalTags.Blocks.CORALS, UConventionalTags.Items.CORALS);
getOrCreateTagBuilder(UConventionalTags.Items.ACORNS).add(UItems.ACORN); getOrCreateTagBuilder(UConventionalTags.Items.ACORNS).add(UItems.ACORN);
getOrCreateTagBuilder(UConventionalTags.Items.APPLES) getOrCreateTagBuilder(UConventionalTags.Items.APPLES)
.add(Items.APPLE, Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, UItems.ROTTEN_APPLE) .add(Items.APPLE, Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, UItems.ROTTEN_APPLE)
@ -161,8 +173,34 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
.addOptionalTag(new Identifier("c", "pyrite_apples")) // no idea which mod add pyrite apples .addOptionalTag(new Identifier("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(new Identifier("c", "mollusks"));
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_FISH).add(Items.COOKED_COD, Items.COOKED_SALMON); getOrCreateTagBuilder(UConventionalTags.Items.COOKED_FISH).add(Items.COOKED_COD, Items.COOKED_SALMON);
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_MEAT)
.add(Items.COOKED_PORKCHOP, Items.COOKED_BEEF, Items.COOKED_MUTTON, Items.COOKED_RABBIT, Items.COOKED_CHICKEN, Items.RABBIT_STEW)
.addOptionalTag(new Identifier("c", "cooked_bacon"))
.addOptionalTag(new Identifier("c", "cooked_beef"))
.addOptionalTag(new Identifier("c", "cooked_chicken"))
.addOptionalTag(new Identifier("c", "cooked_mutton"))
.addOptionalTag(new Identifier("c", "cooked_pork"))
.addOptionalTag(new Identifier("c", "fried_chickens"))
.addOptionalTag(new Identifier("c", "hamburgers"))
.addOptionalTag(new Identifier("c", "pork_and_beans"))
.addOptionalTag(new Identifier("c", "pork_jerkies"))
.addOptionalTag(new Identifier("c", "protien"));
getOrCreateTagBuilder(UConventionalTags.Items.RAW_MEAT)
.add(Items.PORKCHOP, Items.BEEF, Items.MUTTON, Items.RABBIT, Items.CHICKEN)
.addOptionalTag(new Identifier("c", "raw_bacon"))
.addOptionalTag(new Identifier("c", "raw_beef"))
.addOptionalTag(new Identifier("c", "raw_chicken"))
.addOptionalTag(new Identifier("c", "raw_mutton"))
.addOptionalTag(new Identifier("c", "raw_pork"))
.addOptionalTag(new Identifier("c", "lemon_chickens"));
getOrCreateTagBuilder(UConventionalTags.Items.ROTTEN_MEAT).add(Items.ROTTEN_FLESH);
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_INSECT).add(Items.FERMENTED_SPIDER_EYE);
getOrCreateTagBuilder(UConventionalTags.Items.RAW_INSECT).add(Items.SPIDER_EYE, UItems.BUTTERFLY, UItems.WHEAT_WORMS, UBlocks.WORM_BLOCK.asItem());
getOrCreateTagBuilder(UConventionalTags.Items.WORMS).add(UItems.WHEAT_WORMS);
getOrCreateTagBuilder(UConventionalTags.Items.STICKS).add(Items.STICK); getOrCreateTagBuilder(UConventionalTags.Items.STICKS).add(Items.STICK);
getOrCreateTagBuilder(UConventionalTags.Items.ROCKS).add(UItems.ROCK);
getOrCreateTagBuilder(UConventionalTags.Items.PINECONES).add(UItems.PINECONE); getOrCreateTagBuilder(UConventionalTags.Items.PINECONES).add(UItems.PINECONE);
getOrCreateTagBuilder(UConventionalTags.Items.PINEAPPLES).add(UItems.PINEAPPLE); getOrCreateTagBuilder(UConventionalTags.Items.PINEAPPLES).add(UItems.PINEAPPLE);
getOrCreateTagBuilder(UConventionalTags.Items.MANGOES).add(UItems.MANGO); getOrCreateTagBuilder(UConventionalTags.Items.MANGOES).add(UItems.MANGO);
@ -184,9 +222,18 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
private void exportFarmersDelightItems() { private void exportFarmersDelightItems() {
getOrCreateTagBuilder(UTags.Items.COOLS_OFF_KIRINS) getOrCreateTagBuilder(UTags.Items.COOLS_OFF_KIRINS)
.addOptional(new Identifier("farmersdelight:melon_popsicle")) .addOptional(new Identifier("farmersdelight", "melon_popsicle"))
.addOptional(new Identifier("farmersdelight:melon_juice")); .addOptional(new Identifier("farmersdelight", "melon_juice"));
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier("farmersdelight:cabbage_roll_ingredients"))).add(UItems.OATS, UItems.ROCK, UItems.WHEAT_WORMS); getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier("farmersdelight", "cabbage_roll_ingredients"))).add(UItems.OATS, UItems.ROCK, UItems.WHEAT_WORMS);
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier("farmersdelight:comfort_foods"))).add(UItems.OATMEAL, UItems.ROCK_STEW, UItems.MUFFIN); getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier("farmersdelight", "comfort_foods"))).add(UItems.OATMEAL, UItems.ROCK_STEW, UItems.MUFFIN);
getOrCreateTagBuilder(UConventionalTags.Items.RAW_FISH)
.addOptional(new Identifier("farmersdelight", "cod_roll"))
.addOptional(new Identifier("farmersdelight", "salmon_roll"))
.addOptional(new Identifier("farmersdelight", "cod_slice"))
.addOptional(new Identifier("farmersdelight", "salmon_slice"));
getOrCreateTagBuilder(UConventionalTags.Items.COOKED_FISH)
.addOptional(new Identifier("farmersdelight", "fish_stew"))
.addOptional(new Identifier("farmersdelight", "baked_cod_stew"))
.addOptional(new Identifier("farmersdelight", "grilled_salmon"));
} }
} }

View file

@ -5,11 +5,11 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.entity.player.Pony; import com.minelittlepony.unicopia.entity.player.Pony;
import com.minelittlepony.unicopia.item.ItemDuck; import com.minelittlepony.unicopia.item.ItemDuck;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
@ -19,13 +19,11 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.FoodComponent; import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
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.UseAction; import net.minecraft.util.UseAction;
public record DietProfile( public record DietProfile(
@ -40,12 +38,34 @@ public record DietProfile(
Codec.FLOAT.fieldOf("default_multiplier").forGetter(DietProfile::defaultMultiplier), Codec.FLOAT.fieldOf("default_multiplier").forGetter(DietProfile::defaultMultiplier),
Codec.FLOAT.fieldOf("foraging_multiplier").forGetter(DietProfile::foragingMultiplier), Codec.FLOAT.fieldOf("foraging_multiplier").forGetter(DietProfile::foragingMultiplier),
Codec.list(Multiplier.CODEC).fieldOf("multipliers").forGetter(DietProfile::multipliers), Codec.list(Multiplier.CODEC).fieldOf("multipliers").forGetter(DietProfile::multipliers),
Codec.list(Effect.CODEC).fieldOf("effects").forGetter(DietProfile::effects), Codec.list(Effect.PROFILE_CODEC).fieldOf("effects").forGetter(DietProfile::effects),
Effect.CODEC.optionalFieldOf("default_effect").forGetter(DietProfile::defaultEffect) Effect.CODEC.optionalFieldOf("default_effect").forGetter(DietProfile::defaultEffect)
).apply(instance, DietProfile::new)); ).apply(instance, DietProfile::new));
public DietProfile(PacketByteBuf buffer) { public DietProfile(PacketByteBuf buffer) {
this(buffer.readFloat(), buffer.readFloat(), buffer.readList(Multiplier::new), buffer.readList(Effect::new), buffer.readOptional(Effect::new)); this(buffer.readFloat(), buffer.readFloat(),
buffer.readList(Multiplier::new),
buffer.readList(b -> new Effect(b, FoodGroupKey.LOOKUP)),
buffer.readOptional(b -> new Effect(b, FoodGroupKey.LOOKUP))
);
}
public void validate(Consumer<String> issues, Predicate<Identifier> foodGroupExists) {
multipliers.stream().flatMap(i -> i.tags().stream()).forEach(key -> {
if (!foodGroupExists.test(key.id())) {
issues.accept("Multiplier referenced unknown food group: " + key.id());
}
});
effects.stream().flatMap(i -> i.tags().stream()).forEach(key -> {
if (!foodGroupExists.test(key.id())) {
issues.accept("Override defined for unknown food group: " + key.id());
}
});
defaultEffect.stream().flatMap(i -> i.tags().stream()).forEach(key -> {
if (!foodGroupExists.test(key.id())) {
issues.accept("Default override defined for unknown food group: " + key.id());
}
});
} }
public void toBuffer(PacketByteBuf buffer) { public void toBuffer(PacketByteBuf buffer) {
@ -145,11 +165,11 @@ public record DietProfile(
} }
public record Multiplier( public record Multiplier(
Set<TagKey<Item>> tags, Set<FoodGroupKey> tags,
float hunger, float hunger,
float saturation float saturation
) implements Predicate<ItemStack> { ) implements Predicate<ItemStack> {
public static final Codec<Set<TagKey<Item>>> TAGS_CODEC = Codec.list(TagKey.unprefixedCodec(RegistryKeys.ITEM)).xmap( public static final Codec<Set<FoodGroupKey>> TAGS_CODEC = FoodGroupKey.CODEC.listOf().xmap(
l -> l.stream().distinct().collect(Collectors.toSet()), l -> l.stream().distinct().collect(Collectors.toSet()),
set -> new ArrayList<>(set) set -> new ArrayList<>(set)
); );
@ -160,12 +180,12 @@ public record DietProfile(
).apply(instance, Multiplier::new)); ).apply(instance, Multiplier::new));
public Multiplier(PacketByteBuf buffer) { public Multiplier(PacketByteBuf buffer) {
this(buffer.readCollection(HashSet::new, p -> TagKey.of(RegistryKeys.ITEM, p.readIdentifier())), buffer.readFloat(), buffer.readFloat()); this(buffer.readCollection(HashSet::new, p -> FoodGroupKey.LOOKUP.apply(p.readIdentifier())), buffer.readFloat(), buffer.readFloat());
} }
@Override @Override
public boolean test(ItemStack stack) { public boolean test(ItemStack stack) {
return tags.stream().anyMatch(tag -> stack.isIn(tag)); return tags.stream().anyMatch(tag -> tag.contains(stack));
} }
public void toBuffer(PacketByteBuf buffer) { public void toBuffer(PacketByteBuf buffer) {

View file

@ -1,12 +1,9 @@
package com.minelittlepony.unicopia.diet; package com.minelittlepony.unicopia.diet;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import org.slf4j.Logger; import org.slf4j.Logger;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
@ -36,9 +33,24 @@ public class DietsLoader implements IdentifiableResourceReloadListener {
Profiler prepareProfiler, Profiler applyProfiler, Profiler prepareProfiler, Profiler applyProfiler,
Executor prepareExecutor, Executor applyExecutor) { Executor prepareExecutor, Executor applyExecutor) {
var dietsLoadTask = loadData(manager, prepareExecutor, "diets/races").thenApplyAsync(data -> { CompletableFuture<Map<Identifier, Effect>> foodGroupsFuture = CompletableFuture.supplyAsync(() -> {
Map<Identifier, Effect> foodGroups = new HashMap<>();
for (var group : loadData(manager, prepareExecutor, "diets/food_groups").entrySet()) {
try {
Effect.CODEC.parse(JsonOps.INSTANCE, group.getValue())
.resultOrPartial(error -> LOGGER.error("Could not load food group {}: {}", group.getKey(), error))
.ifPresent(value -> {
foodGroups.put(group.getKey(), value);
});
} catch (Throwable t) {
LOGGER.error("Could not load food effects {}", group.getKey(), t);
}
}
return foodGroups;
}, prepareExecutor);
CompletableFuture<Map<Race, DietProfile>> profilesFuture = CompletableFuture.supplyAsync(() -> {
Map<Race, DietProfile> profiles = new HashMap<>(); Map<Race, DietProfile> profiles = new HashMap<>();
for (var entry : data.entrySet()) { for (var entry : loadData(manager, prepareExecutor, "diets/races").entrySet()) {
Identifier id = entry.getKey(); Identifier id = entry.getKey();
try { try {
Race.REGISTRY.getOrEmpty(id).ifPresentOrElse(race -> { Race.REGISTRY.getOrEmpty(id).ifPresentOrElse(race -> {
@ -53,33 +65,26 @@ public class DietsLoader implements IdentifiableResourceReloadListener {
return profiles; return profiles;
}, prepareExecutor); }, prepareExecutor);
var effectsLoadTask = loadData(manager, prepareExecutor, "diets/food_effects").thenApplyAsync(data -> data.entrySet().stream() return CompletableFuture.allOf(foodGroupsFuture, profilesFuture).thenCompose(sync::whenPrepared).thenAcceptAsync(v -> {
.map(entry -> { var profiles = profilesFuture.getNow(Map.of());
try { var foodGroups = foodGroupsFuture.getNow(Map.of());
return Effect.CODEC.parse(JsonOps.INSTANCE, entry.getValue()) profiles.entrySet().removeIf(entry -> {
.resultOrPartial(error -> LOGGER.error("Could not load food effect {}: {}", entry.getKey(), error)); StringBuilder issueList = new StringBuilder();
} catch (Throwable t) { entry.getValue().validate(issue -> {
LOGGER.error("Could not load food effects {}", entry.getKey(), t); issueList.append(System.lineSeparator()).append(issue);
}, foodGroups::containsKey);
if (!issueList.isEmpty()) {
LOGGER.error("Could not load diet profile {}. Caused by {}", entry.getKey(), issueList.toString());
} }
return Optional.<Effect>empty(); return issueList.isEmpty();
}) });
.filter(Optional::isPresent) PonyDiets.load(new PonyDiets(profiles, foodGroups));
.map(Optional::get)
.toList(), prepareExecutor);
return CompletableFuture.allOf(dietsLoadTask, effectsLoadTask).thenCompose(sync::whenPrepared).thenRunAsync(() -> {
PonyDiets.load(new PonyDiets(
dietsLoadTask.getNow(Map.of()),
effectsLoadTask.getNow(List.of())
));
}, applyExecutor); }, applyExecutor);
} }
private static CompletableFuture<Map<Identifier, JsonElement>> loadData(ResourceManager manager, Executor prepareExecutor, String path) { private static Map<Identifier, JsonElement> loadData(ResourceManager manager, Executor prepareExecutor, String path) {
return CompletableFuture.supplyAsync(() -> {
Map<Identifier, JsonElement> results = new HashMap<>(); Map<Identifier, JsonElement> results = new HashMap<>();
JsonDataLoader.load(manager, path, Resources.GSON, results); JsonDataLoader.load(manager, path, Resources.GSON, results);
return results; return results;
});
} }
} }

View file

@ -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.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import com.minelittlepony.unicopia.entity.player.Pony; import com.minelittlepony.unicopia.entity.player.Pony;
@ -10,30 +11,33 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.FoodComponent; import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
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.UseAction; import net.minecraft.util.UseAction;
import net.minecraft.util.Util; import net.minecraft.util.Util;
public record Effect( public record Effect(
List<TagKey<Item>> tags, List<FoodGroupKey> tags,
Optional<FoodComponent> foodComponent, Optional<FoodComponent> foodComponent,
Ailment ailment Ailment ailment
) implements Predicate<ItemStack> { ) implements Predicate<ItemStack> {
public static final Effect EMPTY = new Effect(List.of(), Optional.empty(), Ailment.EMPTY); public static final Effect EMPTY = new Effect(List.of(), Optional.empty(), Ailment.EMPTY);
public static final Codec<Effect> CODEC = RecordCodecBuilder.create(instance -> instance.group( public static final Codec<Effect> CODEC = RecordCodecBuilder.create(instance -> instance.group(
TagKey.unprefixedCodec(RegistryKeys.ITEM).listOf().fieldOf("tags").forGetter(Effect::tags), FoodGroupKey.TAG_CODEC.listOf().fieldOf("tags").forGetter(Effect::tags),
FoodAttributes.CODEC.optionalFieldOf("food_component").forGetter(Effect::foodComponent),
Ailment.CODEC.fieldOf("ailment").forGetter(Effect::ailment)
).apply(instance, Effect::new));
public static final Codec<Effect> PROFILE_CODEC = RecordCodecBuilder.create(instance -> instance.group(
FoodGroupKey.CODEC.listOf().fieldOf("tags").forGetter(Effect::tags),
FoodAttributes.CODEC.optionalFieldOf("food_component").forGetter(Effect::foodComponent), FoodAttributes.CODEC.optionalFieldOf("food_component").forGetter(Effect::foodComponent),
Ailment.CODEC.fieldOf("ailment").forGetter(Effect::ailment) Ailment.CODEC.fieldOf("ailment").forGetter(Effect::ailment)
).apply(instance, Effect::new)); ).apply(instance, Effect::new));
public Effect(PacketByteBuf buffer) { public Effect(PacketByteBuf buffer, Function<Identifier, FoodGroupKey> lookup) {
this(buffer.readList(b -> TagKey.of(RegistryKeys.ITEM, b.readIdentifier())), buffer.readOptional(FoodAttributes::read), new Ailment(buffer)); this(buffer.readList(b -> lookup.apply(b.readIdentifier())), buffer.readOptional(FoodAttributes::read), new Ailment(buffer));
} }
public void afflict(Pony pony, ItemStack stack) { public void afflict(Pony pony, ItemStack stack) {
@ -43,7 +47,7 @@ public record Effect(
public void appendTooltip(ItemStack stack, List<Text> tooltip, TooltipContext context) { public void appendTooltip(ItemStack stack, List<Text> tooltip, TooltipContext context) {
int size = tooltip.size(); int size = tooltip.size();
tags.forEach(tag -> { tags.forEach(tag -> {
if (stack.isIn(tag)) { if (tag.contains(stack)) {
tooltip.add(Text.literal(" ").append(Text.translatable(Util.createTranslationKey("tag", tag.id()))).formatted(Formatting.GRAY)); tooltip.add(Text.literal(" ").append(Text.translatable(Util.createTranslationKey("tag", tag.id()))).formatted(Formatting.GRAY));
} }
}); });
@ -71,6 +75,6 @@ public record Effect(
@Override @Override
public boolean test(ItemStack stack) { public boolean test(ItemStack stack) {
return tags.stream().anyMatch(stack::isIn); return tags.stream().anyMatch(tag -> tag.contains(stack));
} }
} }

View file

@ -0,0 +1,49 @@
package com.minelittlepony.unicopia.diet;
import java.util.function.Function;
import com.mojang.serialization.Codec;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
public interface FoodGroupKey {
Function<Identifier, FoodGroupKey> LOOKUP = Util.memoize(id -> {
return new FoodGroupKey() {
@Override
public Identifier id() {
return id;
}
@Override
public boolean contains(ItemStack stack) {
var group = PonyDiets.getEffect(id);
return group != null && group.test(stack);
}
};
});
Function<TagKey<Item>, FoodGroupKey> TAG_LOOKUP = Util.memoize(tag -> {
return new FoodGroupKey() {
@Override
public Identifier id() {
return tag.id();
}
@Override
public boolean contains(ItemStack stack) {
return stack.isIn(tag);
}
};
});
Function<Identifier, FoodGroupKey> TAG_ID_LOOKUP = id -> TAG_LOOKUP.apply(TagKey.of(RegistryKeys.ITEM, id));
Codec<FoodGroupKey> CODEC = Identifier.CODEC.xmap(LOOKUP, FoodGroupKey::id);
Codec<FoodGroupKey> TAG_CODEC = TagKey.unprefixedCodec(RegistryKeys.ITEM).xmap(TAG_LOOKUP, k -> TagKey.of(RegistryKeys.ITEM, k.id()));
Identifier id();
boolean contains(ItemStack stack);
}

View file

@ -18,35 +18,41 @@ import net.minecraft.network.PacketByteBuf;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.TypedActionResult; import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World; import net.minecraft.world.World;
public class PonyDiets implements DietView { public class PonyDiets implements DietView {
private final Map<Race, DietProfile> diets; private final Map<Race, DietProfile> diets;
private final List<Effect> effects; private final Map<Identifier, Effect> effects;
private static PonyDiets INSTANCE = new PonyDiets(Map.of(), List.of()); private static PonyDiets INSTANCE = new PonyDiets(Map.of(), Map.of());
public static PonyDiets getInstance() { public static PonyDiets getInstance() {
return INSTANCE; return INSTANCE;
} }
@Nullable
static Effect getEffect(Identifier id) {
return INSTANCE.effects.get(id);
}
public static void load(PonyDiets diets) { public static void load(PonyDiets diets) {
INSTANCE = diets; INSTANCE = diets;
} }
PonyDiets(Map<Race, DietProfile> diets, List<Effect> effects) { PonyDiets(Map<Race, DietProfile> diets, Map<Identifier, Effect> effects) {
this.diets = diets; this.diets = diets;
this.effects = effects; this.effects = effects;
} }
public PonyDiets(PacketByteBuf buffer) { public PonyDiets(PacketByteBuf buffer) {
this(buffer.readMap(b -> b.readRegistryValue(Race.REGISTRY), DietProfile::new), buffer.readList(Effect::new)); this(buffer.readMap(b -> b.readRegistryValue(Race.REGISTRY), DietProfile::new), buffer.readMap(PacketByteBuf::readIdentifier, b -> new Effect(b, FoodGroupKey.TAG_ID_LOOKUP)));
} }
public void toBuffer(PacketByteBuf buffer) { public void toBuffer(PacketByteBuf buffer) {
buffer.writeMap(diets, (b, r) -> b.writeRegistryValue(Race.REGISTRY, r), (b, e) -> e.toBuffer(b)); buffer.writeMap(diets, (b, r) -> b.writeRegistryValue(Race.REGISTRY, r), (b, e) -> e.toBuffer(b));
buffer.writeCollection(effects, (b, e) -> e.toBuffer(b)); buffer.writeMap(effects, PacketByteBuf::writeIdentifier, (b, e) -> e.toBuffer(b));
} }
private DietProfile getDiet(Pony pony) { private DietProfile getDiet(Pony pony) {
@ -54,7 +60,7 @@ public class PonyDiets implements DietView {
} }
Effect getEffects(ItemStack stack) { Effect getEffects(ItemStack stack) {
return effects.stream().filter(effect -> effect.test(stack)).findFirst().orElse(Effect.EMPTY); return effects.values().stream().filter(effect -> effect.test(stack)).findFirst().orElse(Effect.EMPTY);
} }
private Effect getEffects(ItemStack stack, Pony pony) { private Effect getEffects(ItemStack stack, Pony pony) {

View file

@ -622,17 +622,17 @@
"tag.unicopia.food_types.rotten_meat": "Rotting Meat", "tag.unicopia.food_types.rotten_meat": "Rotting Meat",
"tag.unicopia.food_types.raw_meat": "Fresh Meat", "tag.unicopia.food_types.raw_meat": "Fresh Meat",
"tag.unicopia.food_types.cooked_meat": "Prepared Meat", "tag.unicopia.food_types.cooked_meat": "Prepared Meat",
"tag.unicopia.food_types.raw_fish": "Fresh Fish", "tag.c.raw_fish": "Fresh Fish",
"tag.unicopia.food_types.cooked_fish": "Prepared Fish", "tag.c.cooked_fish": "Prepared Fish",
"tag.unicopia.food_types.raw_insect": "Bugs & Insects", "tag.c.raw_insect": "Bugs & Insects",
"tag.unicopia.food_types.cooked_insect": "Cooked Bugs & Insects", "tag.unicopia.food_types.cooked_insect": "Cooked Bugs & Insects",
"tag.unicopia.food_types.nuts_and_seeds": "Nuts & Seeds", "tag.unicopia.food_types.nuts_and_seeds": "Nuts & Seeds",
"tag.unicopia.food_types.love": "Love", "tag.unicopia.container_with_love": "Love",
"tag.unicopia.food_types.rocks": "Rocks", "tag.unicopia.food_types.rocks": "Rocks",
"tag.unicopia.food_types.pinecone": "Nuts & Seeds", "tag.unicopia.food_types.pinecone": "Nuts & Seeds",
"tag.unicopia.food_types.bat_ponys_delight": "Bat Pony Treats", "tag.unicopia.food_types.bat_ponys_delight": "Bat Pony Treats",
"tag.unicopia.food_types.cooked_sea_vegitables": "Prepared Fish Food", "tag.unicopia.food_types.cooked_sea_vegitable": "Prepared Fish Food",
"tag.unicopia.food_types.raw_sea_vegitables": "Fresh Fish Food", "tag.unicopia.food_types.raw_sea_vegitable": "Fresh Fish Food",
"tag.unicopia.food_types.shells": "Sea Shells", "tag.unicopia.food_types.shells": "Sea Shells",
"tag.unicopia.food_types.shelly": "Sea Shells", "tag.unicopia.food_types.shelly": "Sea Shells",
"tag.unicopia.food_types.candy": "Candy", "tag.unicopia.food_types.candy": "Candy",

View file

@ -1,21 +0,0 @@
{
"replace": false,
"values": [
"minecraft:white_concrete",
"minecraft:orange_concrete",
"minecraft:magenta_concrete",
"minecraft:light_blue_concrete",
"minecraft:yellow_concrete",
"minecraft:lime_concrete",
"minecraft:pink_concrete",
"minecraft:gray_concrete",
"minecraft:light_gray_concrete",
"minecraft:cyan_concrete",
"minecraft:purple_concrete",
"minecraft:blue_concrete",
"minecraft:brown_concrete",
"minecraft:green_concrete",
"minecraft:red_concrete",
"minecraft:black_concrete"
]
}

View file

@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"minecraft:fermented_spider_eye",
{ "id": "#c:cooked_insect", "required": false }
]
}

View file

@ -1,22 +0,0 @@
{
"replace": false,
"values": [
"minecraft:cooked_porkchop",
"minecraft:cooked_beef",
"minecraft:cooked_mutton",
"minecraft:cooked_rabbit",
"minecraft:rabbit_stew",
"minecraft:cooked_chicken",
{ "id": "#c:cooked_meat", "required": false },
{ "id": "#c:cooked_bacon", "required": false },
{ "id": "#c:cooked_beef", "required": false },
{ "id": "#c:cooked_chicken", "required": false },
{ "id": "#c:cooked_mutton", "required": false },
{ "id": "#c:cooked_pork", "required": false },
{ "id": "#c:fried_chickens", "required": false },
{ "id": "#c:hamburgers", "required": false },
{ "id": "#c:pork_and_beans", "required": false },
{ "id": "#c:pork_jerkies", "required": false },
{ "id": "#c:protein", "required": false }
]
}

View file

@ -1,10 +0,0 @@
{
"replace": false,
"values": [
"minecraft:tube_coral_block",
"minecraft:brain_coral_block",
"minecraft:bubble_coral_block",
"minecraft:fire_coral_block",
"minecraft:horn_coral_block"
]
}

View file

@ -1,10 +0,0 @@
{
"replace": false,
"values": [
"minecraft:tube_coral_fan",
"minecraft:brain_coral_fan",
"minecraft:bubble_coral_fan",
"minecraft:fire_coral_fan",
"minecraft:horn_coral_fan"
]
}

View file

@ -1,10 +0,0 @@
{
"replace": false,
"values": [
"minecraft:tube_coral",
"minecraft:brain_coral",
"minecraft:bubble_coral",
"minecraft:fire_coral",
"minecraft:horn_coral"
]
}

View file

@ -1,21 +0,0 @@
{
"replace": false,
"values": [
"minecraft:white_glazed_terracotta",
"minecraft:orange_glazed_terracotta",
"minecraft:magenta_glazed_terracotta",
"minecraft:light_blue_glazed_terracotta",
"minecraft:yellow_glazed_terracotta",
"minecraft:lime_glazed_terracotta",
"minecraft:pink_glazed_terracotta",
"minecraft:gray_glazed_terracotta",
"minecraft:light_gray_glazed_terracotta",
"minecraft:cyan_glazed_terracotta",
"minecraft:purple_glazed_terracotta",
"minecraft:blue_glazed_terracotta",
"minecraft:brown_glazed_terracotta",
"minecraft:green_glazed_terracotta",
"minecraft:red_glazed_terracotta",
"minecraft:black_glazed_terracotta"
]
}

View file

@ -1,8 +0,0 @@
{
"replace": false,
"values": [
"unicopia:love_bottle",
"unicopia:love_bucket",
"unicopia:love_mug"
]
}

View file

@ -1,10 +0,0 @@
{
"replace": false,
"values": [
"minecraft:pufferfish",
"minecraft:cod",
"minecraft:salmon",
"minecraft:tropical_fish",
{ "id": "#c:mollusks", "required": false }
]
}

View file

@ -1,9 +0,0 @@
{
"replace": false,
"values": [
"minecraft:spider_eye",
"unicopia:butterfly",
"unicopia:wheat_worms",
"unicopia:worm_block"
]
}

View file

@ -1,17 +0,0 @@
{
"replace": false,
"values": [
"minecraft:porkchop",
"minecraft:beef",
"minecraft:mutton",
"minecraft:rabbit",
"minecraft:chicken",
{ "id": "#c:raw_meat", "required": false },
{ "id": "#c:lemon_chickens", "required": false },
{ "id": "#c:raw_bacon", "required": false },
{ "id": "#c:raw_beef", "required": false },
{ "id": "#c:raw_chicken", "required": false },
{ "id": "#c:raw_mutton", "required": false },
{ "id": "#c:raw_pork", "required": false }
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:rock"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"minecraft:rotten_flesh"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:wheat_worms"
]
}

View file

@ -3,7 +3,7 @@
"traits": "earth:1 order:1 knowledge:4", "traits": "earth:1 order:1 knowledge:4",
"items": [ "items": [
"#minecraft:terracotta", "#minecraft:terracotta",
"#c:concrete", "#c:concretes",
"#c:glazed_terracotta" "#c:glazed_terracottas"
] ]
} }

View file

@ -2,8 +2,6 @@
"replace": false, "replace": false,
"traits": "famine:-0.5 life:-1 knowledge:2", "traits": "famine:-0.5 life:-1 knowledge:2",
"items": [ "items": [
"#c:cooked_meats",
"#c:cooked_fish",
"minecraft:fermented_spider_eye", "minecraft:fermented_spider_eye",
"#unicopia:food_types/cooked_fish", "#unicopia:food_types/cooked_fish",
"#unicopia:food_types/cooked_meat" "#unicopia:food_types/cooked_meat"

View file

@ -2,6 +2,6 @@
"replace": false, "replace": false,
"traits": "blood:1 famine:-2", "traits": "blood:1 famine:-2",
"items": [ "items": [
"#c:raw_meats" "#c:raw_meat"
] ]
} }

View file

@ -0,0 +1,10 @@
{
"tags": [ "unicopia:food_types/bat_ponys_delight" ],
"food_component": {
"hunger": 1,
"saturation": 0.1
},
"ailment": {
"effects": []
}
}

View file

@ -1,5 +1,5 @@
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "c:cooked_fish" ],
"food_component": { "food_component": {
"hunger": 1, "hunger": 1,
"saturation": 0.1 "saturation": 0.1

View file

@ -1,5 +1,5 @@
{ {
"tags": [ "unicopia:food_types/raw_fish" ], "tags": [ "c:raw_fish" ],
"food_component": { "food_component": {
"hunger": 1, "hunger": 1,
"saturation": 0.1 "saturation": 0.1

View file

@ -1,5 +1,5 @@
{ {
"tags": [ "unicopia:food_types/rotten_fish" ], "tags": [ "c:rotten_fish" ],
"food_component": { "food_component": {
"hunger": 1, "hunger": 1,
"saturation": 0.1 "saturation": 0.1

View file

@ -1,5 +1,5 @@
{ {
"tags": [ "unicopia:food_types/cooked_insect" ], "tags": [ "c:cooked_insect" ],
"food_component": { "food_component": {
"hunger": 1, "hunger": 1,
"saturation": 0.1 "saturation": 0.1

View file

@ -1,5 +1,5 @@
{ {
"tags": [ "unicopia:food_types/raw_insect" ], "tags": [ "c:raw_insect" ],
"food_component": { "food_component": {
"hunger": 6, "hunger": 6,
"saturation": 0.3 "saturation": 0.3

View file

@ -0,0 +1,21 @@
{
"tags": [ "unicopia:container_with_love" ],
"food_component": {
"hunger": 2,
"saturation": 0.4
},
"ailment": {
"effects": [
{
"effect": "unicopia:food_poisoning",
"seconds": 50,
"amplifier": 2
},
{
"name": "unicopia.affliction.love_sickness",
"type": "unicopia:lose_hunger",
"multiplier": 0.5
}
]
}
}

View file

@ -1,5 +1,5 @@
{ {
"tags": [ "unicopia:food_types/rotten_meat" ], "tags": [ "c:rotten_meat" ],
"food_component": { "food_component": {
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1

View file

@ -0,0 +1,11 @@
{
"tags": [ "unicopia:food_types/cooked_sea_vegitable" ],
"food_component": {
"hunger": 0,
"saturation": 0
},
"ailment": {
"effects": [
]
}
}

View file

@ -0,0 +1,11 @@
{
"tags": [ "unicopia:food_types/raw_sea_vegitable" ],
"food_component": {
"hunger": 0,
"saturation": 0
},
"ailment": {
"effects": [
]
}
}

View file

@ -0,0 +1,10 @@
{
"tags": [ "unicopia:food_types/shells", "unicopia:food_types/shelly" ],
"food_component": {
"hunger": 0,
"saturation": 0
},
"ailment": {
"effects": []
}
}

View file

@ -0,0 +1,10 @@
{
"tags": [ "unicopia:food_types/shells", "unicopia:food_types/shelly" ],
"food_component": {
"hunger": 0,
"saturation": 0
},
"ailment": {
"effects": []
}
}

View file

@ -3,49 +3,49 @@
"foraging_multiplier": 0.9, "foraging_multiplier": 0.9,
"multipliers": [ "multipliers": [
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "unicopia:fish/cooked" ],
"hunger": 1.5, "hunger": 1.5,
"saturation": 1.5 "saturation": 1.5
}, },
{ {
"tags": [ "unicopia:food_types/raw_fish" ], "tags": [ "unicopia:fish/raw" ],
"hunger": 0.5, "hunger": 0.5,
"saturation": 0.6 "saturation": 0.6
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/baked_goods" "unicopia:baked_goods"
], ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_insect", "unicopia:insect/cooked",
"unicopia:food_types/cooked_meat" "unicopia:meat/cooked"
], ],
"hunger": 0.1, "hunger": 0.1,
"saturation": 0.1 "saturation": 0.1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/love", "unicopia:love",
"unicopia:food_types/raw_insect", "unicopia:insect/raw",
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/rotten_meat" "unicopia:meat/rotten"
], ],
"hunger": 0, "hunger": 0,
"saturation": 0 "saturation": 0
}, },
{ {
"tags": [ "unicopia:food_types/pinecone" ], "tags": [ "unicopia:pinecone" ],
"hunger": 0.9, "hunger": 0.9,
"saturation": 0.9 "saturation": 0.9
} }
], ],
"effects": [ "effects": [
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "unicopia:fish/cooked" ],
"food_component": { "food_component": {
"hunger": 2, "hunger": 2,
"saturation": 1 "saturation": 1
@ -55,7 +55,7 @@
} }
}, },
{ {
"tags": [ "unicopia:food_types/raw_fish" ], "tags": [ "unicopia:fish/raw" ],
"ailment": { "ailment": {
"effects": [ ] "effects": [ ]
} }

View file

@ -3,54 +3,54 @@
"foraging_multiplier": 0.9, "foraging_multiplier": 0.9,
"multipliers": [ "multipliers": [
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "unicopia:fish/cooked" ],
"hunger": 0.75, "hunger": 0.75,
"saturation": 0.75 "saturation": 0.75
}, },
{ {
"tags": [ "unicopia:food_types/raw_fish" ], "tags": [ "unicopia:fish/raw" ],
"hunger": 0.5, "hunger": 0.5,
"saturation": 0.6 "saturation": 0.6
}, },
{ {
"tags": [ "unicopia:food_types/cooked_insect" ], "tags": [ "unicopia:insect/cooked" ],
"hunger": 1.75, "hunger": 1.75,
"saturation": 1.75 "saturation": 1.75
}, },
{ {
"tags": [ "unicopia:food_types/cooked_meat" ], "tags": [ "unicopia:meat/cooked" ],
"hunger": 1.15, "hunger": 1.15,
"saturation": 1.15 "saturation": 1.15
}, },
{ {
"tags": [ "unicopia:food_types/raw_insect" ], "tags": [ "unicopia:insect/raw" ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
}, },
{ {
"tags": [ "unicopia:food_types/raw_meat" ], "tags": [ "unicopia:meat/raw" ],
"hunger": 0.25, "hunger": 0.25,
"saturation": 0.25 "saturation": 0.25
}, },
{ {
"tags": [ "unicopia:food_types/rotten_meat" ], "tags": [ "unicopia:meat/rotten" ],
"hunger": 0.2, "hunger": 0.2,
"saturation": 0.2 "saturation": 0.2
}, },
{ {
"tags": [ "unicopia:food_types/love" ], "tags": [ "unicopia:love" ],
"hunger": 0, "hunger": 0,
"saturation": 0 "saturation": 0
}, },
{ {
"tags": [ "unicopia:food_types/pinecone" ], "tags": [ "unicopia:pinecone" ],
"hunger": 0.9, "hunger": 0.9,
"saturation": 0.9 "saturation": 0.9
} }
], ],
"effects": [ "effects": [
{ {
"tags": [ "unicopia:food_types/rotten_fish" ], "tags": [ "unicopia:fish/rotten" ],
"ailment": { "ailment": {
"effects": [ "effects": [
{ {
@ -64,15 +64,15 @@
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_insect", "unicopia:insect/cooked",
"unicopia:food_types/cooked_meat" "unicopia:meat/cooked"
], ],
"ailment": { "ailment": {
"effects": [ ] "effects": [ ]
} }
}, },
{ {
"tags": [ "unicopia:food_types/raw_insect" ], "tags": [ "unicopia:insect/raw" ],
"ailment": { "ailment": {
"effects": [ "effects": [
{ {
@ -85,8 +85,8 @@
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/rotten_meat" "unicopia:meat/rotten"
], ],
"ailment": { "ailment": {
"effects": [ "effects": [
@ -100,7 +100,7 @@
} }
}, },
{ {
"tags": [ "unicopia:food_types/bat_ponys_delight" ], "tags": [ "unicopia:bat_ponys_delight" ],
"ailment": { "ailment": {
"effects": [ "effects": [
{ {

View file

@ -3,39 +3,39 @@
"foraging_multiplier": 0.1, "foraging_multiplier": 0.1,
"multipliers": [ "multipliers": [
{ {
"tags": [ "unicopia:food_types/cooked_insect" ], "tags": [ "unicopia:insect/cooked" ],
"hunger": 2.0, "hunger": 2.0,
"saturation": 1.3 "saturation": 1.3
}, },
{ {
"tags": [ "unicopia:food_types/cooked_meat" ], "tags": [ "unicopia:meat/cooked" ],
"hunger": 1.9, "hunger": 1.9,
"saturation": 1.2 "saturation": 1.2
}, },
{ {
"tags": [ "unicopia:food_types/raw_insect" ], "tags": [ "unicopia:insect/raw" ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
}, },
{ {
"tags": [ "unicopia:food_types/raw_meat" ], "tags": [ "unicopia:meat/raw" ],
"hunger": 1.25, "hunger": 1.25,
"saturation": 1.25 "saturation": 1.25
}, },
{ {
"tags": [ "unicopia:food_types/rotten_meat" ], "tags": [ "unicopia:meat/rotten" ],
"hunger": 0.6, "hunger": 0.6,
"saturation": 0.6 "saturation": 0.6
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/baked_goods" "unicopia:baked_goods"
], ],
"hunger": 0.5, "hunger": 0.5,
"saturation": 0.9 "saturation": 0.9
}, },
{ {
"tags": [ "unicopia:food_types/love" ], "tags": [ "unicopia:love" ],
"hunger": 5, "hunger": 5,
"saturation": 3 "saturation": 3
} }
@ -60,7 +60,7 @@
}, },
"effects": [ "effects": [
{ {
"tags": [ "unicopia:food_types/love" ], "tags": [ "unicopia:love" ],
"food_component": { "food_component": {
"hunger": 2, "hunger": 2,
"saturation": 1 "saturation": 1
@ -76,7 +76,7 @@
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/raw_insect" "unicopia:insect/raw"
], ],
"food_component": { "food_component": {
"hunger": 3, "hunger": 3,
@ -88,8 +88,8 @@
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_fish", "unicopia:fish/cooked",
"unicopia:food_types/raw_fish" "unicopia:fish/raw"
], ],
"ailment": { "ailment": {
"effects": [ "effects": [
@ -108,11 +108,11 @@
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/rotten_fish", "unicopia:fish/rotten",
"unicopia:food_types/cooked_insect", "unicopia:insect/cooked",
"unicopia:food_types/cooked_meat", "unicopia:meat/cooked",
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/rotten_meat" "unicopia:meat/rotten"
], ],
"food_component": { "food_component": {
"hunger": 6, "hunger": 6,
@ -129,8 +129,8 @@
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/forage_edible", "unicopia:foraging/edible",
"unicopia:food_types/forage_edible_filling" "unicopia:foraging/edible_filling"
], ],
"food_component": { "food_component": {
"hunger": 18, "hunger": 18,

View file

@ -4,46 +4,46 @@
"multipliers": [ "multipliers": [
{ {
"tags": [ "tags": [
"unicopia:food_types/candy", "unicopia:candy",
"unicopia:food_types/desserts", "unicopia:desserts",
"unicopia:food_types/rocks" "unicopia:rocks"
], ],
"hunger": 2.5, "hunger": 2.5,
"saturation": 1.7 "saturation": 1.7
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/baked_goods" "unicopia:baked_goods"
], ],
"hunger": 1.2, "hunger": 1.2,
"saturation": 2 "saturation": 2
}, },
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "unicopia:fish/cooked" ],
"hunger": 0.2, "hunger": 0.2,
"saturation": 0.2 "saturation": 0.2
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_insect", "unicopia:insect/cooked",
"unicopia:food_types/cooked_meat" "unicopia:meat/cooked"
], ],
"hunger": 0.1, "hunger": 0.1,
"saturation": 0.1 "saturation": 0.1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/love", "unicopia:love",
"unicopia:food_types/raw_fish", "unicopia:fish/raw",
"unicopia:food_types/raw_insect", "unicopia:insect/raw",
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/rotten_meat" "unicopia:meat/rotten"
], ],
"hunger": 0, "hunger": 0,
"saturation": 0 "saturation": 0
}, },
{ {
"tags": [ "unicopia:food_types/pinecone" ], "tags": [ "unicopia:pinecone" ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
} }
@ -51,8 +51,8 @@
"effects": [ "effects": [
{ {
"tags": [ "tags": [
"unicopia:food_types/candy", "unicopia:candy",
"unicopia:food_types/rocks" "unicopia:rocks"
], ],
"food_component": { "food_component": {
"hunger": 5, "hunger": 5,
@ -65,7 +65,7 @@
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/desserts" "unicopia:desserts"
], ],
"food_component": { "food_component": {
"hunger": 12, "hunger": 12,

View file

@ -4,57 +4,57 @@
"multipliers": [ "multipliers": [
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_meat", "unicopia:meat/cooked",
"unicopia:food_types/cooked_fish" "unicopia:fish/cooked"
], ],
"hunger": 1.6, "hunger": 1.6,
"saturation": 1.6 "saturation": 1.6
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/nuts_and_seeds" "unicopia:nuts_and_seeds"
], ],
"hunger": 1.4, "hunger": 1.4,
"saturation": 1.4 "saturation": 1.4
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/baked_goods" "unicopia:baked_goods"
], ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/raw_fish" "unicopia:fish/raw"
], ],
"hunger": 0.6, "hunger": 0.6,
"saturation": 0.6 "saturation": 0.6
}, },
{ {
"tags": [ "unicopia:food_types/rotten_meat" ], "tags": [ "unicopia:meat/rotten" ],
"hunger": 0.3, "hunger": 0.3,
"saturation": 0.3 "saturation": 0.3
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/love", "unicopia:love",
"unicopia:food_types/raw_insect", "unicopia:insect/raw",
"unicopia:food_types/cooked_insect" "unicopia:insect/cooked"
], ],
"hunger": 0, "hunger": 0,
"saturation": 0 "saturation": 0
}, },
{ {
"tags": [ "unicopia:food_types/pinecone" ], "tags": [ "unicopia:pinecone" ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
} }
], ],
"effects": [ "effects": [
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "unicopia:fish/cooked" ],
"food_component": { "food_component": {
"hunger": 2, "hunger": 2,
"saturation": 1 "saturation": 1
@ -64,15 +64,15 @@
} }
}, },
{ {
"tags": [ "unicopia:food_types/raw_fish" ], "tags": [ "unicopia:fish/raw" ],
"ailment": { "ailment": {
"effects": [ ] "effects": [ ]
} }
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/forage_prickly", "unicopia:foraging/prickly",
"unicopia:food_types/forage_severely_prickly" "unicopia:foraging/severely_prickly"
], ],
"food_component": { "food_component": {
"hunger": 2, "hunger": 2,
@ -83,7 +83,7 @@
} }
}, },
{ {
"tags": [ "unicopia:food_types/pinecone" ], "tags": [ "unicopia:pinecone" ],
"ailment": { "ailment": {
"effects": [ "effects": [
{ {

View file

@ -5,13 +5,13 @@
"effects": [ "effects": [
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_fish", "unicopia:fish/cooked",
"unicopia:food_types/raw_fish", "unicopia:fish/raw",
"unicopia:food_types/rotten_fish", "unicopia:fish/rotten",
"unicopia:food_types/cooked_meat", "unicopia:meat/cooked",
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/rotten_meat", "unicopia:meat/rotten",
"unicopia:food_types/pinecone" "unicopia:pinecone"
], ],
"ailment": { "ailment": {
"effects": [ ] "effects": [ ]

View file

@ -3,42 +3,42 @@
"foraging_multiplier": 0.9, "foraging_multiplier": 0.9,
"multipliers": [ "multipliers": [
{ {
"tags": [ "unicopia:food_types/cooked_meat" ], "tags": [ "unicopia:meat/cooked" ],
"hunger": 1.5, "hunger": 1.5,
"saturation": 1.5 "saturation": 1.5
}, },
{ {
"tags": [ "unicopia:food_types/raw_meat" ], "tags": [ "unicopia:meat/raw" ],
"hunger": 0.5, "hunger": 0.5,
"saturation": 0.6 "saturation": 0.6
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/baked_goods" "unicopia:baked_goods"
], ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_insect", "unicopia:insect/cooked",
"unicopia:food_types/cooked_fish" "unicopia:fish/cooked"
], ],
"hunger": 0.1, "hunger": 0.1,
"saturation": 0.1 "saturation": 0.1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/love", "unicopia:love",
"unicopia:food_types/raw_insect", "unicopia:insect/raw",
"unicopia:food_types/raw_fish", "unicopia:fish/raw",
"unicopia:food_types/rotten_meat" "unicopia:meat/rotten"
], ],
"hunger": 0, "hunger": 0,
"saturation": 0 "saturation": 0
}, },
{ {
"tags": [ "unicopia:food_types/pinecone" ], "tags": [ "unicopia:pinecone" ],
"hunger": 0.9, "hunger": 0.9,
"saturation": 0.9 "saturation": 0.9
} }
@ -46,15 +46,15 @@
"effects": [ "effects": [
{ {
"tags": [ "tags": [
"unicopia:food_types/rotten_fish", "unicopia:fish/rotten",
"unicopia:food_types/cooked_insect", "unicopia:insect/cooked",
"unicopia:food_types/cooked_meat", "unicopia:meat/cooked",
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/rotten_meat", "unicopia:meat/rotten",
"unicopia:food_types/forage_blinding", "unicopia:foraging/blinding",
"unicopia:food_types/forage_prickly", "unicopia:foraging/prickly",
"unicopia:food_types/forage_severely_prickly", "unicopia:foraging/severely_prickly",
"unicopia:food_types/forage_strengthening" "unicopia:foraging/strengthening"
], ],
"food_component": { "food_component": {
"hunger": 2, "hunger": 2,

View file

@ -3,55 +3,55 @@
"foraging_multiplier": 1, "foraging_multiplier": 1,
"multipliers": [ "multipliers": [
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "unicopia:fish/cooked" ],
"hunger": 1.5, "hunger": 1.5,
"saturation": 1.5 "saturation": 1.5
}, },
{ {
"tags": [ "unicopia:food_types/raw_fish" ], "tags": [ "unicopia:fish/raw" ],
"hunger": 0.5, "hunger": 0.5,
"saturation": 0.6 "saturation": 0.6
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/baked_goods" "unicopia:baked_goods"
], ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_insect", "unicopia:insect/cooked",
"unicopia:food_types/cooked_meat" "unicopia:meat/cooked"
], ],
"hunger": 0.1, "hunger": 0.1,
"saturation": 0.1 "saturation": 0.1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/love", "unicopia:love",
"unicopia:food_types/raw_insect", "unicopia:insect/raw",
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/rotten_meat" "unicopia:meat/rotten"
], ],
"hunger": 0, "hunger": 0,
"saturation": 0 "saturation": 0
}, },
{ {
"tags": [ "unicopia:food_types/pinecone" ], "tags": [ "unicopia:pinecone" ],
"hunger": 0.9, "hunger": 0.9,
"saturation": 0.9 "saturation": 0.9
} }
], ],
"effects": [ "effects": [
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "unicopia:fish/cooked" ],
"ailment": { "ailment": {
"effects": [ ] "effects": [ ]
} }
}, },
{ {
"tags": [ "unicopia:food_types/raw_fish" ], "tags": [ "unicopia:fish/raw" ],
"ailment": { "ailment": {
"effects": [ "effects": [
{ {

View file

@ -3,14 +3,13 @@
"foraging_multiplier": 0.7, "foraging_multiplier": 0.7,
"multipliers": [ "multipliers": [
{ {
"tags": [ "unicopia:food_types/raw_sea_vegitable" ], "tags": [ "unicopia:sea_vegetable/raw" ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/shells", "unicopia:shells", "unicopia:shelly"
"unicopia:food_types/shelly"
], ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
@ -27,21 +26,21 @@
}, },
"effects": [ "effects": [
{ {
"tags": [ "unicopia:food_types/cooked_fish" ], "tags": [ "unicopia:fish/cooked" ],
"ailment": { "ailment": {
"effects": [ ] "effects": [ ]
} }
}, },
{ {
"tags": [ "unicopia:food_types/raw_fish" ], "tags": [ "unicopia:fish/raw" ],
"ailment": { "ailment": {
"effects": [ ] "effects": [ ]
} }
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/forage_edible", "unicopia:foraging/edible",
"unicopia:food_types/forage_edible_filling" "unicopia:foraging/edible_filling"
], ],
"food_component": { "food_component": {
"hunger": 18, "hunger": 18,
@ -58,7 +57,7 @@
} }
}, },
{ {
"tags": [ "unicopia:food_types/raw_sea_vegitable" ], "tags": [ "unicopia:sea_vegetable/raw" ],
"food_component": { "food_component": {
"hunger": 2, "hunger": 2,
"saturation": 1 "saturation": 1
@ -68,7 +67,7 @@
} }
}, },
{ {
"tags": [ "unicopia:food_types/cooked_sea_vegitable" ], "tags": [ "unicopia:sea_vegetable/cooked" ],
"food_component": { "food_component": {
"hunger": 6, "hunger": 6,
"saturation": 2 "saturation": 2
@ -78,7 +77,7 @@
} }
}, },
{ {
"tags": [ "unicopia:food_types/shells" ], "tags": [ "unicopia:shells" ],
"food_component": { "food_component": {
"hunger": 3, "hunger": 3,
"saturation": 5 "saturation": 5
@ -88,7 +87,7 @@
} }
}, },
{ {
"tags": [ "unicopia:food_types/shelly" ], "tags": [ "unicopia:shelly" ],
"food_component": { "food_component": {
"hunger": 6, "hunger": 6,
"saturation": 7 "saturation": 7

View file

@ -4,33 +4,33 @@
"multipliers": [ "multipliers": [
{ {
"tags": [ "tags": [
"unicopia:food_types/cooked_insect", "unicopia:insect/cooked",
"unicopia:food_types/cooked_meat", "unicopia:meat/cooked",
"unicopia:food_types/cooked_fish" "unicopia:fish/cooked"
], ],
"hunger": 0.1, "hunger": 0.1,
"saturation": 0.1 "saturation": 0.1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/baked_goods" "unicopia:baked_goods"
], ],
"hunger": 1, "hunger": 1,
"saturation": 1 "saturation": 1
}, },
{ {
"tags": [ "tags": [
"unicopia:food_types/love", "unicopia:love",
"unicopia:food_types/raw_insect", "unicopia:insect/raw",
"unicopia:food_types/raw_meat", "unicopia:meat/raw",
"unicopia:food_types/raw_fish", "unicopia:fish/raw",
"unicopia:food_types/rotten_meat" "unicopia:meat/rotten"
], ],
"hunger": 0, "hunger": 0,
"saturation": 0 "saturation": 0
}, },
{ {
"tags": [ "unicopia:food_types/pinecone" ], "tags": [ "unicopia:pinecone" ],
"hunger": 0.9, "hunger": 0.9,
"saturation": 0.9 "saturation": 0.9
} }

View file

@ -1,40 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 12.0,
"min": 6.0
},
"function": "minecraft:set_count"
},
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"function": "minecraft:apply_bonus",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "unicopia:banana"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,49 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:chitin",
"functions": [
{
"add": false,
"count": 2,
"function": "minecraft:set_count"
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
},
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:chiselled_chitin",
"functions": [
{
"add": false,
"count": 2,
"function": "minecraft:set_count"
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,96 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:clam_shell",
"conditions": [
{
"block": "unicopia:clam_shell",
"condition": "minecraft:block_state_property",
"properties": {
"count": "1"
}
}
],
"functions": [
{
"add": false,
"count": 1,
"function": "minecraft:set_count"
}
]
},
{
"type": "minecraft:item",
"name": "unicopia:clam_shell",
"conditions": [
{
"block": "unicopia:clam_shell",
"condition": "minecraft:block_state_property",
"properties": {
"count": "2"
}
}
],
"functions": [
{
"add": false,
"count": 2,
"function": "minecraft:set_count"
}
]
},
{
"type": "minecraft:item",
"name": "unicopia:clam_shell",
"conditions": [
{
"block": "unicopia:clam_shell",
"condition": "minecraft:block_state_property",
"properties": {
"count": "3"
}
}
],
"functions": [
{
"add": false,
"count": 3,
"function": "minecraft:set_count"
}
]
},
{
"type": "minecraft:item",
"name": "unicopia:clam_shell",
"conditions": [
{
"block": "unicopia:clam_shell",
"condition": "minecraft:block_state_property",
"properties": {
"count": "4"
}
}
],
"functions": [
{
"add": false,
"count": 4,
"function": "minecraft:set_count"
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,41 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:cloud_lump",
"functions": [
{
"add": false,
"count": 2,
"function": "minecraft:set_count"
},
{
"add": false,
"count": 4,
"function": "minecraft:set_count",
"conditions": [
{
"block": "unicopia:cloud_slab",
"condition": "minecraft:block_state_property",
"properties": {
"type": "double"
}
}
]
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,41 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:cloud_lump",
"functions": [
{
"add": false,
"count": 4,
"function": "minecraft:set_count"
},
{
"add": false,
"count": 8,
"function": "minecraft:set_count",
"conditions": [
{
"block": "unicopia:dense_cloud_slab",
"condition": "minecraft:block_state_property",
"properties": {
"type": "double"
}
}
]
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,41 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:cloud_lump",
"functions": [
{
"add": false,
"count": 4,
"function": "minecraft:set_count"
},
{
"add": false,
"count": 8,
"function": "minecraft:set_count",
"conditions": [
{
"block": "unicopia:etched_cloud_slab",
"condition": "minecraft:block_state_property",
"properties": {
"type": "double"
}
}
]
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,51 +0,0 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:explosion_decay"
}
],
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:golden_carrot"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:gold_root",
"condition": "minecraft:block_state_property",
"properties": {
"age": "7"
}
}
],
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"function": "minecraft:apply_bonus",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "minecraft:golden_carrot"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:blocks/carrots"
}

View file

@ -1,49 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:golden_apple"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
},
{
"block": "unicopia:golden_apple",
"condition": "minecraft:block_state_property",
"properties": {
"enchanted": "false"
}
}
]
},
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:enchanted_golden_apple"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
},
{
"block": "unicopia:golden_apple",
"condition": "minecraft:block_state_property",
"properties": {
"enchanted": "true"
}
}
]
}
]
}

View file

@ -1,157 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:hay_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_north_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:wheat"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:hay_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_north_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:wheat"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:hay_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_south_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:wheat"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:hay_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_south_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:wheat"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:hay_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_north_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:wheat"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:hay_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_north_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:wheat"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:hay_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_south_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:wheat"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:hay_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_south_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:wheat"
}
],
"rolls": 1.0
}
]
}

View file

@ -1,64 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:mysterious_egg",
"functions": [
{
"add": false,
"count": 1,
"function": "minecraft:set_count",
"conditions": [
{
"block": "unicopia:mysterious_egg",
"condition": "minecraft:block_state_property",
"properties": {
"count": "1"
}
}
]
},
{
"add": false,
"count": 2,
"function": "minecraft:set_count",
"conditions": [
{
"block": "unicopia:mysterious_egg",
"condition": "minecraft:block_state_property",
"properties": {
"count": "2"
}
}
]
},
{
"add": false,
"count": 3,
"function": "minecraft:set_count",
"conditions": [
{
"block": "unicopia:mysterious_egg",
"condition": "minecraft:block_state_property",
"properties": {
"count": "3"
}
}
]
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,55 +0,0 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:explosion_decay"
}
],
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"name": "unicopia:oat_seeds"
}
]
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:oats",
"condition": "minecraft:block_state_property",
"properties": {
"age": "11"
}
}
],
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"function": "minecraft:apply_bonus",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "unicopia:oat_seeds"
}
],
"rolls": 1.0
}
]
}

View file

@ -1,29 +0,0 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:explosion_decay"
}
],
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"conditions": [
{
"block": "unicopia:oats_crown",
"condition": "minecraft:block_state_property",
"properties": {
"age": "1"
}
}
],
"name": "unicopia:oats"
}
],
"rolls": 1.0
}
]
}

View file

@ -1,29 +0,0 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:explosion_decay"
}
],
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"conditions": [
{
"block": "unicopia:oats_stem",
"condition": "minecraft:block_state_property",
"properties": {
"age": "6"
}
}
],
"name": "unicopia:oats"
}
],
"rolls": 1.0
}
]
}

View file

@ -1,35 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "unicopia:pineapple",
"properties": {
"age": "7",
"half": "top"
}
}
],
"name": "unicopia:pineapple"
}
]
}
]
}
],
"functions": [
{
"function": "minecraft:explosion_decay"
}
]
}

View file

@ -1,42 +0,0 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:explosion_decay"
}
],
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:stick"
},
{
"type": "minecraft:item",
"name": "minecraft:dead_bush"
}
],
"rolls": 4.0
},
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:stick"
},
{
"type": "minecraft:item",
"name": "minecraft:dead_bush"
},
{
"type": "minecraft:item",
"name": "unicopia:gryphon_feather"
}
],
"rolls": 1.0
}
]
}

View file

@ -1,165 +0,0 @@
{
"type": "minecraft:block",
"fabric:load_conditions": [
{
"condition": "fabric:all_mods_loaded",
"values": [
"farmersdelight"
]
}
],
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:rice_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_north_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:rice_panicle"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:rice_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_north_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:rice_panicle"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:rice_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_south_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:rice_panicle"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:rice_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_south_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:rice_panicle"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:rice_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_north_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:rice_panicle"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:rice_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_north_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:rice_panicle"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:rice_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_south_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:rice_panicle"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:rice_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_south_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:rice_panicle"
}
],
"rolls": 1.0
}
]
}

View file

@ -1,85 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "unicopia:rocks",
"properties": {
"age": "7"
}
},
{
"condition": "minecraft:random_chance",
"chance": 0.25
}
],
"name": "unicopia:weird_rock"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "unicopia:rocks",
"properties": {
"age": "7"
}
}
],
"name": "unicopia:rock"
},
{
"type": "minecraft:item",
"name": "unicopia:pebbles"
}
]
}
]
},
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "unicopia:pebbles"
}
],
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "unicopia:rocks",
"properties": {
"age": "7"
}
}
]
}
],
"functions": [
{
"function": "minecraft:explosion_decay"
}
]
}

View file

@ -1,96 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:scallop_shell",
"conditions": [
{
"block": "unicopia:scallop_shell",
"condition": "minecraft:block_state_property",
"properties": {
"count": "1"
}
}
],
"functions": [
{
"add": false,
"count": 1,
"function": "minecraft:set_count"
}
]
},
{
"type": "minecraft:item",
"name": "unicopia:scallop_shell",
"conditions": [
{
"block": "unicopia:scallop_shell",
"condition": "minecraft:block_state_property",
"properties": {
"count": "2"
}
}
],
"functions": [
{
"add": false,
"count": 2,
"function": "minecraft:set_count"
}
]
},
{
"type": "minecraft:item",
"name": "unicopia:scallop_shell",
"conditions": [
{
"block": "unicopia:scallop_shell",
"condition": "minecraft:block_state_property",
"properties": {
"count": "3"
}
}
],
"functions": [
{
"add": false,
"count": 3,
"function": "minecraft:set_count"
}
]
},
{
"type": "minecraft:item",
"name": "unicopia:scallop_shell",
"conditions": [
{
"block": "unicopia:scallop_shell",
"condition": "minecraft:block_state_property",
"properties": {
"count": "4"
}
}
],
"functions": [
{
"add": false,
"count": 4,
"function": "minecraft:set_count"
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,55 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:slime_pustule"
}
],
"conditions": [
{
"condition": "minecraft:all_of",
"terms": [
{
"block": "unicopia:slime_pustule",
"condition": "minecraft:block_state_property",
"properties": {
"shape": "pod"
}
},
{
"condition": "minecraft:any_of",
"terms": [
{
"condition": "minecraft:match_tool",
"predicate": {
"items": [
"minecraft:shears"
]
}
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
]
}
]
}
]
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "unicopia:cloud",
"functions": [
{
"add": false,
"count": 3,
"function": "minecraft:set_count"
}
]
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,165 +0,0 @@
{
"type": "minecraft:block",
"fabric:load_conditions": [
{
"condition": "fabric:all_mods_loaded",
"values": [
"farmersdelight"
]
}
],
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:straw_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_north_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:straw"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:straw_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_north_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:straw"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:straw_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_south_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:straw"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:straw_block",
"condition": "minecraft:block_state_property",
"properties": {
"top_south_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:straw"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:straw_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_north_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:straw"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:straw_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_north_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:straw"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:straw_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_south_east": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:straw"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:straw_block",
"condition": "minecraft:block_state_property",
"properties": {
"bottom_south_west": "true"
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "farmersdelight:straw"
}
],
"rolls": 1.0
}
]
}

Some files were not shown because too many files have changed in this diff Show more