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
;
Nome | Tipo | Required | Default Value | Notes |
---|---|---|---|---|
Nome axisAlignedBB | Tipo MCAxisAlignedBB | Required No | Default Value Full Block | Notes Lets you set the block's bounding box |
Nome beaconBase | Tipo boolean | Required No | Default Value no | Notes Can this block be used as part of a beacon's base? |
Nome blockColorSupplier | Tipo IBlockColorSupplier | Required No | Default Value -1 as color | Notes The block's color |
Nome blockHardness | Tipo float | Required No | Default Value 5.0 | Notes How long it takes to break |
Nome blockLayer | Tipo String | Required No | Default Value "SOLID" | Notes "SOLID", "CUTOUT_MIPPED", "CUTOUT", "TRANSLUCENT" |
Nome blockMaterial | Tipo IMaterialDefinition | Required No | Default Value Iron | Notes The Block's base material |
Nome blockResistance | Tipo float | Required No | Default Value 5.0 | Notes Explosion resistance |
Nome blockSoundType | Tipo SoundType | Required No | Default Value Metal | Notes The Block's sound type (determines things like the breaking sound) |
Nome creativeTab | Tipo CreativeTab | Required No | Default Value Misc | Notes The Creative tab the item will appear in |
Nome dropHandler | Tipo IBlockDropHandler | Required No | Default Value | Notes What the block will drop when broken |
Nome entitySpawnable | Tipo boolean | Required No | Default Value sì | Notes Can be used to prevent any entities from spawning on this block |
Nome enumBlockRenderType | Tipo String | Required No | Default Value "MODEL" | Notes "INVISIBLE", "LIQUID", "ENTITYBLOCK_ANIMATED", "MODEL" → Sets how the block is rendered |
Nome fullBlock | Tipo boolean | Required No | Default Value True | Notes Used for rendering and light calculations |
Nome gravity | Tipo boolean | Required No | Default Value no | Notes Is this block affected by gravity |
Nome itemColorSupplier | Tipo IItemColorSupplier | Required No | Default Value -1 as color | Notes The block's color when it is in item form |
Nome lightOpacity | Tipo int | Required No | Default Value 255 if fullBlock is true or 0 | Notes Does Light pass through |
Nome lightValue | Tipo int | Required No | Default Value 0 | Notes Light level of block, ranges from 0-1. This value is multiplied by 15 to determine the final value. |
Nome onBlockBreak | Tipo IBlockAction | Required No | Default Value | Notes Called when Block is broken. |
Nome onBlockPlace | Tipo IBlockAction | Required No | Default Value | Notes Called when Block is placed. |
Nome onRandomTick | Tipo IBlockAction | Required No | Default Value | Notes Called on a random tick event. |
Nome onUpdateTick | Tipo IBlockAction | Required No | Default Value | Notes Called when Block receives a block update. |
Nome passable | Tipo boolean | Required No | Default Value Depending on the IMaterialDefinition provided | Notes Can players pass through this block? |
Nome replaceable | Tipo boolean | Required No | Default Value Depending on the IMaterialDefinition provided | Notes Can this block be replaced by another block? |
Nome slipperiness | Tipo float | Required No | Default Value 0.6f | Notes Ice blocks are 0.98f |
Nome textureLocation | Tipo CTResourceLocation | Required No | Default Value null | Notes The block's resource location, used for textures etc. |
Nome toolClass | Tipo String | Required No | Default Value pickaxe | Notes Tool required to Break Block |
Nome toolLevel | Tipo int | Required No | Default Value 2 | Notes Tool Level required to Break Block |
Nome translucent | Tipo boolean | Required No | Default Value no | Notes Is see through |
Nome unlocalizedName | Tipo String | Required Yes | Default Value | Notes Name, should be all lowercase |
Nome witherProof | Tipo boolean | Required No | Default Value no | Notes Can Wither's destroy this block |
Esempi
Link to esempi
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!