How to add and subtract XP from players?

Started by karstenvader on

Topic category: User side tutorials

Last seen on 03:21, 12. Feb 2020
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to add and subtract XP from players?

Im working on a mod, mostly for myself, where there is a block, similar to a furnace, that uses XP as fuel instead of actual fuel items, and changes one item in an input slot to a different one in the output. I want to know if there is a way to subtract a players XP level and add charge to the block. Any help, tips or advice would be greatly appreciated. I also want to know if you can make a variable specific to a certain instance of a certain block (similar how each brewing stand has its own blaze powder meter), and if so, how.

Last seen on 03:21, 12. Feb 2020
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Update: i read a few forum…
Mon, 06/17/2019 - 02:01

Update: i read a few forum posts and I also have these questions:

What is NBT? Can I use this to store data (numbers) in blocks? 

Can I make a variable, for each player, that can be accesed and referenced from a procedure? Something akin to Mana in Terraria? Its fine if the variable is stored on an item in the players inventory.

Thanks, all.

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
NBT stands for Named Binary…
Mon, 06/17/2019 - 05:05

NBT stands for Named Binary Tag and is a data format that Minecraft uses to serialize and deserialize data (usually so it can be sent over nerwork or saved into a file). You can't save using it anything directly to a Block, but you can use it to save data using a TileEntity that a Block can have ( like for example furnace does).

 

To add data that is bound to a player you can use the Capability system or in older versions IEEP.