Confirmedusers
536
edits
(Marked this version for translation) |
m (Updated navbox to new code navbox.) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
<languages/> | <languages/> | ||
<translate> | |||
<!--T:89--> | |||
__FORCETOC__ | __FORCETOC__ | ||
</translate> | |||
<translate> | <translate> | ||
<!--T:48--> | <!--T:48--> | ||
Line 7: | Line 10: | ||
<translate> | <translate> | ||
= Introduction = | = Introduction = <!--T:49--> | ||
Block Behaviors are useful when you want different blocks to act in the same way, as you can attach one or more block behaviors to an arbitrary number of blocks. | Block Behaviors are useful when you want different blocks to act in the same way, as you can attach one or more block behaviors to an arbitrary number of blocks. | ||
You may want to have a look at the existing [[Block Json Properties#p_behaviors|block behaviors]] before implementing your own. | You may want to have a look at the existing [[Block Json Properties#p_behaviors|block behaviors]] before implementing your own. | ||
Line 74: | Line 77: | ||
if (world.BlockAccessor.GetBlock(pos).IsReplacableBy(block)) | if (world.BlockAccessor.GetBlock(pos).IsReplacableBy(block)) | ||
{ | { | ||
// Remove the block at the current position and place it at the target position | <translate> | ||
<!--T:88--> | |||
// Remove the block at the current position and place it at the target position | |||
</translate> | |||
world.BlockAccessor.SetBlock(0, blockSel.Position); | world.BlockAccessor.SetBlock(0, blockSel.Position); | ||
world.BlockAccessor.SetBlock(block.BlockId, pos); | world.BlockAccessor.SetBlock(block.BlockId, pos); | ||
Line 263: | Line 269: | ||
</translate> | </translate> | ||
{{Navbox/codemodding}} | |||
{{Navbox/ |