diff --git a/src/main/java/com/minelittlepony/unicopia/item/CrystalHeartItem.java b/src/main/java/com/minelittlepony/unicopia/item/CrystalHeartItem.java index c7b6ef52..00f05454 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/CrystalHeartItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/CrystalHeartItem.java @@ -25,6 +25,7 @@ import net.minecraft.entity.passive.TameableEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.particle.ParticleTypes; import net.minecraft.predicate.entity.EntityPredicates; @@ -151,7 +152,8 @@ public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Art @Override public ActionResult onArtifactDestroyed(FloatingArtefactEntity entity) { entity.playSound(SoundEvents.BLOCK_BEACON_DEACTIVATE, 0.75F, 1); - return ActionResult.PASS; + entity.dropStack(new ItemStack(UItems.CRYSTAL_SHARD, 1 + entity.world.random.nextInt(5)), 0); + return ActionResult.SUCCESS; } private boolean findStructure(FloatingArtefactEntity entity) { diff --git a/src/main/java/com/minelittlepony/unicopia/item/UItems.java b/src/main/java/com/minelittlepony/unicopia/item/UItems.java index f9674a0e..542be7ba 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/UItems.java +++ b/src/main/java/com/minelittlepony/unicopia/item/UItems.java @@ -56,6 +56,8 @@ public interface UItems { Item ZAP_APPLE_JAM_JAR = register("zap_apple_jam_jar", new JarItem(new Item.Settings().group(ItemGroup.DECORATIONS).maxCount(1).fireproof(), false, false, true)); Item CRYSTAL_HEART = register("crystal_heart", new CrystalHeartItem(new Item.Settings().group(ItemGroup.DECORATIONS).maxCount(1))); + Item CRYSTAL_SHARD = register("crystal_shard", new Item(new Item.Settings().group(ItemGroup.MATERIALS))); + static T register(String name, T item) { ITEMS.add(item); diff --git a/src/main/java/com/minelittlepony/unicopia/item/URecipes.java b/src/main/java/com/minelittlepony/unicopia/item/URecipes.java index 1ab65a9c..5f9c4ce5 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/URecipes.java +++ b/src/main/java/com/minelittlepony/unicopia/item/URecipes.java @@ -2,6 +2,9 @@ package com.minelittlepony.unicopia.item; import com.google.gson.JsonArray; +import net.fabricmc.fabric.api.loot.v1.FabricLootSupplier; +import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback; +import net.minecraft.loot.LootTable; import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.Recipe; import net.minecraft.recipe.RecipeSerializer; @@ -45,5 +48,17 @@ public interface URecipes { return defaultedList; } - static void bootstrap() {} + static void bootstrap() { + LootTableLoadingCallback.EVENT.register((res, manager, id, supplier, setter) -> { + if (!"minecraft".contentEquals(id.getNamespace())) { + return; + } + + Identifier modId = new Identifier("unicopiamc", id.getPath()); + LootTable table = manager.getTable(modId); + if (table != LootTable.EMPTY) { + supplier.withPools(((FabricLootSupplier)table).getPools()); + } + }); + } } \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index 190a733d..43a9e6a4 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -24,6 +24,7 @@ "item.unicopia.zap_apple_jam_jar": "Zap Apple Jam", "item.unicopia.crystal_heart": "Crystal Heart", + "item.unicopia.crystal_shard": "Crystal Shard", "item.unicopia.music_disc_pet": "Music Disc", "item.unicopia.music_disc_pet.desc": "Danial Ingram - pet", diff --git a/src/main/resources/assets/unicopia/models/item/crystal_shard.json b/src/main/resources/assets/unicopia/models/item/crystal_shard.json new file mode 100644 index 00000000..df4cbc3d --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/crystal_shard.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/crystal_shard" + } +} diff --git a/src/main/resources/assets/unicopia/textures/item/crystal_shard.png b/src/main/resources/assets/unicopia/textures/item/crystal_shard.png new file mode 100644 index 00000000..d49a7c89 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/crystal_shard.png differ diff --git a/src/main/resources/data/unicopia/recipes/crystal_heart.json b/src/main/resources/data/unicopia/recipes/crystal_heart.json new file mode 100644 index 00000000..9f100a13 --- /dev/null +++ b/src/main/resources/data/unicopia/recipes/crystal_heart.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "* *", + "***", + " * " + ], + "key": { + "*": { + "item": "unicopia:crystal_shard" + } + }, + "result": { + "item": "unicopia:crystal_heart" + } +} \ No newline at end of file diff --git a/src/main/resources/data/unicopiamc/loot_tables/blocks/diamond_ore.json b/src/main/resources/data/unicopiamc/loot_tables/blocks/diamond_ore.json new file mode 100644 index 00000000..48c8b6cc --- /dev/null +++ b/src/main/resources/data/unicopiamc/loot_tables/blocks/diamond_ore.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { "condition": "minecraft:random_chance", "chance": 0.125 } + ], + "functions": [ + { + "function": "minecraft:apply_bonus", + "enchantment": "minecraft:fortune", + "formula": "minecraft:uniform_bonus_count", + "parameters": { "bonusMultiplier": 2 } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "unicopia:crystal_shard" + } + ] + } + ] +} \ No newline at end of file