Search in sources :

Example 11 with Village

use of net.minecraft.village.Village in project BugTorch by jss2a98aj.

the class MixinVillageSiege method func_75529_b.

/**
 * @author jss2a98aj
 * @reason Allows Zombie sieges to start
 */
@Overwrite()
private boolean func_75529_b() {
    List<EntityPlayer> list = worldObj.playerEntities;
    Iterator iterator = list.iterator();
    while (true) {
        if (!iterator.hasNext()) {
            return false;
        }
        EntityPlayer entityplayer = (EntityPlayer) iterator.next();
        theVillage = worldObj.villageCollectionObj.findNearestVillage((int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ, 1);
        if (theVillage != null && theVillage.getNumVillageDoors() >= 10 && theVillage.getTicksSinceLastDoorAdding() >= 20 && theVillage.getNumVillagers() >= 20) {
            ChunkCoordinates chunkcoordinates = theVillage.getCenter();
            float f = (float) theVillage.getVillageRadius();
            boolean flag = false;
            for (int i = 0; i < 10; ++i) {
                float f1 = worldObj.rand.nextFloat() * (float) Math.PI * 2.0F;
                field_75532_g = chunkcoordinates.posX + (int) ((double) (MathHelper.cos(f1) * f) * 0.9D);
                field_75538_h = chunkcoordinates.posY;
                field_75539_i = chunkcoordinates.posZ + (int) ((double) (MathHelper.sin(f1) * f) * 0.9D);
                flag = false;
                Iterator iterator1 = worldObj.villageCollectionObj.getVillageList().iterator();
                while (iterator1.hasNext()) {
                    Village village = (Village) iterator1.next();
                    if (village != theVillage && village.isInRange(field_75532_g, field_75538_h, field_75539_i)) {
                        flag = true;
                        break;
                    }
                }
                if (!flag) {
                    break;
                }
            }
            if (flag) {
                return false;
            }
            Vec3 vec3 = func_75527_a(field_75532_g, field_75538_h, field_75539_i);
            if (vec3 != null) {
                break;
            }
        }
    }
    field_75534_e = 0;
    field_75533_d = 20;
    return true;
}
Also used : Village(net.minecraft.village.Village) Vec3(net.minecraft.util.Vec3) Iterator(java.util.Iterator) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChunkCoordinates(net.minecraft.util.ChunkCoordinates) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Example 12 with Village

use of net.minecraft.village.Village in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class EntityAIMoveThroughVillage method shouldExecute.

/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute() {
    this.resizeDoorList();
    if (this.isNocturnal && this.theEntity.world.isDaytime()) {
        return false;
    } else {
        Village village = this.theEntity.world.getVillageCollection().getNearestVillage(new BlockPos(this.theEntity), 0);
        if (village == null) {
            return false;
        } else {
            this.doorInfo = this.findNearestDoor(village);
            if (this.doorInfo == null) {
                return false;
            } else {
                PathNavigateGround pathnavigateground = (PathNavigateGround) this.theEntity.getNavigator();
                boolean flag = pathnavigateground.getEnterDoors();
                pathnavigateground.setBreakDoors(false);
                this.entityPathNavigate = pathnavigateground.getPathToPos(this.doorInfo.getDoorBlockPos());
                pathnavigateground.setBreakDoors(flag);
                if (this.entityPathNavigate != null) {
                    return true;
                } else {
                    Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 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.entityPathNavigate = this.theEntity.getNavigator().getPathToXYZ(vec3d.xCoord, vec3d.yCoord, vec3d.zCoord);
                        pathnavigateground.setBreakDoors(flag);
                        return this.entityPathNavigate != null;
                    }
                }
            }
        }
    }
}
Also used : Village(net.minecraft.village.Village) BlockPos(net.minecraft.util.math.BlockPos) Vec3d(net.minecraft.util.math.Vec3d) PathNavigateGround(net.minecraft.pathfinding.PathNavigateGround)

Example 13 with Village

use of net.minecraft.village.Village in project WizClient-1.8.9-Version by WizClient.

the class EntityAIMoveThroughVillage method shouldExecute.

/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute() {
    this.resizeDoorList();
    if (this.isNocturnal && this.theEntity.worldObj.isDaytime()) {
        return false;
    } else {
        Village village = this.theEntity.worldObj.getVillageCollection().getNearestVillage(new BlockPos(this.theEntity), 0);
        if (village == null) {
            return false;
        } else {
            this.doorInfo = this.findNearestDoor(village);
            if (this.doorInfo == null) {
                return false;
            } else {
                PathNavigateGround pathnavigateground = (PathNavigateGround) this.theEntity.getNavigator();
                boolean flag = pathnavigateground.getEnterDoors();
                pathnavigateground.setBreakDoors(false);
                this.entityPathNavigate = pathnavigateground.getPathToPos(this.doorInfo.getDoorBlockPos());
                pathnavigateground.setBreakDoors(flag);
                if (this.entityPathNavigate != null) {
                    return true;
                } else {
                    Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 10, 7, new Vec3((double) this.doorInfo.getDoorBlockPos().getX(), (double) this.doorInfo.getDoorBlockPos().getY(), (double) this.doorInfo.getDoorBlockPos().getZ()));
                    if (vec3 == null) {
                        return false;
                    } else {
                        pathnavigateground.setBreakDoors(false);
                        this.entityPathNavigate = this.theEntity.getNavigator().getPathToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord);
                        pathnavigateground.setBreakDoors(flag);
                        return this.entityPathNavigate != null;
                    }
                }
            }
        }
    }
}
Also used : Village(net.minecraft.village.Village) Vec3(net.minecraft.util.Vec3) BlockPos(net.minecraft.util.BlockPos) PathNavigateGround(net.minecraft.pathfinding.PathNavigateGround)

Example 14 with Village

use of net.minecraft.village.Village in project WizClient-1.8.9-Version by WizClient.

the class EntityAIRestrictOpenDoor method shouldExecute.

/**
 * 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;
        }
    }
}
Also used : Village(net.minecraft.village.Village) BlockPos(net.minecraft.util.BlockPos)

Aggregations

Village (net.minecraft.village.Village)14 BlockPos (net.minecraft.util.math.BlockPos)7 BlockPos (net.minecraft.util.BlockPos)6 PathNavigateGround (net.minecraft.pathfinding.PathNavigateGround)5 Vec3 (net.minecraft.util.Vec3)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 Vec3d (net.minecraft.util.math.Vec3d)2 VillageCollection (net.minecraft.village.VillageCollection)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 ChunkCoordinates (net.minecraft.util.ChunkCoordinates)1 VillageDoorInfo (net.minecraft.village.VillageDoorInfo)1 PacketEnvironment (org.blockartistry.DynSurround.network.PacketEnvironment)1 PacketEnvironment (org.orecruncher.dsurround.network.PacketEnvironment)1 Overwrite (org.spongepowered.asm.mixin.Overwrite)1