<commit_before>package refinedstorage.apiimpl.network;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import refinedstorage.api.network.INetworkMaster;

import java.util.HashMap;
import java.util.Map;

public class NetworkMasterRegistry {
    public static final Map<Integer, Map<BlockPos, INetworkMaster>> NETWORKS = new HashMap<Integer, Map<BlockPos, INetworkMaster>>();

    public static void add(World world, INetworkMaster network) {
        add(world.provider.getDimension(), network);
    }

    public static void add(int dim, INetworkMaster network) {
        if (NETWORKS.get(dim) == null) {
            NETWORKS.put(dim, new HashMap<BlockPos, INetworkMaster>());
        }

        NETWORKS.get(dim).put(network.getPosition(), network);
    }

    public static void remove(World world, BlockPos pos) {
        if (get(world) != null) {
            INetworkMaster network = get(world).get(pos);
<commit_msg>Mark dirty on placement too<commit_after>package refinedstorage.apiimpl.network;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import refinedstorage.api.network.INetworkMaster;

import java.util.HashMap;
import java.util.Map;

public class NetworkMasterRegistry {
    public static final Map<Integer, Map<BlockPos, INetworkMaster>> NETWORKS = new HashMap<Integer, Map<BlockPos, INetworkMaster>>();

    public static void add(World world, INetworkMaster network) {
        add(world.provider.getDimension(), network);

        NetworkMasterSavedData.getOrLoad(world).markDirty();
    }

    public static void add(int dim, INetworkMaster network) {
        if (NETWORKS.get(dim) == null) {
            NETWORKS.put(dim, new HashMap<BlockPos, INetworkMaster>());
        }

        NETWORKS.get(dim).put(network.getPosition(), network);
    }

    public static void remove(World world, BlockPos pos) {
        if (get(world) != null) {
            INetworkMaster network = get(world).get(pos);

{'fraction_non_alphanumeric': 0.11308316430020283, 'fraction_numerical': 0.0, 'mean_word_length': 3.823960880195599, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2406149', 'n_tokens_mistral': 588, 'n_tokens_neox': 582, 'n_words': 133}