Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);

}

 

  • 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?

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.

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.

  • Author

first of all  really thank you for the answer,

 

I am new in this section and thats why i ask so mutch xD

 

I will try my best why these infomations and maybe i will get it alone.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.