Skip to content

Commit

Permalink
Fix issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
lilypuree committed Jan 4, 2024
1 parent dc93360 commit f2b1428
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
- Water bottle tooltips added, gives 2 hydration
- Deep dark is cold
- Sprinting & swimming gives metabolism progress
- Other minor bug fixes
- Other minor bug fixes

### [1.1.2] (Minecraft 1.20.1)

- Fixes crash on dedecated server ([#1](https://github.com/lilypuree/Metabolism/issues/1))
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mapping_version=2023.09.03-1.20.1
mod_id=metabolism
mod_name=Metabolism
mod_license=MIT
mod_version=1.20.1-1.1.1
mod_version=1.20.1-1.1.2
mod_group_id=lilypuree.metabolism
mod_authors=Lilypuree
mod_description=a temperature & hunger overhaul mod
4 changes: 2 additions & 2 deletions src/main/java/lilypuree/metabolism/client/ClientHandler.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package lilypuree.metabolism.client;


import lilypuree.metabolism.metabolism.FoodDataDuck;
import lilypuree.metabolism.metabolism.Metabolism;
import lilypuree.metabolism.network.ClientSyncMessage;
import lilypuree.metabolism.network.ProgressSyncMessage;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.network.NetworkEvent;

import java.util.function.Supplier;
Expand All @@ -29,6 +29,6 @@ public static void handleSyncProgress(ProgressSyncMessage msg, Supplier<NetworkE
}

public static Metabolism getClientMetabolism(Minecraft mc) {
return Metabolism.get(mc.player);
return ((FoodDataDuck)mc.player).getMetabolism(); //Cannot use Metabolism.get() due to crash on dedicated server
}
}
3 changes: 0 additions & 3 deletions src/main/java/lilypuree/metabolism/network/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ public static void init() {
.consumerMainThread(ClientHandler::handleSyncMessage)
.add();


channel.messageBuilder(ProgressSyncMessage.class, id++)
.decoder(ProgressSyncMessage::fromBytes)
.encoder(ProgressSyncMessage::toBytes)
.consumerMainThread(ClientHandler::handleSyncProgress)
.add();

}


}

0 comments on commit f2b1428

Please sign in to comment.