- 致编者:请牢记我们的域名wiki.mcbe-dev.net!
- 致编者:欢迎加入本Wiki的官方交流QQ群或Discord服务器!
- 基岩版1.19.31现已发布!(了解更多)
- Inner Core现已支持Xbox模组联机!(了解更多)
- 如果您是第一次来到本Wiki,欢迎注册一个账户
- 点击顶部的“编辑”或“编辑源代码”按钮即可编辑当前页面
- 请知悉:在不登录时也可以编辑和新建页面,但是您当前的IP地址会记录在编辑历史中
Module:IDInfo/Block
来自Minecraft基岩版开发Wiki
local p = {
subheader = '方块',
attributeList = {
'TileID',
'BlockItemID',
'RawID',
'NumericID',
'Experimental',
'Stackable',
'CreativeCategory',
'CreativeGroup',
'Rarity',
'Material',
'MapColor',
'ExplosionRes',
'Hardness',
'Friction',
'FlameOdds',
'BurnOdds',
'CanBeIgnitedByLava',
'LightLevel',
'LightOpaque',
'Translucency',
'BackfaceCulling',
'RenderLayer',
'BlockShape',
'Solid',
'Liquid',
'CircuitComponent',
'RedstoneConductor',
'RedstoneConnector',
'CanBeExtraBlock',
'CanContainExtraBlock',
'CanSpawnOn',
'Renewable',
},
infoboxRows = {
{ label = '实例方块标识符', field = 1 },
{ label = '方块物品标识符', field = 2 },
{ label = '原始标识符', field = 3 },
{ label = '数字标识符', field = 4 },
{ label = '实验性', field = 5 },
{ label = '最大堆叠数', field = 6 },
{ label = '物品栏', field = {
{ label = '分类', field = 7 },
{ label = '分组', field = 8 }
} },
{ label = '稀有度', field = 9 },
{ label = '[[方块/材料|方块材料]]', field = 10 },
{ label = '地图颜色', field = 11 },
{ label = '[[爆炸#爆炸抗性|爆炸抗性]]', field = 12 },
{ label = '硬度', field = 13 },
{ label = '摩擦因数', field = 14 },
{ label = '可燃性', field = {
{ label = '引燃几率', field = 15 },
{ label = '烧毁几率', field = 16 },
{ label = '能被[[Manual:Minecraft:lava|熔岩]]引燃', field = 17 },
} },
{ label = '光照等级', field = 18 },
{ label = '不透明度', field = 19 },
{ label = '半透明度', field = 20 },
{ label = '背面剔除', field = 21 },
{ label = '渲染图层', field = 22 },
{ label = '[[方块/形状|方块形状]]', field = 23 },
{ label = '固体方块', field = 24 },
{ label = '液体方块', field = 25 },
{ label = '电路元件类型', field = 26 },
{ label = '红石导体', field = 27 },
{ label = '红石连接', field = {
{ label = '北面', field = 28, index = 1 },
{ label = '南面', field = 28, index = 2 },
{ label = '西面', field = 28, index = 3 },
{ label = '东面', field = 28, index = 4 },
} },
{ label = '额外方块', field = {
{ label = '可充当', field = 29 },
{ label = '可包含', field = 30 },
} },
{ label = '可生成生物', field = 31 },
{ label = '可再生', field = 32 },
}
}
function p.format( Attributes )
local yesno = require( 'Module:IDInfo/Gadget' ).Yesno
local match = require( 'Module:IDInfo/Gadget' ).Match
if Attributes.identical.RawID ~= nil then
Attributes.identical.TileID = Attributes.identical.TileID or ( 'tile.' .. Attributes.identical.RawID )
Attributes.identical.BlockItemID = Attributes.identical.BlockItemID or Attributes.identical.RawID
end
for data, attributes in pairs( Attributes ) do
Attributes[ data ][ 'Experimental' ] = yesno( attributes.Experimental )
if attributes.CreativeCategory ~= nil then
Attributes[ data ][ 'CreativeCategory' ] = match( 'Item/Category', attributes.CreativeCategory, 'id', 'key' )
Attributes[ data ][ 'CreativeGroup' ] = attributes.CreativeGroup
else
Attributes[ data ][ 'CreativeGroup' ] = nil
end
if attributes.Rarity ~= nil then
Attributes[ data ][ 'Rarity' ] = match( 'Item/Rarity', attributes.Rarity, 'value', 'name' )
end
if attributes.Material ~= nil then
Attributes[ data ][ 'Material' ] = match( 'Block/MaterialType', attributes.Material, 'id', 'key' )
end
if ( attributes.MapColor ~= nil ) then
local color = tonumber(attributes.MapColor)
if (color ~= nil) then
if (color > 16777215) then
color = mw.ustring.format('#%08X', color)
elseif (color > 4095) then
color = mw.ustring.format('#%06X', color)
else
color = mw.ustring.format('#%03X', color)
end
Attributes[ data ][ 'MapColor' ] = mw.ustring.format(
'<span style="display:inline-block; background-color:%s; border-radius:1em; height:1em; width:1em; border:1px solid #aaa; vertical-align:text-top"><br></span> %s',
color,
color
)
end
end
if attributes.FlameOdds ~= nil then
local value = tostring( attributes.FlameOdds )
if value == '5' then
value = '5 (困难)'
elseif value == '20' then
value = '20 (中等)'
elseif value == '60' then
value = '60 (容易)'
elseif value == '100' then
value = '100 (瞬间)'
end
Attributes[ data ][ 'FlameOdds' ] = value
end
if attributes.BurnOdds ~= nil then
local value = tostring( attributes.BurnOdds )
if value == '5' then
value = '5 (困难)'
elseif value == '20' then
value = '15 (中等)'
elseif value == '60' then
value = '30 (容易)'
elseif value == '100' then
value = '60 (瞬间)'
end
Attributes[ data ][ 'BurnOdds' ] = value
end
Attributes[ data ][ 'Renewable' ] = yesno( attributes.Renewable )
Attributes[ data ][ 'CanBeIgnitedByLava' ] = yesno( attributes.CanBeIgnitedByLava )
Attributes[ data ][ 'BackfaceCulling' ] = yesno( attributes.BackfaceCulling )
if attributes.BlockShape ~= nil then
Attributes[ data ][ 'BlockShape' ] = match( 'Block/BlockShape', attributes.BlockShape, 'id', 'key' )
end
Attributes[ data ][ 'Solid' ] = yesno( attributes.Solid )
Attributes[ data ][ 'Liquid' ] = yesno( attributes.Liquid )
if attributes.CircuitComponent ~= nil then
local str = mw.ustring.lower( tostring( attributes.CircuitComponent ) )
if str == 'none' then
Attributes[ data ][ 'CircuitComponent' ] = nil
elseif str == 'producer' then
Attributes[ data ][ 'CircuitComponent' ] = '发电器'
elseif str == 'consumer' then
Attributes[ data ][ 'CircuitComponent' ] = '耗电器'
elseif str == 'capacitor' then
Attributes[ data ][ 'CircuitComponent' ] = '电容器'
elseif str == 'transporter' then
Attributes[ data ][ 'CircuitComponent' ] = '运输器'
end
end
Attributes[ data ][ 'RedstoneConductor' ] = yesno( attributes.RedstoneConductor )
if attributes.RedstoneConnector ~= nil then
if ( type( attributes.RedstoneConnector ) == 'string' ) then
local str = mw.ustring.lower( attributes.RedstoneConnector )
if str == 'true' then
attributes.RedstoneConnector = 'true;true;true;true'
elseif str == 'false' then
attributes.RedstoneConnector = 'false;false;false;false'
end
attributes.RedstoneConnector = mw.text.split( attributes.RedstoneConnector, ';' )
end
if ( type( attributes.RedstoneConnector ) == 'table' ) then
Attributes[ data ][ 'RedstoneConnector' ] = {}
for index = 1, 4 do
Attributes[ data ][ 'RedstoneConnector' ][ index ] = yesno( attributes.RedstoneConnector[ index ] ) or '否'
end
end
end
Attributes[ data ][ 'CanBeExtraBlock' ] = yesno( attributes.CanBeExtraBlock )
Attributes[ data ][ 'CanContainExtraBlock' ] = yesno( attributes.CanContainExtraBlock )
Attributes[ data ][ 'CanSpawnOn' ] = yesno( attributes.CanSpawnOn )
end
return Attributes
end
return p