From 9d5def8db948f34cecf5e2919c6711fd93198a64 Mon Sep 17 00:00:00 2001 From: LimePot Date: Sat, 7 Jan 2023 01:42:36 -0700 Subject: [PATCH] Release --- gradle.properties | 2 +- .../java/xyz/limepot/roses_mod/RosesMod.java | 14 ++++++++++++-- .../roses_mod/loot_tables.blocks/rose_bush.json | 14 ++++++++++++++ .../data/roses_mod/recipes/rose_bush.json | 17 +++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/data/roses_mod/loot_tables.blocks/rose_bush.json create mode 100644 src/main/resources/data/roses_mod/recipes/rose_bush.json diff --git a/gradle.properties b/gradle.properties index 24fd873..9a0a7cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx1G org.gradle.parallel = true # Mod Properties -version = 1.0.0 +version = 1.0.1 maven_group = xyz.limepot archives_base_name = roses_mod diff --git a/src/main/java/xyz/limepot/roses_mod/RosesMod.java b/src/main/java/xyz/limepot/roses_mod/RosesMod.java index 2df86c8..4b65f7c 100644 --- a/src/main/java/xyz/limepot/roses_mod/RosesMod.java +++ b/src/main/java/xyz/limepot/roses_mod/RosesMod.java @@ -1,10 +1,14 @@ package xyz.limepot.roses_mod; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; +import net.fabricmc.fabric.api.loot.v2.LootTableEvents; import net.minecraft.block.*; import net.minecraft.client.render.RenderLayer; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.item.BlockItem; +import net.minecraft.item.Items; +import net.minecraft.loot.LootPool; +import net.minecraft.loot.entry.ItemEntry; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; @@ -35,8 +39,14 @@ public class RosesMod implements ModInitializer { Registry.register(Registries.BLOCK, new Identifier(MOD_ID, "potted_rose"), POTTED_ROSE); - //RENDER LAYERS - + //LOOT TABLES + final Identifier ROSE_BUSH_LOOT_TABLE_ID = Blocks.ROSE_BUSH.getLootTableId(); + LootTableEvents.MODIFY.register((resourceManager, lootManager, id, tableBuilder, source) -> { + if (source.isBuiltin() && ROSE_BUSH_LOOT_TABLE_ID.equals(id)) { + LootPool.Builder poolBuilder = LootPool.builder().with(ItemEntry.builder(RosesMod.ROSE_FLOWER));; + tableBuilder.pool(poolBuilder); + } + }); //INIT LOGGER.info("Hello Quilt world from {}!", mod.metadata().name()); diff --git a/src/main/resources/data/roses_mod/loot_tables.blocks/rose_bush.json b/src/main/resources/data/roses_mod/loot_tables.blocks/rose_bush.json new file mode 100644 index 0000000..4d883a0 --- /dev/null +++ b/src/main/resources/data/roses_mod/loot_tables.blocks/rose_bush.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 2, + "entries": [ + { + "type": "minecraft:item", + "name": "roses_mod:rose_flower" + } + ] + } + ] +} diff --git a/src/main/resources/data/roses_mod/recipes/rose_bush.json b/src/main/resources/data/roses_mod/recipes/rose_bush.json new file mode 100644 index 0000000..e02ef06 --- /dev/null +++ b/src/main/resources/data/roses_mod/recipes/rose_bush.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " ", + " WW", + " WW" + ], + "key": { + "W": { + "item": "roses_mod:rose_flower" + } + }, + "result": { + "item": "minecraft:rose_bush", + "count": 1 + } +}