Skip to content

Commit

Permalink
Fix packet handling issues in multiplayer causing players to disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsoltMolnarrr committed Oct 28, 2023
1 parent ec989ab commit 15bf9fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.8.1

- (1.20.2) Fix packet handling issues in multiplayer causing players to disconnect.

# 1.8.0

New features:
Expand Down
5 changes: 2 additions & 3 deletions common/src/main/java/net/bettercombat/utils/SoundHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public static void playSound(ServerWorld world, Entity entity, WeaponAttributes.
sound.id(),
sound.volume(),
pitch,
rng.nextLong())
.write();
rng.nextLong());

var soundEvent = Registries.SOUND_EVENT.get(new Identifier(sound.id()));
var distance = soundEvent.getDistanceToTravel(sound.volume());
Expand All @@ -45,7 +44,7 @@ public static void playSound(ServerWorld world, Entity entity, WeaponAttributes.
var channel = Packets.AttackSound.ID;
try {
if (ServerPlayNetworking.canSend(serverPlayer, channel)) {
ServerPlayNetworking.send(serverPlayer, channel, packet);
ServerPlayNetworking.send(serverPlayer, channel, packet.write());
}
} catch (Exception e){
e.printStackTrace();
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ minecraft_version=1.20.2
yarn_mappings=1.20.2+build.1

# Loader
fabric_version=0.89.2+1.20.2
fabric_version=0.90.4+1.20.2
loader_version=0.14.22
forge_version=48.0.4

# Mod Properties
mod_version=1.8.0
mod_version=1.8.1
maven_group=net
archives_base_name=bettercombat

Expand Down

0 comments on commit 15bf9fb

Please sign in to comment.