Search in sources :

Example 1 with RadarGunTraceEvent

use of icbm.classic.api.events.RadarGunTraceEvent in project ICBM-Classic by BuiltBrokenModding.

the class ItemRadarGun method trace.

public boolean trace(BlockPos pos, EntityPlayer player) {
    ItemStack stack = player.inventory.getCurrentItem();
    if (stack != null && stack.getItem() == this) {
        RadarGunTraceEvent event = new RadarGunTraceEvent(player.world, pos, player);
        if (// event was canceled
        MinecraftForge.EVENT_BUS.post(event))
            return false;
        if (// someone set the pos in the event to null, use original data
        event.pos == null)
            setLocation(stack, new Location(player.world, pos.getX(), pos.getY(), pos.getZ()));
        else
            setLocation(stack, new Location(player.world, event.pos.getX(), event.pos.getY(), event.pos.getZ()));
        LanguageUtility.addChatToPlayer(player, "gps.pos.set.name");
        System.out.println(getLocation(stack));
    }
    return true;
}
Also used : RadarGunTraceEvent(icbm.classic.api.events.RadarGunTraceEvent) ItemStack(net.minecraft.item.ItemStack) Location(icbm.classic.lib.transform.vector.Location)

Aggregations

RadarGunTraceEvent (icbm.classic.api.events.RadarGunTraceEvent)1 Location (icbm.classic.lib.transform.vector.Location)1 ItemStack (net.minecraft.item.ItemStack)1