當前位置: 首頁>>代碼示例>>Java>>正文


Java Entity.setLocationAndAngles方法代碼示例

本文整理匯總了Java中net.minecraft.entity.Entity.setLocationAndAngles方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.setLocationAndAngles方法的具體用法?Java Entity.setLocationAndAngles怎麽用?Java Entity.setLocationAndAngles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.Entity的用法示例。


在下文中一共展示了Entity.setLocationAndAngles方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Render the mob inside the mob spawner.
 */
public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks)
{
    Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld());

    if (entity != null)
    {
        float f = 0.4375F;
        GlStateManager.translate(0.0F, 0.4F, 0.0F);
        GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.4F, 0.0F);
        GlStateManager.scale(f, f, f);
        entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
        Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:20,代碼來源:TileEntityMobSpawnerRenderer.java

示例2: spawnEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public static Entity spawnEntity(World world, int id, double x, double y, double z) {
	Entity entity = ModEntityList.createEntityByID(id, world);

	if (entity != null && entity instanceof EntityLivingBase) {
		EntityLiving entityliving = (EntityLiving) entity;
		entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
		entityliving.rotationYawHead = entityliving.rotationYaw;
		entityliving.renderYawOffset = entityliving.rotationYaw;
		entityliving.onSpawnWithEgg((IEntityLivingData) null);
		world.spawnEntityInWorld(entity);
		entityliving.playLivingSound();
	}

	return entity;
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:16,代碼來源:ItemEntityEgg.java

示例3: placeInPortal

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void placeInPortal(Entity entityIn, float rotationYaw)
{
    if (this.worldServerInstance.provider.getDimensionId() != 1)
    {
        if (!this.placeInExistingPortal(entityIn, rotationYaw))
        {
            this.makePortal(entityIn);
            this.placeInExistingPortal(entityIn, rotationYaw);
        }
    }
    else
    {
        int i = MathHelper.floor_double(entityIn.posX);
        int j = MathHelper.floor_double(entityIn.posY) - 1;
        int k = MathHelper.floor_double(entityIn.posZ);
        int l = 1;
        int i1 = 0;

        for (int j1 = -2; j1 <= 2; ++j1)
        {
            for (int k1 = -2; k1 <= 2; ++k1)
            {
                for (int l1 = -1; l1 < 3; ++l1)
                {
                    int i2 = i + k1 * l + j1 * i1;
                    int j2 = j + l1;
                    int k2 = k + k1 * i1 - j1 * l;
                    boolean flag = l1 < 0;
                    this.worldServerInstance.setBlockState(new BlockPos(i2, j2, k2), flag ? Blocks.obsidian.getDefaultState() : Blocks.air.getDefaultState());
                }
            }
        }

        entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F);
        entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:38,代碼來源:Teleporter.java

示例4: addEntitiesToWorld

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
    for (Template.EntityInfo template$entityinfo : this.entities)
    {
        BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);

        if (aabb == null || aabb.isVecInside(blockpos))
        {
            NBTTagCompound nbttagcompound = template$entityinfo.entityData;
            Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
            Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
            NBTTagList nbttaglist = new NBTTagList();
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.xCoord));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.yCoord));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.zCoord));
            nbttagcompound.setTag("Pos", nbttaglist);
            nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
            Entity entity;

            try
            {
                entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
            }
            catch (Exception var15)
            {
                entity = null;
            }

            if (entity != null)
            {
                float f = entity.getMirroredYaw(mirrorIn);
                f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
                entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
                worldIn.spawnEntityInWorld(entity);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:39,代碼來源:Template.java

示例5: spawnCreature

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Spawns the creature specified by the egg's type in the location specified by the last three parameters.
 * Parameters: world, entityID, x, y, z.
 */
@Nullable
public static Entity spawnCreature(World worldIn, @Nullable String entityID, double x, double y, double z)
{
    if (entityID != null && EntityList.ENTITY_EGGS.containsKey(entityID))
    {
        Entity entity = null;

        for (int i = 0; i < 1; ++i)
        {
            entity = EntityList.createEntityByIDFromName(entityID, worldIn);

            if (entity instanceof EntityLivingBase)
            {
                EntityLiving entityliving = (EntityLiving)entity;
                entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(worldIn.rand.nextFloat() * 360.0F), 0.0F);
                entityliving.rotationYawHead = entityliving.rotationYaw;
                entityliving.renderYawOffset = entityliving.rotationYaw;
                entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
                worldIn.spawnEntityInWorld(entity);
                entityliving.playLivingSound();
            }
        }

        return entity;
    }
    else
    {
        return null;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:35,代碼來源:ItemMonsterPlacer.java

示例6: placeInPortal

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void placeInPortal(Entity entityIn, float rotationYaw)
{
    if (this.worldServerInstance.provider.getDimensionType().getId() != 1)
    {
        if (!this.placeInExistingPortal(entityIn, rotationYaw))
        {
            this.makePortal(entityIn);
            this.placeInExistingPortal(entityIn, rotationYaw);
        }
    }
    else
    {
        int i = MathHelper.floor(entityIn.posX);
        int j = MathHelper.floor(entityIn.posY) - 1;
        int k = MathHelper.floor(entityIn.posZ);
        int l = 1;
        int i1 = 0;

        for (int j1 = -2; j1 <= 2; ++j1)
        {
            for (int k1 = -2; k1 <= 2; ++k1)
            {
                for (int l1 = -1; l1 < 3; ++l1)
                {
                    int i2 = i + k1 * 1 + j1 * 0;
                    int j2 = j + l1;
                    int k2 = k + k1 * 0 - j1 * 1;
                    boolean flag = l1 < 0;
                    this.worldServerInstance.setBlockState(new BlockPos(i2, j2, k2), flag ? Blocks.OBSIDIAN.getDefaultState() : Blocks.AIR.getDefaultState());
                }
            }
        }

        entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F);
        entityIn.motionX = 0.0D;
        entityIn.motionY = 0.0D;
        entityIn.motionZ = 0.0D;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:40,代碼來源:Teleporter.java

示例7: spawnEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Spawn entity in the world
 * @param mob Mob class to spawn
 * @param pos Block position where entity going to spawn
 * @return Spawned entity
 */
public Entity spawnEntity(UEntityClass mob, UBlockPos pos) {
    Entity entity = mob.construct(this);
    entity.setLocationAndAngles(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, new Random(System.currentTimeMillis()).nextFloat() * 360.0F, 0.0F);
    world.spawnEntityInWorld(entity);
    return entity;
}
 
開發者ID:ternsip,項目名稱:StructPro,代碼行數:13,代碼來源:UWorld.java

示例8: spawnEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Spawn entity in the world
 * @param mob Mob class to spawn
 * @param pos Block position where entity going to spawn
 * @return Spawned entity
 */
public Entity spawnEntity(UEntityClass mob, UBlockPos pos) {
    Entity entity = mob.construct(this);
    entity.setLocationAndAngles(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, new Random(System.currentTimeMillis()).nextFloat() * 360.0F, 0.0F);
    world.spawnEntity(entity);
    return entity;
}
 
開發者ID:ternsip,項目名稱:StructPro,代碼行數:13,代碼來源:UWorld.java

示例9: spawnCreature

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Spawns the creature specified by the egg's type in the location specified by the last three parameters.
 * Parameters: world, entityID, x, y, z.
 */
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
    if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
    {
        return null;
    }
    else
    {
        Entity entity = null;

        for (int i = 0; i < 1; ++i)
        {
            entity = EntityList.createEntityByID(entityID, worldIn);

            if (entity instanceof EntityLivingBase)
            {
                EntityLiving entityliving = (EntityLiving)entity;
                entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
                entityliving.rotationYawHead = entityliving.rotationYaw;
                entityliving.renderYawOffset = entityliving.rotationYaw;
                entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
                worldIn.spawnEntityInWorld(entity);
                entityliving.playLivingSound();
            }
        }

        return entity;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:34,代碼來源:ItemMonsterPlacer.java

示例10: spawnNewEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private Entity spawnNewEntity(Entity entityIn, boolean spawn)
{
    if (this.getRandomEntity() != null)
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        entityIn.writeToNBTOptional(nbttagcompound);

        for (String s : this.getRandomEntity().nbtData.getKeySet())
        {
            NBTBase nbtbase = this.getRandomEntity().nbtData.getTag(s);
            nbttagcompound.setTag(s, nbtbase.copy());
        }

        entityIn.readFromNBT(nbttagcompound);

        if (entityIn.worldObj != null && spawn)
        {
            entityIn.worldObj.spawnEntityInWorld(entityIn);
        }

        NBTTagCompound nbttagcompound2;

        for (Entity entity = entityIn; nbttagcompound.hasKey("Riding", 10); nbttagcompound = nbttagcompound2)
        {
            nbttagcompound2 = nbttagcompound.getCompoundTag("Riding");
            Entity entity1 = EntityList.createEntityByName(nbttagcompound2.getString("id"), entityIn.worldObj);

            if (entity1 != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                entity1.writeToNBTOptional(nbttagcompound1);

                for (String s1 : nbttagcompound2.getKeySet())
                {
                    NBTBase nbtbase1 = nbttagcompound2.getTag(s1);
                    nbttagcompound1.setTag(s1, nbtbase1.copy());
                }

                entity1.readFromNBT(nbttagcompound1);
                entity1.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);

                if (entityIn.worldObj != null && spawn)
                {
                    entityIn.worldObj.spawnEntityInWorld(entity1);
                }

                entity.mountEntity(entity1);
            }

            entity = entity1;
        }
    }
    else if (entityIn instanceof EntityLivingBase && entityIn.worldObj != null && spawn)
    {
        if (entityIn instanceof EntityLiving)
        {
            ((EntityLiving)entityIn).onInitialSpawn(entityIn.worldObj.getDifficultyForLocation(new BlockPos(entityIn)), (IEntityLivingData)null);
        }

        entityIn.worldObj.spawnEntityInWorld(entityIn);
    }

    return entityIn;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:65,代碼來源:MobSpawnerBaseLogic.java

示例11: transferEntityToWorld

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@SuppressWarnings("unused")
public void transferEntityToWorld(Entity entityIn, int lastDimension, WorldServer oldWorldIn, WorldServer toWorldIn, net.minecraft.world.Teleporter teleporter)
{
    net.minecraft.world.WorldProvider pOld = oldWorldIn.provider;
    net.minecraft.world.WorldProvider pNew = toWorldIn.provider;
    double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor();
    double d0 = entityIn.posX * moveFactor;
    double d1 = entityIn.posZ * moveFactor;
    double d2 = 8.0D;
    float f = entityIn.rotationYaw;
    oldWorldIn.theProfiler.startSection("moving");

    if (false && entityIn.dimension == -1)
    {
        d0 = MathHelper.clamp_double(d0 / 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
        d1 = MathHelper.clamp_double(d1 / 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);

        if (entityIn.isEntityAlive())
        {
            oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
        }
    }
    else if (false && entityIn.dimension == 0)
    {
        d0 = MathHelper.clamp_double(d0 * 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
        d1 = MathHelper.clamp_double(d1 * 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);

        if (entityIn.isEntityAlive())
        {
            oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
        }
    }

    if (entityIn.dimension == 1)
    {
        BlockPos blockpos;

        if (lastDimension == 1)
        {
            blockpos = toWorldIn.getSpawnPoint();
        }
        else
        {
            blockpos = toWorldIn.getSpawnCoordinate();
        }

        d0 = (double)blockpos.getX();
        entityIn.posY = (double)blockpos.getY();
        d1 = (double)blockpos.getZ();
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, 90.0F, 0.0F);

        if (entityIn.isEntityAlive())
        {
            oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
        }
    }

    oldWorldIn.theProfiler.endSection();

    if (lastDimension != 1)
    {
        oldWorldIn.theProfiler.startSection("placing");
        d0 = (double)MathHelper.clamp_int((int)d0, -29999872, 29999872);
        d1 = (double)MathHelper.clamp_int((int)d1, -29999872, 29999872);

        if (entityIn.isEntityAlive())
        {
            entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
            teleporter.placeInPortal(entityIn, f);
            toWorldIn.spawnEntityInWorld(entityIn);
            toWorldIn.updateEntityWithOptionalForce(entityIn, false);
        }

        oldWorldIn.theProfiler.endSection();
    }

    entityIn.setWorld(toWorldIn);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:81,代碼來源:PlayerList.java

示例12: 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 < 1)
    {
        throw new WrongUsageException("commands.tp.usage", new Object[0]);
    }
    else
    {
        int i = 0;
        Entity entity;

        if (args.length != 2 && args.length != 4 && args.length != 6)
        {
            entity = getCommandSenderAsPlayer(sender);
        }
        else
        {
            entity = getEntity(server, sender, args[0]);
            i = 1;
        }

        if (args.length != 1 && args.length != 2)
        {
            if (args.length < i + 3)
            {
                throw new WrongUsageException("commands.tp.usage", new Object[0]);
            }
            else if (entity.worldObj != null)
            {
                int j = 4096;
                int lvt_6_2_ = i + 1;
                CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(entity.posX, args[i], true);
                CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(entity.posY, args[lvt_6_2_++], -4096, 4096, false);
                CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(entity.posZ, args[lvt_6_2_++], true);
                CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate((double)entity.rotationYaw, args.length > lvt_6_2_ ? args[lvt_6_2_++] : "~", false);
                CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate((double)entity.rotationPitch, args.length > lvt_6_2_ ? args[lvt_6_2_] : "~", false);
                teleportEntityToCoordinates(entity, commandbase$coordinatearg, commandbase$coordinatearg1, commandbase$coordinatearg2, commandbase$coordinatearg3, commandbase$coordinatearg4);
                notifyCommandListener(sender, this, "commands.tp.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.getResult()), Double.valueOf(commandbase$coordinatearg1.getResult()), Double.valueOf(commandbase$coordinatearg2.getResult())});
            }
        }
        else
        {
            Entity entity1 = getEntity(server, sender, args[args.length - 1]);

            if (entity1.worldObj != entity.worldObj)
            {
                throw new CommandException("commands.tp.notSameDimension", new Object[0]);
            }
            else
            {
                entity.dismountRidingEntity();

                if (entity instanceof EntityPlayerMP)
                {
                    ((EntityPlayerMP)entity).connection.setPlayerLocation(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
                }
                else
                {
                    entity.setLocationAndAngles(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
                }

                notifyCommandListener(sender, this, "commands.tp.success", new Object[] {entity.getName(), entity1.getName()});
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:70,代碼來源:CommandTP.java

示例13: transferEntityToWorld

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Transfers an entity from a world to another world.
 */
public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_)
{
    double d0 = entityIn.posX;
    double d1 = entityIn.posZ;
    double d2 = 8.0D;
    float f = entityIn.rotationYaw;
    p_82448_3_.theProfiler.startSection("moving");

    if (entityIn.dimension == -1)
    {
        d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D);
        d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D);
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);

        if (entityIn.isEntityAlive())
        {
            p_82448_3_.updateEntityWithOptionalForce(entityIn, false);
        }
    }
    else if (entityIn.dimension == 0)
    {
        d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D);
        d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D);
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);

        if (entityIn.isEntityAlive())
        {
            p_82448_3_.updateEntityWithOptionalForce(entityIn, false);
        }
    }
    else
    {
        BlockPos blockpos;

        if (p_82448_2_ == 1)
        {
            blockpos = p_82448_4_.getSpawnPoint();
        }
        else
        {
            blockpos = p_82448_4_.getSpawnCoordinate();
        }

        d0 = (double)blockpos.getX();
        entityIn.posY = (double)blockpos.getY();
        d1 = (double)blockpos.getZ();
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, 90.0F, 0.0F);

        if (entityIn.isEntityAlive())
        {
            p_82448_3_.updateEntityWithOptionalForce(entityIn, false);
        }
    }

    p_82448_3_.theProfiler.endSection();

    if (p_82448_2_ != 1)
    {
        p_82448_3_.theProfiler.startSection("placing");
        d0 = (double)MathHelper.clamp_int((int)d0, -29999872, 29999872);
        d1 = (double)MathHelper.clamp_int((int)d1, -29999872, 29999872);

        if (entityIn.isEntityAlive())
        {
            entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
            p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f);
            p_82448_4_.spawnEntityInWorld(entityIn);
            p_82448_4_.updateEntityWithOptionalForce(entityIn, false);
        }

        p_82448_3_.theProfiler.endSection();
    }

    entityIn.setWorld(p_82448_4_);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:79,代碼來源:ServerConfigurationManager.java

示例14: transferEntityToWorld

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Transfers an entity from a world to another world.
 */
public void transferEntityToWorld(Entity entityIn, int lastDimension, WorldServer oldWorldIn, WorldServer toWorldIn)
{
    double d0 = entityIn.posX;
    double d1 = entityIn.posZ;
    double d2 = 8.0D;
    float f = entityIn.rotationYaw;
    oldWorldIn.theProfiler.startSection("moving");

    if (entityIn.dimension == -1)
    {
        d0 = MathHelper.clamp(d0 / 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
        d1 = MathHelper.clamp(d1 / 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);

        if (entityIn.isEntityAlive())
        {
            oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
        }
    }
    else if (entityIn.dimension == 0)
    {
        d0 = MathHelper.clamp(d0 * 8.0D, toWorldIn.getWorldBorder().minX() + 16.0D, toWorldIn.getWorldBorder().maxX() - 16.0D);
        d1 = MathHelper.clamp(d1 * 8.0D, toWorldIn.getWorldBorder().minZ() + 16.0D, toWorldIn.getWorldBorder().maxZ() - 16.0D);
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);

        if (entityIn.isEntityAlive())
        {
            oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
        }
    }
    else
    {
        BlockPos blockpos;

        if (lastDimension == 1)
        {
            blockpos = toWorldIn.getSpawnPoint();
        }
        else
        {
            blockpos = toWorldIn.getSpawnCoordinate();
        }

        d0 = (double)blockpos.getX();
        entityIn.posY = (double)blockpos.getY();
        d1 = (double)blockpos.getZ();
        entityIn.setLocationAndAngles(d0, entityIn.posY, d1, 90.0F, 0.0F);

        if (entityIn.isEntityAlive())
        {
            oldWorldIn.updateEntityWithOptionalForce(entityIn, false);
        }
    }

    oldWorldIn.theProfiler.endSection();

    if (lastDimension != 1)
    {
        oldWorldIn.theProfiler.startSection("placing");
        d0 = (double)MathHelper.clamp((int)d0, -29999872, 29999872);
        d1 = (double)MathHelper.clamp((int)d1, -29999872, 29999872);

        if (entityIn.isEntityAlive())
        {
            entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
            toWorldIn.getDefaultTeleporter().placeInPortal(entityIn, f);
            toWorldIn.spawnEntityInWorld(entityIn);
            toWorldIn.updateEntityWithOptionalForce(entityIn, false);
        }

        oldWorldIn.theProfiler.endSection();
    }

    entityIn.setWorld(toWorldIn);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:79,代碼來源:PlayerList.java

示例15: teleportEntityToCoordinates

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Teleports an entity to the specified coordinates
 */
private static void teleportEntityToCoordinates(Entity p_189863_0_, CommandBase.CoordinateArg p_189863_1_, CommandBase.CoordinateArg p_189863_2_, CommandBase.CoordinateArg p_189863_3_, CommandBase.CoordinateArg p_189863_4_, CommandBase.CoordinateArg p_189863_5_)
{
    if (p_189863_0_ instanceof EntityPlayerMP)
    {
        Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);

        if (p_189863_1_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X);
        }

        if (p_189863_2_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y);
        }

        if (p_189863_3_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Z);
        }

        if (p_189863_5_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
        }

        if (p_189863_4_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
        }

        float f = (float)p_189863_4_.getAmount();

        if (!p_189863_4_.isRelative())
        {
            f = MathHelper.wrapDegrees(f);
        }

        float f1 = (float)p_189863_5_.getAmount();

        if (!p_189863_5_.isRelative())
        {
            f1 = MathHelper.wrapDegrees(f1);
        }

        p_189863_0_.dismountRidingEntity();
        ((EntityPlayerMP)p_189863_0_).connection.setPlayerLocation(p_189863_1_.getAmount(), p_189863_2_.getAmount(), p_189863_3_.getAmount(), f, f1, set);
        p_189863_0_.setRotationYawHead(f);
    }
    else
    {
        float f2 = (float)MathHelper.wrapDegrees(p_189863_4_.getResult());
        float f3 = (float)MathHelper.wrapDegrees(p_189863_5_.getResult());
        f3 = MathHelper.clamp_float(f3, -90.0F, 90.0F);
        p_189863_0_.setLocationAndAngles(p_189863_1_.getResult(), p_189863_2_.getResult(), p_189863_3_.getResult(), f2, f3);
        p_189863_0_.setRotationYawHead(f2);
    }

    if (!(p_189863_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189863_0_).isElytraFlying())
    {
        p_189863_0_.motionY = 0.0D;
        p_189863_0_.onGround = true;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:68,代碼來源:CommandTP.java


注:本文中的net.minecraft.entity.Entity.setLocationAndAngles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。