SirLich Posted December 2, 2015 Share Posted December 2, 2015 Hi, I need some help. I am creating a basic warp mod. However I want to add a little something extra. Warping will cost experience. I will work out all the details later, but right now I need to know how to add/detract XP levels from the player. I want to focus on detracting right now, because I want to set up my /warp command with something like this: If(player.xplevel > warp_cost) { player.xplevel -= warp_cost; } else { println("Not enough XP); } Could somebody please direct me to the correct class, or more helpfully the actual line of code that will add XP? Using that I can refine my google searches and learn more about it. Thanks. ~SirLich Quote My name is SirLich and I am really, really trying to learn Modding. I am not some dumb middle schooler. I am not some no-coding-loser who wants to mod. I know a number of computer programming languages and right now I am learning Java. Please help me -.- Link to comment Share on other sites More sharing options...
Choonster Posted December 3, 2015 Share Posted December 3, 2015 EntityPlayer#addExperience , EntityPlayer#removeExperienceLevel and EntityPlayer#addExperienceLevel allow you to add and remove XP from the player. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future. Link to comment Share on other sites More sharing options...
Kaneka Posted December 4, 2015 Share Posted December 4, 2015 hi, you could even drop exp with public void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount) { if (!worldIn.isRemote) { while (amount > 0) { int j = EntityXPOrb.getXPSplit(amount); amount -= j; worldIn.spawnEntityInWorld(new EntityXPOrb(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, j)); } } } (Taken from the Block.class) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.