<commit_before>package net.mcft.copy.betterstorage.misc;

import net.mcft.copy.betterstorage.utils.NbtUtils;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;

public class PropertiesBackpackItems implements IExtendedEntityProperties {
	
	public static final String identifier = "BetterStorage.BackpackItems";
	
	public ItemStack[] contents = null;
	
	@Override
	public void init(Entity entity, World world) {  }
	
	@Override
	public void saveNBTData(NBTTagCompound compound) {
		if (contents == null) return;
		compound.setTag("BackpackItems", NbtUtils.writeItems(contents));
	}
	
	@Override
	public void loadNBTData(NBTTagCompound compound) {
		if (!compound.hasKey("BackpackItems")) return;
		contents = new ItemStack[compound.getInteger("BackpackItemsCount")];
		NbtUtils.readItems(contents, compound.getTagList("BackpackItems"));
	}
	
}<commit_msg>Actually save the backpack size<commit_after>package net.mcft.copy.betterstorage.misc;

import net.mcft.copy.betterstorage.utils.NbtUtils;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;

public class PropertiesBackpackItems implements IExtendedEntityProperties {
	
	public static final String identifier = "BetterStorage.BackpackItems";
	
	public ItemStack[] contents = null;
	
	@Override
	public void init(Entity entity, World world) {  }
	
	@Override
	public void saveNBTData(NBTTagCompound compound) {
		if (contents == null) return;
		NBTTagCompound backpack = new NBTTagCompound();
		backpack.setInteger("count", contents.length);
		backpack.setTag("Items", NbtUtils.writeItems(contents));
		compound.setTag("Backpack", backpack);
	}
	
	@Override
	public void loadNBTData(NBTTagCompound compound) {
		if (!compound.hasKey("Backpack")) return;
		NBTTagCompound backpack = compound.getCompoundTag("Backpack");
		contents = new ItemStack[backpack.getInteger("count")];
		NbtUtils.readItems(contents, backpack.getTagList("Items"));
	}
	
}
{'fraction_non_alphanumeric': 0.10583446404341927, 'fraction_numerical': 0.0, 'mean_word_length': 6.276315789473684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5325438', 'n_tokens_mistral': 706, 'n_tokens_neox': 663, 'n_words': 135}