Add a block with the given `texture` and `position` to the world. Parameters ---------- position : tuple of len 3 The (x, y, z) position of the block to add. texture : list of len 3 The coordinates of the texture squares. Use `tex_coords()` t
(self, position, texture, immediate=True)
| 231 | return False |
| 232 | |
| 233 | def add_block(self, position, texture, immediate=True): |
| 234 | """ Add a block with the given `texture` and `position` to the world. |
| 235 | |
| 236 | Parameters |
| 237 | ---------- |
| 238 | position : tuple of len 3 |
| 239 | The (x, y, z) position of the block to add. |
| 240 | texture : list of len 3 |
| 241 | The coordinates of the texture squares. Use `tex_coords()` to |
| 242 | generate. |
| 243 | immediate : bool |
| 244 | Whether or not to draw the block immediately. |
| 245 | |
| 246 | """ |
| 247 | if position in self.world: |
| 248 | self.remove_block(position, immediate) |
| 249 | self.world[position] = texture |
| 250 | self.sectors.setdefault(sectorize(position), []).append(position) |
| 251 | if immediate: |
| 252 | if self.exposed(position): |
| 253 | self.show_block(position) |
| 254 | self.check_neighbors(position) |
| 255 | |
| 256 | def remove_block(self, position, immediate=True): |
| 257 | """ Remove the block at the given `position`. |
no test coverage detected