Search in sources :

Example 71 with Biome

use of net.minecraft.world.biome.Biome in project Realistic-Terrain-Generation by Team-RTG.

the class RealisticBiomePresenceTester method doBiomeCheck.

public static void doBiomeCheck() {
    for (Biome biome : Biome.REGISTRY) {
        int biomeId = Biome.getIdForBiome(biome);
        String biomeName = biome.getBiomeName();
        String biomeClass = biome.getBiomeClass().getName();
        switch(biomeId) {
            // The Nether
            case 8:
            // The End
            case 9:
            case // The Void
            127:
                // Do nothing.
                break;
            default:
                try {
                    RealisticBiomeBase rBiome = RealisticBiomeBase.getBiome(biomeId);
                    String rBiomeName = rBiome.biomeSlug();
                    Logger.info("Found biome (%d) %s from %s with a %s beach.", biomeId, biomeName, biomeClass, rBiome.beachBiome().getBiomeName());
                } catch (Exception e) {
                    Logger.warn("WARNING! RTG could not find a realistic version of %s (%d) from %s. (If %s is a non-Overworld biome, then this is not an error.)", biomeName, biomeId, biomeClass, biomeName);
                }
                break;
        }
    }
}
Also used : Biome(net.minecraft.world.biome.Biome) RealisticBiomeBase(rtg.world.biome.realistic.RealisticBiomeBase)

Example 72 with Biome

use of net.minecraft.world.biome.Biome in project Realistic-Terrain-Generation by Team-RTG.

the class BiomeAnalyzer method setupBeachesForBiomes.

private void setupBeachesForBiomes() {
    preferredBeach = new int[256];
    for (int i = 0; i < preferredBeach.length; i++) {
        // We need to work with the realistic biome, so let's try to get it from the base biome, aborting if necessary.
        Biome biome = Biome.getBiome(i);
        if (biome == null)
            continue;
        RealisticBiomeBase realisticBiome = RealisticBiomeBase.getBiome(i);
        if (realisticBiome == null)
            continue;
        preferredBeach[i] = Biome.getIdForBiome(realisticBiome.beachBiome);
        // If stone beaches aren't allowed in this biome, then determine the best beach to use based on the biome's temperature.
        if (realisticBiome.disallowStoneBeaches) {
            if (Biome.getIdForBiome(realisticBiome.beachBiome) == Biome.getIdForBiome(Biomes.STONE_BEACH)) {
                preferredBeach[i] = Biome.getIdForBiome((biome.getTemperature() <= 0.05f) ? Biomes.COLD_BEACH : Biomes.BEACH);
            }
        }
        // If beaches aren't allowed in this biome, then use this biome as the beach.
        if (realisticBiome.disallowAllBeaches) {
            preferredBeach[i] = i;
        }
    }
}
Also used : Biome(net.minecraft.world.biome.Biome) RealisticBiomeBase(rtg.world.biome.realistic.RealisticBiomeBase)

Example 73 with Biome

use of net.minecraft.world.biome.Biome in project Realistic-Terrain-Generation by Team-RTG.

the class BiomeProviderRTG method findBiomePosition.

@Override
public BlockPos findBiomePosition(int x, int z, int range, @Nonnull List<Biome> biomes, @Nonnull Random random) {
    IntCache.resetIntCache();
    int i = x - range >> 2;
    int j = z - range >> 2;
    int k = x + range >> 2;
    int l = z + range >> 2;
    int i1 = k - i + 1;
    int j1 = l - j + 1;
    int[] aint = this.genBiomes.getInts(i, j, i1, j1);
    BlockPos blockpos = null;
    int k1 = 0;
    for (int l1 = 0; l1 < i1 * j1; ++l1) {
        int i2 = i + l1 % i1 << 2;
        int j2 = j + l1 / i1 << 2;
        Biome biome = Biome.getBiome(aint[l1]);
        if (biomes.contains(biome) && (blockpos == null || random.nextInt(k1 + 1) == 0)) {
            blockpos = new BlockPos(i2, 0, j2);
            ++k1;
        }
    }
    return blockpos;
}
Also used : Biome(net.minecraft.world.biome.Biome) BlockPos(net.minecraft.util.math.BlockPos)

Example 74 with Biome

use of net.minecraft.world.biome.Biome in project Realistic-Terrain-Generation by Team-RTG.

the class RealisticBiomeATGBase method addBiomes.

public static void addBiomes() {
    if (Loader.isModLoaded("atg")) {
        for (Biome biome : Biome.REGISTRY) {
            if (biome.getBiomeName().isEmpty()) {
                Logger.warn("Biome ID %d has no name.", Biome.getIdForBiome(biome));
                continue;
            }
            String biomeName = biome.getBiomeName();
            String biomeClass = biome.getBiomeClass().getName();
            if (biomeName.equals("Gravel Beach") && biomeClass.equals("ttftcuts.atg.biome.BiomeGravelBeach")) {
                gravelBeach = new RealisticBiomeATGGravelBeach(biome);
            } else if (biomeName.equals("Scrubland") && biomeClass.equals("ttftcuts.atg.biome.BiomeScrubland")) {
                scrubland = new RealisticBiomeATGScrubland(biome);
            } else if (biomeName.equals("Shrubland") && biomeClass.equals("ttftcuts.atg.biome.BiomeShrubland")) {
                shrubland = new RealisticBiomeATGShrubland(biome);
            } else if (biomeName.equals("Snowy Gravel Beach") && biomeClass.equals("ttftcuts.atg.biome.BiomeSnowyGravelBeach")) {
                snowyGravelBeach = new RealisticBiomeATGSnowyGravelBeach(biome);
            } else if (biomeName.equals("Tropical Shrubland") && biomeClass.equals("ttftcuts.atg.biome.BiomeTropicalShrubland")) {
                tropicalShrubland = new RealisticBiomeATGTropicalShrubland(biome);
            } else if (biomeName.equals("Tundra") && biomeClass.equals("ttftcuts.atg.biome.BiomeTundra")) {
                tundra = new RealisticBiomeATGTundra(biome);
            } else if (biomeName.equals("Woodland") && biomeClass.equals("ttftcuts.atg.biome.BiomeWoodland")) {
                woodland = new RealisticBiomeATGWoodland(biome);
            }
        }
    }
}
Also used : Biome(net.minecraft.world.biome.Biome)

Example 75 with Biome

use of net.minecraft.world.biome.Biome in project Realistic-Terrain-Generation by Team-RTG.

the class RealisticBiomeARBase method addBiomes.

public static void addBiomes() {
    if (Loader.isModLoaded("CookingPlus") || Loader.isModLoaded("agriculturalrevolution")) {
        for (Biome biome : Biome.REGISTRY) {
            if (biome.getBiomeName().isEmpty()) {
                Logger.warn("Biome ID %d has no name.", Biome.getIdForBiome(biome));
                continue;
            }
            String biomeName = biome.getBiomeName();
            String biomeClass = biome.getBiomeClass().getName();
            if (biomeName.equals("Orchard") && biomeClass.equals("CookingPlus.generation.CookingPlusOrchardBiome")) {
                arOrchard = new RealisticBiomeAROrchard(biome);
            } else if (biomeName.equals("Bamboo Grove") && biomeClass.equals("CookingPlus.generation.CookingPlusBambooBiome")) {
                arBambooGrove = new RealisticBiomeARBambooGrove(biome);
            } else if (biomeName.equals("Kelp Forest") && biomeClass.equals("CookingPlus.generation.CookingPlusKelpForestBiome")) {
                arKelpForest = new RealisticBiomeARKelpForest(biome);
            } else if (biomeName.equals("Coral Reef") && biomeClass.equals("CookingPlus.generation.CookingPlusCoralReefBiome")) {
                arCoralReef = new RealisticBiomeARCoralReef(biome);
            } else if (biomeName.equals("Tropical Hills") && biomeClass.equals("CookingPlus.generation.CookingPlusTropicalBiome")) {
                arTropicalHills = new RealisticBiomeARTropicalHills(biome);
            } else if (biomeName.equals("Deep Reef") && biomeClass.equals("CookingPlus.generation.CookingPlusDeepReefBiome")) {
                arDeepReef = new RealisticBiomeARDeepReef(biome);
            }
        }
    }
}
Also used : Biome(net.minecraft.world.biome.Biome)

Aggregations

Biome (net.minecraft.world.biome.Biome)110 BlockPos (net.minecraft.util.math.BlockPos)39 IBlockState (net.minecraft.block.state.IBlockState)16 ResourceLocation (net.minecraft.util.ResourceLocation)9 World (net.minecraft.world.World)9 Nullable (javax.annotation.Nullable)8 Random (java.util.Random)7 ChunkPos (net.minecraft.util.math.ChunkPos)7 DoubleRange (com.almuradev.toolbox.util.math.DoubleRange)6 HashMap (java.util.HashMap)6 FunctionPredicate (com.almuradev.content.component.predicate.FunctionPredicate)5 Map (java.util.Map)5 Block (net.minecraft.block.Block)5 WorldServer (net.minecraft.world.WorldServer)5 BiomeChunk (com.almuradev.almura.feature.biome.BiomeChunk)4 Overwrite (org.spongepowered.asm.mixin.Overwrite)4 Entity (net.minecraft.entity.Entity)3 IntRange (com.almuradev.toolbox.util.math.IntRange)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2