Java 类net.minecraft.world.biome.BiomeSnow 实例源码

项目:CustomWorldGen    文件:EntitySkeleton.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
@Nullable
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.worldObj.provider instanceof WorldProviderHell && this.getRNG().nextInt(5) > 0)
    {
        this.tasks.addTask(4, this.aiAttackOnCollide);
        this.setSkeletonType(SkeletonType.WITHER);
        this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.STONE_SWORD));
        this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4.0D);
    }
    else
    {
        Biome biome = this.worldObj.getBiome(new BlockPos(this));

        if (biome instanceof BiomeSnow && this.worldObj.canSeeSky(new BlockPos(this)) && this.rand.nextInt(5) != 0)
        {
            this.setSkeletonType(SkeletonType.STRAY);
        }

        this.tasks.addTask(4, this.aiArrowAttack);
        this.setEquipmentBasedOnDifficulty(difficulty);
        this.setEnchantmentBasedOnDifficulty(difficulty);
    }

    this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * difficulty.getClampedAdditionalDifficulty());

    if (this.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
    {
        Calendar calendar = this.worldObj.getCurrentDate();

        if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F)
        {
            this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.LIT_PUMPKIN : Blocks.PUMPKIN));
            this.inventoryArmorDropChances[EntityEquipmentSlot.HEAD.getIndex()] = 0.0F;
        }
    }

    return livingdata;
}
项目:ExpandedRailsMod    文件:EntitySkeleton.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
@Nullable
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.worldObj.provider instanceof WorldProviderHell && this.getRNG().nextInt(5) > 0)
    {
        this.tasks.addTask(4, this.aiAttackOnCollide);
        this.func_189768_a(SkeletonType.WITHER);
        this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.STONE_SWORD));
        this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4.0D);
    }
    else
    {
        Biome biome = this.worldObj.getBiomeGenForCoords(new BlockPos(this));

        if (biome instanceof BiomeSnow && this.worldObj.canSeeSky(new BlockPos(this)) && this.rand.nextInt(5) != 0)
        {
            this.func_189768_a(SkeletonType.STRAY);
        }

        this.tasks.addTask(4, this.aiArrowAttack);
        this.setEquipmentBasedOnDifficulty(difficulty);
        this.setEnchantmentBasedOnDifficulty(difficulty);
    }

    this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * difficulty.getClampedAdditionalDifficulty());

    if (this.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
    {
        Calendar calendar = this.worldObj.getCurrentDate();

        if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F)
        {
            this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.LIT_PUMPKIN : Blocks.PUMPKIN));
            this.inventoryArmorDropChances[EntityEquipmentSlot.HEAD.getIndex()] = 0.0F;
        }
    }

    return livingdata;
}
项目:geomastery    文件:GeoBiomes.java   
/** Assigns a temperature to the biome.
 * @return The base temperature for the biome */
private static float chooseTemp(Biome biome) {

    if (biome == Biomes.MUTATED_ICE_FLATS) {

        return -4;

    } else if (biome instanceof BiomeSnow) {

        return -3;

    } else if (biome == Biomes.FROZEN_RIVER) {

        return -2;

    } else if (biome == Biomes.COLD_TAIGA ||
            biome == Biomes.COLD_TAIGA_HILLS ||
            biome == Biomes.MUTATED_TAIGA_COLD) {

        return -1;

    } else if (biome == Biomes.COLD_BEACH) {

        return -0.5F;

    } else if (biome instanceof BiomeHills || biome instanceof BiomeTaiga ||
            biome instanceof BiomeVoid || biome instanceof BiomeEnd) {

        return 0;

    } else if (biome == Biomes.STONE_BEACH) {

        return 0.5F;

    } else if (biome == Biomes.BIRCH_FOREST ||
            biome == Biomes.BIRCH_FOREST_HILLS) {

        return 1;

    } else if (biome instanceof BiomeOcean || biome instanceof BiomeForest
            || biome instanceof BiomeRiver) {

        return 2;

    } else if (biome instanceof BiomePlains) {

        return 2.5F;

    } else if (biome instanceof BiomeSwamp || biome instanceof BiomeBeach) {

        return 3;

    } else if (biome instanceof BiomeMushroomIsland) {

        return 4;

    } else if (biome instanceof BiomeJungle) {

        return 4.5F;

    } else if (biome instanceof BiomeSavanna) {

        return 5;

    } else if (biome instanceof BiomeDesert || biome instanceof BiomeMesa ||
            biome instanceof BiomeHell) {

        return 6;

    } else {

        float base = biome.getTemperature();
        float converted = (base - 1) * 10;
        Geomastery.LOG.info("Unsupported biome {} has had its temperature set to {}", biome.getBiomeName(), converted);
        return converted;
    }
}