Skip to content

Commit

Permalink
Fix inked nomad books never progressing
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Oct 13, 2020
1 parent 4178ad5 commit cbe9806
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 4 additions & 0 deletions 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

Expand Down
11 changes: 7 additions & 4 deletions gradle.properties
Expand Up @@ -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

Expand Down
Expand Up @@ -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;
Expand All @@ -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);
}
Expand All @@ -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()) {
Expand All @@ -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);
Expand Down

0 comments on commit cbe9806

Please sign in to comment.