@Override public List<BaseBiome> getBiomes() { List<BaseBiome> list = new ArrayList<>(); for (Biome biome : Biome.REGISTRY) { list.add(new BaseBiome(Biome.getIdForBiome(biome))); } return list; }
@Override public String getName() { return biome.getBiomeName(); } }
@Override public BiomeData getData(BaseBiome biome) { return new ForgeBiomeData(Biome.getBiome(biome.getId())); }
public static JsonObject fillJsonObject(final Biome biome, final int ... coords){ BiomeHelper.checkFields(); final JsonObject obj = new JsonObject(); obj.addProperty("ID", Biome.getIdForBiome(biome)); obj.addProperty("Name", biome.biomeName); obj.addProperty("Resource Location", Biome.REGISTRY.getNameForObject(biome).toString()); obj.addProperty("Class", biome.getClass().getName()); obj.addProperty("Root Height", biome.getBaseHeight()); obj.addProperty("Height Variation", biome.getHeightVariation()); final boolean topNull = biome.topBlock == null || biome.topBlock.getBlock() == null || biome.topBlock.getBlock().delegate == null; final boolean bottomNull = biome.topBlock == null || biome.topBlock.getBlock() == null || biome.topBlock.getBlock().delegate == null; obj.addProperty("Grass Color", "Disabled. Activate in BiomeTweakerCore."); else obj.addProperty("Grass Color", ""+((hasCoords && FMLCommonHandler.instance().getSide().isClient()) ? biome.getGrassColorAtPos(new BlockPos(x, y, z)):(i = BiomePropertyManager.GRASS_COLOR.get(biome)) == -1 ? "Not set. Check in-game.":i)); if(!BiomeTweaker.getInstance().isTweakEnabled("foliageColor")) obj.addProperty("Foliage Color", "Disabled. Activate in BiomeTweakerCore."); else obj.addProperty("Foliage Color", ""+((hasCoords && FMLCommonHandler.instance().getSide().isClient()) ? biome.getFoliageColorAtPos(new BlockPos(x, y, z)):(i = BiomePropertyManager.FOLIAGE_COLOR.get(biome)) == -1 ? "Not set. Check in-game.":i)); obj.addProperty("Water Color", ""+biome.getWaterColorMultiplier()); } catch (final Exception e) { LogHelper.error("Failed to retrieve inserted fields!"); e.printStackTrace(); obj.addProperty("Temperature", biome.getDefaultTemperature()); obj.addProperty("Humidity", biome.getRainfall()); obj.addProperty("Water Tint", biome.getWaterColorMultiplier()); obj.addProperty("Enable Rain", biome.enableRain); obj.addProperty("Enable Snow", biome.getEnableSnow()); JsonArray array = new JsonArray();
public static void complete() { if (!HFAnimals.CAN_SPAWN) { for (Biome biome: Biome.REGISTRY) { Iterator<SpawnListEntry> it = biome.getSpawnableList(EnumCreatureType.CREATURE).iterator(); while (it.hasNext()) { SpawnListEntry entry = it.next(); if (entry.entityClass == EntityCow.class || entry.entityClass == EntityChicken.class || entry.entityClass == EntitySheep.class) { it.remove(); } } } } } }
private static double calculateBiomeDistance(Biome a, Biome b) { if (a == b) { return -1000; } float dr = a.getRainfall() - b.getRainfall(); float dt = a.getDefaultTemperature() - b.getDefaultTemperature(); float dv = a.getHeightVariation() - b.getHeightVariation(); float dh = a.getBaseHeight() - b.getBaseHeight(); return Math.sqrt(dr * dr + dt * dt + dv * dv + dh * dh); }
public void loadBiomeList() { for (Biome biome : Biome.REGISTRY) { if (biome == null) { continue; } templatesByBiome.put(biome.getRegistryName().toString(), new HashSet<>()); } }
@Override public Integer get(final Object obj) throws IllegalStateException, IllegalArgumentException { if(!(obj instanceof Biome)) throw new IllegalArgumentException("Passed object is not an instance of Biome!"); if(!BiomeEventHandler.getDecorationsPerChunk().containsKey(this.type)) throw new IllegalStateException("Decoration "+this.type.name()+" has not been set for biome" + ((Biome) obj).getBiomeName() + "!"); final int id = Biome.getIdForBiome((Biome) obj); final TIntIntMap map = BiomeEventHandler.getDecorationsPerChunk().get(this.type); if(!map.containsKey(id)) throw new IllegalStateException("Decoration "+this.type.name()+" has not been set for biome" + ((Biome) obj).getBiomeName() + "!"); return map.get(id); }
public boolean isCompatible(Biome biome) { return biome.getDefaultTemperature() >= minTemperature && biome.getDefaultTemperature() <= maxTemperature && biome.getRainfall() >= minRainfall && biome.getRainfall() <= maxRainfall && biome.decorator.treesPerChunk >= minTreesPerChunk && biome.decorator.treesPerChunk <= maxTreesPerChunk && biome.getHeightVariation() >= minHeightVariation && biome.getHeightVariation() <= maxHeightVariation; }
private boolean isJungleCompatible(int p_151631_1_) { return Biome.getBiome(p_151631_1_) != null && Biome.getBiome(p_151631_1_).getBiomeClass() == BiomeJungle.class ? true : p_151631_1_ == Biome.getIdForBiome(Biomes.JUNGLE_EDGE) || p_151631_1_ == Biome.getIdForBiome(Biomes.JUNGLE) || p_151631_1_ == Biome.getIdForBiome(Biomes.JUNGLE_HILLS) || p_151631_1_ == Biome.getIdForBiome(Biomes.FOREST) || p_151631_1_ == Biome.getIdForBiome(Biomes.TAIGA) || isBiomeOceanic(p_151631_1_); }
@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()); }
@Override public void perform() throws Exception { final Iterator<Biome> it = this.pack.getIterator(); while(it.hasNext()){ final Biome gen = it.next(); if(MinecraftForge.EVENT_BUS.post(new BiomeTweakEvent.RemoveAllSpawns(this, gen, this.type))) continue; gen.getSpawnableList(this.type).clear(); BiomeTweaker.getInstance().onTweak(Biome.getIdForBiome(gen)); } }
public BiomeCheck(int topLeftY, Biome biome) { super(8, topLeftY, 16, 16, String.format("%s (%s)", biome.getBiomeName(), biome.getRegistryName().toString())); //noinspection ConstantConditions this.name = biome.getRegistryName().toString(); } }
if (blendBiome.getBaseHeight() > baseBiome.getBaseHeight()) blendedHeight *= 0.5F; variationBlended += blendBiome.getHeightVariation() * blendedHeight; rootBlended += blendBiome.getBaseHeight() * blendedHeight; totalBlendedHeight += blendedHeight;
@Override public int getDelayBetweenPassiveGeneration() { boolean rain = supertile.getWorld().getBiome(supertile.getPos()).getRainfall() > 0 && (supertile.getWorld().isRaining() || supertile.getWorld().isThundering()); return rain ? 2 : 3; }
EnumClimate(String spriteName, Biome biome) { climateState = ClimateStateHelper.of(biome.getDefaultTemperature(), biome.getRainfall()); this.spriteName = spriteName; }
private int getColor(final int chunkX, final int chunkZ) { if(this.bProvider == null) { final DummyWorld world = new DummyWorld(new WorldInfo(this.worldSettings, this.worldName)); world.provider.setWorld(world); this.bProvider = world.getBiomeProvider(); } this.tempArray[0] = null; final int bId = Biome.getIdForBiome(this.bProvider.getBiomes(this.tempArray, (chunkX << 4) + 8, (chunkZ << 4) + 8, 1, 1, false)[0]); if(this.colorArray[bId] == -1) { LogHelper.info(bId); LogHelper.info(Biome.getBiome(bId)); LogHelper.info(Biome.REGISTRY.getNameForObject(Biome.getBiome(bId)));; this.colorArray[bId] = BiomeColorMappings.getColorForBiome(Biome.REGISTRY.getNameForObject(Biome.getBiome(bId)).toString()); } return this.colorArray[bId]; }
@Override public float getTemperature() { return this.biomeBase.getDefaultTemperature(); }
@Override public boolean getSundamageInBiome(@Nonnull Biome biome) { if (!getSundamageInBiome(biome.getRegistryName())) return false; for (Class clazz : noSundamageBiomes) { if (clazz.isAssignableFrom(biome.getBiomeClass())) { return false; } } return true; }
@Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack itemstack, @Nullable World world, List<String> list, ITooltipFlag flag) { super.addInformation(itemstack, world, list, flag); Minecraft minecraft = Minecraft.getMinecraft(); if (world != null && minecraft.player != null) { EntityPlayerSP player = minecraft.player; Biome currentBiome = player.world.getBiome(player.getPosition()); EnumTemperature temperature = EnumTemperature.getFromBiome(currentBiome, player.getPosition()); EnumHumidity humidity = EnumHumidity.getFromValue(currentBiome.getRainfall()); list.add(Translator.translateToLocal("for.gui.currentBiome") + ": " + currentBiome.getBiomeName()); list.add(Translator.translateToLocal("for.gui.temperature") + ": " + AlleleManager.climateHelper.toDisplay(temperature)); list.add(Translator.translateToLocal("for.gui.humidity") + ": " + AlleleManager.climateHelper.toDisplay(humidity)); } }