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


Java Entity.setPositionAndUpdate方法代碼示例

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


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

示例1: onItemUse

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
		EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

	if (!worldIn.isRemote) {
		if(!facing.equals(EnumFacing.UP)){
			playerIn.addChatComponentMessage(new TextComponentTranslation("chat.tripod.mustup"));
			return EnumActionResult.PASS;
		}
		Entity entity = new EntityTripod(worldIn);
		entity.setPositionAndUpdate(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
		entity.rotationYaw = playerIn.rotationYaw;
		entity.rotationPitch = playerIn.rotationPitch;
		worldIn.spawnEntityInWorld(entity);
		// worldIn.updateEntities();
		stack.stackSize--;
		return EnumActionResult.SUCCESS;
	}
	return EnumActionResult.PASS;
}
 
開發者ID:PorPit,項目名稱:MineCamera,代碼行數:21,代碼來源:ItemTripod.java

示例2: teleportEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void teleportEntity(Entity entityIn)
{
    if (!this.world.isRemote && !this.isCoolingDown())
    {
        this.teleportCooldown = 100;

        if (this.exitPortal == null && this.world.provider instanceof WorldProviderEnd)
        {
            this.findExitPortal();
        }

        if (this.exitPortal != null)
        {
            BlockPos blockpos = this.exactTeleport ? this.exitPortal : this.findExitPosition();
            entityIn.setPositionAndUpdate((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D);
        }

        this.triggerCooldown();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:TileEntityEndGateway.java

示例3: teleportEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void teleportEntity(Entity entityIn)
{
    if (!this.worldObj.isRemote && !this.isCoolingDown())
    {
        this.teleportCooldown = 100;

        if (this.exitPortal == null && this.worldObj.provider instanceof WorldProviderEnd)
        {
            this.findExitPortal();
        }

        if (this.exitPortal != null)
        {
            BlockPos blockpos = this.exactTeleport ? this.exitPortal : this.findExitPosition();
            entityIn.setPositionAndUpdate((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D);
        }

        this.triggerCooldown();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:21,代碼來源:TileEntityEndGateway.java

示例4: func_110671_a

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private double func_110671_a(List<Entity> p_110671_1_, World worldIn, CommandSpreadPlayers.Position[] p_110671_3_, boolean p_110671_4_)
{
    double d0 = 0.0D;
    int i = 0;
    Map<Team, CommandSpreadPlayers.Position> map = Maps.<Team, CommandSpreadPlayers.Position>newHashMap();

    for (int j = 0; j < p_110671_1_.size(); ++j)
    {
        Entity entity = (Entity)p_110671_1_.get(j);
        CommandSpreadPlayers.Position commandspreadplayers$position;

        if (p_110671_4_)
        {
            Team team = entity instanceof EntityPlayer ? ((EntityPlayer)entity).getTeam() : null;

            if (!map.containsKey(team))
            {
                map.put(team, p_110671_3_[i++]);
            }

            commandspreadplayers$position = (CommandSpreadPlayers.Position)map.get(team);
        }
        else
        {
            commandspreadplayers$position = p_110671_3_[i++];
        }

        entity.setPositionAndUpdate((double)((float)MathHelper.floor_double(commandspreadplayers$position.field_111101_a) + 0.5F), (double)commandspreadplayers$position.func_111092_a(worldIn), (double)MathHelper.floor_double(commandspreadplayers$position.field_111100_b) + 0.5D);
        double d2 = Double.MAX_VALUE;

        for (int k = 0; k < p_110671_3_.length; ++k)
        {
            if (commandspreadplayers$position != p_110671_3_[k])
            {
                double d1 = commandspreadplayers$position.func_111099_a(p_110671_3_[k]);
                d2 = Math.min(d1, d2);
            }
        }

        d0 += d2;
    }

    d0 = d0 / (double)p_110671_1_.size();
    return d0;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:46,代碼來源:CommandSpreadPlayers.java

示例5: setPlayerPositions

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private double setPlayerPositions(List<Entity> p_110671_1_, World worldIn, CommandSpreadPlayers.Position[] p_110671_3_, boolean p_110671_4_)
{
    double d0 = 0.0D;
    int i = 0;
    Map<Team, CommandSpreadPlayers.Position> map = Maps.<Team, CommandSpreadPlayers.Position>newHashMap();

    for (int j = 0; j < p_110671_1_.size(); ++j)
    {
        Entity entity = (Entity)p_110671_1_.get(j);
        CommandSpreadPlayers.Position commandspreadplayers$position;

        if (p_110671_4_)
        {
            Team team = entity instanceof EntityPlayer ? entity.getTeam() : null;

            if (!map.containsKey(team))
            {
                map.put(team, p_110671_3_[i++]);
            }

            commandspreadplayers$position = (CommandSpreadPlayers.Position)map.get(team);
        }
        else
        {
            commandspreadplayers$position = p_110671_3_[i++];
        }

        entity.setPositionAndUpdate((double)((float)MathHelper.floor(commandspreadplayers$position.x) + 0.5F), (double)commandspreadplayers$position.getSpawnY(worldIn), (double)MathHelper.floor(commandspreadplayers$position.z) + 0.5D);
        double d2 = Double.MAX_VALUE;

        for (CommandSpreadPlayers.Position commandspreadplayers$position1 : p_110671_3_)
        {
            if (commandspreadplayers$position != commandspreadplayers$position1)
            {
                double d1 = commandspreadplayers$position.dist(commandspreadplayers$position1);
                d2 = Math.min(d1, d2);
            }
        }

        d0 += d2;
    }

    d0 = d0 / (double)p_110671_1_.size();
    return d0;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:46,代碼來源:CommandSpreadPlayers.java

示例6: getCollisionBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public AxisAlignedBB getCollisionBox(Entity entityIn) {
	if (!this.world.isRemote && !this.isExit() && this.getTPprogress() <= 0 && entityIn != null
			&& entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityBuilding)
			&& ((this.getOwner() != null && ((WeaponsCapability.get(this.getOwner()).teleporterEntity && !(entityIn instanceof EntityPlayer)) || 
					(WeaponsCapability.get(this.getOwner()).teleporterPlayer && entityIn instanceof EntityPlayer && entityIn.getTeam() == null)))
					|| TF2Util.isOnSameTeam(EntityTeleporter.this, entityIn))
			&& entityIn.getEntityBoundingBox()
					.intersects(this.getEntityBoundingBox().grow(0, 0.5, 0).offset(0, 0.5D, 0)))
		if (ticksToTeleport <= 0)
			if (ticksToTeleport < 0)
				ticksToTeleport = 10;
			else {
				TeleporterData exit = this.getTeleportExit();
				if (exit != null) {
					if (exit.dimension != this.dimension) {
						if(entityIn instanceof EntityPlayerMP && net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, exit.dimension)) {
							this.world.getMinecraftServer().getPlayerList().transferPlayerToDimension((EntityPlayerMP) entityIn, 
									exit.dimension, new TeleporterDim((WorldServer) this.world,exit));
							
						}
						else {
							World destworld = this.world.getMinecraftServer().getWorld(exit.dimension);
							Entity newent = EntityList.newEntity(entityIn.getClass(), destworld);
							if(newent != null) {
								NBTTagCompound data = entityIn.writeToNBT(new NBTTagCompound());
								data.removeTag("Dimension");
								newent.readFromNBT(data);
								entityIn.setDead();
								newent.forceSpawn = true;
								entityIn.moveToBlockPosAndAngles(exit, entityIn.rotationYaw, entityIn.rotationPitch);
								destworld.spawnEntity(newent);
								entityIn = newent;
							}
						}
					}
					entityIn.setPositionAndUpdate(exit.getX() + 0.5, exit.getY() + 0.23, exit.getZ() + 0.5);
					this.setTeleports(this.getTeleports() + 1);
					this.setTPprogress(this.getLevel() == 1 ? 200 : (this.getLevel() == 2 ? 100 : 60));
					this.playSound(TF2Sounds.MOB_TELEPORTER_SEND, 1.5f, 1f);
					entityIn.playSound(TF2Sounds.MOB_TELEPORTER_RECEIVE, 0.75f, 1f);
					if(this.getOwner() instanceof EntityPlayerMP){
						((EntityPlayer) this.getOwner()).addStat(TF2Achievements.TELEPORTED);
						/*if(((EntityPlayerMP) this.getOwner()).getStatFile().readStat(TF2Achievements.TELEPORTED)>=100)
							((EntityPlayer) this.getOwner()).addStat(TF2Achievements.TELEPORTS);*/
					}
				}
			}
	return super.getCollisionBox(entityIn);
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:51,代碼來源:EntityTeleporter.java

示例7: setPlayerPositions

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private double setPlayerPositions(List<Entity> p_110671_1_, World worldIn, CommandSpreadPlayers.Position[] p_110671_3_, boolean p_110671_4_)
{
    double d0 = 0.0D;
    int i = 0;
    Map<Team, CommandSpreadPlayers.Position> map = Maps.<Team, CommandSpreadPlayers.Position>newHashMap();

    for (int j = 0; j < p_110671_1_.size(); ++j)
    {
        Entity entity = (Entity)p_110671_1_.get(j);
        CommandSpreadPlayers.Position commandspreadplayers$position;

        if (p_110671_4_)
        {
            Team team = entity instanceof EntityPlayer ? ((EntityPlayer)entity).getTeam() : null;

            if (!map.containsKey(team))
            {
                map.put(team, p_110671_3_[i++]);
            }

            commandspreadplayers$position = (CommandSpreadPlayers.Position)map.get(team);
        }
        else
        {
            commandspreadplayers$position = p_110671_3_[i++];
        }

        entity.setPositionAndUpdate((double)((float)MathHelper.floor_double(commandspreadplayers$position.x) + 0.5F), (double)commandspreadplayers$position.getSpawnY(worldIn), (double)MathHelper.floor_double(commandspreadplayers$position.z) + 0.5D);
        double d2 = Double.MAX_VALUE;

        for (CommandSpreadPlayers.Position commandspreadplayers$position1 : p_110671_3_)
        {
            if (commandspreadplayers$position != commandspreadplayers$position1)
            {
                double d1 = commandspreadplayers$position.dist(commandspreadplayers$position1);
                d2 = Math.min(d1, d2);
            }
        }

        d0 += d2;
    }

    d0 = d0 / (double)p_110671_1_.size();
    return d0;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:46,代碼來源:CommandSpreadPlayers.java


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