Closed juh9870 closed 2 years ago
My use case is that Iw as trying to make a recipe that, upon item explosion, makes 9 rolls, each of them having 50% chance to give you an item. So you can end up with 0 or with 9, but most of the time you will get 4 or 5.
This is exactly the current behavior of "drop_item"
Can you please provide an example? If I try to add a contextual chance condition to drop item post action, it either drops all items or none at all. I'm on 1.18.2
{
"type": "drop_item",
"item": "cod",
"count": 5,
"contextual": {
"type": "chance",
"chance": 0.5
}
}
This doesn't work. I tried making this
onEvent("recipes", (event) => {
event.custom({
type: "lychee:item_exploding",
item_in: Item.of('minecraft:stone').toJson(),
post: [{
"type": "drop_item",
"item": "cobblestone",
"count": 64,
"contextual": {
"type": "chance",
"chance": 0.5
}
}]
})
});
And it either drops 64 or drops 0, nothing in between, while I want it to roll that chance for every item in a count, so I would get an average of 32 in this case
So I have to resort to this script to make items drop roll chance for every item. It makes one ghost recipe for user info, and ugly actual recipe for mechanics. https://pastebin.com/AHsawsrk
that example only works if the recipe can be repeated for more than one time. I can add range support for the "count" property if you want
That would be great too, but not quite my use case. I just want something like random
node, but accepting only one argument and repeating post action N times. Maybe just allowrandom
node to accept a single argument to allow it to function like repeat
So something like this
event.custom({
type: "lychee:item_exploding",
item_in: Item.of("minecraft:stone").toJson(),
post: [
{
type: "random",
rolls: 64,
entries: [
{
type: "drop_item",
item: "cobblestone",
count: 1,
contextual: {
type: "chance",
chance: 0.5,
},
}
],
},
],
});
Because right now I have to write either what I shown in my previous message above, or do this
event.custom({
type: "lychee:item_exploding",
item_in: Item.of("minecraft:stone").toJson(),
post: [
{
type: "random",
rolls: 64,
entries: [
{
type: "drop_item",
item: "cobblestone",
count: 1,
contextual: {
type: "chance",
chance: 0.5,
},
},
{
type: "drop_item",
item: "cobblestone",
count: 1,
contextual: {
type: "chance",
chance: 0.5,
},
},
],
},
],
});
and having quite confusing JEI recipe info
implemented in 2.2.8
Mod loader
Forge
Minecraft version
-
Mod version
-
Modloader version
-
Modpack info
No response
If bug:
If bug: The latest.log file
No response
Issue description
Please add "repeat" post action, aka the one that triggers its child multiple times. My use case is that Iw as trying to make a recipe that, upon item explosion, makes 9 rolls, each of them having 50% chance to give you an item. So you can end up with 0 or with 9, but most of the time you will get 4 or 5. I was able to replicate behavior using
random
node, but it required one recipe for an actual behavior, and anoher one for JEI, because behavior one was showing misleading and confusing info