Send packets for player motion

This commit is contained in:
Electroblob77
2020-09-27 17:54:13 +01:00
parent 3f36f933ff
commit a5fb3c6ac5
@@ -4,7 +4,9 @@ import electroblob.wizardry.entity.ICustomHitbox;
import electroblob.wizardry.registry.WizardrySounds;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.SPacketEntityVelocity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
@@ -85,8 +87,16 @@ public class EntityIceBarrier extends EntityScaledConstruct implements ICustomHi
double perpendicularDist = getSignedPerpendicularDistance(entity.getPositionVector());
if(Math.abs(perpendicularDist) < entity.width/2 + THICKNESS/2){
double velocity = 0.25 * Math.signum(perpendicularDist);
entity.addVelocity(velocity * look.x, 0, velocity * look.z);
if(!world.isRemote){
// Player motion is handled on that player's client so needs packets
if(entity instanceof EntityPlayerMP){
((EntityPlayerMP)entity).connection.sendPacket(new SPacketEntityVelocity(entity));
}
}
}
}