(以“....”为内容创建页面) |
Hatsuki kiri(留言 | 贡献) 小无编辑摘要 |
||
(未显示6个用户的9个中间版本) | |||
第1行: | 第1行: | ||
+ | <includeonly>{{#invoke: Materials row | properties }}</includeonly><noinclude> |
||
− | .... |
||
+ | {{documentation|content= |
||
+ | {{lua|Materials row}} |
||
+ | 该模板用于创建材料属性表,以展示各个[[材料]]的特征。 |
||
+ | |||
+ | == Usage == |
||
+ | |||
+ | The parameter is set to the title to display in the first column. |
||
+ | |||
+ | The parameter {{p|rgb}} contains three color values separated by commas to display as a colored cell and text. It should be set based on the material's map color. If unset, it defaults to a white color and the text "None" |
||
+ | |||
+ | === Properties === |
||
+ | |||
+ | The table contains the following properties. They are set to 1 for true, and 0 for false. |
||
+ | {{pipe escape| |
||
+ | {| class{{=}}"wikitable" |
||
+ | ! Name |
||
+ | ! Subclass only? |
||
+ | ! Description |
||
+ | ! Default |
||
+ | |- |
||
+ | | {{p|liquid}} |
||
+ | | {{tc|no|yes}} |
||
+ | | The block allows the player to swim. |
||
+ | | 0 |
||
+ | |- |
||
+ | | {{p|solid}} |
||
+ | | {{tc|no|yes}} |
||
+ | | This block allows block dependent blocks to be placed on it, and is considered when spawning various structures. |
||
+ | | 1 |
||
+ | |- |
||
+ | | {{p|blocklight}} |
||
+ | | {{tc|no|yes}} |
||
+ | | This block reduces the level of light passing through it (often blocking it entirely). |
||
+ | | 1 |
||
+ | |- |
||
+ | | {{p|blockmove}} |
||
+ | | {{tc|no|yes}} |
||
+ | | This block prevents movement through it, and usually suffocates entities inside of it. |
||
+ | | 1 |
||
+ | |- |
||
+ | | {{p|opaque}} |
||
+ | | {{tc|yes|no}} |
||
+ | | This block cannot be seen through. |
||
+ | | {{p|blockmove}} |
||
+ | |- |
||
+ | | {{p|tool}} |
||
+ | | {{tc|yes|no}} |
||
+ | | This block requires a tool to give a drop. |
||
+ | | 0 |
||
+ | |- |
||
+ | | {{p|burn}} |
||
+ | | {{tc|yes|no}} |
||
+ | | This block can become lit from lava. |
||
+ | | 0 |
||
+ | |- |
||
+ | | {{p|replace}} |
||
+ | | {{tc|yes|no}} |
||
+ | | This block will be replaced from {{control|using}} another block on it. |
||
+ | | 0 |
||
+ | |- |
||
+ | | {{p|adventureExempt}} |
||
+ | | {{tc|yes|no}} |
||
+ | | Does not seem to be used anywhere in Minecraft, and is not displayed in the table. |
||
+ | | 0 |
||
+ | |} |
||
+ | }} |
||
+ | |||
+ | Subclasses can also be set using {{p|subclass}} for to change the defaults based on coded subclasses. Values include: |
||
+ | * <code>liquid</code> |
||
+ | ** defaults {{p|liquid}} and {{p|replace}} to 1 |
||
+ | ** defaults {{p|blockmove}} and {{p|solid}} to 0 |
||
+ | ** defaults {{p|piston}} to "replace" |
||
+ | * <code>nonsolid</code> |
||
+ | ** defaults {{p|adventureExempt}} to 1 |
||
+ | ** defaults {{p|solid}}, {{p|blocklight}} and {{p|blockmove}} to 0 |
||
+ | * <code>portal</code> |
||
+ | ** defaults {{p|solid}}, {{p|blocklight}} and {{p|blockmove}} to 0 |
||
+ | * <code>liquid</code> |
||
+ | ** defaults {{p|replace}} to 1 |
||
+ | ** defaults {{p|solid}}, {{p|blocklight}} and {{p|blockmove}} to 0 |
||
+ | * <code>cobweb</code> |
||
+ | ** defaults {{p|blockmove}} to 1 |
||
+ | |||
+ | The parameter {{p|piston}} can be set to determine the interaction when a piston pushes the block. Options are as follows: |
||
+ | * <code>pushed</code> - pushes the block, default |
||
+ | * <code>replace</code> - breaks the block being pushed |
||
+ | * <code>blocked</code> - stops the piston from extending |
||
+ | |||
+ | == Code == |
||
+ | |||
+ | The parameters generally correspond to the actual structure of the code. |
||
+ | * {{p|subclass}} refers to actual subclasses of the <code>Material</code> class. Names mostly match, but "nonsolid" is <code>MaterialLogic</code>, while "cobweb" is the inline class used for the <code>web</code> material. |
||
+ | * {{p|liquid}} refers to the <code>isLiquid()</code> method. |
||
+ | * {{p|solid}} refers to the <code>isSolid()</code> method. |
||
+ | * {{p|blocklight}} refers to the <code>blocksLight()</code> method. |
||
+ | * {{p|blockmove}} refers to the <code>blocksMovement()</code> method. |
||
+ | * {{p|opaque}} refers to the <code>setTranslucent()</code> and <code>isOpaque()</code> methods. |
||
+ | * {{p|tool}} refers to the <code>setRequiresTool()</code> and <code>isToolNotRequired()</code> methods. |
||
+ | * {{p|burn}} refers to the <code>setBurning()</code> and <code>getCanBurn()</code> methods. |
||
+ | * {{p|replace}} refers to the <code>setReplaceable()</code> and <code>isReplaceable()</code> methods. |
||
+ | * {{p|adventureExempt}} refers to the <code>setAdventureModeExempt()</code> method. |
||
+ | * {{p|piston}} refers to the <code>setNoPushMobility()</code>, <code>setImmovableMobility()</code>, and <code>getMaterialMobility()</code> methods. |
||
+ | |||
+ | [[Category:表格模板]] |
||
+ | }} |
||
+ | <noinclude> |
||
+ | [[en:Materials/properties row]] |
||
+ | </noinclude> |
2020年6月1日 (一) 03:43的版本
此模板使用了Module:Materials row,此脚本使用Lua编写。
更多详情,请参阅维基百科:Lua和MediaWiki:扩展:Scribunto。
该模板用于创建材料属性表,以展示各个材料的特征。
Usage
The parameter is set to the title to display in the first column.
The parameter |rgb=
contains three color values separated by commas to display as a colored cell and text. It should be set based on the material's map color. If unset, it defaults to a white color and the text "None"
Properties
The table contains the following properties. They are set to 1 for true, and 0 for false.
Name | Subclass only? | Description | Default |
---|---|---|---|
|liquid=
|
Yes | The block allows the player to swim. | 0 |
|solid=
|
Yes | This block allows block dependent blocks to be placed on it, and is considered when spawning various structures. | 1 |
|blocklight=
|
Yes | This block reduces the level of light passing through it (often blocking it entirely). | 1 |
|blockmove=
|
Yes | This block prevents movement through it, and usually suffocates entities inside of it. | 1 |
|opaque=
|
No | This block cannot be seen through. | |blockmove=
|
|tool=
|
No | This block requires a tool to give a drop. | 0 |
|burn=
|
No | This block can become lit from lava. | 0 |
|replace=
|
No | This block will be replaced from using another block on it. | 0 |
|adventureExempt=
|
No | Does not seem to be used anywhere in Minecraft, and is not displayed in the table. | 0 |
Subclasses can also be set using |subclass=
for to change the defaults based on coded subclasses. Values include:
liquid
- defaults
|liquid=
and|replace=
to 1 - defaults
|blockmove=
and|solid=
to 0 - defaults
|piston=
to "replace"
- defaults
nonsolid
- defaults
|adventureExempt=
to 1 - defaults
|solid=
,|blocklight=
and|blockmove=
to 0
- defaults
portal
- defaults
|solid=
,|blocklight=
and|blockmove=
to 0
- defaults
liquid
- defaults
|replace=
to 1 - defaults
|solid=
,|blocklight=
and|blockmove=
to 0
- defaults
cobweb
- defaults
|blockmove=
to 1
- defaults
The parameter |piston=
can be set to determine the interaction when a piston pushes the block. Options are as follows:
pushed
- pushes the block, defaultreplace
- breaks the block being pushedblocked
- stops the piston from extending
Code
The parameters generally correspond to the actual structure of the code.
|subclass=
refers to actual subclasses of theMaterial
class. Names mostly match, but "nonsolid" isMaterialLogic
, while "cobweb" is the inline class used for theweb
material.|liquid=
refers to theisLiquid()
method.|solid=
refers to theisSolid()
method.|blocklight=
refers to theblocksLight()
method.|blockmove=
refers to theblocksMovement()
method.|opaque=
refers to thesetTranslucent()
andisOpaque()
methods.|tool=
refers to thesetRequiresTool()
andisToolNotRequired()
methods.|burn=
refers to thesetBurning()
andgetCanBurn()
methods.|replace=
refers to thesetReplaceable()
andisReplaceable()
methods.|adventureExempt=
refers to thesetAdventureModeExempt()
method.|piston=
refers to thesetNoPushMobility()
,setImmovableMobility()
, andgetMaterialMobility()
methods.