@Override public boolean isGoodBiome(Biome biome) { return BiomeDictionary.hasType(biome, BiomeDictionary.Type.END); } },
private static void register(IForgeRegistry<Biome> r, Biome item, BiomeDictionary.Type... types) { r.register(item.setRegistryName(MOD_ID, item.biomeName.replace(MOD_NAME + " ", "").replace(' ', '_').toLowerCase())); BiomeDictionary.addTypes(item, types); }
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); }
@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); }
/** Scan all registered biomes to mark biomes of certain types that will be * given higher priority when identifying mean biome ID for a chunk. * (Currently WATER, BEACH and SWAMP) */ public static void scanBiomeTypes() { waterBiomes.addAll(BiomeDictionary.getBiomes(Type.WATER)); beachBiomes.addAll(BiomeDictionary.getBiomes(Type.BEACH)); swampBiomes.addAll(BiomeDictionary.getBiomes(Type.SWAMP)); }
prop.copy(toCopy, biome); if(BiomeDictionary.hasAnyType(toCopy)) BiomeDictionary.addTypes(biome, BiomeDictionary.getTypes(toCopy).toArray(new BiomeDictionary.Type[0]));
obj.addProperty("Enable Snow", biome.getEnableSnow()); 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 boolean matches(IBlockAccess world, BlockPos pos, IBlockState state) { boolean matches = super.matches(world, pos, state); if (!matches || !(world instanceof World)) return false; Biome biome = ((World) world).provider.getBiomeForCoords(pos); boolean isForest = BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST); return isForest && !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.CONIFEROUS) && !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.JUNGLE); } };
public static Set<Biome> getBiomesForTypes (Type... types) { final Set<Biome> biomes = new HashSet<>(); for (final Type type : types) { biomes.addAll(BiomeDictionary.getBiomes(type)); } return biomes; } }
@Override public boolean testCondition(World world, BlockPos pos) { return BiomeDictionary.isBiomeOfType(world.getBiome(pos), biome); }
public boolean isValidBiome(Biome biome) { return allowGenInMesa || !BiomeDictionary.hasType(biome, BiomeDictionary.Type.MESA); }
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; }
public DinosaurMetadata setSpawn(int chance, BiomeDictionary.Type... types) { ArrayList<Biome> biomeList = new ArrayList<>(); for (BiomeDictionary.Type type : types) { biomeList.addAll(BiomeDictionary.getBiomes(type)); } this.setSpawn(chance, biomeList.toArray(new Biome[0])); return this; } public DinosaurMetadata setDinosaurType(Dinosaur.DinosaurType dinosaurType) {
private static <T extends Biome> void registerBiome(final IForgeRegistry<Biome> registry, final T biome, final String biomeName, final BiomeManager.BiomeType biomeType, final int weight, final BiomeDictionary.Type... types) { registry.register(biome.setRegistryName(Reference.MOD_ID, biomeName)); BiomeDictionary.addTypes(biome, types); //BiomeManager.addBiome(biomeType, new BiomeManager.BiomeEntry(biome, weight)); for(int x = 0; x < weight; x++) BIOME_LIST.add((BiomeBaseErebus) biome); //temp hack for now } }
private static Pair<Season, WaterType> getLocation(World world, BlockPos pos) { Season season = HFApi.calendar.getDate(world).getSeason(); TownData data = TownHelper.getClosestTownToBlockPos(world, pos, false); BlockPos position = data.getCoordinatesFor(BuildingLocations.FISHING_POND_CENTRE); WaterType type; if (position != null && position.getDistance(pos.getX(), pos.getY(), pos.getZ()) <= 5) { type = WaterType.POND; } else { Biome biome = world.getBiome(pos); if (BiomeDictionary.isBiomeOfType(biome, Type.OCEAN)) type = WaterType.OCEAN; else if (BiomeDictionary.isBiomeOfType(biome, Type.RIVER)) type = WaterType.RIVER; else type = WaterType.LAKE; } return Pair.of(season, type); }
private static void addEndSPAWN(Map<Type, Set<Biome>> biomeMap) { /* * SKY */ for (Biome biome : biomeMap.get(Type.END)) { if (BiomeDictionary.hasType(biome, Type.COLD) && (BiomeDictionary.hasType(biome, Type.DRY))) { add(GENERAL.spawnEnderDragonGirl, EntityGaiaEnderDragonGirl.class, 1, 2, biome); } } }
private boolean isValidBiome(Biome biome) { if (blacklistedBiomes.contains(biome)) { return false; } return BiomeDictionary.getTypes(biome).stream().noneMatch(blacklistedBiomeTypes::contains); }
@Override public Iterator<Biome> getIterator() { this.checkTypes(); final List<Biome> list = new ArrayList<>(); for(final BiomeDictionary.Type type:this.types){ final Set<Biome> gens = BiomeDictionary.getBiomes(type); for(final Biome gen:gens) if(!list.contains(gen)) list.add(gen); } return list.iterator(); }
public static void register(IForgeRegistry<Biome> registry, Biome biome, String name, BiomeType type, int weight, boolean enable, boolean spawn, boolean village, BiomeDictionary.Type... biomeDictTypes) { if (!enable) { return; } biome.setRegistryName(name); registry.register(biome); for (BiomeDictionary.Type biomeDictType : biomeDictTypes) { BiomeDictionary.addTypes(biome, biomeDictType); } biomeList.add(new WrappedBiomeEntry(biome, type, weight, spawn, village)); }
private static void removeInvalidBiomes(Biome currentBiome, Set<Biome> biomesToSearch) { biomesToSearch.removeAll(waterBiomes); if (BiomeDictionary.hasType(currentBiome, BiomeDictionary.Type.NETHER)) { biomesToSearch.retainAll(netherBiomes); } else { biomesToSearch.removeAll(netherBiomes); } if (BiomeDictionary.hasType(currentBiome, BiomeDictionary.Type.END)) { biomesToSearch.retainAll(endBiomes); } else { biomesToSearch.removeAll(endBiomes); } } }