GroovyScript

GroovyScript

277k Downloads

尝试按照实例配方编写mek的精密锯木厂配方无法运行

sddsd2332 opened this issue · 11 comments

commented

如题,我在测试mek的机器配方时发现,
这段代码无法运行
mods.mekanism.Sawmill.add(item('minecraft:diamond_block'), item('minecraft:diamond') * 9)
JEI会显示这样
image

而日志则会抛出错误,

Error caught from Recipe Category: mekanism.client.jei.machine.ChanceMachineRecipeCategory
java.lang.NullPointerException: null
at mekanism.common.recipe.outputs.ChanceOutput.hasSecondary(ChanceOutput.java:48) ~[ChanceOutput.class:?]
at mekanism.client.jei.machine.ChanceMachineRecipeCategory.setRecipe(ChanceMachineRecipeCategory.java:56) ~[ChanceMachineRecipeCategory.class:?]
at mekanism.client.jei.machine.ChanceMachineRecipeCategory.setRecipe(ChanceMachineRecipeCategory.java:19) ~[ChanceMachineRecipeCategory.class:?]
at mezz.jei.gui.recipes.RecipeLayout.create(RecipeLayout.java:69) [RecipeLayout.class:?]
at mezz.jei.gui.recipes.RecipeGuiLogic.getRecipeLayouts(RecipeGuiLogic.java:198) [RecipeGuiLogic.class:?]
at mezz.jei.gui.recipes.RecipesGui.updateLayout(RecipesGui.java:492) [RecipesGui.class:?]
at mezz.jei.gui.recipes.RecipesGui.onStateChange(RecipesGui.java:538) [RecipesGui.class:?]
at mezz.jei.gui.recipes.RecipeGuiLogic.setRecipeCategory(RecipeGuiLogic.java:231) [RecipeGuiLogic.class:?]
at mezz.jei.gui.recipes.RecipeCategoryTab.handleMouseClicked(RecipeCategoryTab.java:33) [RecipeCategoryTab.class:?]
at mezz.jei.gui.recipes.RecipeGuiTabs.handleMouseClicked(RecipeGuiTabs.java:133) [RecipeGuiTabs.class:?]
at mezz.jei.gui.recipes.RecipesGui.mouseClicked(RecipesGui.java:327) [RecipesGui.class:?]
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:533) [blk.class:?]
at mezz.jei.gui.recipes.RecipesGui.handleMouseInput(RecipesGui.java:304) [RecipesGui.class:?]
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:501) [blk.class:?]
at net.minecraft.client.Minecraft.runTick(MinecraftMixin.java:1759) [bib.class:?]
at net.minecraft.client.Minecraft.runGameLoop(MinecraftMixin.java:1098) [bib.class:?]
at net.minecraft.client.Minecraft.run(MinecraftMixin.java:4114) [bib.class:?]
at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_351]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_351]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_351]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_351]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

必须要在后面添加上物品在可以运行
mods.mekanism.Sawmill.add(item('minecraft:diamond_block'), item('minecraft:diamond') * 9,item('null'))

这些是GroovyScript回报可以添加的配方类型
add(com.cleanroommc.groovyscript.api.IIngredient, net.minecraft.item.ItemStack, net.minecraft.item.ItemStack),
add(com.cleanroommc.groovyscript.api.IIngredient, net.minecraft.item.ItemStack, net.minecraft.item.ItemStack, double), any(),
add(com.cleanroommc.groovyscript.api.IIngredient, net.minecraft.item.ItemStack), wait(), find()

另外,精密锯木厂的配方可以添加第二次输出槽可以概率输出,但是GRS配方是无法添加
以下为我用于测试的带概率的配方
mods.mekanism.Sawmill.add(item('minecraft:diamond_block'),item('minecraft:stone:0')*5,item('minecraft:stone:2'),0.2)
jei的显示
image

是否为我的配方有错误?

commented

Close the problem and fix it in probably fix mek sawmill

commented

It seems i did an oopsie there. Easy fix

commented

For the future please make issues in english. I need to put every sentence into google translate to understand this 😢

commented

Sorry, I forgot to use a translator. I can't enter Google Translate. This is a translator using other software.
This GroovyScript is better than CraftTweaker [referring to thermal loading]
In addition, if I want to make my mod compatible with GroovyScript, what do I need to do?
I want to add some mek machines I transplanted to it

commented

Just look up the code in com.cleanroommc.groovyscript.compat.mods.ModSupport, it will be helpful.
btw, Bing Translator is also a good choice to take the place of Google Translator. (just a suggestion)

commented

Just forgot to say, mek recipe in examples,
The second is also a typo
mods.mekanism.Crusher.add('<item:minecraft:clay_ball>', '<minecraft:gold_ingot>')
mods.mekanism.Crusher.removeByInput('<ore:ingotSilver>')
I guess it should be
mods.mekanism.Crusher.add(item('minecraft:clay_ball'), item('minecraft:gold_ingot'))
mods.mekanism.Crusher.removeByInput(ore('ingotSilver')
is correct

commented

oh I guess so, if you have tested these code you can just make a pr. XD

commented

In addition, if I want to make my mod compatible with GroovyScript, what do I need to do? I want to add some mek machines I transplanted to it

That might be difficult to do right, since we already have compat for mekanism compat.

commented

Just forgot to say, mek recipe in examples, The second is also a typo mods.mekanism.Crusher.add('<item:minecraft:clay_ball>', '<minecraft:gold_ingot>') mods.mekanism.Crusher.removeByInput('<ore:ingotSilver>') I guess it should be mods.mekanism.Crusher.add(item('minecraft:clay_ball'), item('minecraft:gold_ingot')) mods.mekanism.Crusher.removeByInput(ore('ingotSilver') is correct

Yes, that is the old syntax. Ill update them at some point

commented

In addition, if I want to make my mod compatible with GroovyScript, what do I need to do? I want to add some mek machines I transplanted to it

That might be difficult to do right, since we already have compat for mekanism compat.

I support GroovyScript in the machine added by my mek, but the original compatibility of GroovyScript with mekanism is not modified, which may be realized,

In this way, I can make GroovyScript compatible with the original mekanism, and also implement the machine I added.XD

commented

I support GroovyScript in the machine added by my mek, but the original compatibility of GroovyScript with mekanism is not modified, which may be realized,

In this way, I can make GroovyScript compatible with the original mekanism, and also implement the machine I added.XD

Well, I have compatible GroovyScript with the machine transplanted by mek, and now it can run normally and hot load,
XD

mek-sddsd2332version.Demonstration.of.hot.loaded.recipes.mp4