public IBlockState getStoneToPut(BlockPos coords) { Set<Type> types = BiomeDictionary.getTypes(supertile.getWorld().getBiome(coords)); TIntArrayList values = new TIntArrayList(); for(int i = 0; i < TYPES.length; i++) { int times = 1; if(types.contains(TYPES[i])) times = 12; for(int j = 0; j < times; j++) values.add(i); } int meta = values.get(supertile.getWorld().rand.nextInt(values.size())); BiomeStoneVariant variant = BiomeStoneVariant.values()[meta]; return ModFluffBlocks.biomeStoneA.getDefaultState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, variant); }
public static boolean biomeTypeIntersectCheck(Iterable<BiomeDictionary.Type> biomeItr, Biome b) { Set<BiomeDictionary.Type> currentTypes = BiomeDictionary.getTypes(b); for(BiomeDictionary.Type type : biomeItr) if(currentTypes.contains(type)) return true; return false; }
private boolean isValidBiome(Biome biome) { if (blacklistedBiomes.contains(biome)) { return false; } return BiomeDictionary.getTypes(biome).stream().noneMatch(blacklistedBiomeTypes::contains); }
private boolean isBlacklisted(Biome biome) { if (GLOBAL != null && this != GLOBAL && GLOBAL.isBlacklisted(biome)) { return true; } if (blacklistedBiomes.contains(biome)) { return true; } return BiomeDictionary.getTypes(biome).stream().anyMatch(blacklistedTypes::contains); }
private void biomeTypes(Biome biome) { Set<BiomeDictionary.Type> map = BiomeDictionary.getTypes(biome); StringBuilder builder = new StringBuilder("Types: "); for (BiomeDictionary.Type type : map) { builder.append(type.toString()) .append(", "); } Gaia.LOGGER.info(builder.toString()); Gaia.LOGGER.info(" "); }
/** * "Mutated" biomes don't have type dictionaries by default. This addition compensates for specific sub biomes having gaps in creature spawning. */ // public static void biomeTweaks() { // Gaia.LOGGER.info("Sub Biome Tweaks Enabled"); // // BiomeDictionary.addTypes(Biomes.MUTATED_ROOFED_FOREST, BiomeDictionary.Type.HILLS, BiomeDictionary.Type.SPOOKY, BiomeDictionary.Type.DENSE, BiomeDictionary.Type.FOREST); // BiomeDictionary.addTypes(Biomes.MUTATED_EXTREME_HILLS, BiomeDictionary.Type.HILLS, BiomeDictionary.Type.MOUNTAIN); // BiomeDictionary.addTypes(Biomes.MUTATED_EXTREME_HILLS_WITH_TREES, BiomeDictionary.Type.HILLS, BiomeDictionary.Type.MOUNTAIN); // } private static Map<Type, Set<Biome>> buildBiomeListByType() { Map<Type, Set<Biome>> biomesAndTypes = new HashMap<>(); for (Biome biome : Biome.REGISTRY) { Set<BiomeDictionary.Type> types = BiomeDictionary.getTypes(biome); for (BiomeDictionary.Type type : types) { if (!biomesAndTypes.containsKey(type)) { biomesAndTypes.put(type, new HashSet<>()); } biomesAndTypes.get(type).add(biome); } } return biomesAndTypes; }
@Override protected List<String> getLines() { //noinspection ConstantConditions return ForgeRegistries.BIOMES.getValuesCollection().stream() .map(b -> String.join(",", b.getRegistryName().toString(), getBiomeName(b), b.getTempCategory().name() , Boolean.toString(b.isHighHumidity()), Float.toString(b.getHeightVariation()), b.topBlock.getBlock().getRegistryName().toString() , BiomeDictionary.getTypes(b).stream().map(BiomeDictionary.Type::getName).collect(Collectors.joining("|")), b.getBiomeClass().toString())) .sorted(Comparator.naturalOrder()).collect(Collectors.toList()); }
private void ConfigureCommon() { availableBiomes = ForgeRegistries.BIOMES.getValues(); StringBuilder biomeNames = new StringBuilder(); biomeNames.append("Available/Detected biomes: "); for (Biome x : this.availableBiomes) { biomeNames.append("[" + x.getRegistryName().toString() + "], "); HarvestCraft.log.info( x.getRegistryName().toString() + ";" + x.getTempCategory() + ";" + //x.getFloatTemperature(new BlockPos(0,0,0)) + ";" + x.getTemperature(new BlockPos(0,0,0)) + ";" + x.isHighHumidity() + ";" + x.isMutation() + ";" + x.isSnowyBiome() + ";" + BiomeDictionary.getTypes(x).toString() ); } this.config.setCategoryComment(CATEGORY_FRUIT_TREES_COMMON, biomeNames.toString()); this.enableFruitTreeGeneration = config.get(CATEGORY_FRUIT_TREES_COMMON, "enableFruitTreeGeneration", true, "Default: true").getBoolean(); this.fruitGrowthSpeed = config.get(CATEGORY_FRUIT_TREES_COMMON, "fruitGrowthSpeed", 25, "Default: 25, Lower is faster").getInt(); }
public static boolean genCocoon(World world, Random rand, int chunkX, int chunkZ, IButterfly butterfly) { if (butterfly.getGenome().getPrimary().getRarity() * ModuleLepidopterology.getGenerateCocoonsAmount() < rand.nextFloat() * 100.0f) { return false; } int worldX = chunkX * 16; int worldZ = chunkZ * 16; Biome biome = world.getBiome(new BlockPos(worldX, 0, worldZ)); Set<Type> types = BiomeDictionary.getTypes(biome); Set<Type> speciesTypes = butterfly.getGenome().getPrimary().getSpawnBiomes(); boolean biomeTypesGood = false; for (Type type : types) { if (speciesTypes.isEmpty() || speciesTypes.contains(type)) { biomeTypesGood = true; } } if (!biomeTypesGood) { return false; } for (int tries = 0; tries < 4; tries++) { int x = worldX + rand.nextInt(16); int z = worldZ + rand.nextInt(16); if (tryGenCocoon(world, x, z, butterfly)) { return true; } } return false; }
@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(); 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)); } }
@Override protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) { super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY); String str = Translator.translateToLocal("item.for.habitat_locator.name").toUpperCase(); fontRenderer.drawString(str, startX + 8 + textLayout.getCenteredOffset(str, 138), startY + 16, ColourProperties.INSTANCE.get("gui.screen")); // Set active according to valid biomes. Set<BiomeDictionary.Type> activeBiomeTypes = new HashSet<>(); for (Biome biome : itemInventory.getBiomesToSearch()) { Set<BiomeDictionary.Type> biomeTypes = BiomeDictionary.getTypes(biome); activeBiomeTypes.addAll(biomeTypes); } for (HabitatSlot habitatSlot : habitatSlots) { habitatSlot.setActive(activeBiomeTypes); } for (HabitatSlot slot : habitatSlots) { slot.draw(startX, startY); } GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); // Reset afterwards. }
JsonArray array = new JsonArray(); if(BiomeDictionary.hasAnyType(biome)) for(final Type type: BiomeDictionary.getTypes(biome)) array.add(new JsonPrimitive(type.toString())); obj.add("Dictionary Types", array);
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { if(!FairyRings.dimensions.canSpawnHere(world)) return; int x = chunkX * 16 + 8 + random.nextInt(16); int z = chunkZ * 16 + 8 + random.nextInt(16); Biome biome = world.getBiome(new BlockPos(x, 0, z)); Set<BiomeDictionary.Type> types = BiomeDictionary.getTypes(biome); int chance = 0; if(types.contains(BiomeDictionary.Type.FOREST)) chance = FairyRings.forestChance; else if(types.contains(BiomeDictionary.Type.PLAINS)) chance = FairyRings.plainsChance; if(chance > 0 && random.nextInt(chance) == 0) { BlockPos pos = new BlockPos(x, 128, z); IBlockState state = world.getBlockState(pos); while(state.getMaterial() != Material.GRASS && pos.getY() > 30) { pos = pos.down(); state = world.getBlockState(pos); } if(state.getMaterial() == Material.GRASS) spawnFairyRing(world, pos.down()); } }
return; Set<Type> types = BiomeDictionary.getTypes(biome);
public static void generateLeaves(World worldIn, BlockPos blockpos, BlockPos origin, int radius, Random rand) { if (worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), EnumFacing.UP)) { IBlockState leaf = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.DECAYABLE, Boolean.valueOf(false)); for (BiomeDictionary.Type type : BiomeDictionary.getTypes(worldIn.getBiome(blockpos))) { if (type == BiomeDictionary.Type.SANDY || type == BiomeDictionary.Type.SAVANNA || type == BiomeDictionary.Type.WASTELAND) { leaf = Blocks.LEAVES2.getDefaultState().withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(BlockLeaves.DECAYABLE, Boolean.valueOf(false));
BiomeDictionary.addTypes(biome, BiomeDictionary.getTypes(toCopy).toArray(new BiomeDictionary.Type[0]));
@Override public boolean canSpawn(World world, double x, double y, double z) { if (!canFly(world)) { return false; } Biome biome = world.getBiome(new BlockPos(x, 0, z)); if (!getGenome().getPrimary().getSpawnBiomes().isEmpty()) { boolean noneMatched = true; if (getGenome().getPrimary().strictSpawnMatch()) { Set<BiomeDictionary.Type> types = BiomeDictionary.getTypes(biome); if (types.size() == 1 && getGenome().getPrimary().getSpawnBiomes().containsAll(types)) { noneMatched = false; } } else { for (BiomeDictionary.Type type : getGenome().getPrimary().getSpawnBiomes()) { if (BiomeDictionary.hasType(biome, type)) { noneMatched = false; break; } } } if (noneMatched) { return false; } } return isAcceptedEnvironment(world, x, y, z); }