Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Goodie: Minecraft crafting recipes. #697

Merged
merged 16 commits into from Jan 14, 2015
Merged

Conversation

engvik
Copy link
Collaborator

@engvik engvik commented Oct 19, 2014

What does your Instant Answer do?
Return the crafting recipe for something that can be crafted in Minecraft.

What problem does your Instant Answer solve (Why is it better than organic links)?
A faster and cleaner answer.

What is the data source for your Instant Answer? (Provide a link if possible)
A static file.

Why did you choose this data source?
It contains most of the recipes.

Are there any other alternative (better) data sources?
No, not that I know of.

What are some example queries that trigger this Instant Answer?
ladder in minecraft
minecraft craft tnt

Which communities will this Instant Answer be especially useful for? (gamers, book lovers, etc)
Minecraft players.

Is this Instant Answer connected to a DuckDuckHack Instant Answer idea?
Yes, this.

Which existing Instant Answers will this one supercede/overlap with?
None.

Are you having any problems? Do you need our help with anything?

  • We might need to change the triggers, but I tried to avoid using regex. Open for suggestions.
  • I'm not sure if you allow header tags in the HTML. I use h3 for the headline.

Where did you hear about DuckDuckHack? (For first time contributors)
Not my first contribution.

What does the Instant Answer look like? (Provide a screenshot for new or updated Instant Answers)
minecraft-ddg

Checklist

Please place an 'X' where appropriate.

[X] Added metadata and attribution information (https://duck.co/duckduckhack/metadata)
[X] Wrote test file and added to t/ directory (https://duck.co/duckduckhack/goodie_tests)
[X] Verified that instant answer adheres to design guidelines (https://duck.co/duckduckhack/design_styleguide)
[X] Verified that instant answer adheres to code styleguide (https://duck.co/duckduckhack/code_styleguide)
[\] Tested cross-browser compatibility

    Please let us know which browsers/devices you've tested on:
    - Windows 8
        [] Google Chrome
        [] Firefox
        [] Opera
        [] IE 10

    - Windows 7
        [] Google Chrome
        [] Firefox
        [] Opera
        [] IE 8
        [] IE 9
        [] IE 10

    - Windows XP
        [] IE 7
        [] IE 8

    - Mac OSX
        [] Google Chrome
        [] Firefox
        [] Opera
        [] Safari

    - iOS (iPhone)
        [] Safari Mobile
        [] Google Chrome
        [] Opera

    - iOS (iPad)
        [] Safari Mobile
        [] Google Chrome
        [] Opera

    - Android
        [X] Firefox
        [] Native Browser
        [X] Google Chrome
        [] Opera

    - Ubuntu
        [X] Firefox
        [X] Chromium
        [X] Opera

IA Page: https://duck.co/ia/view/minecraft

@mwmiller
Copy link
Contributor

@larseng Thanks for another solid answer for a forum idea! Could you please cite the source of the JSON in the source metadata attribute?

@jagtalon @bsstoner Are we allowed to load third party images like this? Is there a way to proxy arbitrary image requests?

@engvik
Copy link
Collaborator Author

engvik commented Oct 20, 2014

@mwmiller The source is this file. It looks like it's based on the informartion from Mincraft XL. Yes, I forgot to ask about the hotlinking of the images. Keep me updated 😃

@mwmiller
Copy link
Contributor

@larseng I saw that you had the source listed on your forum post. It would be nice to have in the code itself so:

  • the author/maintainer gets proper attribution on the nascent IA information page, and
  • later IA maintainers can check the source for updates, if needed.

I have some working, but as yet unmerged, code which will allow goodies to serve images out of their share directories, if there's a problem with the hot-linking. This would, of course, involve downloading and copying them there. The sheer volume of images might make it interesting. Considering your previous experience with FIGlet fonts, I don't imagine working through this is outside your comfort zone. 😁

@engvik
Copy link
Collaborator Author

engvik commented Oct 20, 2014

@mwmiller Absolutely, but I'm not sure if I understand where you want me to put the attribution? In the attribution-part in Minecraft.pm?

Cool! Just let me know, shouldn't be a problem.

@mwmiller
Copy link
Contributor

In the attribution-part in Minecraft.pm?

Yep, see the CallingCodes goodie for an example. Most goodies don't not have "non-code sources", so I'm not surprised you were unaware of this attribute.

Cool! Just let me know, shouldn't be a problem.

Well, it's a bit different use-case than my current example. I don't think we'd want to preemptively cache all of the possible minecraft images in the perl process, so it may actually lead me to pursue a slightly different architecture. May we live in interesting times. 😁

@engvik
Copy link
Collaborator Author

engvik commented Oct 20, 2014

Actually, what about simply trigger on Minecraft? I think many would search for "minecraft tnt" to get the recipe, which is also the first answer.

code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Minecraft.pm';
attribution
web => ['http://engvik.nu', 'Lars Jansøn Engvik'],
github => [ 'larseng', 'Lars Jansøn Engvik'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admittedly suck at knowing the answers to these kind of questions:

Would this be safer (for our ability to be sure we get the attribution correct) with use utf8;?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I have no idea either 😄 Haven't been mentioned in my earlier contributions as far as I know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I now believe this is actually a problem, based on the trouble @jarmokivekas noted with the attribution on his contributions.

@russellholt @MariagraziaAlastra @jagtalon Do we know if use utf8 in these sources will help with the attribution on the IA pages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwmiller I am having utf8 issues with these, so maybe so. it's worth trying, I hadn't considered this.

@engvik
Copy link
Collaborator Author

engvik commented Oct 21, 2014

@mwmiller How does this look? I'm no regex-master, but it works 😄

It can now trigger on:

  • cake minecraft
  • minecraft craft cake
  • how to craft a cake minecraft
  • how do i make a cake in minecraft
  • crafting activator rail in minecraft
  • etc.

@mintsoft
Copy link
Collaborator

@mwmiller for proxying images I believe you should use URLS like this (stolen from Currency in the Spice Repo):
https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.xe.com%2Ffavicon.ico&f=1

Is that right @jagtalon @moollaza ?

@mwmiller
Copy link
Contributor

@mintsoft I'm not sure if that is available and recommended for general-purpose images.

@engvik
Copy link
Collaborator Author

engvik commented Oct 21, 2014

@mwmiller Ah, man, you're right. That might be a solution. I'll look further into it.

@mintsoft
Copy link
Collaborator

I'm not sure if that is available and recommended for general-purpose images.

Neither am I!

@moollaza
Copy link
Member

@larseng @mwmiller @mintsoft regarding the image proxying, @mintsoft was correct please route them through https://duckduckgo.com/iu/?u=foo.com

It's just a general proxy for images that prevents the client from making a direct request to the host. We have other proxies as well for other types of content (audio for example). They should always be used whenever content needs to be requested by the client :)

@engvik
Copy link
Collaborator Author

engvik commented Oct 26, 2014

I'm kinda swamped these days, but I will get back to this PR as soon as I can. Sorry for the inconvenience.

@moollaza
Copy link
Member

No problem @larseng , I'll label the PR as "On Hold" for now.

@engvik
Copy link
Collaborator Author

engvik commented Nov 3, 2014

So, I tried @mwmiller suggestion with using a list of good and bad words.

It worked okay, but the problem is that we have recipes called Carrot on a Stick and Crafting Table. This means if someone tries to make the a query like how do i craft a book, it won't trigger as it would try to look up a recipe called a book, since both a and book are in the list of good words. And it won't trigger if someone searches for ladder crafting in minecraft, since we would try to look up ladder crafting in the recipe hash.

I've looked through the recipes and I think these two are the only ones that would cause any trouble. and and of are also in the good words list, but I don't think it would be natural for someone use those words unintended in this IA.

What I ended up doing was to strip "okay words" (a and crafting at this point) from the recipe lookup if we don't find a recipe. If we still don't find a recipe after this, we probably don't have one.

@mwmiller mwmiller self-assigned this Nov 4, 2014
"name": "Firework Rocket",
"image": "http://www.minecraftxl.com/images/wiki/recipes/firework-rocket-crafting.gif",
"ingredients": "Gunpowder + Paper + Firework Star",
"description": "Firework that can be launched into the sky and explore. Adding more gunpowder increases the duration of the rocket. Up to three gunpowder can be used. Multiple firework stars can also be used, in which case all will go off simultaneously when the rocket d"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @larseng! It looks like the description here was cut off?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @jagtalon! You're right. The source also have this cut off and the same over at MinecraftXL. I think I've found the complete text, so I'll drop the creator of the json-file an e-mail and update this.

@engvik
Copy link
Collaborator Author

engvik commented Nov 27, 2014

Right again, @jagtalon. Didn't find the missing descriptions as easy as the first one. I'll look furhter into it.

@jagtalon
Copy link
Member

@larseng Thanks!

@engvik
Copy link
Collaborator Author

engvik commented Dec 1, 2014

Tried contacting MinecraftXL, but haven't heard from them yet, @jagtalon. Or from the author of the JSON-file either. Finding a suitable description wouldn't be hard, but the source would differ from the file we use (well, it already does because of the Firework Rocket update).

@abeyang
Copy link
Contributor

abeyang commented Dec 20, 2014

Hi, can we update the design to match this:

screen shot 2014-12-19 at 3 15 39 pm

Is it also possible to link the ingredients to do another ingredient lookup?

@mintsoft
Copy link
Collaborator

Thanks @abeyang how does that look @larseng ?

@engvik
Copy link
Collaborator Author

engvik commented Dec 22, 2014

@abeyang Sure 😄 I'll look into the recipe linking and see what I can do.

Still havent't heard from any of the sources, so I'll just update them myself.

@abeyang
Copy link
Contributor

abeyang commented Dec 23, 2014

@larseng awesome! Let me or @jagtalon know if you need any assistance!

@MrChrisW
Copy link
Collaborator

MrChrisW commented Jan 2, 2015

Happy New Year @larseng Any update on this? 😄

@engvik
Copy link
Collaborator Author

engvik commented Jan 2, 2015

Hi and happy new year! Sorry, been busy during the holidays, but I'll get to it this weekend. Actually got an reply from MinecraftXL as well, but still no updates.

@MrChrisW
Copy link
Collaborator

MrChrisW commented Jan 3, 2015

@larseng No problem! Great to hear you received a reply from MinecraftXL. I'm really looking forward to seeing this Goodie live 😄

@engvik
Copy link
Collaborator Author

engvik commented Jan 5, 2015

Still no updates on their website, so I updated the broken descriptions with descriptions from somewhere else.

How does it look @abeyang @mintsoft @MrChrisW @jagtalon ?

@jagtalon
Copy link
Member

jagtalon commented Jan 8, 2015

@larseng Thanks! Putting it up on a server for final review!

@jagtalon
Copy link
Member

jagtalon commented Jan 8, 2015

@larseng It looks really good. Just one more thing--the image is too close to the text. Is it possible to add a little spacing?

screen shot 2015-01-08 at 5 10 25 pm
screen shot 2015-01-08 at 5 11 37 pm

Thank you!

@engvik
Copy link
Collaborator Author

engvik commented Jan 11, 2015

@jagtalon Done 😄 I also aligned the image with the recipe text as in @abeyang's image.

@jagtalon
Copy link
Member

👍

jagtalon pushed a commit that referenced this pull request Jan 14, 2015
Goodie: Minecraft crafting recipes.
@jagtalon jagtalon merged commit c3f91c8 into duckduckgo:master Jan 14, 2015
@engvik
Copy link
Collaborator Author

engvik commented Jan 14, 2015

Nice 😄

@abeyang
Copy link
Contributor

abeyang commented Jan 16, 2015

@larseng it's looking better! However, can we make the following changes so it'll more look like this:

minecraft-1

Changes:

  • align image to the right rail, so that it matches with the SERP content
  • align image to the top, so it matches to the title text
  • move Ingredients into the subtitle (right below title)
  • mockup's gutter is too wide -- we'll need to tighten that

Finally, we should be using the standard template classes, like the title should be zci__header and the description should be zci__content. Maybe @jagtalon can help you with that?

Thanks! Almost there!

@jagtalon
Copy link
Member

@larseng I can make a PR for these changes and get it out as soon as I can!

@engvik
Copy link
Collaborator Author

engvik commented Jan 16, 2015

@jagtalon Thanks, that would be great as I can't get to this until sunday at earliest.

@moollaza
Copy link
Member

moollaza commented Feb 3, 2015

Hey guys, I'm moving the design updates to an issue. Hopefully someone from the community can tackle this!

@moollaza
Copy link
Member

moollaza commented Apr 1, 2015

@larseng congrats! It's live: https://duckduckgo.com/?q=how+do+i+craft+a+cake+in+minecraft&ia=minecraft

Thanks again for taking the time to contribute! We really appreciate it. Feel free to stick around and comment/help on other PR's & Issues or even submit more Instant Answers!

@moollaza
Copy link
Member

moollaza commented Apr 1, 2015

Apologies for the long delay, we used this IA as a candidate for the new Goodie templates. It was the first live Goodie to use the new templates!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants