Jump to content

Recipes help needed [1.7.2]


zacharyjaiden

Recommended Posts

is it all possible to add conditions to recipes being avaliable

an example of what im trying to do (but failed in doing so) is

 

if(StorageMiningLevel.get(player).GetLevel() > 5){

    TestRecipes.instance().AddRecipe(new ItemStack(Items.stick), new ItemStack(Items.diamond));

    }

 

or

 

if(StorageMiningLevel.get(player).GetLevel() > 5){

    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.BlackQuartz), new Object[]{"QQ", "QQ", 'Q', ModItems.BlackNetherQuartz});

 

    }

 

long story short im trying to make crafting recipes only available on the condition that the player is the required level

but every attempt im making is making the game crash.....

 

is it all possible or is there another way around it?

 

 

 

Link to comment
Share on other sites

are you asking for my main cause you assume thats where i register my recipes?

if so i actually have them in a separate file if that what your wanting, though if you need my main for another purpose i can provide that

 

crash report is as follows

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at com.MCR.MinecraftReloaded.LevelingLib.StorageMiningLevel.get(StorageMiningLevel.java:47)

at com.MCR.MinecraftReloaded.Lib.Crafting.RegisterRecipes(Crafting.java:82)

at com.MCR.MinecraftReloaded.Main.MinecraftReloaded.preInit(MinecraftReloaded.java:163)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:495)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:892)

at net.minecraft.client.main.Main.main(Main.java:112)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

Link to comment
Share on other sites

hmm reading that, im not sure it will really work (im new so i may not be understanding it properly) but it seems those check and things are for crafting results in general you cant define item specifics in there, i need quite a lot of items to be crafted on the condition that the level requirement is met......

 

is there by any chance an on crafting event?

 

through use of packet handlers and  setting and changing nbt data that holds a value (level) ive crated a leveling system, its set up that i can retrieve that value through StorageLevel.get(player).GetLevel() ive used it for a lot of events before

 

what i want to do it have set values that items are able to be crafted,eg if level 1 then allow item1 to be crafted

if level two allow item2 to be crafted and so on

the thing you linked me to as far as i could interpret it was adding extra conditions to items being crafted but it seems like it couldnt be used to achieve what im trying to achieve :/

 

so would it be possible to use some oncrafted event if it exists?

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.