Search in sources :

Example 1 with FakeRadioSender

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();
        }
    }
}
Also used : Pos(com.builtbroken.mc.imp.transform.vector.Pos) FakeRadioSender(com.builtbroken.mc.prefab.hz.FakeRadioSender) ChatComponentText(net.minecraft.util.ChatComponentText)

Aggregations

Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 FakeRadioSender (com.builtbroken.mc.prefab.hz.FakeRadioSender)1 ChatComponentText (net.minecraft.util.ChatComponentText)1