congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
VillageCollection
Code IndexAdd Tabnine to your IDE (free)

How to use
VillageCollection
in
net.minecraft.village

Best Java code snippets using net.minecraft.village.VillageCollection (Showing top 9 results out of 315)

origin: TeamLapen/Vampirism

/**
 * Finds the nearest village, but only the given coordinates are withing it's bounding box plus the given the distance.
 */
public static @Nullable
VampirismVillage getNearestVillage(World w, BlockPos pos, int r) {
  Village v = w.villageCollection.getNearestVillage(pos, r);
  if (v != null) {
    return VampirismVillage.get(v);
  }
  return null;
}
origin: TeamLapen/Vampirism

/**
 * Tick all Vampirism Villages
 */
public static void tick(World w) {
  if (w.villageCollection != null) { //Shouldn't be null, but https://github.com/TeamLapen/Vampirism/issues/372
    for (Village v : w.villageCollection.getVillageList()) {
      VampirismVillage.get(v).tick(w.getTotalWorldTime());
    }
  }
}
origin: TeamLapen/Vampirism

@Override
public boolean getCanSpawnHere() {
  if (isGettingSundamage(true) || (world.isDaytime() && rand.nextInt(5) != 0)) return false;
  if (isGettingGarlicDamage(true) != EnumStrength.NONE) return false;
  if (world.getVillageCollection().getNearestVillage(getPosition(), 1) != null) {
    if (getRNG().nextInt(60) != 0) {
      return false;
    }
  }
  return super.getCanSpawnHere() && (!restrictedSpawn || getCanSpawnHereRestricted());
}
origin: AntiqueAtlasTeam/AntiqueAtlas

/**
 * Returns the village if the specified chunk overlays its territory.
 */
public static Village getVillageInChunk(Chunk chunk) {
  int centerX = (chunk.x << 4) + 8;
  int centerZ = (chunk.z << 4) + 8;
  List<Village> villages = chunk.getWorld().villageCollection.getVillageList();
  for (Village village : villages) {
    BlockPos coords = village.getCenter();
    if ((centerX - coords.getX())*(centerX - coords.getX()) + (centerZ - coords.getZ())*(centerZ - coords.getZ())
        <= village.getVillageRadius()*village.getVillageRadius()) {
      return village;
    }
  }
  return null;
}
 
origin: TeamLapen/Vampirism

return world.getVillageCollection().getNearestVillage(world.getHeight(new BlockPos(i << 4, 0, j << 4)), 20) == null;
origin: TeamLapen/Vampirism

@Override
public boolean shouldExecute() {
  BlockPos blockpos = new BlockPos(this.entityObj);
  if (this.entityObj.getEntityWorld().isDaytime() && this.entityObj.getEntityWorld().provider.hasSkyLight()) {
    if (this.entityObj.getRNG().nextInt(50) != 0) {
      return false;
    } else if (this.insidePosX != -1 && this.entityObj.getDistanceSq((double) this.insidePosX, this.entityObj.posY, (double) this.insidePosZ) < 4.0D) {
      return false;
    } else {
      Village village = this.entityObj.getEntityWorld().getVillageCollection().getNearestVillage(blockpos, 14);
      if (village == null) {
        return false;
      } else {
        this.doorInfo = village.getDoorInfo(blockpos);
        return this.doorInfo != null;
      }
    }
  } else {
    return false;
  }
}
origin: PrinceOfAmber/Cyclic

 @Override
 public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
  BlockPos pos = sender.getPosition();
  World world = sender.getEntityWorld();
  int dX, dZ;
  int range = 64;
  Village closest = world.villageCollection.getNearestVillage(pos, range);
  if (closest == null) {
   UtilChat.addChatMessage(sender, "command.villageinfo.none");
  }
  else {
   int doors = closest.getNumVillageDoors();
   int villagers = closest.getNumVillagers();
   UtilChat.addChatMessage(sender, UtilChat.lang("command.villageinfo.popul") + String.format("%d", villagers));
   UtilChat.addChatMessage(sender, UtilChat.lang("command.villageinfo.doors") + String.format("%d", doors));
   if (sender instanceof EntityPlayer) {
    // command blocks/server controllers do not have reputation
    EntityPlayer player = (EntityPlayer) sender;
    int rep = closest.getPlayerReputation(player.getUniqueID());
    UtilChat.addChatMessage(sender, player.getName() + " " + UtilChat.lang("command.villageinfo.reputation") + String.format("%d", rep));
   }
   dX = pos.getX() - closest.getCenter().getX();
   dZ = pos.getZ() - closest.getCenter().getZ();
   int dist = MathHelper.floor(Math.sqrt(dX * dX + dZ * dZ));
   UtilChat.addChatMessage(sender, UtilChat.lang("command.villageinfo.center") + String.format("%d", dist));
  }
 }
}
origin: ldtteam/minecolonies

&& world.getVillageCollection().getNearestVillage(pos, Configurations.gameplay.workingRangeTownHallChunks * BLOCKS_PER_CHUNK) != null)
origin: TeamLapen/Vampirism

} else {
  @Nullable Village village = this.theEntity.getEntityWorld().getVillageCollection().getNearestVillage(new BlockPos(this.theEntity), 0);
net.minecraft.villageVillageCollection

Most used methods

  • getNearestVillage
  • getVillageList

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JTable (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now