diff --git a/src/client/resources/assets/rounded/lang/en_us.json b/src/client/resources/assets/rounded/lang/en_us.json index a9c1492..5a45ba5 100644 --- a/src/client/resources/assets/rounded/lang/en_us.json +++ b/src/client/resources/assets/rounded/lang/en_us.json @@ -15,6 +15,9 @@ "block.rounded.luster_cluster": "Luster Cluster", "block.rounded.trough": "Trough", + "subtitles.rounded.block.trough_fill": "Trough filled", + "subtitles.rounded.block.trough_consume": "Trough consumed", + "tag.worldgen.biome.rounded.has_lustershrooms": "Has Lustershrooms", "tag.worldgen.biome.rounded.has_more_lustershrooms": "Has more Lustershrooms", "tag.item.rounded.trough_feed": "Trough Feed", diff --git a/src/client/resources/assets/rounded/lang/pl_pl.json b/src/client/resources/assets/rounded/lang/pl_pl.json index 8cec8d5..d10bd76 100644 --- a/src/client/resources/assets/rounded/lang/pl_pl.json +++ b/src/client/resources/assets/rounded/lang/pl_pl.json @@ -15,6 +15,9 @@ "block.rounded.luster_cluster": "Skupiony lśniącogrzyb", "block.rounded.trough": "Koryto", + "subtitles.rounded.block.trough_fill": "Napełniono koryto", + "subtitles.rounded.block.trough_consume": "Opróżniono koryto", + "tag.worldgen.biome.rounded.has_lustershrooms": "Ma lśniącogrzyby", "tag.worldgen.biome.rounded.has_more_lustershrooms": "Ma więcej lśniącogrzybów", "tag.item.rounded.trough_feed": "Pokarm w korycie", diff --git a/src/client/resources/assets/rounded/models/block/trough.json b/src/client/resources/assets/rounded/models/block/trough.json index 1b169ff..53f1046 100644 --- a/src/client/resources/assets/rounded/models/block/trough.json +++ b/src/client/resources/assets/rounded/models/block/trough.json @@ -3,9 +3,9 @@ "textures": { "particle": "rounded:block/trough_side", "top": "rounded:block/trough_top", - "bottom": "rounded:block/trough_bottom", + "bottom": "minecraft:block/smooth_stone", "side": "rounded:block/trough_side", - "inside": "rounded:block/trough_bottom" + "inside": "rounded:block/trough_inside" }, "elements": [ { "from": [ 0, 0, 0 ], diff --git a/src/client/resources/assets/rounded/sounds.json b/src/client/resources/assets/rounded/sounds.json new file mode 100644 index 0000000..94a7078 --- /dev/null +++ b/src/client/resources/assets/rounded/sounds.json @@ -0,0 +1,15 @@ +{ + "trough_fill": { + "subtitle": "subtitles.rounded.block.trough_fill", + "sounds": [ + "rounded:block/trough_fill1", + "rounded:block/trough_fill2" + ] + }, + "trough_consume": { + "subtitle": "subtitles.rounded.block.trough_consume", + "sounds": [ + "rounded:block/trough_consume" + ] + } +} \ No newline at end of file diff --git a/src/client/resources/assets/rounded/sounds/block/trough_consume.ogg b/src/client/resources/assets/rounded/sounds/block/trough_consume.ogg new file mode 100755 index 0000000..ab8646e Binary files /dev/null and b/src/client/resources/assets/rounded/sounds/block/trough_consume.ogg differ diff --git a/src/client/resources/assets/rounded/sounds/block/trough_fill1.ogg b/src/client/resources/assets/rounded/sounds/block/trough_fill1.ogg new file mode 100755 index 0000000..086a719 Binary files /dev/null and b/src/client/resources/assets/rounded/sounds/block/trough_fill1.ogg differ diff --git a/src/client/resources/assets/rounded/sounds/block/trough_fill2.ogg b/src/client/resources/assets/rounded/sounds/block/trough_fill2.ogg new file mode 100755 index 0000000..9092766 Binary files /dev/null and b/src/client/resources/assets/rounded/sounds/block/trough_fill2.ogg differ diff --git a/src/main/java/com/lumiscosity/rounded/Rounded.java b/src/main/java/com/lumiscosity/rounded/Rounded.java index 52b2a66..3e2c672 100644 --- a/src/main/java/com/lumiscosity/rounded/Rounded.java +++ b/src/main/java/com/lumiscosity/rounded/Rounded.java @@ -2,6 +2,7 @@ import com.lumiscosity.rounded.blocks.RegisterBlocks; import com.lumiscosity.rounded.compat.ExtravaganzaCompat; +import com.lumiscosity.rounded.misc.RegisterSounds; import net.fabricmc.api.ModInitializer; import net.fabricmc.loader.api.FabricLoader; @@ -15,6 +16,7 @@ public class Rounded implements ModInitializer { @Override public void onInitialize() { RegisterBlocks.initBlocks(); + RegisterSounds.initSounds(); if (FabricLoader.getInstance().isModLoaded("extravaganza")) { ExtravaganzaCompat.register(); diff --git a/src/main/java/com/lumiscosity/rounded/blocks/RegisterBlocks.java b/src/main/java/com/lumiscosity/rounded/blocks/RegisterBlocks.java index e8fe72b..5f550f8 100644 --- a/src/main/java/com/lumiscosity/rounded/blocks/RegisterBlocks.java +++ b/src/main/java/com/lumiscosity/rounded/blocks/RegisterBlocks.java @@ -119,6 +119,7 @@ public class RegisterBlocks { AbstractBlock.Settings.create() .mapColor(MapColor.CYAN) .luminance(state -> 7) + .sounds(BlockSoundGroup.WOOD) ); public static final BlockItem LUSTERSHROON_BLOCK_ITEM= new BlockItem(LUSTERSHROOM_BLOCK, new Item.Settings()); public static final Block LUSTER_CLUSTER = new Block( diff --git a/src/main/java/com/lumiscosity/rounded/blocks/TroughBlock.java b/src/main/java/com/lumiscosity/rounded/blocks/TroughBlock.java index 401d02f..d151ec6 100644 --- a/src/main/java/com/lumiscosity/rounded/blocks/TroughBlock.java +++ b/src/main/java/com/lumiscosity/rounded/blocks/TroughBlock.java @@ -1,5 +1,6 @@ package com.lumiscosity.rounded.blocks; +import com.lumiscosity.rounded.misc.RegisterSounds; import com.mojang.serialization.MapCodec; import net.minecraft.block.*; import net.minecraft.entity.Entity; @@ -36,6 +37,8 @@ import org.jetbrains.annotations.Nullable; import static com.lumiscosity.rounded.Rounded.MOD_ID; +import static com.lumiscosity.rounded.misc.RegisterSounds.TROUGH_CONSUME; +import static com.lumiscosity.rounded.misc.RegisterSounds.TROUGH_FILL; public class TroughBlock extends Block implements InventoryProvider { @@ -68,9 +71,9 @@ public TroughBlock(Settings settings) { this.setDefaultState(this.stateManager.getDefaultState().with(LEVEL, 0)); } - public static void playEffects(World world, BlockPos pos, boolean fill) { + public static void playEffects(WorldAccess world, BlockPos pos) { BlockState blockState = world.getBlockState(pos); - world.playSoundAtBlockCenter(pos, fill ? SoundEvents.BLOCK_COMPOSTER_FILL_SUCCESS : SoundEvents.BLOCK_COMPOSTER_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + world.playSound(null, pos, TROUGH_FILL, SoundCategory.BLOCKS); double d = blockState.getOutlineShape(world, pos).getEndingCoord(Direction.Axis.Y, 0.5, 0.5) + 0.03125; double e = 0.13125F; double f = 0.7375F; @@ -120,7 +123,6 @@ protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, Worl if (stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MOD_ID, "trough_feed")))) { if (i < 7 && !world.isClient) { BlockState blockState = addToTrough(player, state, world, pos, stack); - world.syncWorldEvent(WorldEvents.COMPOSTER_USED, pos, state != blockState ? 1 : 0); player.incrementStat(Stats.USED.getOrCreateStat(stack.getItem())); stack.decrementUnlessCreative(1, player); } @@ -133,11 +135,12 @@ protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, Worl static BlockState addToTrough(@Nullable Entity user, BlockState state, WorldAccess world, BlockPos pos, ItemStack stack) { int i = state.get(LEVEL); - if (((i != 0) && !(world.getRandom().nextDouble() < 0.5F)) || !stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MOD_ID, "trough_feed")))) { + if (!stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MOD_ID, "trough_feed")))) { return state; } else { int j = i + 1; BlockState blockState = state.with(LEVEL, j); + playEffects(world, pos); world.setBlockState(pos, blockState, Block.NOTIFY_ALL); world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(user, blockState)); @@ -270,6 +273,7 @@ public boolean canExtract(int slot, ItemStack stack, Direction dir) { protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { if (state.get(LEVEL) > 0) { if (growAnimals(world, pos)) { + world.playSound(null, pos, TROUGH_CONSUME, SoundCategory.BLOCKS); world.setBlockState(pos, consumeTroughStack(state), Block.NOTIFY_ALL); } } diff --git a/src/main/java/com/lumiscosity/rounded/misc/RegisterSounds.java b/src/main/java/com/lumiscosity/rounded/misc/RegisterSounds.java new file mode 100644 index 0000000..4dd7131 --- /dev/null +++ b/src/main/java/com/lumiscosity/rounded/misc/RegisterSounds.java @@ -0,0 +1,20 @@ +package com.lumiscosity.rounded.misc; + +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.sound.SoundEvent; +import net.minecraft.util.Identifier; + +import static com.lumiscosity.rounded.Rounded.MOD_ID; + +public class RegisterSounds { + public static final Identifier TROUGH_FILL_ID = Identifier.of(MOD_ID, "trough_fill"); + public static final SoundEvent TROUGH_FILL = SoundEvent.of(TROUGH_FILL_ID); + public static final Identifier TROUGH_CONSUME_ID = Identifier.of(MOD_ID, "trough_consume"); + public static final SoundEvent TROUGH_CONSUME = SoundEvent.of(TROUGH_CONSUME_ID); + + public static void initSounds() { + Registry.register(Registries.SOUND_EVENT, TROUGH_FILL_ID, TROUGH_FILL); + Registry.register(Registries.SOUND_EVENT, TROUGH_CONSUME_ID, TROUGH_CONSUME); + } +} diff --git a/src/main/resources/data/c/tags/item/mushroom_caps.json b/src/main/resources/data/c/tags/item/mushroom_caps.json new file mode 100644 index 0000000..b68b4dd --- /dev/null +++ b/src/main/resources/data/c/tags/item/mushroom_caps.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "rounded:lustershroom_block" + ] +} diff --git a/src/main/resources/data/c/tags/item/mushrooms.json b/src/main/resources/data/c/tags/item/mushrooms.json new file mode 100644 index 0000000..1892a8c --- /dev/null +++ b/src/main/resources/data/c/tags/item/mushrooms.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "rounded:lustershroom" + ] +} diff --git a/src/main/resources/data/minecraft/recipe/cartography_table.json b/src/main/resources/data/minecraft/recipe/cartography_table.json new file mode 100644 index 0000000..271c272 --- /dev/null +++ b/src/main/resources/data/minecraft/recipe/cartography_table.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "rounded:treated_planks" + }, + "@": { + "item": "minecraft:paper" + } + }, + "pattern": [ + "@@", + "##", + "##" + ], + "result": { + "count": 1, + "id": "minecraft:cartography_table" + } +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/block/mineable/axe.json b/src/main/resources/data/minecraft/tags/block/mineable/axe.json index 1bf93f8..20bb8b6 100644 --- a/src/main/resources/data/minecraft/tags/block/mineable/axe.json +++ b/src/main/resources/data/minecraft/tags/block/mineable/axe.json @@ -2,6 +2,7 @@ "replace": false, "values": [ "rounded:lustershroom_block", + "rounded:luster_cluster", "rounded:treated_oak_planks", "rounded:treated_spruce_planks", "rounded:treated_jungle_planks", @@ -12,4 +13,4 @@ "rounded:treated_mangrove_planks", "rounded:treated_bamboo_planks" ] -} \ No newline at end of file +} diff --git a/src/main/resources/data/rounded/advancement/recipes/building_blocks/brown_mushroom_block.json b/src/main/resources/data/rounded/advancement/recipes/building_blocks/brown_mushroom_block.json new file mode 100644 index 0000000..0e821a9 --- /dev/null +++ b/src/main/resources/data/rounded/advancement/recipes/building_blocks/brown_mushroom_block.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_log": { + "conditions": { + "items": [ + { + "items": "minecraft:brown_mushroom" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "rounded:brown_mushroom_block" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_log" + ] + ], + "rewards": { + "recipes": [ + "rounded:brown_mushroom_block" + ] + } +} diff --git a/src/main/resources/data/rounded/advancement/recipes/building_blocks/lustershroom_block.json b/src/main/resources/data/rounded/advancement/recipes/building_blocks/lustershroom_block.json new file mode 100644 index 0000000..e8d866d --- /dev/null +++ b/src/main/resources/data/rounded/advancement/recipes/building_blocks/lustershroom_block.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_log": { + "conditions": { + "items": [ + { + "items": "rounded:lustershroom" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "rounded:lustershroom_block" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_log" + ] + ], + "rewards": { + "recipes": [ + "rounded:lustershroom_block" + ] + } +} diff --git a/src/main/resources/data/rounded/advancement/recipes/building_blocks/red_mushroom_block.json b/src/main/resources/data/rounded/advancement/recipes/building_blocks/red_mushroom_block.json new file mode 100644 index 0000000..977e821 --- /dev/null +++ b/src/main/resources/data/rounded/advancement/recipes/building_blocks/red_mushroom_block.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_log": { + "conditions": { + "items": [ + { + "items": "minecraft:red_mushroom" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "rounded:red_mushroom_block" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_log" + ] + ], + "rewards": { + "recipes": [ + "rounded:red_mushroom_block" + ] + } +} diff --git a/src/main/resources/data/rounded/recipe/brown_mushroom_block.json b/src/main/resources/data/rounded/recipe/brown_mushroom_block.json new file mode 100644 index 0000000..22f44f4 --- /dev/null +++ b/src/main/resources/data/rounded/recipe/brown_mushroom_block.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "group": "rounded:mushroom_block", + "key": { + "#": { + "item": "minecraft:brown_mushroom" + } + }, + "pattern": [ + "##", + "##" + ], + "result": { + "count": 1, + "id": "minecraft:brown_mushroom_block" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rounded/recipe/lustershroom_block.json b/src/main/resources/data/rounded/recipe/lustershroom_block.json new file mode 100644 index 0000000..60adfd8 --- /dev/null +++ b/src/main/resources/data/rounded/recipe/lustershroom_block.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "group": "rounded:mushroom_block", + "key": { + "#": { + "item": "rounded:lustershroom" + } + }, + "pattern": [ + "##", + "##" + ], + "result": { + "count": 1, + "id": "rounded:lustershroom_block" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rounded/recipe/red_mushroom_block.json b/src/main/resources/data/rounded/recipe/red_mushroom_block.json new file mode 100644 index 0000000..c97c33f --- /dev/null +++ b/src/main/resources/data/rounded/recipe/red_mushroom_block.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "group": "rounded:mushroom_block", + "key": { + "#": { + "item": "minecraft:red_mushroom" + } + }, + "pattern": [ + "##", + "##" + ], + "result": { + "count": 1, + "id": "minecraft:red_mushroom_block" + } +} \ No newline at end of file