use of com.builtbroken.mc.prefab.hz.FakeRadioSender in project ICBM-Classic by BuiltBrokenModding.
the class TileLauncherScreen method receiveRadioWave.
@Override
public void receiveRadioWave(float hz, IRadioWaveSender sender, String messageHeader, Object[] data) {
//Floor frequency as we do not care about sub ranges
int frequency = (int) Math.floor(hz);
//Only tier 3 (2 for tier value) can be remotely fired
if (getTier() == 2 && frequency == getFrequency() && laucherBase != null) {
//Laser detonator signal
if (messageHeader.equals("activateLauncherWithTarget")) {
Pos pos = (Pos) data[0];
if (toPos().distance(pos) < this.laucherBase.getRange()) {
setTarget(pos);
launch();
((FakeRadioSender) sender).player.addChatComponentMessage(new ChatComponentText("Firing missile at " + pos));
}
} else //Remote detonator signal
if (messageHeader.equals("activateLauncher")) {
((FakeRadioSender) sender).player.addChatComponentMessage(new ChatComponentText("Firing missile at " + getTarget()));
launch();
}
}
}
Aggregations