Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minetweaker for Grinder #26

Closed
wants to merge 1 commit into from
Closed

Conversation

hilburn
Copy link

@hilburn hilburn commented Feb 18, 2015

Added Minetweaker support for both Grinding recipes and seeds.

Recipes are stored in a different, editable HashMap, updated the relevant methods in RecipesGrinder
Checks for invalid output using the criteria defined in the Grinder API class, also checks for pre-existing recipe for that input. Input and output can be defined as either an OreDictionary entry (in which case it will add recipes for every entry that doesn't already exist for input, or the first OreDictionary entry for the output) or a specific ItemStack.

Seeds are added similarly to the seeds Map - but to protect against Canola being removed from the grinder a list of protected seeds is added - any seed on that list cannot be removed from the grindableSeed Map with the new removeGrindableSeed method

MinetweakerHelper class added to aid in MT input->ItemStacks. You might want to move this to DragonAPI at some point

Note: I had to write this outside of a dev environment - so it's very possible there are a couple of typos or missed imports you will have to clean up

Also didn't do any of the registering of the ZenClass (MineTweakerAPI.registerClass(GrinderTweaker.class);) as I imagine this is something you'd want to centralise through DragonAPI - eg. a static function that you pass the classes to, checks MT is loaded, then does the registering if required.

@ReikaKalseki
Copy link
Owner

I am going to tweak this a bit (no pun intended :P) but I will add it for the next version.

@ReikaKalseki
Copy link
Owner

How do I get all the MT class dependencies?

Also, it looks like this code is broken:

public static ItemStack getStack(IIngredient ingredient) {
    if (ingredient == null)
        return null;
    if (ingredient instanceof IOreDictEntry) {
        return OreDictionary.getOres(toString((IOreDictEntry)ingredient)).get(0);
    }
    else if (ingredient instanceof IItemStack) {
        return getItemStack((IItemStack)ingredient);
    }
}

getItemStack() does not exist, and if it calls getStack() it overflows.

@hilburn
Copy link
Author

hilburn commented Feb 18, 2015

https://github.com/ReikaKalseki/RotaryCraft/pull/26/files#diff-ee9feed29468d1da1ae8b67c1f82a344R3 should have taken care of the import
As for the class dependencies, I think it's all in the API, but I've always just added MT to /libs/
also it should probably have a return null; at the end of that method there - like I said - a few dodgy things from basically coding in a text editor ;)

@ReikaKalseki
Copy link
Owner

OK, the code is included.

@ReikaKalseki
Copy link
Owner

It does not seem to be working - MT throws a "cannot find mods.rotarycraft" error.

@ReikaKalseki ReikaKalseki reopened this Mar 29, 2015
@hilburn
Copy link
Author

hilburn commented Mar 29, 2015

did you register it with the MT API?

MineTweakerAPI.registerClass(XXXX.class);

@ReikaKalseki
Copy link
Owner

Yes.

@coolsquid
Copy link

Minetweaker logs the following error whenever a Rotarycraft method is used: http://pastebin.com/HeEaqcQx. Time to investigate!

@hilburn
Copy link
Author

hilburn commented Mar 30, 2015

Well I had a quick look over it:

I think one error which can be resolved is that output is never actually set, so all the recipes will have null outputs

@ReikaKalseki
Copy link
Owner

That is not the same error I get. I get literally "cannot find mods.rotarycraft".

@hilburn
Copy link
Author

hilburn commented Mar 31, 2015

can you post your Minetweaker script? both @ReikaKalseki ad @coolsquid

@ReikaKalseki
Copy link
Owner

grinder.addRecipe(<minecraft:redstone>, <minecraft:diamond>);
grinder.addSeed(<minecraft:dirt>, 0.2F);

I have also tried mods.rotarycraft.grinder, and rotarycraft.grinder.

@Voidi
Copy link

Voidi commented Mar 31, 2015

As far as i know Minetweaker is case-sensitive, it should be 'mods.rotarycraft.Grinder.addRecipe'.

@ReikaKalseki
Copy link
Owner

I will try this.

EDIT: Still nothing:
ERROR: Error parsing rctest.zs:2 -- ) expected

EDIT2:
Changing the 0.2F to a 0.2 brings back the original error:
[13:46:10] [Client thread/INFO]: [CHAT] ERROR: ?:1 > could not find mods
[13:46:10] [Client thread/INFO]: [CHAT] ERROR: Error executing rctest.zs: 1

@hilburn
Copy link
Author

hilburn commented Apr 1, 2015

@ReikaKalseki - just checking, but you have done
import mods.rotarycraft.Grinder;
at the top of the script right?

@ReikaKalseki
Copy link
Owner

No...I had no idea that was necessary. I will try that when I get home in a few hours.

@coolsquid
Copy link

@hilburn

import mods.rotarycraft.Grinder;

Grinder.addRecipe(minecraft:planks, minecraft:planks);

@ReikaKalseki
Copy link
Owner

Do imports here work anything like java? If so, adding an import for something I write the fully qualified name of is unnecessary, is it not?

@coolsquid
Copy link

Yes, I just tried.

@ReikaKalseki
Copy link
Owner

So then there is another issue...

@hilburn
Copy link
Author

hilburn commented Apr 1, 2015

@coolsquid - those aren't valid MT names - you need the <> around them

@ReikaKalseki - I'll be around in a bit if you are free wanna get on IRC to discuss it

@ReikaKalseki
Copy link
Owner

I will be busy for the next few hours.

@hilburn
Copy link
Author

hilburn commented Apr 1, 2015

Ok, send me a PM on IRC when you're about - I may be busy but if not I'll be happy to give you a hand

@ReikaKalseki
Copy link
Owner

Now I am.

@12345swordy
Copy link

This apparently doesn't work, it literally can not find rotarycraft as part of mods member function.

mods.rotarycraft.Grinder.addRecipe(minecraft:gravel, exnihilo:dust);

@ReikaKalseki
Copy link
Owner

Yes, I know.

@cosmicdan
Copy link

That's a shame, any idea why it's not in there?

...I came here looking to see if there was a way to remove Grinder recipes too. A lot of the defaults are way too generous IMO. Any chance of adding that in if/when you get this sorted?

@ReikaKalseki
Copy link
Owner

That is much less likely.

@cosmicdan
Copy link

Disappointing, but understandable. Thanks for the reply all the same.

@ReikaKalseki
Copy link
Owner

No longer necessary, as of v17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants