Skip to content

Commit

Permalink
Try to resolve #15
Browse files Browse the repository at this point in the history
Please test this, I made this in github editor.
  • Loading branch information
i509VCB committed Nov 26, 2020
1 parent e5960d7 commit 16aeaff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/wraith/waystones/WaystonesClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
Expand All @@ -26,9 +26,12 @@ public void onInitializeClient() {
private void registerPacketHandlers() {
ClientSidePacketRegistry.INSTANCE.register(new Identifier(Waystones.MOD_ID, "waystone_packet"), (packetContext, attachedData) -> {
PlayerEntity player = packetContext.getPlayer();
if(!((ClientPlayNetworkHandler)packetContext).getConnection().isLocal()) {

// A note for the future: Please just treat the integrated server as remote. This is a bit of a hack.
if(!(MinecraftClient.getInstance().getNetworkHandler().getConnection().isLocal()) {
Waystones.WAYSTONE_DATABASE = new WaystoneDatabase(player == null ? null : player.getServer());
}

ListTag list = attachedData.readCompoundTag().getList("Waystones", 10);
for (int i = 0; i < list.size(); ++i) {
CompoundTag tag = list.getCompound(i);
Expand Down

0 comments on commit 16aeaff

Please sign in to comment.