Example usage for net.minecraftforge.common BiomeDictionary getTypes

List of usage examples for net.minecraftforge.common BiomeDictionary getTypes

Introduction

In this page you can find the example usage for net.minecraftforge.common BiomeDictionary getTypes.

Prototype

@Nonnull
public static Set<Type> getTypes(Biome biome) 

Source Link

Document

Gets the set of types that have been added to the given biome.

Usage

From source file:hellfirepvp.astralsorcery.common.world.attributes.GenAttributeGlowstoneFlower.java

License:Open Source License

private boolean isApplicableBiome(World world, BlockPos pos) {
    if (cfgEntry.shouldIgnoreBiomeSpecifications())
        return true;

    Biome b = world.getBiome(pos);/*from w w  w .j a  v a 2 s .co  m*/
    Collection<BiomeDictionary.Type> types = BiomeDictionary.getTypes(b);
    if (types.isEmpty())
        return false;
    boolean applicable = false;
    for (BiomeDictionary.Type t : types) {
        if (cfgEntry.getTypes().contains(t))
            applicable = true;
    }
    return applicable;
}

From source file:hellfirepvp.astralsorcery.common.world.structure.StructureDesertShrine.java

License:Open Source License

private boolean isDesertBiome(World world, BlockPos pos) {
    if (cfgEntry.shouldIgnoreBiomeSpecifications())
        return true;

    Biome b = world.getBiome(pos);/*  www  .j a  va 2s. com*/
    Collection<BiomeDictionary.Type> types = BiomeDictionary.getTypes(b);
    if (types.isEmpty())
        return false;
    boolean applicable = false;
    for (BiomeDictionary.Type t : types) {
        if (cfgEntry.getTypes().contains(t))
            applicable = true;
    }
    return applicable;
}

From source file:nightkosh.gravestone.helper.GraveGenerationHelper.java

License:LGPL

public static boolean isMossyGrave(World world, BlockPos pos, EnumGraveMaterial graveMaterial) {
    Set<BiomeDictionary.Type> biomeTypesList = BiomeDictionary.getTypes(world.getBiome(pos));
    return graveMaterial != EnumGraveMaterial.OTHER && (biomeTypesList.contains(BiomeDictionary.Type.JUNGLE)
            || biomeTypesList.contains(BiomeDictionary.Type.SWAMP));
}

From source file:nightkosh.gravestone.helper.GraveGenerationHelper.java

License:LGPL

public static EnumGraveMaterial[] getGraveMaterialByBiomes(World world, BlockPos pos) {
    Set<BiomeDictionary.Type> biomeTypesList = BiomeDictionary.getTypes(world.getBiome(pos));

    ArrayList<EnumGraveMaterial> materials = new ArrayList<>();
    if (biomeTypesList.contains(BiomeDictionary.Type.SANDY)
            || biomeTypesList.contains(BiomeDictionary.Type.BEACH)) {
        materials.add(EnumGraveMaterial.SANDSTONE);
    }//from  w ww.  jav  a2s  .co m
    if (biomeTypesList.contains(BiomeDictionary.Type.JUNGLE)
            || biomeTypesList.contains(BiomeDictionary.Type.SWAMP)) {
        materials.add(EnumGraveMaterial.STONE);
    }
    if (biomeTypesList.contains(BiomeDictionary.Type.MOUNTAIN)) {
        materials.add(EnumGraveMaterial.GRANITE);
    }
    if (biomeTypesList.contains(BiomeDictionary.Type.HILLS)) {
        materials.add(EnumGraveMaterial.ANDESITE);
        materials.add(EnumGraveMaterial.DIORITE);
    }
    if (biomeTypesList.contains(BiomeDictionary.Type.PLAINS)
            || biomeTypesList.contains(BiomeDictionary.Type.MUSHROOM)) {
        materials.add(EnumGraveMaterial.STONE);
    }
    if (biomeTypesList.contains(BiomeDictionary.Type.FOREST)) {
        materials.add(EnumGraveMaterial.WOOD);
    }
    if (biomeTypesList.contains(BiomeDictionary.Type.SNOWY)) {
        materials.add(EnumGraveMaterial.ICE);
    }
    if (biomeTypesList.contains(BiomeDictionary.Type.NETHER)) {
        materials.add(EnumGraveMaterial.QUARTZ);
    }
    if (biomeTypesList.contains(BiomeDictionary.Type.MESA)) {
        materials.add(EnumGraveMaterial.RED_SANDSTONE);
    }
    // TODO if (biomeTypesList.contains(BiomeDictionary.Type.END)) {} ????????
    if (biomeTypesList.contains(BiomeDictionary.Type.WATER)) {
        materials.add(EnumGraveMaterial.PRIZMARINE);
    }

    if (materials.isEmpty()) {
        materials.add(EnumGraveMaterial.STONE);
    }

    EnumGraveMaterial[] materialsArray = new EnumGraveMaterial[materials.size()];
    return materials.toArray(materialsArray);
}

From source file:nightkosh.gravestone_extended.entity.projectile.EntityCustomFishHook.java

License:LGPL

protected List<ItemStack> getCatch() {
    List<ItemStack> result = new ArrayList<>(1);
    Block liquidBlock = this.world
            .getBlockState(//from ww w.j  av  a2s. co m
                    new BlockPos(this.posX, MathHelper.floor(this.getEntityBoundingBox().minY), this.posZ))
            .getBlock();

    List<ItemStack> tempList = CATCH.getOrDefault(liquidBlock, EntityCustomFishHook::getWaterCatch).getCatch(
            world, this.getPosition(), BiomeDictionary.getTypes(world.getBiome(this.getPosition())),
            (this.luck + this.getAngler().getLuck()) * 1.5F);
    result.add(tempList.get(this.rand.nextInt(tempList.size())));

    return result;
}

From source file:org.blockartistry.DynSurround.registry.BiomeInfo.java

License:MIT License

public BiomeInfo(@Nonnull final Biome biome) {
    this.biome = biome;

    if (!this.isFake()) {
        this.hasPrecipitation = canRain() || getEnableSnow();
        this.biomeTypes = BiomeDictionary.getTypes(this.biome);
        this.biomeId = Biome.getIdForBiome(this.biome);
    } else {/*from  w  w  w.ja  v a  2s  .  com*/
        this.biomeTypes = ImmutableSet.of();
        this.biomeId = ((FakeBiome) this.biome).getBiomeId();
    }
}

From source file:vazkii.pillar.WorldGenerator.java

License:Creative Commons License

public boolean canSpawnInPosition(StructureSchema schema, World world, BlockPos pos) {
    if (schema.generateEverywhere)
        return true;

    if (!schema.dimensionSpawns.isEmpty()) {
        int dim = world.provider.getDimension();
        if (schema.isDimensionSpawnsBlacklist && schema.dimensionSpawns.contains(dim))
            return false;

        if (!schema.isDimensionSpawnsBlacklist && !schema.dimensionSpawns.contains(dim))
            return false;
    }/*ww  w  .  j a  va 2  s.  c  o  m*/

    Biome biome = world.getBiome(pos);
    String name = biome.getRegistryName().toString();

    if (schema.isBiomeNameSpawnsBlacklist && !schema.biomeNameSpawns.contains(name))
        return true;
    if (schema.biomeNameSpawns.contains(name))
        return !schema.isBiomeNameSpawnsBlacklist;

    try {
        Set<BiomeDictionary.Type> types = BiomeDictionary.getTypes(biome);
        if (schema.isBiomeNameSpawnsBlacklist) {
            for (BiomeDictionary.Type type : types)
                if (schema.biomeTagSpawns.contains(type.getName()))
                    return false;

            return true;
        } else
            for (BiomeDictionary.Type type : types)
                if (schema.biomeTagSpawns.contains(type.getName()))
                    return true;
    } catch (NullPointerException e) {
        // In case a biome isn't properly registered
    }

    return false;
}

From source file:vazkii.quark.tweaks.feature.SpongeDriesInNether.java

License:Creative Commons License

@SubscribeEvent
public void onItemPlaced(BlockEvent.PlaceEvent event) {
    if (event.getPlacedBlock().equals(Blocks.SPONGE.getDefaultState().withProperty(BlockSponge.WET, true))
            && BiomeDictionary.getTypes(event.getWorld().getBiome(event.getPos()))
                    .contains(BiomeDictionary.Type.NETHER)) {
        World world = event.getWorld();//from  www .ja v  a2  s .c  o m
        world.playSound(null, event.getPos(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F,
                2.4F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.9F);
        world.setBlockState(event.getPos(),
                Blocks.SPONGE.getDefaultState().withProperty(BlockSponge.WET, false));
    }
}