use of com.builtbroken.mc.api.items.hz.IItemFrequency in project ICBM-Classic by BuiltBrokenModding.
the class TileRadarStation method doScan.
private void doScan() {
this.incomingMissiles.clear();
this.detectedEntities.clear();
List<Entity> entities = RadarRegistry.getAllLivingObjectsWithin(world(), xi() + 1.5, yi() + 0.5, zi() + 0.5, MAX_DETECTION_RANGE, null);
for (Entity entity : entities) {
if (entity instanceof EntityMissile) {
if (((EntityMissile) entity).getTicksInAir() > -1) {
if (!this.detectedEntities.contains(entity)) {
this.detectedEntities.add(entity);
}
if (this.isMissileGoingToHit((EntityMissile) entity)) {
if (this.incomingMissiles.size() > 0) {
/** Sort in order of distance */
double dist = new Pos((TileEntity) this).distance(new Pos(entity));
for (int i = 0; i < this.incomingMissiles.size(); i++) {
EntityMissile daoDan = this.incomingMissiles.get(i);
if (dist < new Pos((TileEntity) this).distance(daoDan.toPos())) {
this.incomingMissiles.add(i, (EntityMissile) entity);
break;
} else if (i == this.incomingMissiles.size() - 1) {
this.incomingMissiles.add((EntityMissile) entity);
break;
}
}
} else {
this.incomingMissiles.add((EntityMissile) entity);
}
}
}
} else {
this.detectedEntities.add(entity);
}
}
List<EntityPlayer> players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.xCoord - MAX_DETECTION_RANGE, this.yCoord - MAX_DETECTION_RANGE, this.zCoord - MAX_DETECTION_RANGE, this.xCoord + MAX_DETECTION_RANGE, this.yCoord + MAX_DETECTION_RANGE, this.zCoord + MAX_DETECTION_RANGE));
for (EntityPlayer player : players) {
if (player != null) {
boolean youHuoLuan = false;
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack itemStack = player.inventory.getStackInSlot(i);
if (itemStack != null) {
if (itemStack.getItem() instanceof IItemFrequency) {
youHuoLuan = true;
break;
}
}
}
if (!youHuoLuan) {
this.detectedEntities.add(player);
}
}
}
}
use of com.builtbroken.mc.api.items.hz.IItemFrequency in project ICBM-Classic by BuiltBrokenModding.
the class GuiFrequency method initGui.
/** Adds the buttons (and other controls) to the screen in question. */
@Override
public void initGui() {
super.initGui();
this.textFieldFrequency = new GuiTextField(fontRendererObj, 80, 50, 40, 12);
this.textFieldFrequency.setMaxStringLength(4);
if (itemStack != null) {
this.textFieldFrequency.setText(((IItemFrequency) this.itemStack.getItem()).getBroadCastHz(this.itemStack) + "");
}
}
Aggregations