Skip to content

Commit

Permalink
vanish
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Oct 24, 2024
1 parent d20e3d6 commit ac96779
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package xyz.nifeather.morph.backends.server.renderer.network.datawatcher.watchers.types;

import com.comphenix.protocol.events.PacketContainer;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.packs.repository.Pack;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import xyz.nifeather.morph.backends.server.renderer.network.datawatcher.watchers.SingleWatcher;
Expand Down Expand Up @@ -82,6 +85,12 @@ protected <X> void onEntryWrite(CustomEntry<X> entry, X oldVal, X newVal)
var component = str.isEmpty() ? null : Component.literal(str);
writePersistent(ValueIndex.BASE_ENTITY.CUSTOM_NAME, component == null ? Optional.empty() : Optional.of(component));
}

if (entry.equals(CustomEntries.VANISHED))
{
var packet = new ClientboundRemoveEntitiesPacket(this.readEntryOrThrow(CustomEntries.SPAWN_ID));
this.sendPacketToAffectedPlayers(PacketContainer.fromPacket(packet));
}
}

@Override
Expand Down

0 comments on commit ac96779

Please sign in to comment.