Wuzzy/Repixture
6
33
Fork
You've already forked Repixture
10

Crafting recipes don't work if they use an alias of an item #258

Closed
opened 2025年07月20日 01:59:17 +02:00 by Skivling · 3 comments

One of the RePixture crafting recipes for my mod wasn't working, but it was fixed after replacing the alias with the new itemstring.

This is the original recipe: (d. and i. tables are defined separately)

d.tardis = "drwho_tardis:tardis"
d.arton_crystal = "drwho_tardis:arton_crystal" -- this item
i.block_steel 		= "rp_default:block_steel"
d.circuitry_board = "drwho_tardis:circuitry_board"
 crafting.register_craft({
 output = d.tardis,
 items = {
 i.block_steel.." 6",
 d.arton_crystal, --
 d.spacetime,
 d.circuitry_board.." 1",
 }
 }) 

I previously renamed the arton crystal to artron crystal, and there is an alias:

core.register_alias("drwho_tardis:arton_crystal", "drwho_tardis:artron_crystal")

But I hadn't remembered to replace the reference in the d. table with the new itemstring. It worked in MTG so I didn't bat an eye. So the crafting recipes were being registered with an alias and not the actual itemstring - and in RePixture this meant the crafting didn't work.
The recipe still displayed in the menu with the correct items, but putting in those items did not craft it. I suspect that there is a place in the code that isn't checking against aliases.

When I replaced the value:
d.arton_crystal = "drwho_tardis:artron_crystal"
the crafting worked properly.

One of the RePixture crafting recipes for my mod wasn't working, but it was fixed after replacing the alias with the new itemstring. This is the original recipe: (d. and i. tables are defined separately) ```lua d.tardis = "drwho_tardis:tardis" d.arton_crystal = "drwho_tardis:arton_crystal" -- this item i.block_steel = "rp_default:block_steel" d.circuitry_board = "drwho_tardis:circuitry_board" crafting.register_craft({ output = d.tardis, items = { i.block_steel.." 6", d.arton_crystal, -- d.spacetime, d.circuitry_board.." 1", } }) ``` I previously renamed the arton crystal to artron crystal, and there is an alias: ```lua core.register_alias("drwho_tardis:arton_crystal", "drwho_tardis:artron_crystal") ``` But I hadn't remembered to replace the reference in the `d.` table with the new itemstring. It worked in MTG so I didn't bat an eye. So the crafting recipes were being registered with an alias and not the actual itemstring - and in RePixture this meant the crafting didn't work. The recipe still displayed in the menu with the correct items, but putting in those items did not craft it. I suspect that there is a place in the code that isn't checking against aliases. When I replaced the value: `d.arton_crystal = "drwho_tardis:artron_crystal"` the crafting worked properly.
Owner
Copy link

Yes, you're right, the crafting mod doesn’t look at aliases. This is a bug, I just forgot about it.

Yes, you're right, the crafting mod doesn’t look at aliases. This is a bug, I just forgot about it.
Owner
Copy link

Strange. I cannot reproduce this. I used your example to write a minimal test mod called drwho_tardis with the following code:

init.lua:

core.register_craftitem("drwho_tardis:tardis", {
	description = "TARDIS",
	-- dummy texture
	inventory_image = "[fill:16x16:#0000FF",
})
core.register_craftitem("drwho_tardis:artron_crystal", {
	description = "Art(r)on Crystal",
	-- dummy texture
	inventory_image = "[fill:16x16:#FF00FF",
})
core.register_craftitem("drwho_tardis:circuitry_board", {
	description = "Circuitry Board",
	-- dummy texture
	inventory_image = "[fill:16x16:#888888",
})
core.register_craftitem("drwho_tardis:spacetime", {
	description = "Spacetime",
	-- dummy texture
	inventory_image = "[fill:16x16:#000000",
})
core.register_alias("drwho_tardis:arton_crystal", "drwho_tardis:artron_crystal")
local d = {}
local i = {}
d.tardis = "drwho_tardis:tardis"
d.arton_crystal = "drwho_tardis:arton_crystal" -- this item
i.block_steel = "rp_default:block_steel"
d.circuitry_board = "drwho_tardis:circuitry_board"
d.spacetime = "drwho_tardis:spacetime" --<< was missing in your example
crafting.register_craft({
	output = d.tardis,
	items = {
		i.block_steel.." 6",
		d.arton_crystal, --
		d.spacetime,
		d.circuitry_board.." 1",
	}
})

mod.conf:

name = drwho_tardis
depends = rp_crafting

If I run this code, the crafting recipe appears correctly in the crafting guide and I can also craft it.

Please test if you can still reproduce this bug in Repixture cee90257ca and Luanti 5.15.0.

Strange. I cannot reproduce this. I used your example to write a minimal test mod called `drwho_tardis` with the following code: init.lua: ``` core.register_craftitem("drwho_tardis:tardis", { description = "TARDIS", -- dummy texture inventory_image = "[fill:16x16:#0000FF", }) core.register_craftitem("drwho_tardis:artron_crystal", { description = "Art(r)on Crystal", -- dummy texture inventory_image = "[fill:16x16:#FF00FF", }) core.register_craftitem("drwho_tardis:circuitry_board", { description = "Circuitry Board", -- dummy texture inventory_image = "[fill:16x16:#888888", }) core.register_craftitem("drwho_tardis:spacetime", { description = "Spacetime", -- dummy texture inventory_image = "[fill:16x16:#000000", }) core.register_alias("drwho_tardis:arton_crystal", "drwho_tardis:artron_crystal") local d = {} local i = {} d.tardis = "drwho_tardis:tardis" d.arton_crystal = "drwho_tardis:arton_crystal" -- this item i.block_steel = "rp_default:block_steel" d.circuitry_board = "drwho_tardis:circuitry_board" d.spacetime = "drwho_tardis:spacetime" --<< was missing in your example crafting.register_craft({ output = d.tardis, items = { i.block_steel.." 6", d.arton_crystal, -- d.spacetime, d.circuitry_board.." 1", } }) ``` mod.conf: ``` name = drwho_tardis depends = rp_crafting ``` If I run this code, the crafting recipe appears correctly in the crafting guide and I can also craft it. Please test if you can still reproduce this bug in Repixture cee90257ca99e9018f6b644b1f260b81d784d031 and Luanti 5.15.0.
Owner
Copy link

Since I cannot reproduce this bug, and there is no response, I close this issue for now. It could be that changes to the code in Luanti might have "accidentally" fixed the bug.

When you (or anyone else) have new information about this, please post and I will re-open if needed.

Since I cannot reproduce this bug, and there is no response, I close this issue for now. It could be that changes to the code in Luanti might have "accidentally" fixed the bug. When you (or anyone else) have new information about this, please post and I will re-open if needed.
Sign in to join this conversation.
No Branch/Tag specified
master
new_weather_types
clock
sponge
cushion
vase
pages
giant_crops
duckweed
new_hairs_new_skin_selection
new_hairs
multi_flower_2
dirt_redo
craft_compat
gold_coin_upgrade
gold_coin
new_traders
item_frame_flat
silktouch_paint
silktouch
newtrees
new_weather
creative_per_player
scrollbar_style
village_nextgen_thread
village_nextgen
new_website
tnt_faster
fixbrush
roots
amber_slime
fir
path_fixes
villager_pathfind_cost
fence_gate
slab_up
biome_skies
pencil_showlabel
moonflower_seed
unicode_signs_refactor_newsigns_sideways
unicode_signs
spyglass
craftcolor
villager_pathfind
mobs_new2
paint_book
moon_phases
newmusic
weblate_test
paint4dir
whistle
buoy
pot
4x4grass
village_vmanip
seagrass
3.20.0
3.19.0
3.18.2
3.18.1
3.18.0
3.17.3
3.17.2
3.17.1
3.17.0
3.16.0
3.15.1
3.15.0
3.14.0
3.13.1
3.13.0
3.12.1
3.12.0
3.11.0
3.10.0
3.9.0
3.8.0
3.7.0
3.6.3
3.6.2
3.6.1
3.6.0
3.5.0
3.4.1
3.4.0
3.3.0
3.2.1
3.2.0
3.1.1
3.1.0
3.0.1
3.0.0
2.1.0
2.0.0
1.5.3
1.5.2
1.5.1
1.5.0
1.4.2
1.4.1
1.4.0
v1.3.6
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
v1.3.0
v1.2.0
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.0
v0.6.0
v0.5.0
v0.4.4
v0.4.3
v0.4.2
v0.4.1
v0.4.0
v0.3.2
v0.3.1
v0.3.0
v0.2.0
v0.1.1
v0.1.0
Labels
Clear labels
Category: Discussion
For discussions about the game
Category: Entities
About entities or objects (including player)
Category: Gameplay
About gameplay mechanics in general
Category: Graphics
About graphics
Category: GUI and HUD
Anything related to the graphical user interface or heads-up display
Category: Items and Tools
About items or tools, but not nodes
Category: Mapgen
About the map generator
Category: Nodes
About nodes
Category: Sounds
About sounds
Category: Translation
About translations
Category: Website
Related to the Repixture website
Kind
Balancing
About game balance
Kind
Bug
When something doesn't work right
Kind
Documentation
About documentation, both for devs and players
Kind
Feature
Ideas, feature requests, enhancements, etc.
Kind
Maintenance
Code quality, technical improvements, refactoring, etc.
Kind
Performance
About making the game run fast
Priority
CRITICAL
Highest priority level. For crashes, major data loss, etc.
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Decision needed
When the issue still needs a decision on what to do
Reviewed
Duplicate
When the issue existed already
Reviewed
Invalid
When the issue was not valid
Reviewed
Rejected
When something that was proposed was rejected
Status
Needs engine change
When it can only be solved after a Luanti bugfix/improvement
Status
Needs testing
If the task is believed to be done, but needs testing
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Wuzzy/Repixture#258
Reference in a new issue
Wuzzy/Repixture
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?