Search in sources :

Example 6 with PortalCoords

use of uk.co.wehavecookies56.kk.common.util.PortalCoords in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class InputHandler method summonPortal.

private void summonPortal(EntityPlayer player, PortalCoords coords) {
    IOrganizationXIII orgXIII = player.getCapability(ModCapabilities.ORGANIZATION_XIII, null);
    RayTraceResult rtr = InputHandler.getMouseOverExtended(100);
    if (rtr != null) {
        if (rtr.typeOfHit == rtr.typeOfHit.BLOCK) {
            double distanceSq = player.getDistanceSq(rtr.getBlockPos());
            double reachSq = 100 * 100;
            if (reachSq >= distanceSq) {
                BlockPos pos = rtr.getBlockPos();
                BlockPos destination = new BlockPos(coords.getX(), coords.getY(), coords.getZ());
                PacketDispatcher.sendToServer(new OrgPortal(rtr.getBlockPos(), destination, coords.getDimID()));
                player.world.playSound((EntityPlayer) player, player.getPosition(), ModSounds.lockon, SoundCategory.MASTER, 1.0f, 1.0f);
            }
        }
    }
}
Also used : RayTraceResult(net.minecraft.util.math.RayTraceResult) BlockPos(net.minecraft.util.math.BlockPos) EntityOrgPortal(uk.co.wehavecookies56.kk.common.entity.magic.EntityOrgPortal) OrgPortal(uk.co.wehavecookies56.kk.common.network.packet.server.OrgPortal) IOrganizationXIII(uk.co.wehavecookies56.kk.common.capability.OrganizationXIIICapability.IOrganizationXIII)

Aggregations

PortalCoords (uk.co.wehavecookies56.kk.common.util.PortalCoords)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 TextComponentString (net.minecraft.util.text.TextComponentString)4 IDriveState (uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)3 PlayerStatsCapability (uk.co.wehavecookies56.kk.common.capability.PlayerStatsCapability)3 Minecraft (net.minecraft.client.Minecraft)2 TileEntityOrgPortal (uk.co.wehavecookies56.kk.common.block.tile.TileEntityOrgPortal)2 ItemKKPotion (uk.co.wehavecookies56.kk.common.item.base.ItemKKPotion)2 SyncOrgXIIIData (uk.co.wehavecookies56.kk.common.network.packet.client.SyncOrgXIIIData)2 BlockPos (net.minecraft.util.math.BlockPos)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 World (net.minecraft.world.World)1 IOrganizationXIII (uk.co.wehavecookies56.kk.common.capability.OrganizationXIIICapability.IOrganizationXIII)1 EntityOrgPortal (uk.co.wehavecookies56.kk.common.entity.magic.EntityOrgPortal)1 DriveFormPacket (uk.co.wehavecookies56.kk.common.network.packet.server.DriveFormPacket)1 OrgPortal (uk.co.wehavecookies56.kk.common.network.packet.server.OrgPortal)1 MagicWisdomShot (uk.co.wehavecookies56.kk.common.network.packet.server.magics.MagicWisdomShot)1