當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityVillager.setLocationAndAngles方法代碼示例

本文整理匯總了Java中net.minecraft.entity.passive.EntityVillager.setLocationAndAngles方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityVillager.setLocationAndAngles方法的具體用法?Java EntityVillager.setLocationAndAngles怎麽用?Java EntityVillager.setLocationAndAngles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.passive.EntityVillager的用法示例。


在下文中一共展示了EntityVillager.setLocationAndAngles方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: spawnVillagers

import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
protected void spawnVillagers(World worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
{
    if (this.villagersSpawned < p_74893_6_)
    {
        for (int i = this.villagersSpawned; i < p_74893_6_; ++i)
        {
            int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_);
            int k = this.getYWithOffset(p_74893_4_);
            int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);

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

            ++this.villagersSpawned;
            EntityVillager entityvillager = new EntityVillager(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.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
            worldIn.spawnEntityInWorld(entityvillager);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:StructureVillagePieces.java

示例2: onChunkPopulated

import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
@SubscribeEvent
public void onChunkPopulated(PopulateChunkEvent.Post event)
{
	EntityVillager villager = new EntityVillager(event.getWorld(), VillagerRegistry.getId(HarshenVillagers.VALOR));
	BlockPos pos = event.getWorld().getTopSolidOrLiquidBlock(new BlockPos(event.getChunkX() * 16 + event.getRand().nextInt(16), 0, event.getChunkZ() * 16 + event.getRand().nextInt(16)));
	villager.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), villager.rotationYaw, villager.rotationPitch);
	if(event.isHasVillageGenerated())
		if(event.getRand().nextFloat() < 0.1f)
			event.getWorld().spawnEntity(villager);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:11,代碼來源:HandlerVillagerSpawn.java

示例3: giveBirth

import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
private void giveBirth()
{
    EntityVillager entityvillager = this.villagerObj.createChild(this.mate);
    this.mate.setGrowingAge(6000);
    this.villagerObj.setGrowingAge(6000);
    this.mate.setIsWillingToMate(false);
    this.villagerObj.setIsWillingToMate(false);
    entityvillager.setGrowingAge(-24000);
    entityvillager.setLocationAndAngles(this.villagerObj.posX, this.villagerObj.posY, this.villagerObj.posZ, 0.0F, 0.0F);
    this.worldObj.spawnEntityInWorld(entityvillager);
    this.worldObj.setEntityState(entityvillager, (byte)12);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:13,代碼來源:EntityAIVillagerMate.java

示例4: spawnVillagers

import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
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.isZombieInfested)
            {
                EntityZombieVillager entityzombievillager = new EntityZombieVillager(worldIn);
                entityzombievillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
                entityzombievillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityzombievillager)), (IEntityLivingData)null);
                entityzombievillager.func_190733_a(this.chooseProfession(i, 0));
                entityzombievillager.enablePersistence();
                worldIn.spawnEntityInWorld(entityzombievillager);
            }
            else
            {
                EntityVillager entityvillager = new EntityVillager(worldIn);
                entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
                entityvillager.setProfession(this.chooseProfession(i, worldIn.rand.nextInt(6)));
                entityvillager.func_190672_a(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null, false);
                worldIn.spawnEntityInWorld(entityvillager);
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:38,代碼來源:StructureVillagePieces.java

示例5: spawnVillagers

import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
/**
 * 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.isZombieInfested)
            {
                EntityZombie entityzombie = new EntityZombie(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.setVillagerType(chooseForgeProfession(i, net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer"))));
                entityzombie.enablePersistence();
                worldIn.spawnEntityInWorld(entityzombie);
            }
            else
            {
                EntityVillager entityvillager = new EntityVillager(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.setProfession(this.chooseForgeProfession(i, entityvillager.getProfessionForge()));
                worldIn.spawnEntityInWorld(entityvillager);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:42,代碼來源:StructureVillagePieces.java


注:本文中的net.minecraft.entity.passive.EntityVillager.setLocationAndAngles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。