Posted January 30, 20169 yr It there a way i can save A custom item with ntb data in a file on the desktop or any other custom location? import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.ArathosRPG.ArathosRPGMod.ArathosRPG; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; public class RINCraftGood extends Item{ private String Rubrik,Lessezeichen; public RINCraftGood(String RubrikString,String Lessezeichen1){ //this.setCreativeTab(ArathosRPG.KoRIN); this.setMaxStackSize(15); this.setCreativeTab(ArathosRPG.KoRIN7); this.Rubrik = RubrikString; this.Lessezeichen = Lessezeichen1; } public RINCraftGood(String RubrikString,boolean a){ //this.setCreativeTab(ArathosRPG.KoRIN); this.setMaxStackSize(15); this.Rubrik = RubrikString; this.setFull3D(); } @SideOnly(Side.CLIENT) public void registerIcons (IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(ArathosRPG.modid + ":" + this.Rubrik + "/" + this.getUnlocalizedName().substring(5)); } @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer Entityplayer) { Vec3 look = Entityplayer.getLookVec(); MovingObjectPosition Coord = Entityplayer.rayTrace(300, 1); EntityLightningBolt Lightning = new EntityLightningBolt(world, 1, 1, 1); Lightning.setPosition(Coord.blockX,Coord.blockY,Coord.blockZ); world.spawnEntityInWorld(Lightning); return itemStack; } public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(Lessezeichen); } } The NBT Data will add ingame through the player by doing stuff with this item. Or the player can create it with NBT stuff like i add this to the item. @Override public void onCreated(ItemStack itemstack, World world,EntityPlayer entityplayer){ int resistanceArmor = 1; itemstack.stackTagCompound = new NBTTagCompound(); itemstack.stackTagCompound.setInteger("armorr", resistanceArmor); } May RPG MOD KoRIN at minecraftforum http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2570463-kingdom-of-rin-rpg-stuff-classes-dungeons http://rin-online.de/forum/
January 30, 20169 yr Author i forgot the file writer i have FileWriter writer; File file2 = new File("KoRIN_ITEMS"); file2.mkdir(); File file = new File("KoRIN_ITEMS/"+CUSTOMID+".txt"); try { writer = new FileWriter(file ,false); writer.write(exsample1); writer.write(System.getProperty("line.separator")); writer.write(exsample2); writer.close(); } catch (IOException e) { e.printStackTrace(); } } the question is how can i save the item and how i can read the item from this file? May RPG MOD KoRIN at minecraftforum http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2570463-kingdom-of-rin-rpg-stuff-classes-dungeons http://rin-online.de/forum/
January 31, 20169 yr CompressedStreamTools allow you to read/write NBT to file. Note that this operation still needs to act only on server. Client cannot manipulate data. 1.7.10 is no longer supported by forge, you are on your own.
January 31, 20169 yr You need a bit more than just the CompressedStreamTools IIRC, but that's a good chunk of it. Its been a while since I did NBT file work (I was rendering camera views, sending them to the server for saving, and retransmitting for viewing, ), but I think the CST won't do the file IO, you'll have to handle that yourself. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 31, 20169 yr Author first of all really thank you for the answer, I am new in this section and thats why i ask so mutch I will try my best why these infomations and maybe i will get it alone. May RPG MOD KoRIN at minecraftforum http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2570463-kingdom-of-rin-rpg-stuff-classes-dungeons http://rin-online.de/forum/
January 31, 20169 yr Author i have download this stuff and will try to understand how the PacketHandlerServer class work, i am happy toseen that i can reach my goal for now May RPG MOD KoRIN at minecraftforum http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2570463-kingdom-of-rin-rpg-stuff-classes-dungeons http://rin-online.de/forum/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.