How to Prevent Named Traders from Being Killed
Build a Protected Enclosure
Create a secure structure around your named traders to keep them safe from hostile mobs. A simple fence, wall, or building works well. Make sure the area is well-lit to prevent mob spawning nearby.
Use Barriers or Walls
Construct barriers that mobs cannot pass through but that you can still access for trading. Fences, walls, or even a roofed structure all provide good protection. Ensure there are no gaps where hostile mobs could squeeze in.
Keep Them Away from Hazards
Position your traders away from water, lava, cliffs, and other environmental dangers. Even though they won't despawn, they can still die from fall damage, fire, or drowning.
Monitor Mob Spawning
Keep the area around your traders well-lit and clear of dark spaces where mobs might spawn. Use torches, lanterns, or other light sources liberally. If you're in a biome with frequent hostile mobs, consider building your trading hub in a safer location or adding extra defensive measures.