<commit_before>package com.sots.tiles;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

import com.sots.LogisticsPipes2;
import com.sots.item.ItemWrench;
import com.sots.item.modules.IItemModule;
import com.sots.module.IModule;
import com.sots.routing.Network;
import com.sots.routing.interfaces.IDestination;
import com.sots.routing.interfaces.IPipe;
import com.sots.routing.interfaces.IRoutable;
import com.sots.util.Connections;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSign;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class TileRoutedPipe extends TileGenericPipe implements IRoutable, IPipe, IDestination{
	
	private static final int MAX_MODS = 1;
	private volatile Set<IModule> mods = new HashSet<IModule>();
	
	@Override
    public void readFromNBT(NBTTagCompound compound) {
		super.readFromNBT(compound);
			for(int i = 0; i<MAX_MODS; i++ ){
				mods.add(IModule.getFromType(compound.getInteger("module_" + i)));
			}
		}
	
	@Override
    public NBTTagCompound writeToNBT(NBTTagCompound compound) {
		super.writeToNBT(compound);
		if(!mods.isEmpty()) {
			int modcount = 0;
	        for(IModule mod : mods) {
	        	compound.setInteger("module_" + modcount, mod.modType().ordinal());
	        	modcount+=1;
	        }
		}
		
        return compound;<commit_msg>Try fix all pipes loading the same modules from NBT<commit_after>package com.sots.tiles;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

import com.sots.LogisticsPipes2;
import com.sots.item.ItemWrench;
import com.sots.item.modules.IItemModule;
import com.sots.module.IModule;
import com.sots.routing.Network;
import com.sots.routing.interfaces.IDestination;
import com.sots.routing.interfaces.IPipe;
import com.sots.routing.interfaces.IRoutable;
import com.sots.util.Connections;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSign;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class TileRoutedPipe extends TileGenericPipe implements IRoutable, IPipe, IDestination{
	
	private static final int MAX_MODS = 1;
	private volatile Set<IModule> mods = new HashSet<IModule>();
	
	@Override
    public void readFromNBT(NBTTagCompound compound) {
		super.readFromNBT(compound);
		String stringPos = String.format("%d:%d:%d",posX(),posY(),posZ());
		for(int i = 0; i<MAX_MODS; i++ ){
			mods.add(IModule.getFromType(compound.getInteger(stringPos +"_module_" + i)));
		}
		}
	
	@Override
    public NBTTagCompound writeToNBT(NBTTagCompound compound) {
		super.writeToNBT(compound);
		if(!mods.isEmpty()) {
			int modcount = 0;
	        for(IModule mod : mods) {
	        	compound.setInteger("module_" + modcount, mod.modType().ordinal());
	        	modcount+=1;
	        }
		}
		
        return compound;
{'fraction_non_alphanumeric': 0.11605080831408776, 'fraction_numerical': 0.002886836027713626, 'mean_word_length': 4.689655172413793, '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': '4146114', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1202, 'n_words': 218}