[Solved] Torch Like Key?

So I have the method below to spawn an entity. Is there a way to offer it a key that gives the entity the ability to be able to be walked through, like a torch, without no one being able to move it? If not, is it possible to do this at all? Thanks!

	public static void spawnNPC(Location<World> location, Direction direction,EntityType x, UUID UUID, String displayName) {
	
	final Entity entity = location.getExtent().createEntity(x, location.getPosition().toDouble().add(0.5,0,0.5));
	
	entity.offer(Keys.DISPLAY_NAME, Text.of(displayName));
	
	entity.offer(Keys.DIRECTION, direction);
		
	entity.offer(Keys.SKIN_UNIQUE_ID, UUID);

	location.getExtent().spawnEntity(entity, Cause.source(EntitySpawnCause.builder().entity(entity).type(SpawnTypes.PLUGIN).build()).build());
}

Make your own data, then cancel any CollideEntityEvent.Impacts where the entity has the data.

1 Like