Java Code Examples for net.minecraft.util.math.Vec3d#subtract()

The following examples show how to use net.minecraft.util.math.Vec3d#subtract() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModuleEffectTimeSlow.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@ModuleOverride("shape_zone_run")
public boolean onRunZone(World world, SpellData data, SpellRing ring, @ContextRing SpellRing childRing) {
	double aoe = ring.getAttributeValue(world, AttributeRegistry.AREA, data);
	double range = ring.getAttributeValue(world, AttributeRegistry.RANGE, data);

	Vec3d targetPos = data.getTarget(world);

	if (targetPos == null) return false;

	Vec3d min = targetPos.subtract(aoe, range, aoe);
	Vec3d max = targetPos.add(aoe, range, aoe);

	List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(min, max));
	for (Entity entity : entities) {
		if (entity instanceof EntityLivingBase) {
			if (!((EntityLivingBase) entity).isPotionActive(ModPotions.TIME_SLOW) && entity.getDistanceSq(targetPos.x, targetPos.y, targetPos.z) <= aoe * aoe) {
				data.processEntity(entity, false);
				runOnStart(world, data, childRing);
			}
		}
	}
	return true;
}
 
Example 2
Source File: ModuleEffectVanish.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@ModuleOverride("shape_zone_run")
public boolean onRunZone(World world, SpellData data, SpellRing ring, @ContextRing SpellRing childRing) {
	double aoe = ring.getAttributeValue(world, AttributeRegistry.AREA, data);
	double range = ring.getAttributeValue(world, AttributeRegistry.RANGE, data);

	Vec3d targetPos = data.getTarget(world);

	if (targetPos == null) return false;

	Vec3d min = targetPos.subtract(aoe, range, aoe);
	Vec3d max = targetPos.add(aoe, range, aoe);

	List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(min, max));
	for (Entity entity : entities) {
		if (entity instanceof EntityLivingBase) {
			if (!VanishTracker.isVanished(entity) && entity.getDistanceSq(targetPos.x, targetPos.y, targetPos.z) <= aoe * aoe) {
				data.processEntity(entity, false);
				run(world, (ModuleInstanceEffect) childRing.getModule(), data, childRing);
			}
		}
	}
	return true;
}
 
Example 3
Source File: ModuleEffectLowGravity.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@ModuleOverride("shape_zone_run")
public boolean onRunZone(World world, SpellData data, SpellRing ring, @ContextRing SpellRing childRing) {
	double aoe = ring.getAttributeValue(world, AttributeRegistry.AREA, data);
	double range = ring.getAttributeValue(world, AttributeRegistry.RANGE, data);

	Vec3d targetPos = data.getTarget(world);

	if (targetPos == null) return false;

	Vec3d min = targetPos.subtract(aoe, range, aoe);
	Vec3d max = targetPos.add(aoe, range, aoe);

	List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(min, max));
	for (Entity entity : entities) {
		if (entity instanceof EntityLivingBase) {
			if (!((EntityLivingBase) entity).isPotionActive(ModPotions.LOW_GRAVITY) && entity.getDistanceSq(targetPos.x, targetPos.y, targetPos.z) <= aoe * aoe) {
				data.processEntity(entity, false);
				run(world, (ModuleInstanceEffect) childRing.getModule(), data, childRing);
			}
		}
	}
	return true;
}
 
Example 4
Source File: ModuleEffectLightning.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ModuleOverride("shape_zone_run")
public boolean onRunZone(@ContextSuper ModuleOverrideSuper ovdSuper, World world, SpellData data, SpellRing shape, @ContextRing SpellRing childRing) {
	if (ovdSuper.hasSuper())
		ovdSuper.invoke(true, world, data, shape);


	Entity caster = data.getCaster(world);
	Vec3d targetPos = data.getTargetWithFallback(world);

	if (targetPos == null) return true;

	if (!childRing.taxCaster(world, data, true)) return true;

	double lightningRange = childRing.getAttributeValue(world, AttributeRegistry.RANGE, data);
	double lightningPotency = childRing.getAttributeValue(world, AttributeRegistry.POTENCY, data);
	double lightningDuration = childRing.getAttributeValue(world, AttributeRegistry.DURATION, data);
	double zoneAoE = shape.getAttributeValue(world, AttributeRegistry.AREA, data);
	double zoneRange = shape.getAttributeValue(world, AttributeRegistry.RANGE, data);

	Vec3d min = targetPos.subtract(zoneAoE / 2, zoneRange / 2, zoneAoE / 2);
	Vec3d max = targetPos.add(zoneAoE / 2, zoneRange / 2, zoneAoE / 2);

	RandUtilSeed rand = new RandUtilSeed(RandUtil.nextLong(100, 100000));

	Vec3d from = new Vec3d(rand.nextDouble(min.x, max.x), rand.nextDouble(min.y, max.y), rand.nextDouble(min.z, max.z));
	float pitch = (float) (180 * Math.asin(2 * rand.nextDouble() - 1) / Math.PI);
	float yaw = (float) rand.nextDouble(360);

	Vec3d to = Vec3d.fromPitchYaw(pitch, yaw).normalize().scale(lightningRange).add(from);

	doLightning(rand.nextLong(100, 100000), world, caster, from, to, lightningRange, lightningPotency, lightningDuration);
	return true;
}
 
Example 5
Source File: ModuleEffectFrost.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ModuleOverride("shape_zone_run")
public boolean onRunZone(World world, SpellData data, SpellRing ring, @ContextRing SpellRing childRing) {
	if(!world.isRemote) return false;

	double aoe = ring.getAttributeValue(world, AttributeRegistry.AREA, data);
	double range = ring.getAttributeValue(world, AttributeRegistry.RANGE, data);

	Vec3d targetPos = data.getTarget(world);

	if (targetPos == null) return false;

	Vec3d min = targetPos.subtract(aoe, range, aoe);
	Vec3d max = targetPos.add(aoe, range, aoe);

	List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(min, max));
	for (Entity entity : entities) {
		entity.extinguish();
		if (entity instanceof EntityLivingBase) {
			if (!((EntityLivingBase) entity).isPotionActive(ModPotions.SLIPPERY) && entity.getDistanceSq(targetPos.x, targetPos.y, targetPos.z) <= aoe * aoe) {

				double time = childRing.getAttributeValue(world, AttributeRegistry.DURATION, data) * 10;
				world.playSound(null, entity.getPosition(), ModSounds.FROST_FORM, SoundCategory.NEUTRAL, 1, 1);
				((EntityLivingBase) entity).addPotionEffect(new PotionEffect(ModPotions.SLIPPERY, (int) time, 0, true, false));
			}
		}
	}
	return false;
}
 
Example 6
Source File: SidePicker.java    From OpenModsLib with MIT License 5 votes vote down vote up
private Map<Side, Vec3d> calculateHitPoints(Vec3d near, Vec3d far) {
	Vec3d diff = far.subtract(near);

	Map<Side, Vec3d> result = Maps.newEnumMap(Side.class);
	addPoint(result, Side.XNeg, calculateXPoint(near, diff, negX));
	addPoint(result, Side.XPos, calculateXPoint(near, diff, posX));

	addPoint(result, Side.YNeg, calculateYPoint(near, diff, negY));
	addPoint(result, Side.YPos, calculateYPoint(near, diff, posY));

	addPoint(result, Side.ZNeg, calculateZPoint(near, diff, negZ));
	addPoint(result, Side.ZPos, calculateZPoint(near, diff, posZ));
	return result;
}
 
Example 7
Source File: RenderUtils.java    From ForgeHax with MIT License 4 votes vote down vote up
public static void drawLine(
    Vec3d startPos, Vec3d endPos, int color, boolean smooth, float width) {
  Tessellator tessellator = Tessellator.getInstance();
  BufferBuilder BufferBuilder = tessellator.getBuffer();
  
  Vec3d endVecPos = endPos.subtract(startPos);
  
  float r = (float) (color >> 16 & 255) / 255.0F;
  float g = (float) (color >> 8 & 255) / 255.0F;
  float b = (float) (color & 255) / 255.0F;
  float a = (float) (color >> 24 & 255) / 255.0F;
  
  if (smooth) {
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
  }
  
  GL11.glLineWidth(width);
  
  GlStateManager.pushMatrix();
  GlStateManager.translate(startPos.x, startPos.y, startPos.z);
  GlStateManager.disableTexture2D();
  GlStateManager.enableBlend();
  GlStateManager.disableAlpha();
  GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
  GlStateManager.shadeModel(GL11.GL_SMOOTH);
  
  BufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
  BufferBuilder.pos(0, 0, 0).color(r, g, b, a).endVertex();
  BufferBuilder.pos(endVecPos.x, endVecPos.y, endVecPos.z).color(r, g, b, a).endVertex();
  tessellator.draw();
  
  if (smooth) {
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
  }
  
  GlStateManager.shadeModel(GL11.GL_FLAT);
  GlStateManager.disableBlend();
  GlStateManager.enableAlpha();
  GlStateManager.enableTexture2D();
  GlStateManager.enableDepth();
  GlStateManager.enableCull();
  GlStateManager.popMatrix();
}
 
Example 8
Source File: RenderUtils.java    From ForgeHax with MIT License 4 votes vote down vote up
public static void drawBox(
    Vec3d startPos, Vec3d endPos, int color, float width, boolean ignoreZ) {
  Tessellator tessellator = Tessellator.getInstance();
  BufferBuilder buffer = tessellator.getBuffer();
  
  Vec3d renderPos = EntityUtils.getInterpolatedPos(getLocalPlayer(), MC.getRenderPartialTicks());
  
  Vec3d min = startPos.subtract(renderPos);
  Vec3d max = endPos.subtract(renderPos);
  
  double minX = min.x, minY = min.y, minZ = min.z;
  double maxX = max.x, maxY = max.y, maxZ = max.z;
  
  float r = (float) (color >> 16 & 255) / 255.0F;
  float g = (float) (color >> 8 & 255) / 255.0F;
  float b = (float) (color & 255) / 255.0F;
  float a = (float) (color >> 24 & 255) / 255.0F;
  
  GlStateManager.pushMatrix();
  GlStateManager.disableTexture2D();
  GlStateManager.enableBlend();
  GlStateManager.disableAlpha();
  GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
  GlStateManager.shadeModel(GL11.GL_SMOOTH);
  GlStateManager.glLineWidth(width);
  
  if (ignoreZ) {
    GlStateManager.disableDepth();
  }
  
  GlStateManager.color(r, g, b, a);
  
  // GlStateManager.translate(startPos.xCoord, startPos.yCoord, startPos.zCoord);
  
  buffer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
  buffer.pos(minX, minY, minZ).endVertex();
  buffer.pos(maxX, minY, minZ).endVertex();
  buffer.pos(maxX, minY, maxZ).endVertex();
  buffer.pos(minX, minY, maxZ).endVertex();
  buffer.pos(minX, minY, minZ).endVertex();
  tessellator.draw();
  buffer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
  buffer.pos(minX, maxY, minZ).endVertex();
  buffer.pos(maxX, maxY, minZ).endVertex();
  buffer.pos(maxX, maxY, maxZ).endVertex();
  buffer.pos(minX, maxY, maxZ).endVertex();
  buffer.pos(minX, maxY, minZ).endVertex();
  tessellator.draw();
  buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
  buffer.pos(minX, minY, minZ).endVertex();
  buffer.pos(minX, maxY, minZ).endVertex();
  buffer.pos(maxX, minY, minZ).endVertex();
  buffer.pos(maxX, maxY, minZ).endVertex();
  buffer.pos(maxX, minY, maxZ).endVertex();
  buffer.pos(maxX, maxY, maxZ).endVertex();
  buffer.pos(minX, minY, maxZ).endVertex();
  buffer.pos(minX, maxY, maxZ).endVertex();
  tessellator.draw();
  
  GlStateManager.shadeModel(GL11.GL_FLAT);
  GlStateManager.disableBlend();
  GlStateManager.enableAlpha();
  GlStateManager.enableTexture2D();
  GlStateManager.enableDepth();
  GlStateManager.enableCull();
  GlStateManager.popMatrix();
}
 
Example 9
Source File: ModuleEffectPhase.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderSpell(World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
	EnumFacing faceHit = spell.getFaceHit();

	Set<BlockPos> blockSet = spell.getDataWithFallback(SpellData.DefaultKeys.BLOCK_SET, new BlockSet(new HashSet<>())).getBlockSet();
	Map<BlockPos, IBlockState> blockStateCache = spell.getDataWithFallback(SpellData.DefaultKeys.BLOCKSTATE_CACHE, new BlockStateCache(new HashMap<>())).getBlockStateCache();
	HashMap<BlockPos, IBlockState> tmpCache = new HashMap<>(blockStateCache);

	double duration = spellRing.getAttributeValue(world, AttributeRegistry.DURATION, spell) * 20;
	PhasedBlockRenderer.addPhase(world, blockSet, (int) duration);

	if (faceHit != null) {
		for (Map.Entry<BlockPos, IBlockState> entry : tmpCache.entrySet()) {

			IBlockState thisState = entry.getValue();
			if (thisState.getBlock() != ModBlocks.FAKE_AIR) continue;

			ParticleBuilder glitter2 = new ParticleBuilder(10);
			glitter2.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, NBTConstants.MISC.SPARKLE_BLURRED));
			glitter2.disableRandom();
			ParticleSpawner.spawn(glitter2, world, new StaticInterp<>(new Vec3d(entry.getKey()).add(0.5, 0.5, 0.5)), 5, (int) duration, (aFloat, build) -> {
				build.setColor(Color.CYAN);
				//build.setAlphaFunction(new InterpFloatInOut(1f, 0.1f));
				build.setAlpha(RandUtil.nextFloat(0.05f, 0.2f));

				build.setPositionOffset(new Vec3d(
						RandUtil.nextDouble(-0.5, 0.5),
						RandUtil.nextDouble(-0.5, 0.5),
						RandUtil.nextDouble(-0.5, 0.5)
				));
				build.setMotion(new Vec3d(
						RandUtil.nextDouble(-0.001, 0.001),
						RandUtil.nextDouble(-0.001, 0.001),
						RandUtil.nextDouble(-0.001, 0.001)
				));
				build.setLifetime(RandUtil.nextInt(20, 40));
				build.setScaleFunction(new InterpFloatInOut(0.9f, 0.9f));
				build.setScale(RandUtil.nextFloat(0.1f, 0.3f));
			});

			BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos(entry.getKey());
			for (EnumFacing facing : EnumFacing.VALUES) {
				mutable.move(facing);

				IBlockState adjState;
				if (!blockStateCache.containsKey(mutable)) {
					adjState = world.getBlockState(mutable);
					blockStateCache.put(mutable.toImmutable(), adjState);
				} else adjState = blockStateCache.get(mutable);

				if (adjState.getBlock() != Blocks.AIR && adjState.getBlock() != ModBlocks.FAKE_AIR) {

					Vec3d directionOffsetVec = new Vec3d(facing.getOpposite().getDirectionVec()).scale(0.5);
					Vec3d adjPos = new Vec3d(mutable).add(0.5, 0.5, 0.5).add(directionOffsetVec);

					for (EnumFacing subFacing : getPerpendicularFacings(facing)) {
						mutable.move(subFacing);

						IBlockState subState;
						if (!blockStateCache.containsKey(mutable)) {
							subState = world.getBlockState(mutable);
							blockStateCache.put(mutable.toImmutable(), subState);
						} else subState = blockStateCache.get(mutable);

						if (BlockUtils.isAnyAir(subState)) {
							Vec3d subPos = new Vec3d(mutable).add(0.5, 0.5, 0.5).add(directionOffsetVec);
							Vec3d midPointVec = new Vec3d(
									(adjPos.x + subPos.x) / 2.0,
									(adjPos.y + subPos.y) / 2.0,
									(adjPos.z + subPos.z) / 2.0);
							Vec3d sub = subPos.subtract(adjPos);
							EnumFacing adjSubFacing = EnumFacing.getFacingFromVector((float) sub.x, (float) sub.y, (float) sub.z);
							Vec3d cross = new Vec3d(adjSubFacing.getDirectionVec()).crossProduct(new Vec3d(facing.getDirectionVec())).normalize().scale(0.5);

							ParticleBuilder glitter = new ParticleBuilder(10);
							glitter.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, NBTConstants.MISC.SPARKLE_BLURRED));
							glitter.disableRandom();
							ParticleSpawner.spawn(glitter, world, new StaticInterp<>(midPointVec), 50, (int) duration, (aFloat, build) -> {
								build.setColor(Color.CYAN);
								//build.setAlphaFunction(new InterpFloatInOut(1f, 0.1f));
								build.setAlpha(RandUtil.nextFloat(0.3f, 0.7f));

								build.setPositionOffset(cross.scale(RandUtil.nextFloat(-1, 1)));
								build.setLifetime(RandUtil.nextInt(20, 40));
								build.setScaleFunction(new InterpFloatInOut(0.9f, 0.9f));
								build.setScale(RandUtil.nextFloat(0.2f, 0.5f));
							});
						}
						mutable.move(subFacing.getOpposite());
					}
				}
				mutable.move(facing.getOpposite());
			}
		}
	}
}
 
Example 10
Source File: NearbySmeltCommandsImplementation.java    From malmo with MIT License 4 votes vote down vote up
@Override
public IMessage onMessage(SmeltNearbyMessage message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    Vec3d headPos = new Vec3d(player.posX, player.posY + 1.6, player.posZ);

    // Location checking
    boolean closeFurnace = false;
    for (BlockPos furnace : furnaces) {
        Vec3d blockVec = new Vec3d(furnace.getX() + 0.5, furnace.getY() + 0.5, furnace.getZ() + 0.5);

        if (headPos.squareDistanceTo(blockVec) <= 25.0) {
            // Within a reasonable FOV?
            // Lots of trig, let's go
            double fov = Minecraft.getMinecraft().gameSettings.fovSetting;
            double height = Minecraft.getMinecraft().displayHeight;
            double width = Minecraft.getMinecraft().displayWidth;
            Vec3d lookVec = player.getLookVec();
            Vec3d toBlock = blockVec.subtract(headPos);

            // Projection of block onto player look vector - if greater than 0, then in front of us
            double scalarProjection = lookVec.dotProduct(toBlock) / lookVec.lengthVector();
            if (scalarProjection > 0) {
                Vec3d yUnit = new Vec3d(0, 1.0, 0);
                Vec3d lookCross = lookVec.crossProduct(yUnit);
                Vec3d blockProjectedOntoCross = lookCross.scale(lookCross.dotProduct(toBlock) / lookCross.lengthVector());
                Vec3d blockProjectedOntoPlayerPlane = toBlock.subtract(blockProjectedOntoCross);
                double xyDot = lookVec.dotProduct(blockProjectedOntoPlayerPlane);
                double pitchTheta = Math.acos(xyDot / (lookVec.lengthVector() * blockProjectedOntoPlayerPlane.lengthVector()));

                Vec3d playerY = lookCross.crossProduct(lookVec);
                Vec3d blockProjectedOntoPlayerY = playerY.scale(playerY.dotProduct(toBlock) / playerY.lengthVector());
                Vec3d blockProjectedOntoYawPlane = toBlock.subtract(blockProjectedOntoPlayerY);
                double xzDot = lookVec.dotProduct(blockProjectedOntoYawPlane);
                double yawTheta = Math.acos(xzDot / (lookVec.lengthVector() * blockProjectedOntoYawPlane.lengthVector()));

                if (Math.abs(Math.toDegrees(yawTheta)) <= Math.min(1, width / height) * (fov / 2.0) && Math.abs(Math.toDegrees(pitchTheta)) <= Math.min(1, height / width) * (fov / 2.0))
                    closeFurnace = true;
            }
        }
    }

    if (closeFurnace) {
        ItemStack input = CraftingHelper.getSmeltingRecipeForRequestedOutput(message.parameters);
        if (input != null)
            if (CraftingHelper.attemptSmelting(player, input))
                return null;
    }

    return null;
}
 
Example 11
Source File: NearbyCraftCommandsImplementation.java    From malmo with MIT License 4 votes vote down vote up
@Override
public IMessage onMessage(CraftNearbyMessage message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    Vec3d headPos = new Vec3d(player.posX, player.posY + 1.6, player.posZ);

    // Location checking
    boolean closeTable = false;
    for (BlockPos furnace : craftingTables) {
        Vec3d blockVec = new Vec3d(furnace.getX() + 0.5, furnace.getY() + 0.5, furnace.getZ() + 0.5);

        if (headPos.squareDistanceTo(blockVec) <= 25.0) {
            // Within a reasonable FOV?
            // Lots of trig, let's go
            double fov = Minecraft.getMinecraft().gameSettings.fovSetting;
            double height = Minecraft.getMinecraft().displayHeight;
            double width = Minecraft.getMinecraft().displayWidth;
            Vec3d lookVec = player.getLookVec();
            Vec3d toBlock = blockVec.subtract(headPos);

            // Projection of block onto player look vector - if greater than 0, then in front of us
            double scalarProjection = lookVec.dotProduct(toBlock) / lookVec.lengthVector();
            if (scalarProjection > 0) {
                Vec3d yUnit = new Vec3d(0, 1.0, 0);
                Vec3d lookCross = lookVec.crossProduct(yUnit);
                Vec3d blockProjectedOntoCross = lookCross.scale(lookCross.dotProduct(toBlock) / lookCross.lengthVector());
                Vec3d blockProjectedOntoPlayerPlane = toBlock.subtract(blockProjectedOntoCross);
                double xyDot = lookVec.dotProduct(blockProjectedOntoPlayerPlane);
                double pitchTheta = Math.acos(xyDot / (lookVec.lengthVector() * blockProjectedOntoPlayerPlane.lengthVector()));

                Vec3d playerY = lookCross.crossProduct(lookVec);
                Vec3d blockProjectedOntoPlayerY = playerY.scale(playerY.dotProduct(toBlock) / playerY.lengthVector());
                Vec3d blockProjectedOntoYawPlane = toBlock.subtract(blockProjectedOntoPlayerY);
                double xzDot = lookVec.dotProduct(blockProjectedOntoYawPlane);
                double yawTheta = Math.acos(xzDot / (lookVec.lengthVector() * blockProjectedOntoYawPlane.lengthVector()));

                if (Math.abs(Math.toDegrees(yawTheta)) <= Math.min(1, width / height) * (fov / 2.0) && Math.abs(Math.toDegrees(pitchTheta)) <= Math.min(1, height / width) * (fov / 2.0))
                    closeTable = true;
            }
        }
    }

    if (closeTable) {
        // We are close enough, try crafting recipes
        List<IRecipe> matching_recipes;
        String[] split = message.parameters.split(" ");
        if (split.length > 1)
            matching_recipes = CraftingHelper.getRecipesForRequestedOutput(message.parameters, true);
        else
            matching_recipes = CraftingHelper.getRecipesForRequestedOutput(message.parameters, false);

        for (IRecipe recipe : matching_recipes)
            if (CraftingHelper.attemptCrafting(player, recipe))
                return null;
    }

    return null;
}