How to filter out arrows that are in ground?

Started by Asa_sakura on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to filter out arrows that are in ground?

I wanted to make it so that the arrows in the radius disappear. I did it, but now the problem is that the arrows that are lying on the ground also disappear. How can I make sure that they are not affected by the procedure? And also, if it is possible, how can I make sure that my own arrows don't disappear?

PROCEDURE:

https://imgur.com/2hlNPCy

I read that I should add  

CompoundTag nbtdata = entity.saveWithoutId(new CompoundTag());
nbtdata.getBoolean("inGround")

somewhere, but I don't know where and how to use it, because I absolutely don't know Java. Please help, it would be very helpful

 

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If it is necessary package…
Wed, 11/06/2024 - 20:19

If it is necessary

package net.mcreator.legendarytimes.procedures;

/* imports omitted */

public class AegisFunctionProcedure {
	public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) {
		if (entity == null)
			return;
		if (entity.isSprinting()) {
			{
				final Vec3 _center = new Vec3((entity.getX()), (entity.getY() + 0.5), (entity.getZ()));
				List<Entity> _entfound = world.getEntitiesOfClass(Entity.class, new AABB(_center, _center).inflate(2.5 / 2d), e -> true).stream().sorted(Comparator.comparingDouble(_entcnd -> _entcnd.distanceToSqr(_center))).toList();
				for (Entity entityiterator : _entfound) {
					if (entityiterator.getType().is(TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.parse("minecraft:impact_projectiles")))) {
						if (world instanceof ServerLevel _level)
							_level.sendParticles(ParticleTypes.GUST, (entityiterator.getX()), (entityiterator.getY()), (entityiterator.getZ()), 1, 0.01, 0.01, 0.01, 1);
						if (world instanceof Level _level) {
							if (!_level.isClientSide()) {
								_level.playSound(null, BlockPos.containing(x, y, z), BuiltInRegistries.SOUND_EVENT.get(ResourceLocation.parse("entity.breeze.jump")), SoundSource.PLAYERS, 1, (float) 0.9);
							} else {
								_level.playLocalSound(x, y, z, BuiltInRegistries.SOUND_EVENT.get(ResourceLocation.parse("entity.breeze.jump")), SoundSource.PLAYERS, 1, (float) 0.9, false);
							}
						}
						if (!entityiterator.level().isClientSide())
							entityiterator.discard();
					}
				}
			}
		}
	}
}