Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make players affected as well #7

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/java/io/ix0rai/ramel/mixin/CamelEntityMixin.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package io.ix0rai.ramel.mixin;

import io.ix0rai.ramel.Config;
import java.util.Objects;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.passive.CamelEntity;
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
Expand All @@ -16,8 +19,6 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Objects;

@Mixin(CamelEntity.class)
public abstract class CamelEntityMixin extends LivingEntity {
@Shadow public abstract boolean isDashing();
Expand Down Expand Up @@ -53,6 +54,10 @@ protected CamelEntityMixin(EntityType<? extends CamelEntity> entityType, World w

entity.takeKnockback(blockedImpact * speedAdjustedImpact * knockBackMultiplier,
MathHelper.sin(this.getPitch() * ((float) Math.PI / 180)), -MathHelper.cos(this.getPitch() * ((float) Math.PI / 180)));
if (entity instanceof ServerPlayerEntity player) {
// The player won't feel any effects if we don't update the velocity
player.networkHandler.send(new EntityVelocityUpdateS2CPacket(player));
}
});
}
}
Loading