Added recipes for the crystal heart

This commit is contained in:
Sollace 2021-02-19 10:34:26 +02:00
parent f3b13b4984
commit 82bc317bc1
8 changed files with 72 additions and 2 deletions

View file

@ -25,6 +25,7 @@ import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.predicate.entity.EntityPredicates;
@ -151,7 +152,8 @@ public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Art
@Override @Override
public ActionResult onArtifactDestroyed(FloatingArtefactEntity entity) { public ActionResult onArtifactDestroyed(FloatingArtefactEntity entity) {
entity.playSound(SoundEvents.BLOCK_BEACON_DEACTIVATE, 0.75F, 1); 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) { private boolean findStructure(FloatingArtefactEntity entity) {

View file

@ -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 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_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 extends Item> T register(String name, T item) { static <T extends Item> T register(String name, T item) {
ITEMS.add(item); ITEMS.add(item);

View file

@ -2,6 +2,9 @@ package com.minelittlepony.unicopia.item;
import com.google.gson.JsonArray; 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.Ingredient;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeSerializer; import net.minecraft.recipe.RecipeSerializer;
@ -45,5 +48,17 @@ public interface URecipes {
return defaultedList; 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());
}
});
}
} }

View file

@ -24,6 +24,7 @@
"item.unicopia.zap_apple_jam_jar": "Zap Apple Jam", "item.unicopia.zap_apple_jam_jar": "Zap Apple Jam",
"item.unicopia.crystal_heart": "Crystal Heart", "item.unicopia.crystal_heart": "Crystal Heart",
"item.unicopia.crystal_shard": "Crystal Shard",
"item.unicopia.music_disc_pet": "Music Disc", "item.unicopia.music_disc_pet": "Music Disc",
"item.unicopia.music_disc_pet.desc": "Danial Ingram - pet", "item.unicopia.music_disc_pet.desc": "Danial Ingram - pet",

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/crystal_shard"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"* *",
"***",
" * "
],
"key": {
"*": {
"item": "unicopia:crystal_shard"
}
},
"result": {
"item": "unicopia:crystal_heart"
}
}

View file

@ -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"
}
]
}
]
}