Posted October 17, 20214 yr I've been trying to sort this out for a few days but unfortunately I've had no success. I was wondering if anyone has figured out how to add xp drops to an ore for 1.17.1. Anyone help would be appreciated, thanks!
October 18, 20214 yr Author I should've mentioned that's what I've done the past few days. I don't wanna be told exactly how to do it just a little guidance
October 18, 20214 yr Author @Override public int getExpDrop(BlockState state, LevelReader reader, BlockPos pos, int fortune, int silktouch) { return silktouch == 0 ? this.RANDOM.nextInt(10) : 20; } this is what i've recently tried and it did drop xp but it drops it regardless if silk touch is involved or not
October 18, 20214 yr the code should work, if the SilkTouch level is 0 it will return a random xp count between 0 and 9, if the SilkTouch level is not 0 it will return constantly 20
October 18, 20214 yr Author Ah i see the issue i had it set to give 20 xp with silk alright. Is there anything i can replace random with so for example itll always drop 10 xp
October 18, 20214 yr Author Ok so i have this right which means without silk touch it'll drop between 0-9 xp and 0 with silktouch so i assume the 0-9 is because of that this.RANDOM. So im wondering if i can change that RANDOM so it always drops the 10 xp or if im just over thinking this @Override public int getExpDrop(BlockState state, LevelReader reader, BlockPos pos, int fortune, int silktouch) { return silktouch == 0 ? this.RANDOM.nextInt(10) : 0; }
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.