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


Java Entity.setPosition方法代码示例

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


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

示例1: updatePassenger

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void updatePassenger(Entity passenger)
{
    super.updatePassenger(passenger);

    if (passenger instanceof EntityLiving)
    {
        EntityLiving entityliving = (EntityLiving)passenger;
        this.renderYawOffset = entityliving.renderYawOffset;
    }

    if (this.prevRearingAmount > 0.0F)
    {
        float f3 = MathHelper.sin(this.renderYawOffset * 0.017453292F);
        float f = MathHelper.cos(this.renderYawOffset * 0.017453292F);
        float f1 = 0.7F * this.prevRearingAmount;
        float f2 = 0.15F * this.prevRearingAmount;
        passenger.setPosition(this.posX + (double)(f1 * f3), this.posY + this.getMountedYOffset() + passenger.getYOffset() + (double)f2, this.posZ - (double)(f1 * f));

        if (passenger instanceof EntityLivingBase)
        {
            ((EntityLivingBase)passenger).renderYawOffset = this.renderYawOffset;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:AbstractHorse.java

示例2: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
    TileEntityElevatorBase te = getElevatorTE(world, pos);
    if (te != null && te.oldExtension != te.extension) {
        entity.setPosition(entity.posX, te.getPos().getY() + 1 + te.extension, entity.posZ);
    }
    entity.fallDistance = 0;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:BlockElevatorFrame.java

示例3: moveEntityToCenter

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void moveEntityToCenter(Entity entity) {
    /*
     * this is for your own protection. you may hurt yourself if you're not standing right, especially
     * on multiblock-elevators (entity will be found by multiple bases, causing problems)
     */
    entity.setPosition(getPos().getX() + 0.5F, entity.posY, getPos().getZ() + 0.5F);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:TileEntityElevatorBase.java

示例4: setPositions

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static void setPositions(Entity ent, double x, double y, double z) {
    ent.setPosition(0.0D, 0.0D, 0.0D);
    ent.prevPosX = ent.lastTickPosX = ent.posX = x;
    ent.prevPosY = ent.lastTickPosY = ent.posY = y;
    ent.prevPosZ = ent.lastTickPosZ = ent.posZ = z;
    ent.setPosition(x, y, z);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:8,代码来源:ZWrapper.java

示例5: placeInPortal

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public void placeInPortal(Entity pEntity, float rotationYaw) {
    this.worldServerInstance.getBlockState(new BlockPos((int) this.x, (int) this.y, (int) this.z));   //dummy load to maybe gen chunk

    pEntity.setPosition(this.x, this.y, this.z);
    pEntity.motionX = 0.0f;
    pEntity.motionY = 0.0f;
    pEntity.motionZ = 0.0f;
}
 
开发者ID:elytra,项目名称:tp-plus,代码行数:10,代码来源:RfToolsTeleporter.java

示例6: updateEntityPositionClient

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static void updateEntityPositionClient(int entityID, double x, double y, double z)
{
	Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityID);
	
	if (entity == null) { return; }	// Doesn't exist? Shame.
	
	// Entity exists, so setting its position now
	entity.setPosition(x, y, z);
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:10,代码来源:Helper_Client.java

示例7: updatePassenger

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void updatePassenger(Entity passenger)
{
    if (this.isPassenger(passenger))
    {
        float f = 0.0F;
        float f1 = (float)((this.isDead ? 0.009999999776482582D : this.getMountedYOffset()) + passenger.getYOffset());

        if (this.getPassengers().size() > 1)
        {
            int i = this.getPassengers().indexOf(passenger);

            if (i == 0)
            {
                f = 0.2F;
            }
            else
            {
                f = -0.6F;
            }

            if (passenger instanceof EntityAnimal)
            {
                f = (float)((double)f + 0.2D);
            }
        }

        Vec3d vec3d = (new Vec3d((double)f, 0.0D, 0.0D)).rotateYaw(-this.rotationYaw * 0.017453292F - ((float)Math.PI / 2F));
        passenger.setPosition(this.posX + vec3d.xCoord, this.posY + (double)f1, this.posZ + vec3d.zCoord);
        passenger.rotationYaw += this.deltaRotation;
        passenger.setRotationYawHead(passenger.getRotationYawHead() + this.deltaRotation);
        this.applyYawToEntity(passenger);

        if (passenger instanceof EntityAnimal && this.getPassengers().size() > 1)
        {
            int j = passenger.getEntityId() % 2 == 0 ? 90 : 270;
            passenger.setRenderYawOffset(((EntityAnimal)passenger).renderYawOffset + (float)j);
            passenger.setRotationYawHead(passenger.getRotationYawHead() + (float)j);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:41,代码来源:EntityBoat.java

示例8: updatePassenger

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void updatePassenger(Entity passenger)
{
    if (this.isPassenger(passenger))
    {
        float f = MathHelper.cos(this.renderYawOffset * 0.017453292F);
        float f1 = MathHelper.sin(this.renderYawOffset * 0.017453292F);
        float f2 = 0.3F;
        passenger.setPosition(this.posX + (double)(0.3F * f1), this.posY + this.getMountedYOffset() + passenger.getYOffset(), this.posZ - (double)(0.3F * f));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:EntityLlama.java

示例9: updatePassenger

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void updatePassenger(Entity passenger)
{
    super.updatePassenger(passenger);
    float f = MathHelper.sin(this.renderYawOffset * 0.017453292F);
    float f1 = MathHelper.cos(this.renderYawOffset * 0.017453292F);
    float f2 = 0.1F;
    float f3 = 0.0F;
    passenger.setPosition(this.posX + (double)(0.1F * f), this.posY + (double)(this.height * 0.5F) + passenger.getYOffset() + 0.0D, this.posZ - (double)(0.1F * f1));

    if (passenger instanceof EntityLivingBase)
    {
        ((EntityLivingBase)passenger).renderYawOffset = this.renderYawOffset;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:EntityChicken.java

示例10: func_190970_b

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void func_190970_b(World p_190970_1_, BlockPos p_190970_2_)
{
    IBlockState iblockstate = Blocks.DIRT.getDefaultState();
    p_190970_1_.setBlockState(p_190970_2_, iblockstate);
    AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(p_190970_1_, p_190970_2_).offset(p_190970_2_);

    for (Entity entity : p_190970_1_.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb))
    {
        entity.setPosition(entity.posX, axisalignedbb.maxY, entity.posZ);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:BlockFarmland.java

示例11: spawnWitherSkeleton

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void spawnWitherSkeleton(World world, BlockPos toSpawnIn) {
    Entity wither = new EntityWitherSkeleton(world);
    wither.setPosition(toSpawnIn.getX(), toSpawnIn.getY() + 0.5, toSpawnIn.getZ());
    world.spawnEntity(wither);
}
 
开发者ID:elifoster,项目名称:MakeClayValuableAgain,代码行数:6,代码来源:ClayProgressionImprovements.java

示例12: fire

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private synchronized boolean fire() {
    Entity itemShot = getCloseEntityIfUpgraded();
    if (getPressure() >= PneumaticValues.MIN_PRESSURE_AIR_CANNON && (itemShot != null || !inventory.getStackInSlot(CANNON_SLOT).isEmpty())) {
        double[] velocity = getVelocityVector(heightAngle, rotationAngle, getForce());
        addAir((int) (-500 * getForce()));
        boolean shootingInventory = false;
        if (itemShot == null) {
            shootingInventory = true;
            itemShot = getPayloadEntity();
            if (itemShot instanceof EntityItem) {
                inventory.setStackInSlot(CANNON_SLOT, ItemStack.EMPTY);
                if (getUpgrades(EnumUpgrade.BLOCK_TRACKER) > 0) {
                    trackedItems.add((EntityItem) itemShot);
                }
            } else {
                inventory.extractItem(CANNON_SLOT, 1, false);
            }
        } else if (itemShot instanceof EntityPlayer) {
            EntityPlayerMP entityplayermp = (EntityPlayerMP) itemShot;
            if (entityplayermp.connection.getNetworkManager().isChannelOpen()) {
                
                //This is a nasty hack to get around "player moved wrongly!" messages, which can be caused if player movement
                // triggers a player teleport (e.g. player moves onto pressure plate, triggers air cannon with an entity tracker).
                entityplayermp.invulnerableDimensionChange = true;
                
                entityplayermp.setPositionAndUpdate(getPos().getX() + 0.5D, getPos().getY() + 1.8D, getPos().getZ() + 0.5D);
            }
        }

        if (itemShot.isRiding()) {
            itemShot.dismountRidingEntity();
        }

        itemShot.setPosition(getPos().getX() + 0.5D, getPos().getY() + 1.8D, getPos().getZ() + 0.5D);
        NetworkHandler.sendToAllAround(new PacketSetEntityMotion(itemShot, velocity[0], velocity[1], velocity[2]),
                new TargetPoint(getWorld().provider.getDimension(), getPos().getX(), getPos().getY(), getPos().getZ(), 64));

        if (itemShot instanceof EntityFireball) {
            velocity[0] *= 0.05D;
            velocity[1] *= 0.05D;
            velocity[2] *= 0.05D;
        }

        itemShot.motionX = velocity[0];
        itemShot.motionY = velocity[1];
        itemShot.motionZ = velocity[2];

        itemShot.onGround = false;
        itemShot.collided = false;
        itemShot.collidedHorizontally = false;
        itemShot.collidedVertically = false;
        if (itemShot instanceof EntityLivingBase) ((EntityLivingBase) itemShot).setJumping(true);

        if (shootingInventory && !getWorld().isRemote) getWorld().spawnEntity(itemShot);

        for (int i = 0; i < 10; i++) {
            double velX = velocity[0] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
            double velY = velocity[1] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
            double velZ = velocity[2] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
            NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.SMOKE_LARGE, getPos().getX() + 0.5D, getPos().getY() + 0.7D, getPos().getZ() + 0.5D, velX, velY, velZ), getWorld());
        }
        NetworkHandler.sendToAllAround(new PacketPlaySound(Sounds.CANNON_SOUND, SoundCategory.BLOCKS, getPos().getX(), getPos().getY(), getPos().getZ(), 1.0F, rand.nextFloat() / 4F + 0.75F, true), getWorld());
        return true;
    } else {
        return false;
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:68,代码来源:TileEntityAirCannon.java

示例13: setPos

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static void setPos(Entity ent, BlockPos pos) {
    ent.setPosition(getX(pos), getY(pos), getZ(pos));
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:4,代码来源:ZWrapper.java

示例14: setPosition

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static void setPosition(Entity ent, Vec3d vec) {
    ent.setPosition(getX(vec), getY(vec), getZ(vec));
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:4,代码来源:ZWrapper.java

示例15: teleport

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void teleport(Entity entity, World world) {
    EntityPlayerMP playerMP = (EntityPlayerMP) entity;
    double dx = 0;
    double dy = 0;
    double dz = 0;
    
    WorldInfo wi = worldserver.getWorldInfo();
 
    if (wi != null) {
   
        dx = wi.getSpawnX();
        dy = wi.getSpawnY();
        dz = wi.getSpawnZ();
       
    }
 
    // check for zeros
    if (dx == 0 && dy == 0 && dz == 0) {
   
        // Set height to something big
        dy = 250;
 
        // Drop down until find solid
        while (world.getBlockState(new BlockPos((int) dx, (int) dy - 1, (int) dz)).equals(Blocks.AIR.getDefaultState()) && dy > 0) {
       
            dy--;
           
        }
 
        // Last check if dy == 0
        if (dy == 0) {
       
            dy = 128;
           
        }
       
    }
 
    // Offset locations for accuracy
    dx = dx + 0.5d;
    dy = dy + 1.0d;
    dz = dz + 0.5d;
    entity.setPosition(dx, dy, dz);
   
    // Freeze motion
    entity.motionX = entity.motionY = entity.motionZ = 0.0D;
    playerMP.setPosition(dx, dy, dz);
 
    if (playerMP.world.provider.getDimension() != world.provider.getDimension()) {
        playerMP.getServer().getPlayerList().transferPlayerToDimension(playerMP, world.provider.getDimension(), this);
    }
 
    entity.setPosition(dx, dy, dz); 
   
}
 
开发者ID:trigg,项目名称:Firma,代码行数:56,代码来源:SpawnTeleport.java


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