From cbe98064f333ab661c7d1748828326c7460f9a7f Mon Sep 17 00:00:00 2001 From: doctor4t <25477005+doctor4t@users.noreply.github.com> Date: Tue, 13 Oct 2020 10:42:20 +0200 Subject: [PATCH] Fix inked nomad books never progressing --- CHANGELOG.md | 4 ++++ gradle.properties | 11 +++++++---- .../nomadbooks/mixin/ServerPlayerEntityMixin.java | 10 ++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2931634..5b3637c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Nomad Books - Changelog +### Nomad Books 0.5.7 - 1.16.3 +- Fixed an issue that made inked nomad books unable to progress +- Added a sound effect when an inked nomad book reaches its goal + ### Nomad Books 0.5.6 - 1.16.3 - Updated to Minecraft 1.16.3 diff --git a/gradle.properties b/gradle.properties index cc07361..f2a07a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,15 +2,18 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties + + minecraft_version=1.16.3 -yarn_mappings=1.16.3+build.17 -loader_version=0.10.0+build.208 +yarn_mappings=1.16.3+build.45 +loader_version=0.10.1+build.209 #Fabric api -fabric_version=0.22.1+build.409-1.16 +fabric_version=0.24.0+build.411-1.16 + # Mod Properties -mod_version = 0.5.6 +mod_version = 0.5.7 maven_group = io.github.ladysnake archives_base_name = nomadbooks diff --git a/src/main/java/ladysnake/nomadbooks/mixin/ServerPlayerEntityMixin.java b/src/main/java/ladysnake/nomadbooks/mixin/ServerPlayerEntityMixin.java index e3272eb..fe613e1 100644 --- a/src/main/java/ladysnake/nomadbooks/mixin/ServerPlayerEntityMixin.java +++ b/src/main/java/ladysnake/nomadbooks/mixin/ServerPlayerEntityMixin.java @@ -14,6 +14,9 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerInteractionManager; import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; @@ -33,6 +36,8 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity { @Shadow public abstract void sendMessage(Text message, boolean bl); + @Shadow public abstract void playSound(SoundEvent event, SoundCategory category, float volume, float pitch); + public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile profile) { super(world, pos, yaw, profile); } @@ -46,8 +51,8 @@ private void enterBiome(CallbackInfo info) { // if inventory has an inked nomad book if (tags.getBoolean("Inked")) { ListTag visitedBiomes = tags.getList("VisitedBiomes", NbtType.STRING); - if (BuiltinRegistries.BIOME.getId(this.world.getBiome(this.getBlockPos())) != null) { - StringTag biome = StringTag.of(BuiltinRegistries.BIOME.getId(this.world.getBiome(this.getBlockPos())).toString()); + if (this.world.getBiome(this.getBlockPos()).toString() != null) { + StringTag biome = StringTag.of(this.world.getBiome(this.getBlockPos()).toString()); if (!visitedBiomes.contains(biome)) { // if not the first biome (just crafted), increment progress if (!visitedBiomes.isEmpty()) { @@ -68,6 +73,7 @@ private void enterBiome(CallbackInfo info) { BlockPos pos = NbtHelper.toBlockPos(tags.getCompound("CampPos")).add(-1, 0, -1); tags.put("CampPos", NbtHelper.fromBlockPos(pos)); // show a chat message to the player + this.playSound(SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.PLAYERS, 0.1f, 0.75f); this.sendMessage(new TranslatableText("info.nomadbooks.itinerant_ink_done", tags.getInt("Width")).setStyle(EMPTY.withColor(Formatting.BLUE)), false); // sound effect not working because server side // this.world.playSound(this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.PLAYERS, 1, 1, true);