Search in sources :

Example 91 with Biome

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

the class BiomeAbsorberTileEntity method checkStateServer.

protected void checkStateServer() {
    if (absorbing > 0) {
        Biome Biome = getWorld().getBiomeForCoordsBody(getPos());
        if (Biome == null || !Biome.getRegistryName().toString().equals(biomeId)) {
            return;
        }
        absorbing--;
        markDirtyClient();
    }
}
Also used : Biome(net.minecraft.world.biome.Biome)

Example 92 with Biome

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

the class BiomeAbsorberTileEntity method placeDown.

public void placeDown() {
    if (biomeId == null) {
        Biome Biome = getWorld().getBiomeForCoordsBody(getPos());
        if (Biome == null) {
            biomeId = null;
            absorbing = 0;
        } else if (!Biome.getRegistryName().toString().equals(biomeId)) {
            biomeId = Biome.getRegistryName().toString();
            absorbing = DimletConstructionConfiguration.maxBiomeAbsorbtion;
        }
        markDirty();
    }
}
Also used : Biome(net.minecraft.world.biome.Biome)

Example 93 with Biome

use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.

the class MapGenChalosRavine method isTopBlock.

private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) {
    Biome biome = this.world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
    IBlockState state = data.getBlockState(x, y, z);
    return state.getBlock() == biome.topBlock;
}
Also used : Biome(net.minecraft.world.biome.Biome) IBlockState(net.minecraft.block.state.IBlockState) BlockPos(net.minecraft.util.math.BlockPos)

Example 94 with Biome

use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.

the class BiomeProviderChalos method findBiomePosition.

@Override
public BlockPos findBiomePosition(int x, int z, int range, List<Biome> biomes, 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.unzoomedBiomes.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 biomegenbase = Biome.getBiome(aint[l1]);
        if (biomes.contains(biomegenbase) && (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 95 with Biome

use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.

the class WeatherRendererNibiru method render.

@Override
public void render(float partialTicks, WorldClient worldClient, Minecraft mc) {
    if (mc.player.posY > 256) {
        return;
    }
    if (// TODO Fix vanilla particles
    this.rendererUpdateCount == -1) {
        this.addRainParticles(mc);
    }
    float f = mc.world.getRainStrength(partialTicks);
    if (f > 0.0F) {
        mc.entityRenderer.enableLightmap();
        Entity entity = mc.getRenderViewEntity();
        World world = mc.world;
        int i = MathHelper.floor(entity.posX);
        int j = MathHelper.floor(entity.posY);
        int k = MathHelper.floor(entity.posZ);
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder worldrenderer = tessellator.getBuffer();
        GlStateManager.disableCull();
        GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F);
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        GlStateManager.alphaFunc(516, 0.1F);
        double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks;
        double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks;
        double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks;
        int l = MathHelper.floor(d1);
        int i1 = 5;
        if (mc.gameSettings.fancyGraphics) {
            i1 = 10;
        }
        int j1 = -1;
        float f1 = this.rendererUpdateCount + partialTicks;
        worldrenderer.setTranslation(-d0, -d1, -d2);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
        for (int k1 = k - i1; k1 <= k + i1; ++k1) {
            for (int l1 = i - i1; l1 <= i + i1; ++l1) {
                int i2 = (k1 - k + 16) * 32 + l1 - i + 16;
                double d3 = this.rainXCoords[i2] * 0.5D;
                double d4 = this.rainYCoords[i2] * 0.5D;
                blockpos$mutableblockpos.setPos(l1, 0, k1);
                Biome biomegenbase = world.getBiome(blockpos$mutableblockpos);
                if (biomegenbase.canRain() || biomegenbase.getEnableSnow()) {
                    int j2 = world.getPrecipitationHeight(blockpos$mutableblockpos).getY();
                    int k2 = j - i1;
                    int l2 = j + i1;
                    if (k2 < j2) {
                        k2 = j2;
                    }
                    if (l2 < j2) {
                        l2 = j2;
                    }
                    int i3 = j2;
                    if (j2 < l) {
                        i3 = l;
                    }
                    if (k2 != l2) {
                        this.random.setSeed(l1 * l1 * 3121 + l1 * 45238971 ^ k1 * k1 * 418711 + k1 * 13761);
                        blockpos$mutableblockpos.setPos(l1, k2, k1);
                        float f2 = biomegenbase.getTemperature(blockpos$mutableblockpos);
                        if (world.getBiomeProvider().getTemperatureAtHeight(f2, j2) >= 0.15F) {
                            if (j1 != 0) {
                                if (j1 >= 0) {
                                    tessellator.draw();
                                }
                                j1 = 0;
                                if (biomegenbase == MPBiomes.GREEN_VEIN) {
                                    mc.getTextureManager().bindTexture(this.purifyRainTexture);
                                } else {
                                    mc.getTextureManager().bindTexture(this.rainTexture);
                                }
                                worldrenderer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
                            }
                            double d5 = ((double) (this.rendererUpdateCount + l1 * l1 * 3121 + l1 * 45238971 + k1 * k1 * 418711 + k1 * 13761 & 31) + (double) partialTicks) / 32.0D * (3.0D + this.random.nextDouble());
                            double d6 = l1 + 0.5F - entity.posX;
                            double d7 = k1 + 0.5F - entity.posZ;
                            float f3 = MathHelper.sqrt(d6 * d6 + d7 * d7) / i1;
                            float f4 = ((1.0F - f3 * f3) * 0.5F + 0.5F) * f;
                            blockpos$mutableblockpos.setPos(l1, i3, k1);
                            int j3 = world.getCombinedLight(blockpos$mutableblockpos, 0);
                            int k3 = j3 >> 16 & 65535;
                            int l3 = j3 & 65535;
                            worldrenderer.pos(l1 - d3 + 0.5D, k2, k1 - d4 + 0.5D).tex(0.0D, k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
                            worldrenderer.pos(l1 + d3 + 0.5D, k2, k1 + d4 + 0.5D).tex(1.0D, k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
                            worldrenderer.pos(l1 + d3 + 0.5D, l2, k1 + d4 + 0.5D).tex(1.0D, l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
                            worldrenderer.pos(l1 - d3 + 0.5D, l2, k1 - d4 + 0.5D).tex(0.0D, l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
                        } else {
                            if (j1 != 1) {
                                if (j1 >= 0) {
                                    tessellator.draw();
                                }
                                j1 = 1;
                                mc.getTextureManager().bindTexture(this.snowTexture);
                                worldrenderer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
                            }
                            double d8 = ((this.rendererUpdateCount & 511) + partialTicks) / 512.0F;
                            double d9 = this.random.nextDouble() + f1 * 0.01D * (float) this.random.nextGaussian();
                            double d10 = this.random.nextDouble() + f1 * (float) this.random.nextGaussian() * 0.001D;
                            double d11 = l1 + 0.5F - entity.posX;
                            double d12 = k1 + 0.5F - entity.posZ;
                            float f6 = MathHelper.sqrt(d11 * d11 + d12 * d12) / i1;
                            float f5 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f;
                            blockpos$mutableblockpos.setPos(l1, i3, k1);
                            int i4 = (world.getCombinedLight(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4;
                            int j4 = i4 >> 16 & 65535;
                            int k4 = i4 & 65535;
                            worldrenderer.pos(l1 - d3 + 0.5D, k2, k1 - d4 + 0.5D).tex(0.0D + d9, k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
                            worldrenderer.pos(l1 + d3 + 0.5D, k2, k1 + d4 + 0.5D).tex(1.0D + d9, k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
                            worldrenderer.pos(l1 + d3 + 0.5D, l2, k1 + d4 + 0.5D).tex(1.0D + d9, l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
                            worldrenderer.pos(l1 - d3 + 0.5D, l2, k1 - d4 + 0.5D).tex(0.0D + d9, l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
                        }
                    }
                }
            }
        }
        if (j1 >= 0) {
            tessellator.draw();
        }
        worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
        GlStateManager.enableCull();
        GlStateManager.disableBlend();
        GlStateManager.alphaFunc(516, 0.1F);
        mc.entityRenderer.disableLightmap();
    }
}
Also used : Entity(net.minecraft.entity.Entity) Tessellator(net.minecraft.client.renderer.Tessellator) Biome(net.minecraft.world.biome.Biome) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World)

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