Search in sources :

Example 1 with OrgPortal

use of uk.co.wehavecookies56.kk.common.network.packet.server.OrgPortal 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

BlockPos (net.minecraft.util.math.BlockPos)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1 IOrganizationXIII (uk.co.wehavecookies56.kk.common.capability.OrganizationXIIICapability.IOrganizationXIII)1 EntityOrgPortal (uk.co.wehavecookies56.kk.common.entity.magic.EntityOrgPortal)1 OrgPortal (uk.co.wehavecookies56.kk.common.network.packet.server.OrgPortal)1