Search in sources :

Example 1 with SPacketBlockBreakAnim

use of net.minecraft.network.play.server.SPacketBlockBreakAnim in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class ValkyrienWarfareWorldEventListener method sendBlockBreakProgress.

@Override
public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) {
    if (!worldObj.isRemote) {
        for (EntityPlayer entityplayermp : worldObj.playerEntities) {
            if (entityplayermp != null && entityplayermp.getEntityId() != breakerId) {
                Vector posVector = new Vector(pos.getX(), pos.getY(), pos.getZ());
                PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(worldObj, pos);
                if (wrapper != null) {
                    RotationMatrices.applyTransform(wrapper.wrapping.coordTransform.lToWTransform, posVector);
                }
                double d0 = posVector.X - entityplayermp.posX;
                double d1 = posVector.Y - entityplayermp.posY;
                double d2 = posVector.Z - entityplayermp.posZ;
                if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
                    ((EntityPlayerMP) entityplayermp).connection.sendPacket(new SPacketBlockBreakAnim(breakerId, pos, progress));
                }
            }
        }
    }
}
Also used : PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SPacketBlockBreakAnim(net.minecraft.network.play.server.SPacketBlockBreakAnim) Vector(ValkyrienWarfareBase.API.Vector)

Aggregations

Vector (ValkyrienWarfareBase.API.Vector)1 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 SPacketBlockBreakAnim (net.minecraft.network.play.server.SPacketBlockBreakAnim)1