Page 1 of 1

[Mod] Item Frames [itemframes]

Posted: Sun Jun 29, 2014 18:00
by Calinou
Another item frames and pedestals mod. Based on Zeg9's item frames mod.

This mod is originating from Carbone. You don't install this mod if you're playing that particular game; it's already included and enabled by default there.

Download

No dependencies on non-default mods.
License for code: CC0
License for textures: CC BY-SA 3.0


Crafting

X = stick, P = paper.

X X X
X P X
X X X

S = stone, _ = nothing.

S S S
_ S _
S S S

Re: [Mod] Item Frames [itemframes]

Posted: Sun Jun 29, 2014 18:11
by Inocudom
It looks like Zeg9 might be gone for some time, so I am glad that you are doing this. Along with the frames and the pedestals, glass cases would be useful too.

Could the displays work like locked treasure chests, but have only one slot for the item to be put on display to be placed in? That way, if clearobjects is performed, they could reshow the single item that they have either by the player getting close enough to them or by being punched.

Re: [Mod] Item Frames [itemframes]

Posted: Sun Jun 29, 2014 20:14
by TenPlus1
Glad to see this mod getting some attention... what differs between this and Zeg's ?

Re: [Mod] Item Frames [itemframes]

Posted: Wed Jul 02, 2014 09:20
by Calinou
TenPlus1 wrote:Glad to see this mod getting some attention... what differs between this and Zeg's ?
Textures were redone, items rotate slower on pedestals, code style fixed and cleaned up.

Re: [Mod] Item Frames [itemframes]

Posted: Wed Jul 02, 2014 19:30
by TenPlus1
Nice, I did however notice that using a screwdriver to rotate the item frame then adding an item crashes minetest and servers it runs on and the only fix I could see was to tweak the screwdriver mod slightly to ignore frames... ADDED below...

Re: [Mod] Item Frames [itemframes]

Posted: Thu Aug 07, 2014 18:13
by Inocudom
In the topic of the original item_frames mod, thus was spoken:
Inocudom wrote:This mod was updated yesterday, so displayed objects will now reappear after /clearobjects actions.
Very significant, very significant.

Re: [Mod] Item Frames [itemframes]

Posted: Sun Aug 10, 2014 21:09
by Inocudom
https://github.com/VanessaE/minetest-it ... 873b117244
This is the commit to Zeg9's itemframes mod that fixes displayed objects vanishing after /clearobjects.

Re: [Mod] Item Frames [itemframes]

Posted: Sat Feb 11, 2017 12:06
by Wuzzy
You can't place the following Minetest Game items on item frames and pedestals:
  • Boat
  • Cart
  • Screwdriver
  • Wheat Seed
  • Cotton Seed
  • Skeleton Key
  • Key
You can rotate item frames with a screwdriver, which looks very weird. I think the easiest fix would be to disallow screwdriver rotation of item frames.

Also, the Minetest mod manager gets confused if you have this mod and Homedecor installed. If you try to enable this mod, it doesn't get enabled!
I noticed this mod has the identical name as a homedecor mod. This is a very confusing bug, please consider a rename.

Re: [Mod] Item Frames [itemframes]

Posted: Sat Feb 11, 2017 13:40
by TenPlus1
We could easily add the following code to the on_rightclick for each item that doesn't work for itemframes so that they do (like I did with Farming Redo crop/seed):

Code: Select all

	local def = minetest.registered_nodes[under.name]
	if def and def.on_rightclick then
		return def.on_rightclick(pt.under, under, placer, itemstack)
	end

Re: [Mod] Item Frames [itemframes]

Posted: Tue Feb 21, 2017 20:36
by sorcerykid
Thanks for the heads up Wuzzy. I didn't realize those items were incompatible with the itemframes mod. I think TenPlus has the right solution. I'll get the fix in place on the JT2 server.

Re: [Mod] Item Frames [itemframes]

Posted: Mon Jul 24, 2017 21:38
by Lord_Vlad
Download is down.

Re: [Mod] Item Frames [itemframes]

Posted: Mon Jul 24, 2017 23:42
by sorcerykid
My solution was to override the registration functions. This affords a universal means for interactive nodes (like those used in the itemframes mod) to intercept right-clicks whenever a player is wielding a craftitem or a node with an on_place handler. With this code it is also possible to open doors and chests while a cart, a boat, a wheat seed, or a cotton seed is currently selected in the inventory.

Code: Select all

local old_register_node = minetest.register_node
local old_register_craftitem = minetest.register_craftitem

minetest.register_craftitem = function ( name, fields )
	if fields.on_place then
		fields._on_place = fields.on_place
		fields.on_place = function( itemstack, player, pointed_thing )
			local pos = pointed_thing.under
			local node = minetest.get_node( pos )

			-- allow on_rightclick callback of pointed_thing to intercept item placement 
			if minetest.registered_nodes[ node.name ].on_rightclick then
				minetest.registered_nodes[ node.name ].on_rightclick( pos, node, player, itemstack )
			-- otherwise placement is dependent on anti-grief rules of this item (if hook is defined)
			elseif not fields.allow_place or fields.allow_place( pos, player ) then
				return fields._on_place( itemstack, player, pointed_thing )
			end
			return itemstack
		end
	end
	old_register_craftitem( name, fields )
end

minetest.register_node = function ( name, fields )
	if fields.on_place and fields.on_place ~= minetest.rotate_node then
		fields._on_place = fields.on_place
		fields.on_place = function( itemstack, player, pointed_thing )
			local pos = pointed_thing.under
			local node = minetest.get_node( pos )

			-- allow on_rightclick callback of pointed_thing to intercept item placement 
			if minetest.registered_nodes[ node.name ].on_rightclick then
				minetest.registered_nodes[ node.name ].on_rightclick( pos, node, player, itemstack )
			-- otherwise placement is dependent on anti-grief rules of this item (if hook is defined)
			elseif not fields.allow_place or fields.allow_place( pos, player ) then
				return fields._on_place( itemstack, player, pointed_thing )
			end
			return itemstack
		end
	end
	if fields.on_punch then
		fields._on_punch = fields.on_punch
		fields.on_punch = function( pos, node, player )
			-- punching is dependent on anti-grief rules of this item (currently only used by tnt)
			if not fields.allow_punch or fields.allow_punch( pos, player ) then
				fields._on_punch( pos, node, player )
			end
		end
	end
	old_register_node( name, fields )
end
The above code snippet is a global dependency, so obviously needs to be executed ahead of all other mods. A suitable location would be default/init.lua.

Re: [Mod] Item Frames [itemframes]

Posted: Fri Jan 12, 2018 17:32
by TechNolaByte
Lord_Vlad wrote:Download is down.
i don't think that will ever get fixed as this is an old mod

Update:

Posted: Mon Mar 22, 2021 11:21
by TenPlus1
- Invisible Item Frame added
- Glowing items will glow inside of a frame or pedestal
- Better itemframe placement (wall, floor, ceiling)
- Frames can be rotated and can sit flat on a surface to showcase items
- Both frames and pedestals no longer owned but protected (protection mod required)

https://content.minetest.net/packages/T ... temframes/