Search in sources :

Example 26 with WorldServer

use of net.minecraft.server.level.WorldServer in project Panilla by ds58.

the class PacketInspector method stripNbtFromItemEntity.

@Override
public void stripNbtFromItemEntity(UUID entityId) {
    Entity entity = null;
    for (WorldServer worldServer : MinecraftServer.getServer().F()) {
        entity = worldServer.O.d().a(entityId);
        if (entity != null)
            break;
    }
    if (entity instanceof EntityItem) {
        EntityItem item = (EntityItem) entity;
        if (item.h() == null)
            return;
        if (!item.h().r())
            return;
        item.h().c((NBTTagCompound) null);
    }
}
Also used : PacketPlayOutSpawnEntity(net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity) Entity(net.minecraft.world.entity.Entity) WorldServer(net.minecraft.server.level.WorldServer) EntityItem(net.minecraft.world.entity.item.EntityItem)

Example 27 with WorldServer

use of net.minecraft.server.level.WorldServer in project Nexus by ProjectEdenGG.

the class NMSUtils method createEntityPlayer.

public static EntityPlayer createEntityPlayer(UUID uuid, @NonNull Location location, String name) {
    if (uuid == null)
        uuid = UUID.randomUUID();
    WorldServer world = getWorldServer(location);
    GameProfile gameProfile = new GameProfile(uuid, name);
    EntityPlayer entityPlayer = new EntityPlayer(NMSUtils.getServer(), world, gameProfile);
    setLocation(entityPlayer, location);
    return entityPlayer;
}
Also used : GameProfile(com.mojang.authlib.GameProfile) EntityPlayer(net.minecraft.server.level.EntityPlayer) WorldServer(net.minecraft.server.level.WorldServer)

Aggregations

WorldServer (net.minecraft.server.level.WorldServer)27 EntityItem (net.minecraft.world.entity.item.EntityItem)9 BlockPosition (net.minecraft.core.BlockPosition)8 EntityPlayer (net.minecraft.server.level.EntityPlayer)7 CraftWorld (org.bukkit.craftbukkit.v1_18_R1.CraftWorld)6 Field (java.lang.reflect.Field)5 PacketPlayOutSpawnEntity (net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity)5 Entity (net.minecraft.world.entity.Entity)5 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)5 Method (java.lang.reflect.Method)4 World (org.bukkit.World)4 LivingEntity (org.bukkit.entity.LivingEntity)4 PacketType (com.comphenix.protocol.PacketType)3 PacketContainer (com.comphenix.protocol.events.PacketContainer)3 InteractionVisualizer (com.loohp.interactionvisualizer.InteractionVisualizer)3 BlockPosition (com.loohp.interactionvisualizer.objectholders.BlockPosition)3 BoundingBox (com.loohp.interactionvisualizer.objectholders.BoundingBox)3 ChunkPosition (com.loohp.interactionvisualizer.objectholders.ChunkPosition)3 NMSTileEntitySet (com.loohp.interactionvisualizer.objectholders.NMSTileEntitySet)3 TileEntity (com.loohp.interactionvisualizer.objectholders.TileEntity)3