public void tick(GameContainer container, StateBasedGame game, int delta) throws SlickException {
        tickCount++;
        
        Input input = container.getInput();
        
        for (int i = 0; i < entities.size(); i++) {
            Entity e = entities.get(i);
            
            for (int j = 0; j < entities.size(); j++) {
                Entity e2 = entities.get(j);
                if (e2 != e && e.intersects(e2) && e.isCollidable() && e2.isCollidable()) {
                    e.onHit(e2);
                    Collision.doCollision(e, e2);
                }
            }
            
            Collision.doEdgeCollision(e);
            e.update(container, game, delta);
            
            if (e.removed) {
                entities.remove(i--);
            }
        }
        
        Terrain.update(container, game, delta);
        
        if (input.isMousePressed(0)) {
            int mouseX = Mouse.getX();
            int mouseY = Game.height - Mouse.getY();
            
            Entity e = new Entity(mouseX, mouseY);
            add(e);
        }
        
        if (input.isKeyPressed(Input.KEY_T)) {
            terrainMode = !terrainMode;
        }
    }