Search in sources :

Example 16 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project MineFactoryReloaded by powercrystals.

the class TileEntityWeather method activateMachine.

@Override
public boolean activateMachine() {
    MFRLiquidMover.pumpLiquid(_tank, this);
    if (worldObj.getWorldInfo().isRaining() && canSeeSky()) {
        BiomeGenBase bgb = worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord);
        if (!bgb.canSpawnLightningBolt() && !bgb.getEnableSnow()) {
            setIdleTicks(getIdleTicksMax());
            return false;
        }
        setWorkDone(getWorkDone() + 1);
        if (getWorkDone() >= getWorkMax()) {
            if (bgb.getFloatTemperature() >= 0.15F) {
                if (_tank.fill(new LiquidStack(Block.waterStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME), true) > 0) {
                    setWorkDone(0);
                    return true;
                } else {
                    setWorkDone(getWorkMax());
                    return false;
                }
            } else {
                doDrop(new ItemStack(Item.snowball));
                setWorkDone(0);
            }
        }
        return true;
    }
    setIdleTicks(getIdleTicksMax());
    return false;
}
Also used : LiquidStack(net.minecraftforge.liquids.LiquidStack) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase) ItemStack(net.minecraft.item.ItemStack)

Example 17 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.

the class BiomeControllerMapping method makeFilteredBiomeMap.

public static void makeFilteredBiomeMap(BiomeGenBase[] biomeGenArray, Map<Integer, Integer> map, ControllerType.BiomeFilter filter) {
    map.clear();
    // First check if there exist biomes for a certain filter.
    boolean ok = false;
    for (BiomeGenBase biome : biomeGenArray) {
        if (biome != null) {
            if (filter.match(biome)) {
                ok = true;
                break;
            }
        }
    }
    if (!ok) {
        // No biomes found! We just map every biome to itself as a fallback.
        for (BiomeGenBase biome : biomeGenArray) {
            if (biome != null) {
                map.put(biome.biomeID, biome.biomeID);
            }
        }
    } else {
        for (BiomeGenBase biome : biomeGenArray) {
            if (biome != null) {
                if (filter.match(biome)) {
                    map.put(biome.biomeID, biome.biomeID);
                } else {
                    map.put(biome.biomeID, findSuitableBiomes(biomeGenArray, biome, filter));
                }
            }
        }
    }
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 18 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.

the class IslandTerrainGenerator method replaceBlocksForBiome.

@Override
public void replaceBlocksForBiome(int chunkX, int chunkZ, ChunkPrimer primer, BiomeGenBase[] biomeGenBases) {
    // ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(provider, chunkX, chunkZ, aBlock, abyte, biomeGenBases, world);
    // MinecraftForge.EVENT_BUS.post(event);
    // if (event.getResult() == Event.Result.DENY) {
    // return;
    // }
    double d0 = 0.03125D;
    this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, (chunkX * 16), (chunkZ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
    for (int k = 0; k < 16; ++k) {
        for (int l = 0; l < 16; ++l) {
            BiomeGenBase biomegenbase = biomeGenBases[l + k * 16];
            genBiomeTerrain(biomegenbase, primer, chunkX * 16 + k, chunkZ * 16 + l, this.stoneNoise[l + k * 16]);
        }
    }
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 19 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.

the class NormalTerrainGenerator method replaceBlocksForBiome.

@Override
public void replaceBlocksForBiome(int chunkX, int chunkZ, ChunkPrimer primer, BiomeGenBase[] biomeGenBases) {
    ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(provider, chunkX, chunkZ, primer, world);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.getResult() == Event.Result.DENY) {
        return;
    }
    double d0 = 0.03125D;
    this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, (chunkX * 16), (chunkZ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
    for (int k = 0; k < 16; ++k) {
        for (int l = 0; l < 16; ++l) {
            BiomeGenBase biomegenbase = biomeGenBases[l + k * 16];
            biomegenbase.genTerrainBlocks(world, provider.rand, primer, chunkX * 16 + k, chunkZ * 16 + l, this.stoneNoise[l + k * 16]);
        }
    }
}
Also used : ChunkProviderEvent(net.minecraftforge.event.terraingen.ChunkProviderEvent) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 20 with BiomeGenBase

use of net.minecraft.world.biome.BiomeGenBase in project RFToolsDimensions by McJty.

the class NormalTerrainGenerator method func_147423_a.

private void func_147423_a(int chunkX4, int chunkY4, int chunkZ4) {
    this.noiseData4 = this.noiseGen6.generateNoiseOctaves(this.noiseData4, chunkX4, chunkZ4, 5, 5, 200.0D, 200.0D, 0.5D);
    this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, chunkX4, chunkY4, chunkZ4, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D);
    this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, chunkX4, chunkY4, chunkZ4, 5, 33, 5, 684.412D, 684.412D, 684.412D);
    this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, chunkX4, chunkY4, chunkZ4, 5, 33, 5, 684.412D, 684.412D, 684.412D);
    int l = 0;
    int i1 = 0;
    boolean domaze = false;
    boolean elevated = false;
    boolean donearlands = provider.dimensionInformation.getTerrainType() == TerrainType.TERRAIN_NEARLANDS;
    if (donearlands) {
        elevated = true;
    }
    if (provider.dimensionInformation.hasFeatureType(FeatureType.FEATURE_MAZE)) {
        domaze = true;
        long s2 = (((chunkX4 >> 2) + provider.seed + 13) * 314) + (chunkZ4 >> 2) * 17L;
        Random rand = new Random(s2);
        // Skip one.
        rand.nextFloat();
        elevated = ((chunkX4 >> 2) & 1) == 0;
        if (rand.nextFloat() < .2f) {
            elevated = !elevated;
        }
    }
    if (donearlands) {
        int cx = chunkX4 >> 2;
        int cz = chunkZ4 >> 2;
        if (Math.abs(cx) < 5 && Math.abs(cz) < 5) {
            elevated = false;
        }
    }
    if (provider.biomesForGeneration == null) {
        Logging.log("Dimension " + world.provider.getDimensionId() + " has a problem! Ignoring for now.");
        return;
    }
    for (int j1 = 0; j1 < 5; ++j1) {
        for (int k1 = 0; k1 < 5; ++k1) {
            float f = 0.0F;
            float f1 = 0.0F;
            float f2 = 0.0F;
            byte b0 = 2;
            BiomeGenBase biomegenbase = provider.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];
            for (int l1 = -b0; l1 <= b0; ++l1) {
                for (int i2 = -b0; i2 <= b0; ++i2) {
                    BiomeGenBase biomegenbase1 = provider.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
                    // float f3 = biomegenbase1.rootHeight;
                    // float f4 = biomegenbase1.heightVariation;
                    float f3 = provider.getSettings().biomeDepthOffSet + biomegenbase1.minHeight * provider.getSettings().biomeDepthWeight;
                    float f4 = provider.getSettings().biomeScaleOffset + biomegenbase1.maxHeight * provider.getSettings().biomeScaleWeight;
                    if (domaze || donearlands) {
                        if (f3 > 0.0F && elevated) {
                            if (provider.worldType == WorldType.AMPLIFIED) {
                                f3 = 2.0F + f3 * 1.5f;
                                f4 = 1.0F + f4 * 3.0f;
                            } else {
                                f3 = 2.0F + f3;
                                f4 = 0.5F + f4 * 1.5f;
                            }
                        } else {
                            if (provider.worldType == WorldType.AMPLIFIED && f3 > 0.0f) {
                                f3 = 0.5F + f3 * 1.5F;
                                f4 = 0.5F + f4 * 2.0F;
                            } else {
                                f4 = f4 * 0.5F;
                            }
                        }
                    } else {
                        if (provider.worldType == WorldType.AMPLIFIED && f3 > 0.0F) {
                            f3 = 1.0F + f3 * 2.0F;
                            f4 = 1.0F + f4 * 4.0F;
                        }
                    }
                    float f5 = parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F);
                    if (biomegenbase1.minHeight > biomegenbase.minHeight) {
                        f5 /= 2.0F;
                    }
                    f += f4 * f5;
                    f1 += f3 * f5;
                    f2 += f5;
                }
            }
            f /= f2;
            f1 /= f2;
            f = f * 0.9F + 0.1F;
            f1 = (f1 * 4.0F - 1.0F) / 8.0F;
            double d12 = this.noiseData4[i1] / 8000.0D;
            if (d12 < 0.0D) {
                d12 = -d12 * 0.3D;
            }
            d12 = d12 * 3.0D - 2.0D;
            if (d12 < 0.0D) {
                d12 /= 2.0D;
                if (d12 < -1.0D) {
                    d12 = -1.0D;
                }
                d12 /= 1.4D;
                d12 /= 2.0D;
            } else {
                if (d12 > 1.0D) {
                    d12 = 1.0D;
                }
                d12 /= 8.0D;
            }
            ++i1;
            double d13 = f1;
            double d14 = f;
            d13 += d12 * 0.2D;
            d13 = d13 * 8.5D / 8.0D;
            double d5 = 8.5D + d13 * 4.0D;
            for (int j2 = 0; j2 < 33; ++j2) {
                double d6 = (j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
                if (d6 < 0.0D) {
                    d6 *= 4.0D;
                }
                double d7 = this.noiseData2[l] / 512.0D;
                double d8 = this.noiseData3[l] / 512.0D;
                double d9 = (this.noiseData1[l] / 10.0D + 1.0D) / 2.0D;
                double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;
                if (j2 > 29) {
                    double d11 = ((j2 - 29) / 3.0F);
                    d10 = d10 * (1.0D - d11) + -10.0D * d11;
                }
                this.noiseField[l] = d10;
                ++l;
            }
        }
    }
}
Also used : Random(java.util.Random) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Aggregations

BiomeGenBase (net.minecraft.world.biome.BiomeGenBase)62 Block (net.minecraft.block.Block)9 BlockPos (net.minecraft.util.BlockPos)9 World (net.minecraft.world.World)6 Type (net.minecraftforge.common.BiomeDictionary.Type)5 ArrayList (java.util.ArrayList)4 EnumHumidity (forestry.api.core.EnumHumidity)3 IBlockState (net.minecraft.block.state.IBlockState)3 ChunkCoordIntPair (net.minecraft.world.ChunkCoordIntPair)3 Chunk (net.minecraft.world.chunk.Chunk)3 BiomeDictionary (net.minecraftforge.common.BiomeDictionary)3 HashMultimap (com.google.common.collect.HashMultimap)2 Multimap (com.google.common.collect.Multimap)2 IBeeGenome (forestry.api.apiculture.IBeeGenome)2 EnumTemperature (forestry.api.core.EnumTemperature)2 HashSet (java.util.HashSet)2 Random (java.util.Random)2 UUID (java.util.UUID)2 Entity (net.minecraft.entity.Entity)2 AttributeModifier (net.minecraft.entity.ai.attributes.AttributeModifier)2