use of net.minecraft.village.Village in project CumServerPro by MCUmbrella.
the class EntityAIRestrictOpenDoor method shouldExecute.
public boolean shouldExecute() {
if (this.entity.world.isDaytime()) {
return false;
} else {
BlockPos blockpos = new BlockPos(this.entity);
Village village = this.entity.world.getVillageCollection().getNearestVillage(blockpos, 16);
if (village == null) {
return false;
} else {
this.frontDoor = village.getNearestDoor(blockpos);
if (this.frontDoor == null) {
return false;
} else {
return (double) this.frontDoor.getDistanceToInsideBlockSq(blockpos) < 2.25D;
}
}
}
}
use of net.minecraft.village.Village in project CumServerPro by MCUmbrella.
the class EntityAIMoveThroughVillage method shouldExecute.
public boolean shouldExecute() {
this.resizeDoorList();
if (this.isNocturnal && this.entity.world.isDaytime()) {
return false;
} else {
Village village = this.entity.world.getVillageCollection().getNearestVillage(new BlockPos(this.entity), 0);
if (village == null) {
return false;
} else {
this.doorInfo = this.findNearestDoor(village);
if (this.doorInfo == null) {
return false;
} else {
PathNavigateGround pathnavigateground = (PathNavigateGround) this.entity.getNavigator();
boolean flag = pathnavigateground.getEnterDoors();
pathnavigateground.setBreakDoors(false);
this.path = pathnavigateground.getPathToPos(this.doorInfo.getDoorBlockPos());
pathnavigateground.setBreakDoors(flag);
if (this.path != null) {
return true;
} else {
Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockTowards(this.entity, 10, 7, new Vec3d((double) this.doorInfo.getDoorBlockPos().getX(), (double) this.doorInfo.getDoorBlockPos().getY(), (double) this.doorInfo.getDoorBlockPos().getZ()));
if (vec3d == null) {
return false;
} else {
pathnavigateground.setBreakDoors(false);
this.path = this.entity.getNavigator().getPathToXYZ(vec3d.x, vec3d.y, vec3d.z);
pathnavigateground.setBreakDoors(flag);
return this.path != null;
}
}
}
}
}
}
use of net.minecraft.village.Village in project Minecraft-SlientClient-Hack by YouNeverKnow00.
the class EntityAIRestrictOpenDoor method shouldExecute.
/**
* 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);
if (this.frontDoor == null) {
return false;
} else {
return (double) this.frontDoor.getDistanceToInsideBlockSq(blockpos) < 2.25D;
}
}
}
}
use of net.minecraft.village.Village in project DynamicSurroundings by OreCruncher.
the class EnvironmentService method tickEvent.
@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);
}
}
use of net.minecraft.village.Village in project Random-Things by lumien231.
the class FestivalHandler method addFestival.
public int addFestival(EntityVillager villager) {
Village v = ReflectionUtil.getVillage(villager);
if (v != null) {
List<VillageDoorInfo> doorInfos = v.getVillageDoorInfoList();
if (doorInfos != null && !doorInfos.isEmpty()) {
Festival f = new Festival();
for (VillageDoorInfo doorInfo : doorInfos) {
f.addDoorPos(doorInfo.getInsideBlockPos());
}
HashSet<BlockPos> hashTest = new HashSet<>(f.getDoorPositions());
for (Festival currentFestival : currentFestivals) {
for (BlockPos p : currentFestival.doorPositions) {
if (hashTest.contains(p)) {
return 1;
}
}
}
addFestival(f);
return 2;
}
}
return 0;
}
Aggregations