com.gmail.filoghost.holographicdisplays.util.Utils.square()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中com.gmail.filoghost.holographicdisplays.util.Utils.square()方法的一些代码示例,展示了Utils.square()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.square()方法的具体详情如下:
包路径:com.gmail.filoghost.holographicdisplays.util.Utils
类名称:Utils
方法名:square

Utils.square介绍

暂无

代码示例

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);

    for (Object obj : super.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);

    for (Object obj : super.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);

    for (Object obj : super.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);

    for (Object obj : super.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);

    for (Object obj : super.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);

    for (Object obj : super.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);

    for (Object obj : super.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void m() {
  
  // So it won't get removed.
  ticksLived = 0;
  
  if (resendMountPacketTicks++ > 20) {
    resendMountPacketTicks = 0;
    if (bB() != null) {
      // Send a packet near to "remind" players that the slime is riding the armor stand (Spigot bug or client bug)
      PacketPlayOutMount mountPacket = new PacketPlayOutMount(bB());

      for (Object obj : super.world.players) {
        if (obj instanceof EntityPlayer) {
          EntityPlayer nmsPlayer = (EntityPlayer) obj;

          double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
          if (distanceSquared < 1024 && nmsPlayer.playerConnection != null) {
            nmsPlayer.playerConnection.sendPacket(mountPacket);
          }
        }
      }
    }
  }
  
  if (!lockTick) {
    super.m();
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 1024 && nmsPlayer.playerConnection != null) {
  nmsPlayer.playerConnection.sendPacket(mountPacket);

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void m() {
  
  // So it won't get removed.
  ticksLived = 0;
  
  if (resendMountPacketTicks++ > 20) {
    resendMountPacketTicks = 0;
    if (bz() != null) {
      // Send a packet near to "remind" players that the slime is riding the armor stand (Spigot bug or client bug)
      PacketPlayOutMount mountPacket = new PacketPlayOutMount(bz());

      for (Object obj : super.world.players) {
        if (obj instanceof EntityPlayer) {
          EntityPlayer nmsPlayer = (EntityPlayer) obj;

          double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
          if (distanceSquared < 1024 && nmsPlayer.playerConnection != null) {
            nmsPlayer.playerConnection.sendPacket(mountPacket);
          }
        }
      }
    }
  }
  
  if (!lockTick) {
    super.m();
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 1024 && nmsPlayer.playerConnection != null) {
  nmsPlayer.playerConnection.sendPacket(mountPacket);

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void m() {
  
  // So it won't get removed.
  ticksLived = 0;
  
  if (resendMountPacketTicks++ > 20) {
    resendMountPacketTicks = 0;
    if (by() != null) {
      // Send a packet near to "remind" players that the slime is riding the armor stand (Spigot bug or client bug)
      PacketPlayOutMount mountPacket = new PacketPlayOutMount(by());

      for (Object obj : super.world.players) {
        if (obj instanceof EntityPlayer) {
          EntityPlayer nmsPlayer = (EntityPlayer) obj;

          double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
          if (distanceSquared < 1024 && nmsPlayer.playerConnection != null) {
            nmsPlayer.playerConnection.sendPacket(mountPacket);
          }
        }
      }
    }
  }
  
  if (!lockTick) {
    super.m();
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 1024 && nmsPlayer.playerConnection != null) {
  nmsPlayer.playerConnection.sendPacket(mountPacket);

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
      getIdNMS(),
      MathHelper.floor(this.locX * 32.0D),
      MathHelper.floor(this.locY * 32.0D),
      MathHelper.floor(this.locZ * 32.0D),
      (byte) (int) (this.yaw * 256.0F / 360.0F),
      (byte) (int) (this.pitch * 256.0F / 360.0F),
      this.onGround
    );

    for (Object obj : this.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
      getIdNMS(),
      MathHelper.floor(this.locX * 32.0D),
      MathHelper.floor(this.locY * 32.0D),
      MathHelper.floor(this.locZ * 32.0D),
      (byte) (int) (this.yaw * 256.0F / 360.0F),
      (byte) (int) (this.pitch * 256.0F / 360.0F),
      this.onGround
    );

    for (Object obj : this.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

代码示例来源:origin: filoghost/HolographicDisplays

@Override
public void setLocationNMS(double x, double y, double z) {
  super.setPosition(x, y, z);
  
  if (Configuration.preciseHologramMovement) {
    // Send a packet near to update the position.
    PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
      getIdNMS(),
      MathHelper.floor(this.locX * 32.0D),
      MathHelper.floor(this.locY * 32.0D),
      MathHelper.floor(this.locZ * 32.0D),
      (byte) (int) (this.yaw * 256.0F / 360.0F),
      (byte) (int) (this.pitch * 256.0F / 360.0F),
      this.onGround
    );

    for (Object obj : this.world.players) {
      if (obj instanceof EntityPlayer) {
        EntityPlayer nmsPlayer = (EntityPlayer) obj;

        double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
        if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
          nmsPlayer.playerConnection.sendPacket(teleportPacket);
        }
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多