当前位置: 首页>>代码示例>>Java>>正文


Java Entity.getUniqueID方法代码示例

本文整理汇总了Java中net.minecraft.entity.Entity.getUniqueID方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getUniqueID方法的具体用法?Java Entity.getUniqueID怎么用?Java Entity.getUniqueID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.Entity的用法示例。


在下文中一共展示了Entity.getUniqueID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SPacketSpawnObject

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public SPacketSpawnObject(Entity entityIn, int typeIn, int dataIn)
{
    this.entityId = entityIn.getEntityId();
    this.uniqueId = entityIn.getUniqueID();
    this.x = entityIn.posX;
    this.y = entityIn.posY;
    this.z = entityIn.posZ;
    this.pitch = MathHelper.floor(entityIn.rotationPitch * 256.0F / 360.0F);
    this.yaw = MathHelper.floor(entityIn.rotationYaw * 256.0F / 360.0F);
    this.type = typeIn;
    this.data = dataIn;
    double d0 = 3.9D;
    this.speedX = (int)(MathHelper.clamp(entityIn.motionX, -3.9D, 3.9D) * 8000.0D);
    this.speedY = (int)(MathHelper.clamp(entityIn.motionY, -3.9D, 3.9D) * 8000.0D);
    this.speedZ = (int)(MathHelper.clamp(entityIn.motionZ, -3.9D, 3.9D) * 8000.0D);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:SPacketSpawnObject.java

示例2: applyItemEntityDataToEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Applies the data in the EntityTag tag of the given ItemStack to the given Entity.
 */
public static void applyItemEntityDataToEntity(World entityWorld, @Nullable EntityPlayer player, ItemStack stack, @Nullable Entity targetEntity)
{
    MinecraftServer minecraftserver = entityWorld.getMinecraftServer();

    if (minecraftserver != null && targetEntity != null)
    {
        NBTTagCompound nbttagcompound = stack.getTagCompound();

        if (nbttagcompound != null && nbttagcompound.hasKey("EntityTag", 10))
        {
            if (!entityWorld.isRemote && targetEntity.ignoreItemEntityData() && (player == null || !minecraftserver.getPlayerList().canSendCommands(player.getGameProfile())))
            {
                return;
            }

            NBTTagCompound nbttagcompound1 = targetEntity.writeToNBT(new NBTTagCompound());
            UUID uuid = targetEntity.getUniqueID();
            nbttagcompound1.merge(nbttagcompound.getCompoundTag("EntityTag"));
            targetEntity.setUniqueId(uuid);
            targetEntity.readFromNBT(nbttagcompound1);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:ItemMonsterPlacer.java

示例3: SPacketSpawnObject

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public SPacketSpawnObject(Entity entityIn, int typeIn, int dataIn)
{
    this.entityId = entityIn.getEntityId();
    this.uniqueId = entityIn.getUniqueID();
    this.x = entityIn.posX;
    this.y = entityIn.posY;
    this.z = entityIn.posZ;
    this.pitch = MathHelper.floor_float(entityIn.rotationPitch * 256.0F / 360.0F);
    this.yaw = MathHelper.floor_float(entityIn.rotationYaw * 256.0F / 360.0F);
    this.type = typeIn;
    this.data = dataIn;
    double d0 = 3.9D;
    this.speedX = (int)(MathHelper.clamp_double(entityIn.motionX, -3.9D, 3.9D) * 8000.0D);
    this.speedY = (int)(MathHelper.clamp_double(entityIn.motionY, -3.9D, 3.9D) * 8000.0D);
    this.speedZ = (int)(MathHelper.clamp_double(entityIn.motionZ, -3.9D, 3.9D) * 8000.0D);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:SPacketSpawnObject.java

示例4: canAddEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private boolean canAddEntity(Entity entityIn)
{
    if (entityIn.isDead)
    {
        LOGGER.warn("Tried to add entity {} but it was marked as removed already", new Object[] {EntityList.func_191301_a(entityIn)});
        return false;
    }
    else
    {
        UUID uuid = entityIn.getUniqueID();

        if (this.entitiesByUuid.containsKey(uuid))
        {
            Entity entity = (Entity)this.entitiesByUuid.get(uuid);

            if (this.unloadedEntityList.contains(entity))
            {
                this.unloadedEntityList.remove(entity);
            }
            else
            {
                if (!(entityIn instanceof EntityPlayer))
                {
                    LOGGER.warn("Keeping entity {} that already exists with UUID {}", new Object[] {EntityList.func_191301_a(entity), uuid.toString()});
                    return false;
                }

                LOGGER.warn("Force-added player with duplicate UUID {}", new Object[] {uuid.toString()});
            }

            this.removeEntityDangerously(entity);
        }

        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:37,代码来源:WorldServer.java

示例5: canAddEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private boolean canAddEntity(Entity entityIn)
{
    if (entityIn.isDead)
    {
        LOGGER.warn("Tried to add entity {} but it was marked as removed already", new Object[] {EntityList.getEntityString(entityIn)});
        return false;
    }
    else
    {
        UUID uuid = entityIn.getUniqueID();

        if (this.entitiesByUuid.containsKey(uuid))
        {
            Entity entity = (Entity)this.entitiesByUuid.get(uuid);

            if (this.unloadedEntityList.contains(entity))
            {
                this.unloadedEntityList.remove(entity);
            }
            else
            {
                if (!(entityIn instanceof EntityPlayer))
                {
                    LOGGER.warn("Keeping entity {} that already exists with UUID {}", new Object[] {EntityList.getEntityString(entity), uuid.toString()});
                    return false;
                }

                LOGGER.warn("Force-added player with duplicate UUID {}", new Object[] {uuid.toString()});
            }

            this.removeEntityDangerously(entity);
        }

        return true;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:37,代码来源:WorldServer.java

示例6: execute

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.entitydata.usage", new Object[0]);
    }
    else
    {
        Entity entity = getEntity(server, sender, args[0]);

        if (entity instanceof EntityPlayer)
        {
            throw new CommandException("commands.entitydata.noPlayers", new Object[] {entity.getDisplayName()});
        }
        else
        {
            NBTTagCompound nbttagcompound = entityToNBT(entity);
            NBTTagCompound nbttagcompound1 = nbttagcompound.copy();
            NBTTagCompound nbttagcompound2;

            try
            {
                nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText());
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()});
            }

            UUID uuid = entity.getUniqueID();
            nbttagcompound.merge(nbttagcompound2);
            entity.setUniqueId(uuid);

            if (nbttagcompound.equals(nbttagcompound1))
            {
                throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()});
            }
            else
            {
                entity.readFromNBT(nbttagcompound);
                notifyCommandListener(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()});
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:49,代码来源:CommandEntityData.java


注:本文中的net.minecraft.entity.Entity.getUniqueID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。