Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Entity[] entities = myAABB.getEntitiesOfClass(EntityPlayer.class);
for (Entity e : entities) {
float x = e.getX()-myX;
float y = e.getY()-myY;
float z = e.getZ()-myZ;
float length = Math.sqrt(x*x + y*y + z*z);
float radii = 5f;
if (length <= radii) {
sphere.addEntity(e); //удовлетворяет условиям - сущность подходит
}
}
for(int i < -5; i < 4; i++){
if(player.worldObj.getBlock(player.posX + i, player.posY + i, player.posZ + i) == Your_Block){
//Если в радиусе 5 блоков от игрока есть твой блок - выполняем что-то.
}
}
int pX = player.posX;
int pY = player.posY;
int pZ = player.posZ;
int radii = 5;
for (int x = -radii; x < radii; x++)
for (int y = -radii; y < radii; y++)
for (int z = -radii; z < radii; z++) {
int tx = x-pX;
int ty = y-pY;
int tz = z-pZ;
double len = Math.sqrt(tx*tx + ty*ty + tz*tz);
if (len <= radii) {
//Если в радиусе 5 блоков от игрока есть твой блок - выполняем что-то.
}
}