Posted July 6, 20205 yr I put this in my block class: public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { if (!entityIn.isSneaking()){ entityIn.attackEntityFrom(DamageSource.FALL, 10); } super.onEntityWalk(worldIn, pos, entityIn); } When i'm in the game I don't take any damage from sneaking on it. What am I doing wrong?
July 6, 20205 yr Are you saying you want the entity to take damage when you are sneaking on it? Not damage except when you're sneaking on it (i.e. magma blocks)? If so, you'll want to check entityIn.isSneaking(), not !entityIn.isSneaking(). The latter returns true when the entity isn't sneaking.
July 6, 20205 yr Author I had set it to take damage when I am sneaking for testing, and when I removed the exclamation point I still didn't take damage sneaking
July 7, 20205 yr 15 minutes ago, Help! said: How would I do that? Shouldn't you use a Player object to do that?
July 7, 20205 yr Author 12 hours ago, poopoodice said: /gamerule fallDamage That didn't work. Any other ideas of why it isn't working?
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.