Block
Link to block
Fields
Link to fields
Required Fields will never have a default value, empty defaults means null.
All Fields can be set via setName
e.g. block.setUnlocalizedName("name");
and gotten via getName
;
名称 | 类型 | Required | 默认值 | 注意 |
---|---|---|---|---|
名称 axisAlignedBB | 类型 MCAxisAlignedBB | Required No | 默认值 Full Block | 注意 Lets you set the block's bounding box |
名称 beaconBase | 类型 布尔值 | Required No | 默认值 false | 注意 Can this block be used as part of a beacon's base? |
名称 blockColorSupplier | 类型 IBlockColorSupplier | Required No | 默认值 -1 as color | 注意 The block's color |
名称 blockHardness | 类型 float | Required No | 默认值 5.0 | 注意 How long it takes to break |
名称 blockLayer | 类型 字符串[string] | Required No | 默认值 "SOLID" | 注意 "SOLID", "CUTOUT_MIPPED", "CUTOUT", "TRANSLUCENT" |
名称 blockMaterial | 类型 IMaterialDefinition | Required No | 默认值 Iron | 注意 The Block's base material |
名称 blockResistance | 类型 float | Required No | 默认值 5.0 | 注意 Explosion resistance |
名称 blockSoundType | 类型 SoundType | Required No | 默认值 Metal | 注意 The Block's sound type (determines things like the breaking sound) |
名称 creativeTab | 类型 CreativeTab | Required No | 默认值 Misc | 注意 The Creative tab the item will appear in |
名称 dropHandler | 类型 IBlockDropHandler | Required No | 默认值 | 注意 What the block will drop when broken |
名称 entitySpawnable | 类型 布尔值 | Required No | 默认值 true | 注意 Can be used to prevent any entities from spawning on this block |
名称 enumBlockRenderType | 类型 字符串[string] | Required No | 默认值 "MODEL" | 注意 "INVISIBLE", "LIQUID", "ENTITYBLOCK_ANIMATED", "MODEL" → Sets how the block is rendered |
名称 fullBlock | 类型 布尔值 | Required No | 默认值 True | 注意 Used for rendering and light calculations |
名称 gravity | 类型 布尔值 | Required No | 默认值 false | 注意 Is this block affected by gravity |
名称 itemColorSupplier | 类型 IItemColorSupplier | Required No | 默认值 -1 as color | 注意 The block's color when it is in item form |
名称 lightOpacity | 类型 int | Required No | 默认值 255 if fullBlock is true or 0 | 注意 Does Light pass through |
名称 lightValue | 类型 int | Required No | 默认值 0 | 注意 Light level of block, ranges from 0-1. This value is multiplied by 15 to determine the final value. |
名称 onBlockBreak | 类型 IBlockAction | Required No | 默认值 | 注意 Called when Block is broken. |
名称 onBlockPlace | 类型 IBlockAction | Required No | 默认值 | 注意 Called when Block is placed. |
名称 onRandomTick | 类型 IBlockAction | Required No | 默认值 | 注意 Called on a random tick event. |
名称 onUpdateTick | 类型 IBlockAction | Required No | 默认值 | 注意 Called when Block receives a block update. |
名称 passable | 类型 布尔值 | Required No | 默认值 Depending on the IMaterialDefinition provided | 注意 Can players pass through this block? |
名称 replaceable | 类型 布尔值 | Required No | 默认值 Depending on the IMaterialDefinition provided | 注意 Can this block be replaced by another block? |
名称 slipperiness | 类型 float | Required No | 默认值 0.6f | 注意 Ice blocks are 0.98f |
名称 textureLocation(材质位置) | 类型 CTResourceLocation | Required No | 默认值 null | 注意 The block's resource location, used for textures etc. |
名称 toolClass | 类型 字符串[string] | Required No | 默认值 pickaxe | 注意 Tool required to Break Block |
名称 toolLevel | 类型 int | Required No | 默认值 2 | 注意 Tool Level required to Break Block |
名称 translucent | 类型 布尔值 | Required No | 默认值 false | 注意 Is see through |
名称 unlocalizedName | 类型 字符串[string] | Required Yes | 默认值 | 注意 Name, should be all lowercase |
名称 witherProof | 类型 布尔值 | Required No | 默认值 false | 注意 Can Wither's destroy this block |
ZenScript Copy#loader contenttweaker
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Block;
var antiIceBlock = VanillaFactory.createBlock("anti_ice", <blockmaterial:ice>);
antiIceBlock.setLightOpacity(3);
antiIceBlock.setLightValue(0);
antiIceBlock.setBlockHardness(5.0);
antiIceBlock.setBlockResistance(5.0);
antiIceBlock.setToolClass("pickaxe");
antiIceBlock.setToolLevel(0);
antiIceBlock.setBlockSoundType(<soundtype:snow>);
antiIceBlock.setSlipperiness(0.3);
antiIceBlock.register();
Localising the block
Link to localising-the-block
You will need to add tile.contenttweaker.blockName.name=Localized Name
to the responding language files.
If you have doubts, take a look at the display name of the item when you're holding it before translating it.
Alternatively, you could use CraftTweaker's localization feature, though it's recommended using the language files!