--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -49,6 +_,11 @@
     @Nullable
     public BlockPos anchorPoint;
     Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
+    // Paper start
+    @Nullable
+    public java.util.UUID spawningEntity;
+    public boolean shouldBurnInDay = true;
+    // Paper end
 
     public Phantom(EntityType<? extends Phantom> entityType, Level level) {
         super(entityType, level);
@@ -143,7 +_,7 @@
 
     @Override
     public void aiStep() {
-        if (this.isAlive() && this.isSunBurnTick()) {
+        if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API
             this.igniteForSeconds(8.0F);
         }
 
@@ -178,6 +_,10 @@
         super.readAdditionalSaveData(input);
         this.anchorPoint = input.read("anchor_pos", BlockPos.CODEC).orElse(null);
         this.setPhantomSize(input.getIntOr("size", 0));
+        // Paper start
+        this.spawningEntity = input.read("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
+        this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true);
+        // Paper end
     }
 
     @Override
@@ -185,6 +_,10 @@
         super.addAdditionalSaveData(output);
         output.storeNullable("anchor_pos", BlockPos.CODEC, this.anchorPoint);
         output.putInt("size", this.getPhantomSize());
+        // Paper start
+        output.storeNullable("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity);
+        output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+        // Paper end
     }
 
     @Override
@@ -258,7 +_,8 @@
 
                     for (Player player : nearbyPlayers) {
                         if (Phantom.this.canAttack(serverLevel, player, TargetingConditions.DEFAULT)) {
-                            Phantom.this.setTarget(player);
+                            if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.IS_INSOMNIAC.test(player)) // Paper - Add phantom creative and insomniac controls
+                            Phantom.this.setTarget(player, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER); // CraftBukkit - reason
                             return true;
                         }
                     }
