Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void onImpact(RayTraceResult result)
- {
- if(result.typeOfHit == Type.BLOCK)
- {
- if(!world.isRemote&&world.getBlockState(result.getBlockPos()).getBlockHardness(world, result.getBlockPos())>1)
- {
- System.out.println("ping!");
- this.world.spawnParticle(EnumParticleTypes.LAVA, this.posX, this.posY, this.posZ, 0, 0, 0, new int[0]);
- this.world.playSound(posX, posY, posZ, SoundEvents.BLOCK_ANVIL_FALL, SoundCategory.HOSTILE, 1, 1, false);
- }
- if(world.getBlockState(result.getBlockPos()).getCollisionBoundingBox(world, result.getBlockPos()) != null)setDead();
- }
- else if(result.entityHit != null)
- {
- result.entityHit.attackEntityFrom(DamageSource.GENERIC, 3);
- result.entityHit.hurtResistantTime = 0;
- setDead();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement