MCPcopy Create free account
hub / github.com/fogleman/Minecraft / __init__

Method __init__

main.py:131–156  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

129class Model(object):
130
131 def __init__(self):
132
133 # A Batch is a collection of vertex lists for batched rendering.
134 self.batch = pyglet.graphics.Batch()
135
136 # A TextureGroup manages an OpenGL texture.
137 self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
138
139 # A mapping from position to the texture of the block at that position.
140 # This defines all the blocks that are currently in the world.
141 self.world = {}
142
143 # Same mapping as `world` but only contains blocks that are shown.
144 self.shown = {}
145
146 # Mapping from position to a pyglet `VertextList` for all shown blocks.
147 self._shown = {}
148
149 # Mapping from sector to a list of positions inside that sector.
150 self.sectors = {}
151
152 # Simple function queue implementation. The queue is populated with
153 # _show_block() and _hide_block() calls
154 self.queue = deque()
155
156 self._initialize()
157
158 def _initialize(self):
159 """ Initialize the world by placing all the blocks.

Callers 1

__init__Method · 0.45

Calls 1

_initializeMethod · 0.95

Tested by

no test coverage detected