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


Java Village类代码示例

本文整理汇总了Java中net.minecraft.village.Village的典型用法代码示例。如果您正苦于以下问题:Java Village类的具体用法?Java Village怎么用?Java Village使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: isAngry

import net.minecraft.village.Village; //导入依赖的package包/类
private static boolean isAngry(EntityIronGolem e) {
    // Manually spawned golems will not turn hostile
    if (e.isPlayerCreated())
        return false;

    // Check if the village dislike the player
    {
        Village village = e.getVillage();
        // noinspection ConstantConditions
        if (village != null && village.isPlayerReputationTooLow(mc.player.getName()))
            return true;
    }

    // Check if the player is being targeted
    if (isTargeting(e, mc.player))
        return true;

    return false;
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:20,代码来源:EntityFilters.java

示例2: shouldExecute

import net.minecraft.village.Village; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.entityObj.worldObj.isDaytime())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = new BlockPos(this.entityObj);
        Village village = this.entityObj.worldObj.getVillageCollection().getNearestVillage(blockpos, 16);

        if (village == null)
        {
            return false;
        }
        else
        {
            this.frontDoor = village.getNearestDoor(blockpos);
            return this.frontDoor == null ? false : (double)this.frontDoor.getDistanceToInsideBlockSq(blockpos) < 2.25D;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:EntityAIRestrictOpenDoor.java

示例3: findNearestDoor

import net.minecraft.village.Village; //导入依赖的package包/类
private VillageDoorInfo findNearestDoor(Village villageIn)
{
    VillageDoorInfo villagedoorinfo = null;
    int i = Integer.MAX_VALUE;

    for (VillageDoorInfo villagedoorinfo1 : villageIn.getVillageDoorInfoList())
    {
        int j = villagedoorinfo1.getDistanceSquared(MathHelper.floor_double(this.theEntity.posX), MathHelper.floor_double(this.theEntity.posY), MathHelper.floor_double(this.theEntity.posZ));

        if (j < i && !this.doesDoorListContain(villagedoorinfo1))
        {
            villagedoorinfo = villagedoorinfo1;
            i = j;
        }
    }

    return villagedoorinfo;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:EntityAIMoveThroughVillage.java

示例4: shouldExecute

import net.minecraft.village.Village; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.entityObj.world.isDaytime())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = new BlockPos(this.entityObj);
        Village village = this.entityObj.world.getVillageCollection().getNearestVillage(blockpos, 16);

        if (village == null)
        {
            return false;
        }
        else
        {
            this.frontDoor = village.getNearestDoor(blockpos);
            return this.frontDoor == null ? false : (double)this.frontDoor.getDistanceToInsideBlockSq(blockpos) < 2.25D;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:EntityAIRestrictOpenDoor.java

示例5: findNearestDoor

import net.minecraft.village.Village; //导入依赖的package包/类
private VillageDoorInfo findNearestDoor(Village villageIn)
{
    VillageDoorInfo villagedoorinfo = null;
    int i = Integer.MAX_VALUE;

    for (VillageDoorInfo villagedoorinfo1 : villageIn.getVillageDoorInfoList())
    {
        int j = villagedoorinfo1.getDistanceSquared(MathHelper.floor(this.theEntity.posX), MathHelper.floor(this.theEntity.posY), MathHelper.floor(this.theEntity.posZ));

        if (j < i && !this.doesDoorListContain(villagedoorinfo1))
        {
            villagedoorinfo = villagedoorinfo1;
            i = j;
        }
    }

    return villagedoorinfo;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:EntityAIMoveThroughVillage.java

示例6: isVampireActive

import net.minecraft.village.Village; //导入依赖的package包/类
private static boolean isVampireActive(EntityPlayer player, long totalWorldTicks) {
   if(Config.instance().vampireHunterSpawnChance <= 0.0D) {
      return false;
   } else {
      ExtendedPlayer playerEx = ExtendedPlayer.get(player);
      if(playerEx.getVampireLevel() < 10) {
         return false;
      } else {
         if(player.worldObj.rand.nextDouble() < Config.instance().vampireHunterSpawnChance) {
            Village village = player.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ), 128);
            if(village != null && village.getReputationForPlayer(player.getCommandSenderName()) < -1) {
               List hunters = player.worldObj.getEntitiesWithinAABB(EntityWitchHunter.class, player.boundingBox.expand(64.0D, 16.0D, 64.0D));
               return hunters == null || hunters.size() == 0;
            }
         }

         return false;
      }
   }
}
 
开发者ID:lerion13,项目名称:witchery,代码行数:21,代码来源:EntityWitchHunter.java

示例7: noAnyInRange

import net.minecraft.village.Village; //导入依赖的package包/类
protected static boolean noAnyInRange(int x, int z, World world) {
    GSLogger.logInfo("Catacombs generation - Begin Checking area for another catacombs or villages");
    for (ChunkPos position : structuresList) {
        if (checkStructuresInRange(position.x, position.z, x, z, CATACOMBS_DISTANCE)) {
            return false;
        }
    }

    if (world.getVillageCollection() != null && world.getVillageCollection().getVillageList() != null) {
        for (Object villageObj : world.getVillageCollection().getVillageList()) {
            BlockPos villageCenter = ((Village) villageObj).getCenter();

            if (checkStructuresInRange(villageCenter.getX(), villageCenter.getZ(), x, z, VILLAGE_RANGE)) {
                return false;
            }

        }
    }

    if (checkStructuresInRange(world.getWorldInfo().getSpawnX(), world.getWorldInfo().getSpawnZ(), x, z, DISTANCE_FROM_SPAWN)) {
        return false;
    }

    GSLogger.logInfo("Catacombs generation - End Checking area for another catacombs or villages");
    return true;
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:27,代码来源:CatacombsGenerator.java

示例8: tickEvent

import net.minecraft.village.Village; //导入依赖的package包/类
@SubscribeEvent
public void tickEvent(@Nonnull final TickEvent.PlayerTickEvent event) {
	if (event.phase == Phase.END && event.side == Side.SERVER) {
		final EntityPlayer player = event.player;
		final VillageCollection villageCollection = player.getEntityWorld().getVillageCollection();
		boolean inVillage = false;

		if (villageCollection != null) {
			final List<Village> villages = villageCollection.getVillageList();
			if (villages != null && villages.size() > 0) {
				final BlockPos pos = player.getPosition();
				for (final Village v : villages)
					if (v.isBlockPosWithinSqVillageRadius(pos)) {
						inVillage = true;
						break;
					}
			}
		}

		final PacketEnvironment packet = new PacketEnvironment(inVillage);
		Network.sendToPlayer((EntityPlayerMP) player, packet);
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:24,代码来源:EnvironmentService.java

示例9: okToSpawnNearVillage

import net.minecraft.village.Village; //导入依赖的package包/类
public boolean okToSpawnNearVillage(int distanceToLook) {
		World world = this.worldObj;
		int x = (int) this.posX;
		int z = (int) this.posZ;
		int surfaceY = world.getHeightValue(x, z);
		Village v = world.villageCollectionObj.findNearestVillage(x, surfaceY, z, distanceToLook);
		if (v == null) {
			return false;
		}

		int r = v.getVillageRadius();
		AxisAlignedBB box = AxisAlignedBB.getBoundingBox(v.getCenter().posX - r, surfaceY - 20, v.getCenter().posZ - r, 
				v.getCenter().posX + r,	surfaceY + 35, v.getCenter().posZ + r);
		int spawnedGuards = world.getEntitiesWithinAABB(EntityGuard.class, box).size();
//		LogHelper.info("GuardSpawn: Found village at: " + v.getCenter().posX + " " + v.getCenter().posY
//				+ " " + v.getCenter().posZ + " with " + spawnedGuards + " Guards");
		if (v.isInRange(x, surfaceY, z) && spawnedGuards < BALANCE.MOBPROP.GUARD_MAX_PER_VILLAGE) {
			setHomeArea(v.getCenter().posX, v.getCenter().posY, v.getCenter().posZ, r);
			setFoundHome();
			return true;
		}
		else
			return false;
	}
 
开发者ID:DracoAnimus,项目名称:Coding,代码行数:25,代码来源:EntityGuard.java

示例10: okToSpawnNearVillage

import net.minecraft.village.Village; //导入依赖的package包/类
public boolean okToSpawnNearVillage(EntityJoinWorldEvent event, int distanceToLook) {
		World world = event.world;
		int x = (int) event.entity.posX;
		int z = (int) event.entity.posZ;
		int surfaceY = world.getHeightValue(x, z);
		Village v = world.villageCollectionObj.findNearestVillage(x, surfaceY, z, distanceToLook);
		if (v == null) {
			return false;
		}

		int r = v.getVillageRadius();
		AxisAlignedBB box = AxisAlignedBB.getBoundingBox(v.getCenter().posX - r, surfaceY - 20, v.getCenter().posZ - r, 
				v.getCenter().posX + r,	surfaceY + 35, v.getCenter().posZ + r);
		int spawnedGuards = world.getEntitiesWithinAABB(EntityGuard.class, box).size();
//		LogHelper.info("GuardSpawn: Found village at: " + v.getCenter().posX + " " + v.getCenter().posY
//				+ " " + v.getCenter().posZ + " with " + spawnedGuards + " Guards");
		if (v.isInRange(x, surfaceY, z) && spawnedGuards < BALANCE.MOBPROP.GUARD_MAX_PER_VILLAGE) {
			EntityGuard guard = (EntityGuard) event.entity;
			if (guard instanceof EntityGuard) {
				guard.setHomeArea(v.getCenter().posX, v.getCenter().posY, v.getCenter().posZ, r);
				guard.setFoundHome();
				return true;
			}
		}
		return false;
	}
 
开发者ID:DracoAnimus,项目名称:Coding,代码行数:27,代码来源:EntityGuardEventHandler.java

示例11: shouldExecute

import net.minecraft.village.Village; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.entityObj.worldObj.isDaytime())
    {
        return false;
    }
    else
    {
        Village var1 = this.entityObj.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ), 16);

        if (var1 == null)
        {
            return false;
        }
        else
        {
            this.frontDoor = var1.findNearestDoor(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ));
            return this.frontDoor == null ? false : (double)this.frontDoor.getInsideDistanceSquare(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ)) < 2.25D;
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:25,代码来源:EntityAIRestrictOpenDoor.java

示例12: func_75412_a

import net.minecraft.village.Village; //导入依赖的package包/类
private VillageDoorInfo func_75412_a(Village par1Village)
{
    VillageDoorInfo var2 = null;
    int var3 = Integer.MAX_VALUE;
    List var4 = par1Village.getVillageDoorInfoList();
    Iterator var5 = var4.iterator();

    while (var5.hasNext())
    {
        VillageDoorInfo var6 = (VillageDoorInfo)var5.next();
        int var7 = var6.getDistanceSquared(MathHelper.floor_double(this.theEntity.posX), MathHelper.floor_double(this.theEntity.posY), MathHelper.floor_double(this.theEntity.posZ));

        if (var7 < var3 && !this.func_75413_a(var6))
        {
            var2 = var6;
            var3 = var7;
        }
    }

    return var2;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:22,代码来源:EntityAIMoveThroughVillage.java

示例13: shouldExecute

import net.minecraft.village.Village; //导入依赖的package包/类
public boolean shouldExecute()
{
    if (this.entityObj.worldObj.isDaytime())
    {
        return false;
    }
    else
    {
        Village village = this.entityObj.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ), 16);

        if (village == null)
        {
            return false;
        }
        else
        {
            this.frontDoor = village.findNearestDoor(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ));
            return this.frontDoor == null ? false : (double)this.frontDoor.getInsideDistanceSquare(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ)) < 2.25D;
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:22,代码来源:EntityAIRestrictOpenDoor.java

示例14: func_75412_a

import net.minecraft.village.Village; //导入依赖的package包/类
private VillageDoorInfo func_75412_a(Village p_75412_1_)
{
    VillageDoorInfo villagedoorinfo = null;
    int i = Integer.MAX_VALUE;
    List list = p_75412_1_.getVillageDoorInfoList();
    Iterator iterator = list.iterator();

    while (iterator.hasNext())
    {
        VillageDoorInfo villagedoorinfo1 = (VillageDoorInfo)iterator.next();
        int j = villagedoorinfo1.getDistanceSquared(MathHelper.floor_double(this.theEntity.posX), MathHelper.floor_double(this.theEntity.posY), MathHelper.floor_double(this.theEntity.posZ));

        if (j < i && !this.func_75413_a(villagedoorinfo1))
        {
            villagedoorinfo = villagedoorinfo1;
            i = j;
        }
    }

    return villagedoorinfo;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:22,代码来源:EntityAIMoveThroughVillage.java

示例15: shouldExecute

import net.minecraft.village.Village; //导入依赖的package包/类
@Override
public boolean shouldExecute() {
	Village village = ((IVillageDefender) defender).getVillageToDefend();
	if (village == null) {
		return false;
	} else {
		aggressor = village.findNearestVillageAggressor(defender);

		if (!isSuitableTarget(aggressor, false)) {
			if (taskOwner.getRNG().nextInt(20) == 0) {
				aggressor = village.getNearestTargetPlayer(defender);
				return isSuitableTarget(aggressor, false);
			} else {
				return false;
			}
		} else {
			return true;
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:21,代码来源:GenericAIDefendVillage.java


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