Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
Advertisement
这是文档页面,它应该被放置到Template:Inventory slot。查看Template:Documentation以获取更多信息。
快捷方式
Slot
Grid
Lua logo

此模板使用了Module:Inventory slot,以及数据模块Module:Inventory slot/Aliases
这些脚本均使用Lua编写。更多详情,请参阅维基百科:LuaMediaWiki:扩展:Scribunto

翻译者从英文条目翻译下文中的内容时感觉其艰涩难懂。

翻译者希望更有能力的用户能够帮助改善本条目的行文,所以请先慎重对待本条目内容。
如果可能,请帮助我们完善此条目的内容。

Inventory slot模板用于创建模仿游戏内物品栏的图形界面元素。图像主要取自{{InvSprite}},若指定项目未被找到,模板会回落至独立图像,名称格式为Grid <物品名>.png

用法

所有的输入都是可选的:

{{Slot
|[Title]Mod:Name,Amount[Description]; [Title2]Mod2:Name2,Amount2[Description2]; ...
|mod=Default mod (useful for animations and layout templates)
|default=Image always shown under the main image
|align=Vertical Alignment
|link=Link override
|title=Text show on mouseover
|class=Adds additional classes to the .invslot class
|style=Adds styling to the .invslot
|imgclass=Adds additional classes to the .invslot-item
|numstyle=Adds styling to the stack number
}}

部分

第一个参数是一个特殊参数,由若干个“部分”组成(用;分割),如果开启了JavaScript,它们将按顺序接连展示。每一部分都是可选的,但如果不提供Name,将会被忽略。

示例

要显示堆叠20个的猪排,你需要输入:{{Slot|Raw Porkchop,20}}

显示

20

允许2~999的数字,输入其它的将不会被显示。

别称

注:旗帜变种因过多图标而不被包含在内。

以上别称可以用来缩短常用物品的语句,例如展示所有原木变种,或者默认把某个物品单独加到某个名字中。

{{Slot|Any Log;Golden Apple}}

显示


使用别称时,可以在一个“部分”前添加修饰语,修饰语将作用到别称的每个元素上。

{{Slot|Any Log,4;[&oShiny Apple]Enchanted Golden Apple}}

显示

44444444Shiny Apple


模组可以使用模组别名参数指定另外的别名表。

标题和描述

标题参数可以用来为所有展示的物品设置标题(将鼠标置于物品之上查看)。

{{Slot|Raw Porkchop; Cooked Porkchop|title=Smelly Porkchop}}

显示


要想隐藏标题,只需将其设置为none{{Slot|Raw Porkchop; Cooked Porkchop|title=none}}

显示


不过,第一个参数也可以用于为每个元素单独设置样式,并支持使用标准格式代码(需要使用&而不是§)。如果只想改变物品标题的格式而不改变其文本,则格式代码应当添加至第一个参数部分。

{{Slot|[&b]Diamond Sword}}

显示


第一个参数每个“部分”后的括号中用于附加说明,支持标准格式代码,且可以使用正斜杠(/)设定为多行。

{{Slot|[&b&oExcalibur]Iron Sword[&7Smite V/Fire Aspect I//&9+6 Attack Damage]}}

显示

子帧

子帧包含多个元素,每次轮到子帧展示时将展示它的一个元素。将若干个帧(或别称)用大括号括在一起以设定一个子帧。
与直接使用别称不同,使用别称时每次轮到别称将一次性展示别称的每个元素,而子帧每次只会展示它的一个元素。

在这里,一个别名(包含若干个帧)被包裹在一个子帧中,于是每次循环时将展示不同的木板变种:

{{Slot|{Any Planks};Iron Ingot}}

显示

对齐

Ic translate
此段落的(部分)内容需要翻译

Align uses the vertical-align CSS property. For example to align to the middle: Smells like{{Slot|Raw Porkchop|align=middle}}in here!

显示

Smells likein here!

默认

Default is always shown and is placed under the image. {{Slot|default=Grid layout Brewing Empty}}{{Slot|Splash Mundane Potion|default=Grid layout Brewing Empty}}

显示

链接

To change the link for all frames from the image name put: {{Slot|Charcoal|link=煤炭#木炭}}

显示


To remove the link, set link to none: {{Slot|Charcoal|link=none}}

显示

Note that this retains the title.

可用图像

In general, an item can be referred to by its tooltip name.

For dyes, dyed items and wood, there are two shortcuts to refer to all colors or tree species. Use e.g. "Any Wood Planks" if the item appears in more than one input slot and doesn't have to be the same color in all slots. Different copies of the same "Any [item]" will switch randomly and separately among the variants. Otherwise, use "Matching [item]"; all slots containing a "Matching" item will cycle through the species or dye colors in unison, even if they're not the same item.

{{Slot|Any Planks}}{{Slot|Any wood Slab}}{{Slot|Any wood Stairs}}

{{Slot|Matching Wood Planks}}{{Slot|Matching Wood Slab}}{{Slot|Matching wood Stairs}}

shows

Most items with a durability bar exist as "Damaged [item]".

See Template:InvSprite for the full list of items.

其他模板

These templates implement this template into a GUI screen which mimics how it would look in Minecraft. Thus, they have mostly the same features as this template.

Advertisement