net.minecraft.entity.monster.EntityZombieVillager Java Examples

The following examples show how to use net.minecraft.entity.monster.EntityZombieVillager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntitySpawning.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onZombieVillagerDeath(LivingUpdateEvent event) {
	if (!event.getEntity().getEntityWorld().isRemote && event.getEntity().isDead && event.getEntity() instanceof EntityZombieVillager) {

		EntityLiving convertTo = null;

		if (hasRoyalEffect(event)) {
			convertTo = new EntityVillageLord(event.getEntity().world);
		} else if (hasLoyalEffect(event)) {
			convertTo = new EntityGuard(event.getEntity().world);
		}

		if (convertTo == null) {
			return;
		}

		if (handlePossibleConversion((EntityLiving) event.getEntity(), convertTo)) {
			removeVillager(event);
		}
	}
}
 
Example #2
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Spawns a number of villagers in this component. Parameters: world, component bounding box, x offset, y
 * offset, z offset, number of villagers
 */
protected void spawnVillagers(World worldIn, StructureBoundingBox structurebb, int x, int y, int z, int count) {
    if (this.villagersSpawned < count) {
        for (int i = this.villagersSpawned; i < count; ++i) {
            int j = this.getXWithOffset(x + i, z);
            int k = this.getYWithOffset(y);
            int l = this.getZWithOffset(x + i, z);

            if (!structurebb.isVecInside(new BlockPos(j, k, l))) {
                break;
            }

            ++this.villagersSpawned;

            if (this.field_189929_i) {
                EntityZombieVillager entityzombie = new EntityZombieVillager(worldIn);
                entityzombie.setLocationAndAngles((double) j + 0.5D, (double) k, (double) l + 0.5D, 0.0F, 0.0F);
                entityzombie.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData) null);
                entityzombie.enablePersistence();
                worldIn.spawnEntity(entityzombie);
            } else {
                EntityTofunian entityvillager = new EntityTofunian(worldIn);
                entityvillager.setLocationAndAngles((double) j + 0.5D, (double) k, (double) l + 0.5D, 0.0F, 0.0F);
                entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData) null);
                worldIn.spawnEntity(entityvillager);
            }
        }
    }
}
 
Example #3
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
protected void spawnVillagers(World worldIn, StructureBoundingBox structurebb, int x, int y, int z, int count,int profession) {
    if (this.villagersSpawned < count) {
        for (int i = this.villagersSpawned; i < count; ++i) {
            int j = this.getXWithOffset(x + i, z);
            int k = this.getYWithOffset(y);
            int l = this.getZWithOffset(x + i, z);

            if (!structurebb.isVecInside(new BlockPos(j, k, l))) {
                break;
            }

            ++this.villagersSpawned;

            if (this.field_189929_i) {
                EntityZombieVillager entityzombie = new EntityZombieVillager(worldIn);
                entityzombie.setLocationAndAngles((double) j + 0.5D, (double) k, (double) l + 0.5D, 0.0F, 0.0F);
                entityzombie.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData) null);
                entityzombie.enablePersistence();
                worldIn.spawnEntity(entityzombie);
            } else {
                EntityTofunian entityvillager = new EntityTofunian(worldIn);
                entityvillager.setLocationAndAngles((double) j + 0.5D, (double) k, (double) l + 0.5D, 0.0F, 0.0F);
                entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData) null);
                entityvillager.setTofuProfession(profession);
                worldIn.spawnEntity(entityvillager);
            }
        }
    }
}
 
Example #4
Source File: CraftVillagerZombie.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftVillagerZombie(CraftServer server, EntityZombieVillager entity) {
    super(server, entity);
}
 
Example #5
Source File: CraftVillagerZombie.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityZombieVillager getHandle() {
    return (EntityZombieVillager) super.getHandle();
}
 
Example #6
Source File: CraftZombie.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public boolean isVillager() {
    return getHandle() instanceof EntityZombieVillager;
}
 
Example #7
Source File: EntitySpawning.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
private boolean hasRoyalEffect(LivingUpdateEvent event) {
	return ((EntityZombieVillager) event.getEntity()).getActivePotionEffect(PotionRoyal.INSTANCE) != null;
}
 
Example #8
Source File: EntitySpawning.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
private boolean hasLoyalEffect(LivingUpdateEvent event) {
	return ((EntityZombieVillager) event.getEntity()).getActivePotionEffect(PotionLoyalty.INSTANCE) != null;
}