[Mod] Item Frames [itemframes]

Post Reply
User avatar
Calinou
Moderator
Posts: 3169
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

[Mod] Item Frames [itemframes]

by Calinou » Post

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

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

Re: [Mod] Item Frames [itemframes]

by Inocudom » Post

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.

User avatar
TenPlus1
Member
Posts: 3700
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Item Frames [itemframes]

by TenPlus1 » Post

Glad to see this mod getting some attention... what differs between this and Zeg's ?

User avatar
Calinou
Moderator
Posts: 3169
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: [Mod] Item Frames [itemframes]

by Calinou » Post

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.

User avatar
TenPlus1
Member
Posts: 3700
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Item Frames [itemframes]

by TenPlus1 » Post

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...
Attachments
screwdriver(frame_fix).zip
(5.33 KiB) Downloaded 211 times

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

Re: [Mod] Item Frames [itemframes]

by Inocudom » Post

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.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

Re: [Mod] Item Frames [itemframes]

by Inocudom » Post

https://github.com/VanessaE/minetest-it ... 873b117244
This is the commit to Zeg9's itemframes mod that fixes displayed objects vanishing after /clearobjects.

User avatar
Wuzzy
Member
Posts: 4778
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Item Frames [itemframes]

by Wuzzy » Post

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.

User avatar
TenPlus1
Member
Posts: 3700
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Item Frames [itemframes]

by TenPlus1 » Post

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

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: [Mod] Item Frames [itemframes]

by sorcerykid » Post

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.

User avatar
Lord_Vlad
Member
Posts: 112
Joined: Thu Jul 20, 2017 07:58

Re: [Mod] Item Frames [itemframes]

by Lord_Vlad » Post

Download is down.

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: [Mod] Item Frames [itemframes]

by sorcerykid » Post

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.

User avatar
TechNolaByte
Member
Posts: 465
Joined: Wed May 10, 2017 21:00
GitHub: TechNolaByte

Re: [Mod] Item Frames [itemframes]

by TechNolaByte » Post

Lord_Vlad wrote:Download is down.
i don't think that will ever get fixed as this is an old mod
The great quest of alchemy neither failed nor attained gold; programmers are those great alchemists who transmute caffeine into code.

User avatar
TenPlus1
Member
Posts: 3700
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Update:

by TenPlus1 » Post

- 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/

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests