Restore legacy book linking sound
Build / build (push) Canceled after 0s

This commit is contained in:
dnorberg committed 2026-09-21 15:01:52 -04:00
1 parent b8215f1336
commit 2da52f2658
9 files changed
+65 -7

No files matched your search

+3
View File
@@ -19,6 +19,9 @@ survives inventory and world saves. Travel only succeeds if the target
dimension is loaded and a non-fluid, passable landing position can be found
nearby.
Successful book travel plays Mystcraft Legacy's original linking sound at both
the departure and arrival locations.
Right-click an empty vanilla lectern with a Rivencraft book to convert it into
a Book Stand and place the book on it. Use a Linking Book on the stand by
right-clicking with an empty hand. Sneak-right-click with an empty hand to take
+4
View File
@@ -206,6 +206,10 @@ Version 0.2.10.3 scans each candidate column downward from the dimension's top
before choosing footing, preventing cave floors from being selected as the Age
arrival surface. Columns covered by fluid remain ineligible.
Version 0.2.10.4 restores Mystcraft Legacy's standard linking sound for both
Linking and Descriptive Books. Successful travel plays the sound at its source
and destination with the legacy volume and pitch variation.
The preview code is separated behind a renderer interface and uses an isolated
Ponder level populated from server-authoritative destination snapshots.
+1 -1
View File
@@ -35,7 +35,7 @@ mod_name=Rivencraft
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=LGPL-3.0-or-later
# The mod version. Rivencraft uses the x.y.z.b policy documented in README.md.
mod_version=0.2.10.3
mod_version=0.2.10.4
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
@@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils;
import net.dnorberg.rivencraft.registry.ModCreativeTabs;
import net.dnorberg.rivencraft.registry.ModDataComponents;
import net.dnorberg.rivencraft.registry.ModItems;
import net.dnorberg.rivencraft.registry.ModSounds;
import net.dnorberg.rivencraft.registry.ModBlocks;
import net.dnorberg.rivencraft.registry.ModBlockEntities;
import net.dnorberg.rivencraft.event.BookStandConversionHandler;
@@ -30,6 +31,7 @@ public final class Rivencraft {
ModBlocks.register(modEventBus);
ModBlockEntities.register(modEventBus);
ModItems.register(modEventBus);
ModSounds.register(modEventBus);
ModCreativeTabs.register(modEventBus);
NeoForge.EVENT_BUS.addListener(BookStandConversionHandler::onRightClickBlock);
LOGGER.info("Initializing Rivencraft");
@@ -9,13 +9,14 @@ import net.dnorberg.rivencraft.book.AgeDimensionService;
import net.dnorberg.rivencraft.config.RivencraftConfig;
import net.dnorberg.rivencraft.registry.ModDataComponents;
import net.dnorberg.rivencraft.registry.ModItems;
import net.dnorberg.rivencraft.registry.ModSounds;
import net.minecraft.ChatFormatting;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
@@ -51,6 +52,8 @@ public final class DescriptiveBookItem extends Item {
return false;
}
ServerLevel sourceLevel = player.serverLevel();
var sourcePosition = player.blockPosition();
LinkingService.LinkResult result = LinkingService.travelWithFooting(player, ageTarget);
if (result != LinkingService.LinkResult.SUCCESS) {
player.displayClientMessage(Component.translatable("message.rivencraft.descriptive_book.unsafe"), true);
@@ -69,7 +72,10 @@ public final class DescriptiveBookItem extends Item {
player.drop(returnBook, false);
}
}
player.level().playSound(null, player.blockPosition(), SoundEvents.PORTAL_TRAVEL, SoundSource.PLAYERS, 0.35F, 1.0F);
sourceLevel.playSound(null, sourcePosition, ModSounds.LINK.get(), SoundSource.PLAYERS,
0.8F, sourceLevel.random.nextFloat() * 0.2F + 0.9F);
player.level().playSound(null, player.blockPosition(), ModSounds.LINK.get(), SoundSource.PLAYERS,
0.8F, player.level().random.nextFloat() * 0.2F + 0.9F);
player.displayClientMessage(Component.translatable(
createReturnLink ? "message.rivencraft.descriptive_book.linked_first" : "message.rivencraft.descriptive_book.linked",
age.name()
@@ -4,12 +4,12 @@ import java.util.List;
import net.dnorberg.rivencraft.book.LinkTarget;
import net.dnorberg.rivencraft.book.LinkingService;
import net.dnorberg.rivencraft.registry.ModDataComponents;
import net.dnorberg.rivencraft.registry.ModSounds;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
@@ -45,15 +45,19 @@ public final class LinkingBookItem extends Item {
return InteractionResultHolder.fail(stack);
}
Level sourceLevel = player.level();
BlockPos sourcePosition = player.blockPosition();
LinkingService.LinkResult result = LinkingService.travel(player, target);
if (result == LinkingService.LinkResult.SUCCESS) {
sourceLevel.playSound(null, sourcePosition, ModSounds.LINK.get(), SoundSource.PLAYERS,
0.8F, sourceLevel.random.nextFloat() * 0.2F + 0.9F);
player.level().playSound(
null,
player.blockPosition(),
SoundEvents.PORTAL_TRAVEL,
ModSounds.LINK.get(),
SoundSource.PLAYERS,
0.35F,
1.0F
0.8F,
player.level().random.nextFloat() * 0.2F + 0.9F
);
player.displayClientMessage(Component.translatable("message.rivencraft.linking_book.linked"), true);
return InteractionResultHolder.success(stack);
@@ -0,0 +1,29 @@
package net.dnorberg.rivencraft.registry;
import net.dnorberg.rivencraft.Rivencraft;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;
/** Sound events retained from Mystcraft Legacy's linking behavior. */
public final class ModSounds {
private static final DeferredRegister<SoundEvent> SOUNDS =
DeferredRegister.create(Registries.SOUND_EVENT, Rivencraft.MOD_ID);
public static final DeferredHolder<SoundEvent, SoundEvent> LINK = register("linking.link");
private ModSounds() {
}
private static DeferredHolder<SoundEvent, SoundEvent> register(String name) {
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, name);
return SOUNDS.register(name, () -> SoundEvent.createVariableRangeEvent(id));
}
public static void register(IEventBus modEventBus) {
SOUNDS.register(modEventBus);
}
}
@@ -0,0 +1,10 @@
{
"linking.link": {
"category": "player",
"sounds": [
{
"name": "rivencraft:linking/link"
}
]
}
}