Minecraft Wiki

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

了解更多

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

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

Ic translate
此条目的(部分)内容需要翻译。

你可以帮助我们来翻译此条目,但请勿使用机器翻译

这个物品栏模板用来创建类似于游戏里面的物品。

The images used are primarily taken from {{InvSprite}}, but if the specified item is not found, the template falls back to individual images in the format of Grid <item name>.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
}}

部分

The first parameter is a special parameter consisting of various "parts" grouped together in frames (delimited by ;) which will be display one after another if JavaScript is enabled. Every part is optional, but without "name", won't do anything.

简单的示例

To display an inventory item of "Raw Porkchop" with an stack size of 20 you would put: {{Slot|Raw Porkchop,20}}

shows

20

An amount of 2–999 is supported, anything else will not be displayed.

If no image is specified, an empty slot is displayed, this could be used to do layouts like so:

{{Slot|TNT}}{{Slot|TNT}}{{Slot}}{{Slot}}{{Slot|TNT}}{{Slot|TNT}}<br>
{{Slot|TNT}}{{Slot|TNT}}{{Slot}}{{Slot}}{{Slot|TNT}}{{Slot|TNT}}<br>
{{Slot}}{{Slot}}{{Slot|TNT}}{{Slot|TNT}}{{Slot}}{{Slot}}<br>
{{Slot}}{{Slot|TNT}}{{Slot|TNT}}{{Slot|TNT}}{{Slot|TNT}}{{Slot}}<br>
{{Slot}}{{Slot|TNT}}{{Slot|TNT}}{{Slot|TNT}}{{Slot|TNT}}{{Slot}}<br>
{{Slot}}{{Slot|TNT}}{{Slot}}{{Slot}}{{Slot|TNT}}{{Slot}}
shows






However this is really inefficient and produces ugly code, so don't do this. Use Template:BlockGrid or Template:Schematic instead.

Aliases

Note: Banner variations are not included due to how many there are.

The above aliases can be used to shorten common items, such as all wood blocks or adding parts to certain names by default.

{{Slot|Any Wood;Golden Apple}}

shows


When using the alias, parts can be added which will override any parts in the alias.

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

shows

44444444Shiny Apple


Mods can specify an additional aliases table using the modaliases parameter.

Titles and description

The title parameter can be used to set a title for all frames.

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

shows


To remove the title, set it to "none": {{Slot|Raw Porkchop; Cooked Porkchop|title=none}}

shows


However, the first bracketed text can be used to specify a title for each frame individually, and also supports standard formatting codes using & instead of §. If the title only contains formatting codes and no actual text, the formatting will be added to the normal title.

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

shows


The last bracketed text can be used to specify a description, this also supports standard formatting codes, and can also have multiple lines by using forward slashes (/).

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

shows

Align

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

shows

Smells like in here!

Default

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

shows

Link

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

shows


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

shows

Note that this retains the title.


Mods

A mod image is specified with the Mod: section of the name (or by setting a default mod using the mod parameter). The image link will then link to the mod sub-page allowing correct linking of mod images. The uploaded image name should by uploaded as Grid <Name> (<Mod>).png and should be added to the Inventory slot mods category, which prevents them from being confused with official Minecraft items.
For example, to display this mod image File:Grid Bronze Sword (IndustrialCraft).png: {{Slot|IndustrialCraft:Bronze Sword}} (or {{Slot|mod=IndustrialCraft|Bronze Sword}})

shows

Bronze Sword


Slots can be animated with a theoretically unlimited amount of frames, between mod items and vanilla items. Frames are separated by semi-colons (;).

{{Slot|
Dirt;
TNT,64;
IndustrialCraft:Bronze Sword,6;
;
Grass Block,5;
Sand;
Gold Helmet,12;
IndustrialCraft:Bronze Helmet,2;
IndustrialCraft:Copper,50;
Redstone
}}
shows

64Bronze Sword65Gold Helmet12Bronze Helmet250

As you can see, the mod had to be specified for each mod frame, this is where the default mod parameter is useful. {{Slot|mod=IndustrialCraft|Bronze Sword,6; ; Bronze Helmet,12; Copper,50; Copper Dust}}

shows

Bronze Sword6Bronze Helmet1250Copper Dust

To use a vanilla minecraft item when a default mod is set, use "vanilla" (shortcut "v") or "minecraft" (shortcut "mc") as the mod (case insensitive).

{{Slot|mod=IndustrialCraft|
Vanilla:Dirt;
vanilla:TNT,64;
Bronze Sword,6;
;
V:Grass Block,5;
v:Sand;
Minecraft:Gold Helmet,12;
Bronze Helmet,2;
Copper,50;
mc:Redstone Dust
}}
shows

64Bronze Sword65Gold Helmet12Bronze Helmet250

Available images

Template:InvSprite/Image list

Other templates

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