<commit_before>package com.comandante.creeper.Items;

import com.comandante.creeper.managers.GameManager;
import com.comandante.creeper.model.CreeperEntity;

import java.util.Random;
import java.util.Set;

public class ItemSpawner extends CreeperEntity {

    private final ItemType spawnItemType;
    private final ItemSpawnRule itemSpawnRule;
    private final GameManager gameManager;
    private Integer roomId;
    private int noTicks = 0;
    private final Random random = new Random();

    public ItemSpawner(ItemType spawnItemType, ItemSpawnRule itemSpawnRule, GameManager gameManager) {
        this.spawnItemType = spawnItemType;
        this.itemSpawnRule = itemSpawnRule;
        this.gameManager = gameManager;
    }

    public void incTicks() {
        noTicks++;
    }

    public void setRoomId(Integer roomId) {
        this.roomId = roomId;
    }

    @Override
    public void run() {
        incTicks();
        int numberCurrentlyInRoom = 0;
        if (noTicks >= itemSpawnRule.getSpawnIntervalTicks()) {
            Set<String> itemIds = gameManager.getRoomManager().getRoom(roomId).getItemIds();
            for (String i : itemIds) {
                Item currentItem = gameManager.getEntityManager().getItemEntity(i);
                ItemType currentItemType = ItemType.itemTypeFromCode(currentItem.getItemTypeId());
                if (currentItemType.equals(spawnItemType)) {
                    numberCurrentlyInRoom++;
                }
            }
            while (numberCurrentlyInRoom < itemSpawnRule.getMaxPerRoom()) {
                if (itemSpawnRule.getRandomChance().isPresent()) {
                    if (random.nextInt(100) < itemSpawnRule.getRandomChance().get()) {
                        Item item = spawnItemType.create();
                        gameManager.getEntityManager().addItem(item);
                        gameManager.placeItemInRoom(roomId, item.getItemId());
                        numberCurrentlyInRoom++;
                        continue;
                    }
                }
                Item item = spawnItemType.create();
                gameManager.getEntityManager().addItem(item);
                gameManager.placeItemInRoom(roomId, item.getItemId());
                numberCurrentlyInRoom++;
            }
        }
    }


}
<commit_msg>sheesh another one<commit_after>package com.comandante.creeper.Items;

import com.comandante.creeper.managers.GameManager;
import com.comandante.creeper.model.CreeperEntity;

import java.util.Random;
import java.util.Set;

public class ItemSpawner extends CreeperEntity {

    private final ItemType spawnItemType;
    private final ItemSpawnRule itemSpawnRule;
    private final GameManager gameManager;
    private Integer roomId;
    private int noTicks = 0;
    private final Random random = new Random();

    public ItemSpawner(ItemType spawnItemType, ItemSpawnRule itemSpawnRule, GameManager gameManager) {
        this.spawnItemType = spawnItemType;
        this.itemSpawnRule = itemSpawnRule;
        this.gameManager = gameManager;
    }

    public void incTicks() {
        noTicks++;
    }

    public void setRoomId(Integer roomId) {
        this.roomId = roomId;
    }

    @Override
    public void run() {
        incTicks();
        int numberCurrentlyInRoom = 0;
        if (noTicks >= itemSpawnRule.getSpawnIntervalTicks()) {
            Set<String> itemIds = gameManager.getRoomManager().getRoom(roomId).getItemIds();
            for (String i : itemIds) {
                Item currentItem = gameManager.getEntityManager().getItemEntity(i);
                ItemType currentItemType = ItemType.itemTypeFromCode(currentItem.getItemTypeId());
                if (currentItemType.equals(spawnItemType)) {
                    numberCurrentlyInRoom++;
                }
            }
            while (numberCurrentlyInRoom < itemSpawnRule.getMaxPerRoom()) {
                if (itemSpawnRule.getRandomChance().isPresent()) {
                    if (random.nextInt(100) < itemSpawnRule.getRandomChance().get()) {
                        Item item = spawnItemType.create();
                        gameManager.getEntityManager().addItem(item);
                        gameManager.placeItemInRoom(roomId, item.getItemId());
                        numberCurrentlyInRoom++;
                        continue;
                    }
                } else {
                    continue;
                }
                Item item = spawnItemType.create();
                gameManager.getEntityManager().addItem(item);
                gameManager.placeItemInRoom(roomId, item.getItemId());
                numberCurrentlyInRoom++;
            }
        }
    }


}

{'fraction_non_alphanumeric': 0.08844842284739983, 'fraction_numerical': 0.002131287297527707, 'mean_word_length': 2.093605800922874, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5105403', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1252, 'n_words': 230}