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


Java Entity.getTeam方法代码示例

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


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

示例1: getTeamCollisionPredicate

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static <T extends Entity> Predicate<T> getTeamCollisionPredicate(final Entity entityIn)
{
    final Team team = entityIn.getTeam();
    final Team.CollisionRule team$collisionrule = team == null ? Team.CollisionRule.ALWAYS : team.getCollisionRule();
    Predicate<?> ret = team$collisionrule == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : Predicates.and(NOT_SPECTATING, new Predicate<Entity>()
    {
        public boolean apply(@Nullable Entity p_apply_1_)
        {
            if (!p_apply_1_.canBePushed())
            {
                return false;
            }
            else if (!entityIn.world.isRemote || p_apply_1_ instanceof EntityPlayer && ((EntityPlayer)p_apply_1_).isUser())
            {
                Team team1 = p_apply_1_.getTeam();
                Team.CollisionRule team$collisionrule1 = team1 == null ? Team.CollisionRule.ALWAYS : team1.getCollisionRule();

                if (team$collisionrule1 == Team.CollisionRule.NEVER)
                {
                    return false;
                }
                else
                {
                    boolean flag = team != null && team.isSameTeam(team1);
                    return (team$collisionrule == Team.CollisionRule.HIDE_FOR_OWN_TEAM || team$collisionrule1 == Team.CollisionRule.HIDE_FOR_OWN_TEAM) && flag ? false : team$collisionrule != Team.CollisionRule.HIDE_FOR_OTHER_TEAMS && team$collisionrule1 != Team.CollisionRule.HIDE_FOR_OTHER_TEAMS || flag;
                }
            }
            else
            {
                return false;
            }
        }
    });
    return (Predicate<T>)ret;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:EntitySelectors.java

示例2: getTeam

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static Team getTeam(Entity living) {
	if (living == null)
		return null;
	else if (!(living instanceof IThrowableEntity))
		return living.getTeam();
	else
		return getTeam(((IThrowableEntity) living).getThrower());
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:9,代码来源:TF2Util.java

示例3: testCondition

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public boolean testCondition(Random rand, LootContext context) {

	Entity player = this.team ? context.getKiller() : context.getKillerPlayer();
	if(player instanceof IEntityOwnable && ((IEntityOwnable)player).getOwner() instanceof EntityPlayer)
		player = ((IEntityOwnable)player).getOwner();
	return player != null && player.getTeam() != null && !player.isOnSameTeam(context.getLootedEntity());
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:9,代码来源:KilledByTeam.java

示例4: getTeamCollisionPredicate

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static <T extends Entity> Predicate<T> getTeamCollisionPredicate(final Entity entityIn)
{
    final Team team = entityIn.getTeam();
    final Team.CollisionRule team$collisionrule = team == null ? Team.CollisionRule.ALWAYS : team.getCollisionRule();
    Predicate<?> ret = team$collisionrule == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : Predicates.and(NOT_SPECTATING, new Predicate<Entity>()
    {
        public boolean apply(@Nullable Entity p_apply_1_)
        {
            if (!p_apply_1_.canBePushed())
            {
                return false;
            }
            else if (!entityIn.worldObj.isRemote || p_apply_1_ instanceof EntityPlayer && ((EntityPlayer)p_apply_1_).isUser())
            {
                Team team1 = p_apply_1_.getTeam();
                Team.CollisionRule team$collisionrule1 = team1 == null ? Team.CollisionRule.ALWAYS : team1.getCollisionRule();

                if (team$collisionrule1 == Team.CollisionRule.NEVER)
                {
                    return false;
                }
                else
                {
                    boolean flag = team != null && team.isSameTeam(team1);
                    return (team$collisionrule == Team.CollisionRule.HIDE_FOR_OWN_TEAM || team$collisionrule1 == Team.CollisionRule.HIDE_FOR_OWN_TEAM) && flag ? false : team$collisionrule != Team.CollisionRule.HIDE_FOR_OTHER_TEAMS && team$collisionrule1 != Team.CollisionRule.HIDE_FOR_OTHER_TEAMS || flag;
                }
            }
            else
            {
                return false;
            }
        }
    });
    return (Predicate<T>)ret;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:36,代码来源:EntitySelectors.java

示例5: isOnSameTeam

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Returns whether this Entity is on the same team as the given Entity.
 */
public boolean isOnSameTeam(Entity entityIn)
{
    return super.isOnSameTeam(entityIn) ? true : (entityIn instanceof EntityLivingBase && ((EntityLivingBase)entityIn).getCreatureAttribute() == EnumCreatureAttribute.ILLAGER ? this.getTeam() == null && entityIn.getTeam() == null : false);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:EntityVindicator.java

示例6: isOnSameTeam

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Returns whether this Entity is on the same team as the given Entity.
 */
public boolean isOnSameTeam(Entity entityIn)
{
    return entityIn == null ? false : (entityIn == this ? true : (super.isOnSameTeam(entityIn) ? true : (entityIn instanceof EntityVex ? this.isOnSameTeam(((EntityVex)entityIn).func_190645_o()) : (entityIn instanceof EntityLivingBase && ((EntityLivingBase)entityIn).getCreatureAttribute() == EnumCreatureAttribute.ILLAGER ? this.getTeam() == null && entityIn.getTeam() == null : false))));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:EntityEvoker.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 ? 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

示例8: 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


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