Java Code Examples for net.minecraft.entity.player.EntityPlayer.getHeldItemMainhand()

The following are Jave code examples for showing how to use getHeldItemMainhand() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: pnc-repressurized   File: EntityDrone.java   View Source Code Vote up 6 votes
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
    ItemStack equippedItem = player.getHeldItemMainhand();
    if (!world.isRemote && !equippedItem.isEmpty()) {
        if (equippedItem.getItem() == Itemss.GPS_TOOL) {
            BlockPos gpsLoc = ItemGPSTool.getGPSLocation(equippedItem);
            if (gpsLoc != null) {
                getNavigator().tryMoveToXYZ(gpsLoc.getX(), gpsLoc.getY(), gpsLoc.getZ(), 0.1D);
            }
        } else {
            int dyeIndex = TileEntityPlasticMixer.getDyeIndex(equippedItem);
            if (dyeIndex >= 0) {
                setDroneColor(ItemDye.DYE_COLORS[dyeIndex]);
                equippedItem.shrink(1);
                if (equippedItem.getCount() <= 0) {
                    player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
                }
            }
        }
    }
    return false;
}
 
Example 2
Project: Adventurers-Toolbox   File: SpecialToolAbilityHandler.java   View Source Code Vote up 6 votes
@SubscribeEvent
public void onWitherBoneAttackEvent(AttackEntityEvent event) {
	
	EntityPlayer player = event.getEntityPlayer();
	ItemStack stack = player.getHeldItemMainhand();
	
	boolean flag = false;
	
	if (stack.getItem() instanceof IHaftTool) {
		if (IHaftTool.getHaftMat(stack) == ModMaterials.HAFT_WITHER_BONE) {
			flag = true;
		}
	}

	if (flag) {
		if (player.dimension != DimensionType.NETHER.getId()) {
			stack.damageItem(7, player);
		}
	}
}
 
Example 3
Project: ExPetrum   File: BlockSnow.java   View Source Code Vote up 6 votes
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,	EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
	ItemStack itm = playerIn.getHeldItemMainhand();
	if (!itm.isEmpty() && itm.getItem() instanceof ItemBlock && Block.getBlockFromItem(itm.getItem()) == this && state.getValue(LAYERS) < 8)
	{
		if (!playerIn.capabilities.isCreativeMode)
		{
			itm.shrink(1);
		}
		
		worldIn.setBlockState(pos, state.cycleProperty(LAYERS));
		return true;
	}
	
	return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
}
 
Example 4
Project: uniquecrops   File: Malleatoris.java   View Source Code Vote up 6 votes
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {

	if (this.getAge(state) < getMaxAge()) return false;
	
	if (!world.isRemote && hand == EnumHand.MAIN_HAND) {
		ItemStack stacky = player.getHeldItemMainhand();
		if (stacky == null || (stacky != null && !stacky.isItemDamaged())) return false;
		
		int repair = stacky.getMaxDamage() / 2;
		stacky.setItemDamage(Math.max(stacky.getItemDamage() - repair, 0));
		world.setBlockState(pos, this.withAge(0), 2);
		return true;
	}
	return false;
}
 
Example 5
Project: ExPetrum   File: DownStrike.java   View Source Code Vote up 6 votes
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	EnumWeaponWeight weight = EnumWeaponWeight.getWeaponWeight(is);
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 1F);
	Vec3d look = player.getLookVec().scale(5);
	Vec3d pos = player.getPositionVector();
	List<EntityLivingBase> targets = Helpers.rayTraceEntities(player.world, pos.addVector(0, player.getEyeHeight(), 0), look, Optional.of(e -> e != player), EntityLivingBase.class);
	EntityLivingBase assumedToBeLookedAt = Helpers.getClosest(targets, player);
	if (assumedToBeLookedAt != null)
	{
		if (!player.world.isRemote)
		{
			assumedToBeLookedAt.addPotionEffect(new PotionEffect(ExPPotions.stunned, weight == EnumWeaponWeight.NORMAL ? 20 : 30, 0, false, false));
		}
		
		player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, SoundCategory.PLAYERS, 1, 1F);
		Vec3d targetPos = assumedToBeLookedAt.getPositionVector();
		assumedToBeLookedAt.knockBack(player, 1, pos.x - targetPos.x, pos.z - targetPos.z);
		for (int i = 0; i < 50; ++i)
		{
			player.world.spawnParticle(EnumParticleTypes.CRIT_MAGIC, targetPos.x + player.world.rand.nextDouble() - player.world.rand.nextDouble(), targetPos.z + assumedToBeLookedAt.getEyeHeight() + player.world.rand.nextDouble() - player.world.rand.nextDouble(), targetPos.z + player.world.rand.nextDouble() - player.world.rand.nextDouble(), 0, -0.1, 0);
		}
	}
}
 
Example 6
Project: ToolBelt   File: GuiHandler.java   View Source Code Vote up 6 votes
@Nullable
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
    switch (id)
    {
        case BELT:
            ItemStack heldItem = player.getHeldItem(EnumHand.values()[x]);
            if (heldItem.getCount() > 0)
            {
                ToolBeltInventory inventory = ItemToolBelt.getItems(heldItem);

                int blockedSlot = -1;
                if (player.getHeldItemMainhand() == heldItem)
                    blockedSlot = player.inventory.currentItem;

                return new ContainerBelt(player.inventory, inventory, blockedSlot);
            }
            break;
    }
    return null;
}
 
Example 7
Project: CustomWorldGen   File: ForgeHooks.java   View Source Code Vote up 5 votes
public static boolean onPlayerAttackTarget(EntityPlayer player, Entity target)
{
    if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(player, target))) return false;
    ItemStack stack = player.getHeldItemMainhand();
    if (stack != null && stack.getItem().onLeftClickEntity(stack, player, target)) return false;
    return true;
}
 
Example 8
Project: pnc-repressurized   File: ClientEventHandler.java   View Source Code Vote up 5 votes
private void renderMinigunFirstPerson() {
    EntityPlayer player = Minecraft.getMinecraft().player;
    ItemStack stack = player.getHeldItemMainhand();
    if (stack.getItem() == Itemss.MINIGUN) {
        Minigun minigun = ((ItemMinigun) Itemss.MINIGUN).getMinigun(stack, player);
        if (minigun.isMinigunActivated() && minigun.getMinigunSpeed() == Minigun.MAX_GUN_SPEED) {
            GlStateManager.disableTexture2D();
            GlStateManager.disableLighting();
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

            RenderUtils.glColorHex(0x40000000 | minigun.getAmmoColor());
            for (int i = 0; i < 5; i++) {
                Vec3d directionVec = player.getLookVec().normalize();
                Vec3d vec2 = new Vec3d(directionVec.x, directionVec.y, directionVec.z);
                vec2 = vec2.rotateYaw(-(float)Math.PI / 2f);
                minigunFire.startX = vec2.x ;
                minigunFire.startY = 1.0;
                minigunFire.startZ = vec2.z;
                minigunFire.endX = directionVec.x * 20 + player.getRNG().nextDouble() - 0.5;
                minigunFire.endY = directionVec.y * 20 + player.getEyeHeight() + player.getRNG().nextDouble() - 0.5;
                minigunFire.endZ = directionVec.z * 20 + player.getRNG().nextDouble() - 0.5;
                minigunFire.render();
            }
            GlStateManager.color(1, 1, 1, 1);
            GlStateManager.enableLighting();
            GlStateManager.enableTexture2D();
            GlStateManager.disableBlend();
        }
    }
}
 
Example 9
Project: Never-Enough-Currency   File: GuiHandler.java   View Source Code Vote up 5 votes
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID == 1) {
		return new ContainerItem(player, player.inventory, new InventoryItem(player.getHeldItemMainhand()));
	} else if (ID == 2) {
		return new ContainerItem(player, player.inventory, new InventoryItem(player.getHeldItemOffhand()));
	} else if (ID == 4) {
		return new ContainerStockCrate(player.inventory, (TileEntityStockCrate) world.getTileEntity(new BlockPos(x, y, z)));
	}

	return null;
}
 
Example 10
Project: ExPetrum   File: BlockCrop.java   View Source Code Vote up 5 votes
@SuppressWarnings("deprecation")
@Override
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos)
{
	// Axes are hardcoded to break blocks with a material of PLANT at their efficiency speed, need to fix that.
	ItemStack stack = player.getHeldItemMainhand();
	return !stack.isEmpty() && stack.getItem() instanceof ItemAxe ? super.getPlayerRelativeBlockHardness(state, player, worldIn, pos) / stack.getItem().getStrVsBlock(stack, state) : super.getPlayerRelativeBlockHardness(state, player, worldIn, pos);
}
 
Example 11
Project: Whoosh   File: GuiHandler.java   View Source Code Vote up 5 votes
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {

    switch (id) {
        case TRANSPORTER_ID:
            return new GuiTransporter(player, new ContainerTransporter(player.getHeldItemMainhand()));

        default:
            return null;
    }
}
 
Example 12
Project: pnc-repressurized   File: ItemGPSTool.java   View Source Code Vote up 5 votes
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
    if (handIn != EnumHand.MAIN_HAND) return ActionResult.newResult(EnumActionResult.PASS, playerIn.getHeldItem(handIn));
    ItemStack stack = playerIn.getHeldItemMainhand();
    if (worldIn.isRemote) {
        BlockPos pos = getGPSLocation(stack);
        FMLCommonHandler.instance().showGuiScreen(new GuiGPSTool(pos != null ? pos : new BlockPos(0, 0, 0), getVariable(stack)));
    }
    return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}
 
Example 13
Project: ExPetrum   File: ItemThrow.java   View Source Code Vote up 5 votes
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	EntityThrownWeapon etw = new EntityThrownWeapon(player.getEntityWorld(), player, is.copy());
	etw.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
	if (!player.world.isRemote)
	{
		player.world.spawnEntity(etw);
		is.setCount(0);
	}
}
 
Example 14
Project: DankNull   File: DankNullRenderer.java   View Source Code Vote up 5 votes
private boolean isStackInHand(ItemStack itemStackIn) {
	EntityPlayer player = EasyMappings.player();
	if ((player.getHeldItemMainhand() == itemStackIn) || (player.getHeldItemOffhand() == itemStackIn)) {
		return true;
	}
	return false;
}
 
Example 15
Project: Randores2   File: RandoresGuiHandler.java   View Source Code Vote up 5 votes
@Override
@SideOnly(Side.CLIENT)
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    BlockPos pos = new BlockPos(x, y, z);
    if (ID == RandoresGuiType.FORGE.ordinal()) {
        TileEntity entity = world.getTileEntity(pos);
        if (entity instanceof CraftiniumForgeTileEntity) {
            return new CraftiniumForgeGui((CraftiniumForgeTileEntity) entity, player.inventory);
        }
    } else if (ID == RandoresGuiType.TABLE.ordinal()) {
        return new CraftiniumTableGui(player.inventory, world, pos);
    } else if (ID == RandoresGuiType.TOME.ordinal()) {
        ItemStack[] stacks = new ItemStack[] {player.getHeldItemMainhand(), player.getHeldItemOffhand()};
        for(ItemStack stack : stacks) {
            if(stack.getItem() instanceof TomeItem && RandoresItemData.hasData(stack)) {
                RandoresItemData data = new RandoresItemData(stack);
                if(RandoresWorldData.contains(data)) {
                    return new TomeGui(RandoresWorldData.get(data).buildPages());
                }
            }
        }

        return new TomeGui(Arrays.asList(new TomeGui.StringElement("An example text page: \n" + TextFormatting.RED + "This tome has no data associated with it, so it instead displays examples of the different kinds of pages in a tome.", "Example"),
                new TomeGui.CraftingElement("An example crafting recipe page: ", new ItemStack[][]{
                           {new ItemStack(Items.IRON_INGOT), new ItemStack(Items.IRON_INGOT), new ItemStack(Items.IRON_INGOT)},
                           {null, new ItemStack(Items.STICK), null},
                           {null, new ItemStack(Items.STICK), null}
                   }, new ItemStack(Items.IRON_PICKAXE), "Example"),
                new TomeGui.FurnaceElement("An example furnace recipe page: ", new ItemStack(Items.STICK), new ItemStack(Blocks.IRON_ORE), new ItemStack(Items.IRON_INGOT), "Example")));
    } else if (ID == RandoresGuiType.CONVERTER.ordinal()) {
        return new CraftiniumConverterGui(player.inventory, world, pos);
    }
    return null;
}
 
Example 16
Project: ExPetrum   File: Slash.java   View Source Code Vote up 5 votes
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	EnumWeaponWeight weight = EnumWeaponWeight.getWeaponWeight(is);
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, SoundCategory.PLAYERS, 1, 1F);
	Vec3d playerLook = player.getLookVec();
	Vec3d playerPos = player.getPositionVector();
	player.world.spawnParticle(EnumParticleTypes.SWEEP_ATTACK, playerPos.x + playerLook.x, playerPos.y + player.getEyeHeight() * 0.5F, playerPos.z + playerLook.z, 0, 0, 0);
	AxisAlignedBB aabb = new AxisAlignedBB(playerPos.addVector(-3, -1, -3), playerPos.addVector(3, 3, 3));
	List<EntityLivingBase> lst = player.world.getEntitiesWithinAABB(EntityLivingBase.class, aabb, e -> e != player);
	for (EntityLivingBase ent : lst)
	{
		if (ent instanceof EntityTameable && ((EntityTameable)ent).getOwner() == player)
		{
			continue;
		}
		
		Vec3d ePos = ent.getPositionVector();
		Vec3d player2ent = ePos.subtract(playerPos).normalize();
		float angle = (float) Math.toDegrees(Math.acos(player2ent.dotProduct(playerLook)));
		if (angle > 60)
		{
			continue;
		}
		
		ent.attackEntityFrom(DamageSource.causePlayerDamage(player), (float) (player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue() * 0.85F));
		player.world.playSound(player, ent.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, SoundCategory.PLAYERS, 1, 2F);
		if (!player.world.isRemote && weight == EnumWeaponWeight.HEAVY && player.world.rand.nextBoolean())
		{
			ent.addPotionEffect(new PotionEffect(ExPPotions.stunned, 100, 0, false, false));
		}
	}
}
 
Example 17
Project: Lanolin   File: EventHandlerCommon.java   View Source Code Vote up 4 votes
@SubscribeEvent
public void breakSpeed(PlayerEvent.BreakSpeed event){
    // Check if the break speed has been modified due to water
    // prevent the modification if there is lanolin on the tool being used
    // decrement the lanolin when the block is successfully broken
    EntityPlayer player = event.getEntityPlayer();
    IBlockState state = event.getState();
    BlockPos pos = event.getPos();
    if(player.isInsideOfMaterial(Material.WATER)) {
        //Player is inside water, check for lanolin
        if(player.getHeldItemMainhand().hasTagCompound() && player.getHeldItemMainhand().getTagCompound().hasKey("lanolin")){
            // Recalculate ala EntityPlayer.getDigSpeed(), but skip the water portion
            float f = player.inventory.getStrVsBlock(state);

            if (f > 1.0F)
            {
                int i = EnchantmentHelper.getEfficiencyModifier(player);
                ItemStack itemstack = player.getHeldItemMainhand();

                if (i > 0 && !itemstack.isEmpty())
                {
                    f += (float)(i * i + 1);
                }
            }

            if (player.isPotionActive(MobEffects.HASTE))
            {
                f *= 1.0F + (float)(player.getActivePotionEffect(MobEffects.HASTE).getAmplifier() + 1) * 0.2F;
            }

            if (player.isPotionActive(MobEffects.MINING_FATIGUE))
            {
                float f1;

                switch (player.getActivePotionEffect(MobEffects.MINING_FATIGUE).getAmplifier())
                {
                    case 0:
                        f1 = 0.3F;
                        break;
                    case 1:
                        f1 = 0.09F;
                        break;
                    case 2:
                        f1 = 0.0027F;
                        break;
                    case 3:
                    default:
                        f1 = 8.1E-4F;
                }

                f *= f1;
            }
            if(f > event.getNewSpeed()){
                event.setNewSpeed(f < 0 ? 0 : f);
            }
        }
    }
}
 
Example 18
Project: pnc-repressurized   File: SemiBlockLogistics.java   View Source Code Vote up 4 votes
@SideOnly(Side.CLIENT)
private boolean playerIsHoldingLogisticItems() {
    EntityPlayer player = Minecraft.getMinecraft().player;
    ItemStack stack = player.getHeldItemMainhand();
    return (stack.getItem() == Itemss.LOGISTICS_CONFIGURATOR || stack.getItem() instanceof ItemLogisticsFrame);
}
 
Example 19
Project: Clef   File: BlockInstrumentPlayer.java   View Source Code Vote up 4 votes
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
    TileEntity te = worldIn.getTileEntity(pos);
    if(te instanceof TileEntityInstrumentPlayer)
    {
        TileEntityInstrumentPlayer player = (TileEntityInstrumentPlayer)te;
        boolean hasSlot = false;
        ItemStack is = playerIn.getHeldItemMainhand();
        if(is.getItem() == Clef.itemInstrument && !playerIn.isSneaking())
        {
            if(is.getTagCompound() == null && !worldIn.isRemote)
            {
                InstrumentLibrary.assignRandomInstrument(is);
            }
            //Find a free slot
            for(int i = 0; i < player.getSizeInventory(); i++)
            {
                ItemStack is1 = player.getStackInSlot(i);
                if(is1.isEmpty())
                {
                    hasSlot = true;
                    worldIn.playSound(null, pos.getX() + 0.5D, pos.getY() + 1D, pos.getZ() + 0.5D, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
                    if(!worldIn.isRemote)
                    {
                        player.setInventorySlotContents(i, is);
                        player.markDirty();
                        playerIn.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
                        playerIn.inventory.markDirty();
                        worldIn.notifyBlockUpdate(pos, state, state, 3);
                    }
                    break;
                }
            }
        }
        else if(is.getItem() == Items.NAME_TAG && is.hasDisplayName())
        {
            boolean full = true;
            for(int i = 0; i < 9 ; i++)
            {
                if(player.getStackInSlot(i).isEmpty())
                {
                    full = false;
                    break;
                }
            }
            if(!full)
            {
                return false;
            }
            if(worldIn.isRemote)
            {
                for(Instrument instrument : InstrumentLibrary.instruments)
                {
                    if(instrument.info.itemName.equalsIgnoreCase(is.getDisplayName()))
                    {
                        Clef.channel.sendToServer(new PacketCreateInstrument(instrument.info.itemName, pos));
                        break;
                    }
                }
            }
            return true;
        }
        if(!hasSlot && !player.justCreatedInstrument)
        {
            FMLNetworkHandler.openGui(playerIn, Clef.instance, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
        }
        return true;
    }
    return false;
}
 
Example 20
Project: ForgeHax   File: ProjectileUtils.java   View Source Code Vote up 4 votes
/**
 * Will simulate a shot made from an angle to see if it hits our target
 */
public static boolean projectileTrajectoryHitsEntity(Entity target, Vec3d shootPos, Vec3d targetPos, ProjectileTraceResult result) {
    // gg fps
    EntityPlayer localPlayer = MC.player;
    Vec3d selfPos = localPlayer.getPositionVector();
    ItemStack heldItem = localPlayer.getHeldItemMainhand();
    // work backwards
    // this is actually just a coincidence that the
    // sequence and min value are same
    // im just abusing it so that I can get it to work with other projectile items
    double min = getMinForce(heldItem);
    double max = getMaxForce(heldItem);
    for(double force = max; force >= min; force -= min) {
        Angle angle = getShootAngle(heldItem, shootPos, targetPos, force);

        if(angle == null)
            continue;

        Angle initAngle = new Angle(-angle.getPitch(), angle.getYaw() + 90.D, 0.D);

        double fixX = Math.cos(initAngle.getYaw(true) - Math.PI / 2.0) * 0.16;
        double fixY = ProjectileUtils.PROJECTILE_SHOOTPOS_OFFSET;
        double fixZ = Math.sin(initAngle.getYaw(true) - Math.PI / 2.0) * 0.16;
        Vec3d initPos = new Vec3d(-fixX, localPlayer.getEyeHeight() - fixY, -fixZ);

        Vec3d acceleration = ProjectileUtils.getGravity(heldItem);
        Vec3d airResistance = ProjectileUtils.getAirResistance(heldItem);
        // convert polar coords to cartesian coords
        Vec3d velocity = initAngle.getCartesianCoords().normalize().scale(force);

        Vec3d startPos = initPos;
        Vec3d endPos = startPos;
        for (int i = 0; i < 100; i++) {
            // add velocity
            startPos = startPos.add(velocity);
            // add air resistance
            velocity = VectorUtils.multiplyBy(velocity, airResistance);
            // add gravity (acceleration)
            velocity = velocity.add(acceleration);

            Vec3d wrlStart = selfPos.add(startPos), wrlEnd = selfPos.add(endPos);

            RayTraceResult tr = getWorld().rayTraceBlocks(wrlStart, wrlEnd);
            // if we have hit a block
            if (tr != null &&
                    !getWorld().getBlockState(tr.getBlockPos()).getBlock().isPassable(getWorld(), tr.getBlockPos())) {
                break;
            }

            // if we have hit our target
            tr = target.getEntityBoundingBox().calculateIntercept(wrlStart, wrlEnd);
            if (tr != null) {
                if(result != null) {
                    result.maxForce = force;
                    result.shootAngle = angle;
                }
                return true;
            }
            endPos = startPos;
        }
    }
    return false;
}