Skip to content

Commit

Permalink
fix a networking crash
Browse files Browse the repository at this point in the history
  • Loading branch information
LemmaEOF committed May 22, 2019
1 parent 3b1dc52 commit 4359fed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(rootProject.file("private.gradle").exists()) { //Publishing details

archivesBaseName = "skillcheck"
group = "io.github.cottonmc"
version = "1.0.8+1.14.1"
version = "1.0.9+1.14.1"

minecraft {
refmapName = "mixins.skillcheck.refmap.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,23 @@ public static void initServer() {
});
}

@Environment(EnvType.CLIENT)

public static void syncPlayerLevel(int level, ServerPlayerEntity player) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeInt(level);
player.networkHandler.sendPacket(new CustomPayloadS2CPacket(SYNC_PLAYER_LEVEL, buf));
}

public static void syncSelection(int index) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeInt(index);
MinecraftClient.getInstance().getNetworkHandler().getClientConnection().send(new CustomPayloadC2SPacket(SYNC_SELECTION, buf));
}

@Environment(EnvType.CLIENT)
public static void syncLevelup(Identifier id, int xpCost) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeIdentifier(id);
buf.writeInt(xpCost);
MinecraftClient.getInstance().getNetworkHandler().getClientConnection().send(new CustomPayloadC2SPacket(SYNC_LEVELUP, buf));
}

@Environment(EnvType.CLIENT)
public static void syncPlayerLevel(int level, ServerPlayerEntity player) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeInt(level);
player.networkHandler.sendPacket(new CustomPayloadS2CPacket(SYNC_PLAYER_LEVEL, buf));
}
}

0 comments on commit 4359fed

Please sign in to comment.