|
1 | 1 | package io.ix0rai.ramel.mixin;
|
2 | 2 |
|
3 | 3 | import io.ix0rai.ramel.Config;
|
| 4 | +import java.util.Objects; |
4 | 5 | import net.minecraft.entity.Entity;
|
5 | 6 | import net.minecraft.entity.EntityType;
|
6 | 7 | import net.minecraft.entity.LivingEntity;
|
7 | 8 | import net.minecraft.entity.damage.DamageSource;
|
8 | 9 | import net.minecraft.entity.effect.StatusEffects;
|
9 | 10 | import net.minecraft.entity.passive.CamelEntity;
|
| 11 | +import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket; |
| 12 | +import net.minecraft.server.network.ServerPlayerEntity; |
10 | 13 | import net.minecraft.sound.SoundEvents;
|
11 | 14 | import net.minecraft.util.math.MathHelper;
|
12 | 15 | import net.minecraft.world.World;
|
|
16 | 19 | import org.spongepowered.asm.mixin.injection.Inject;
|
17 | 20 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
18 | 21 |
|
19 |
| -import java.util.Objects; |
20 |
| - |
21 | 22 | @Mixin(CamelEntity.class)
|
22 | 23 | public abstract class CamelEntityMixin extends LivingEntity {
|
23 | 24 | @Shadow public abstract boolean isDashing();
|
@@ -53,6 +54,10 @@ protected CamelEntityMixin(EntityType<? extends CamelEntity> entityType, World w
|
53 | 54 |
|
54 | 55 | entity.takeKnockback(blockedImpact * speedAdjustedImpact * knockBackMultiplier,
|
55 | 56 | MathHelper.sin(this.getPitch() * ((float) Math.PI / 180)), -MathHelper.cos(this.getPitch() * ((float) Math.PI / 180)));
|
| 57 | + if (entity instanceof ServerPlayerEntity player) { |
| 58 | + // The player won't feel any effects if we don't update the velocity |
| 59 | + player.networkHandler.send(new EntityVelocityUpdateS2CPacket(player)); |
| 60 | + } |
56 | 61 | });
|
57 | 62 | }
|
58 | 63 | }
|
0 commit comments