Jump to content

NBT Usage Help [Solved]


wookiederk

Recommended Posts

Hi, I'm doing a little experimenting with NBT Tags. I'm  trying to save and load data player specific but I do not know how to access it correctly. It just results in a crash when I try to save/load to the tag. The additional properties attach to the player in my main file. Here is my code for the extended properties and Item class that call it:

Both Save and Load NBT arent working.

Extended Properties Class:

public static boolean[] recipes;
public static String[] recipeNames;

@Override
public void saveNBTData(NBTTagCompound compound) {
	NBTTagList cookValues = new NBTTagList();
	for (int i = 0; i < recipes.length; i++) {
		compound.setBoolean(recipeNames[i], recipes[i]);
		cookValues.appendTag(compound);
	}
	compound.setTag("Cookbook", cookValues);
}

@Override
public void loadNBTData(NBTTagCompound compound) {
	NBTTagList cookValues = compound.getTagList("Cookbook");
	for (int i = 0; i < cookValues.tagCount(); i++) {
		this.recipes[i] = compound.getBoolean(recipeNames[i]);
		System.out.println(recipes[i]);
	}
}

@Override
public void init(Entity entity, World world) {

}

public void writeRecipe(boolean par1, int par2, String par3) {
	recipes[par2] = par1;
	this.recipeNames[par2] = par3;
} 

 

Food Class:

@Override
public void onFoodEaten(ItemStack itemstack, World world,
		EntityPlayer player) {
	player.getFoodStats().addStats(this);
	world.playSoundAtEntity(player, "random.burp", 0.5F,
			world.rand.nextFloat() * 0.1F + 0.9F);
	this.addPotionEffects(itemstack, world, player);
	((EventCookbook) player.getExtendedProperties("Cookbook")).writeRecipe(
			true, 0);
} 

 

Any help appreciated

 

Edit: Fixed it on my own

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • If you are using AMD/ATI, get the latest drivers from their website
    • Add the mod lmft: https://www.curseforge.com/minecraft/mc-mods/lmft   If there is no change, you have to remove the mods in groups/one by one until you find the one causing this issue
    • +256754810143 NATIVE BLACK MAGIC SPELLS CASTER IN SOUTH AMERICA-SOUTH AFRICA-CANADA-AUSTRALIA-ASIA-NEW ZEALAND.@@@$+256754810143@powerful-black-magic-instant-revenge-spell-caster-in-uganda-netherlands-spain-scotland-south-africa-instant-revenge-spell-caster-revenge-spell-in-italy-norway-austria-vienna% POWERFUL DEATH SPELL CASTER INSTANT DEATH SPELLS IN, USA UK U.A.E.**^^SPELL CASTER, DEATH SPELL, SPELL CASTER REVIEW, WITCHCRAFT, PSYCHIC, MAGIC FORUM, BLACK MAGIC IN AMSTERDAM, GERMANY, SPAIN Results are 100% s=ure and guaranteed, spell casting specialist, , black magic death spells that work overnight or by accident. I Cast these strongest black magic revenge death spells that work fast overnight to kill ex-lover, husband, wife girlfriend Enemies  she is in a far location, I guarantee you to have your results you are looking for immediately. Just make sure before you contact me you are committed and you want what you are looking for (Victim Death) because my death spell work fast overnight after casting the spells that work, guaranteed black magic love spells, guaranteed voodoo spells, spell to make someone sick and die, revenge spells that work instantly, real witches for hire, revenge spells on an ex- lover, how to put a Black magic death spells on ex-lover, Revenge instant death spells on toxic uncles powerful instant death spells online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece. Death spell on someone, death spells that Death Revenge Spell on wicked friends, Voodoo Death Spells to kill Enemies Black Magic Spells To Harm Someone, Black magic death spells on ex-lover, Revenge instant death spells on toxic uncles powerful instant death spells online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, revenge spells, most powerful death spell, spell to die in your sleep, successful death spell, most powerful voodoo spell caster, voodoo spell casters in new Orleans, voodoo love spells reviews, proven authentic voodoo spell casters, most powerful voodoo priest in world, black magic tricks to destroy enemy. Results are 100% sure and guaranteed whatapp or cal, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. spells, guaranteed voodoo spells, spell to make someone sick and die, revenge spells that work instantly, real witches for hire, revenge spells on an ex- lover, how to put a spell on someone who hurts you, spell to make someone sick, voodoo spells to hurt someone, spells to curse someone, powerful revenge spells, most powerful death spell, spell to die in your sleep, successful death spell, most powerful voodoo spell caster, voodoo spell casters in new Orleans, voodoo love spells reviews, proven authentic voodoo spell casters, most powerful voodoo priest in world, black magic tricks to destroy enemy. Results are 100% sure and guaranteed whatapp or call  ஜ۩۞۩ஜ ??@@$+256754810143
    • POWERFUL BLACK MAGIC INSTANT DEATH SPELL CASTER IN GERMANY.@@@$+256754810143@powerful-black-magic-instant-revenge-spell-caster-in-uganda-netherlands-spain-scotland-south-africa-instant-revenge-spell-caster-revenge-spell-in-italy-norway-austria-vienna% POWERFUL DEATH SPELL CASTER INSTANT DEATH SPELLS IN, USA UK U.A.E.**^^SPELL CASTER, DEATH SPELL, SPELL CASTER REVIEW, WITCHCRAFT, PSYCHIC, MAGIC FORUM, BLACK MAGIC IN AMSTERDAM, GERMANY, SPAIN Results are 100% s=ure and guaranteed, spell casting specialist, , black magic death spells that work overnight or by accident. I Cast these strongest black magic revenge death spells that work fast overnight to kill ex-lover, husband, wife girlfriend Enemies  she is in a far location, I guarantee you to have your results you are looking for immediately. Just make sure before you contact me you are committed and you want what you are looking for (Victim Death) because my death spell work fast overnight after casting the spells that work, guaranteed black magic love spells, guaranteed voodoo spells, spell to make someone sick and die, revenge spells that work instantly, real witches for hire, revenge spells on an ex- lover, how to put a Black magic death spells on ex-lover, Revenge instant death spells on toxic uncles powerful instant death spells online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece. Death spell on someone, death spells that Death Revenge Spell on wicked friends, Voodoo Death Spells to kill Enemies Black Magic Spells To Harm Someone, Black magic death spells on ex-lover, Revenge instant death spells on toxic uncles powerful instant death spells online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, revenge spells, most powerful death spell, spell to die in your sleep, successful death spell, most powerful voodoo spell caster, voodoo spell casters in new Orleans, voodoo love spells reviews, proven authentic voodoo spell casters, most powerful voodoo priest in world, black magic tricks to destroy enemy. Results are 100% sure and guaranteed whatapp or cal, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. spells, guaranteed voodoo spells, spell to make someone sick and die, revenge spells that work instantly, real witches for hire, revenge spells on an ex- lover, how to put a spell on someone who hurts you, spell to make someone sick, voodoo spells to hurt someone, spells to curse someone, powerful revenge spells, most powerful death spell, spell to die in your sleep, successful death spell, most powerful voodoo spell caster, voodoo spell casters in new Orleans, voodoo love spells reviews, proven authentic voodoo spell casters, most powerful voodoo priest in world, black magic tricks to destroy enemy. Results are 100% sure and guaranteed whatapp or call  ஜ۩۞۩ஜ ??@@$+256754810143
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.