apace100/apoli

Item Action Modifier not working

Opened this issue · 4 comments

I'm using this through Origins 1.1.2

It simply prints test^1 into console and does nothing else when called under the ItemOnItem Power Type.

I've narrowed it down to this check failing. Somehow when it's trying to get the server it's getting a null value?

Here's my current code:

internal_furnace.json

{
	"name": "Internal Furnace",
	"description": "Allows you to smelt items inside your inventory with a blast furnace at the cost of energy",

	"type": "origins:item_on_item",
	"using_item_condition": {
		"type": "origins:ingredient",
		"ingredient": {
			"tag": "minecraft:smeltable"
		}
	},
	"on_item_condition": {
		"type": "origins:ingredient",
		"ingredient": {
			"item": "minecraft:blast_furnace"
		}
	},
	"using_item_action" : {
		"type": "origins:modify",
		"modifier": "minecraft:smelt_item"
	}
}

minecraft/data/item_modifiers/smelt_item.json

{ "function": "minecraft:furnace_smelt" }

minecraft/data/tags/items/smeltable.json

{"replace":false,"values":["minecraft:iron_boots","minecraft:iron_leggings","minecraft:iron_chestplate","minecraft:iron_helmet","minecraft:iron_axe","minecraft:iron_hoe","minecraft:iron_pickaxe","minecraft:iron_shovel","minecraft:golden_boots","minecraft:golden_leggings","minecraft:golden_chestplate","minecraft:golden_helmet","minecraft:golden_axe","minecraft:golden_hoe","minecraft:golden_pickaxe","minecraft:golden_shovel","minecraft:coal_ore","minecraft:iron_ore","minecraft:lapis_ore","minecraft:gilded_blackstone","minecraft:gold_ore","minecraft:redstone_ore","minecraft:emerald_ore","minecraft:diamond_ore","minecraft:nether_quartz_ore","minecraft:nether_gold_ore","minecraft:beef","minecraft:chicken","minecraft:cod","minecraft:mutton","minecraft:salmon","minecraft:porkchop","minecraft:potato","minecraft:rabbit","minecraft:white_terracotta","minecraft:orange_terracotta","minecraft:magenta_terracotta","minecraft:light_blue_terracotta","minecraft:yellow_terracotta","minecraft:lime_terracotta","minecraft:pink_terracotta","minecraft:gray_terracotta","minecraft:light_gray_terracotta","minecraft:cyan_terracotta","minecraft:purple_terracotta","minecraft:blue_terracotta","minecraft:brown_terracotta","minecraft:green_terracotta","minecraft:red_terracotta","minecraft:black_terracotta","minecraft:terracotta","minecraft:oak_log","minecraft:oak_wood","minecraft:stripped_oak_log","minecraft:stripped_oak_wood","minecraft:birch_log","minecraft:birch_wood","minecraft:stripped_birch_log","minecraft:stripped_birch_wood","minecraft:acacia_log","minecraft:acacia_wood","minecraft:stripped_acacia_log","minecraft:stripped_acacia_wood","minecraft:jungle_log","minecraft:jungle_wood","minecraft:stripped_jungle_log","minecraft:stripped_jungle_wood","minecraft:spruce_log","minecraft:spruce_wood","minecraft:stripped_spruce_log","minecraft:stripped_spruce_wood","minecraft:dark_oak_log","minecraft:dark_oak_wood","minecraft:stripped_dark_oak_log","minecraft:stripped_dark_oak_wood","minecraft:ancient_debris","minecraft:cactus","minecraft:clay","minecraft:clay_ball","minecraft:cobblestone","minecraft:chorus_fruit","minecraft:golden_horse_armor","minecraft:golden_sword","minecraft:iron_horse_armor","minecraft:iron_sword","minecraft:kelp","minecraft:netherrack","minecraft:nether_bricks","minecraft:red_sand","minecraft:sand","minecraft:sea_pickle","minecraft:stone","minecraft:stone_bricks","minecraft:wet_sponge","minecraft:copper_ore","minecraft:deepslate_coal_ore","minecraft:deepslate_iron_ore","minecraft:deepslate_lapis_ore","minecraft:deepslate_gold_ore","minecraft:deepslate_redstone_ore","minecraft:deepslate_emerald_ore","minecraft:deepslate_diamond_ore","minecraft:deepslate_copper_ore","minecraft:cobbled_deepslate","minecraft:raw_iron","minecraft:raw_gold","minecraft:raw_copper"]}

Are you in Creative mode? That's a bug that was reported to me, and the test statements you see in the code was me trying to fix that.
Just asking to make sure this is a duplicate.

It fails in both survival and creative with the smelt item modifier, however it works fine with set_count like this in survival:

{
	"function": "minecraft:set_count",
	"count": {
		"type": "minecraft:score",
		"target": {
			"type": "minecraft:fixed",
			"name": "#count"
		},
		"score": "i"
	}
}

it prints all four test messages when in survival using the smelting modifier

Ah, I see! Sorry for the late reply.
The problem is that item actions inside the item_on_item power type can not modify the item of existing item stacks. Thus the stack that's being used, as well as the on stack, are unavailable for having their item changed. Other modifiers which modify NBT data on the item or the count of items still work.
I tried thinking of a work-around using the result item stack, however there's no way to copy the item of either the on or the using stack into the result, requiring you to hard-code each input and output combination. That's definitely not feasible.

I will look into allowing a copy_result_from_input field or something similar, so you can copy an input stack into a resulting output. Then you could apply the smelt modifier to the result, and just need to consume the input stack.

I will leave the issue open until that is implemented. Thanks for making me aware of this!

Sounds like a plausible workaround! Thanks for looking into it.