Skip to content

Commit

Permalink
Fix Barrier not knocking back hostile players
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsoltMolnarrr committed Sep 12, 2024
1 parent c32d413 commit 63790a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.0.4

- Fix Barrier not knocking back hostile players

# 2.0.3

- Fix breaking change with Spell Engine
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fabric_api_version=0.102.0+1.21.1
# Mod
maven_group=net
archives_base_name=paladins
mod_version=2.0.3
mod_version=2.0.4
minecraft_compat_version=1.21

# Dependencies
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/net/paladins/entity/BarrierEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.data.TrackedData;
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
Expand Down Expand Up @@ -182,6 +186,12 @@ public void tick() {
} else {
livingEntity.takeKnockback(PaladinsMod.tweaksConfig.value.barrier_knockback_strength,
this.getX() - livingEntity.getX(), this.getZ() - livingEntity.getZ());
if (livingEntity instanceof ServerPlayerEntity serverPlayer) {
serverPlayer.networkHandler.send(
new EntityVelocityUpdateS2CPacket(serverPlayer.getId(), serverPlayer.getVelocity()),
null
);
}
}
}
}
Expand Down

0 comments on commit 63790a8

Please sign in to comment.