Search in sources :

Example 6 with Color

use of org.blockartistry.lib.Color in project DynamicSurroundings by OreCruncher.

the class MoteWaterSpray method configureColor.

@Override
public void configureColor() {
    final Color waterColor = BiomeUtils.getColorForLiquid(this.world, this.position);
    this.red = waterColor.red;
    this.green = waterColor.green;
    this.blue = waterColor.blue;
    this.alpha = 1F;
}
Also used : Color(org.blockartistry.lib.Color)

Example 7 with Color

use of org.blockartistry.lib.Color in project DynamicSurroundings by OreCruncher.

the class AuroraClassic method render.

@Override
public void render(final float partialTick) {
    final float alpha = getAlpha();
    final Tessellator tess = Tessellator.getInstance();
    final BufferBuilder renderer = tess.getBuffer();
    final double tranY = getTranslationY(partialTick);
    final double tranX = getTranslationX(partialTick);
    final double tranZ = getTranslationZ(partialTick);
    final Color base = getBaseColor();
    final Color fade = getFadeColor();
    final double zero = 0.0D;
    final OpenGlState glState = OpenGlState.push();
    GlStateManager.translate(tranX, tranY, tranZ);
    GlStateManager.scale(0.5D, 8.0D, 0.5D);
    GlStateManager.disableLighting();
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.disableTexture2D();
    GlStateManager.shadeModel(GL11.GL_SMOOTH);
    GlStateManager.disableAlpha();
    GlStateManager.disableCull();
    GlStateManager.depthMask(false);
    renderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR);
    for (int b = 0; b < this.bands.length; b++) {
        this.bands[b].translate(partialTick);
        final Node[] array = this.bands[b].getNodeList();
        for (int i = 0; i < array.length - 1; i++) {
            final Node node = array[i];
            final double posY = node.getModdedY();
            final double posX = node.tetX;
            final double posZ = node.tetZ;
            final double tetX = node.tetX2;
            final double tetZ = node.tetZ2;
            final double posX2;
            final double posZ2;
            final double tetX2;
            final double tetZ2;
            final double posY2;
            if (i < array.length - 2) {
                final Node nodePlus = array[i + 1];
                posX2 = nodePlus.tetX;
                posZ2 = nodePlus.tetZ;
                tetX2 = nodePlus.tetX2;
                tetZ2 = nodePlus.tetZ2;
                posY2 = nodePlus.getModdedY();
            } else {
                posX2 = tetX2 = node.posX;
                posZ2 = tetZ2 = node.getModdedZ();
                posY2 = 0.0D;
            }
            // Front
            renderer.pos(posX, zero, posZ).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(posX, posY, posZ).color(fade.red, fade.green, fade.blue, 0).endVertex();
            renderer.pos(posX2, posY2, posZ2).color(fade.red, fade.green, fade.blue, 0).endVertex();
            renderer.pos(posX2, posY2, posZ2).color(fade.red, fade.green, fade.blue, 0).endVertex();
            renderer.pos(posX2, zero, posZ2).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(posX, zero, posZ).color(base.red, base.green, base.blue, alpha).endVertex();
            // Bottom
            renderer.pos(posX, zero, posZ).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(posX2, zero, posZ2).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(tetX2, zero, tetZ2).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(tetX2, zero, tetZ2).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(tetX, zero, tetZ).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(posX, zero, posZ).color(base.red, base.green, base.blue, alpha).endVertex();
            // Back
            renderer.pos(tetX, zero, tetZ).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(tetX, posY, tetZ).color(fade.red, fade.green, fade.blue, 0).endVertex();
            renderer.pos(tetX2, posY2, tetZ2).color(fade.red, fade.green, fade.blue, 0).endVertex();
            renderer.pos(tetX2, posY2, tetZ2).color(fade.red, fade.green, fade.blue, 0).endVertex();
            renderer.pos(tetX2, zero, tetZ2).color(base.red, base.green, base.blue, alpha).endVertex();
            renderer.pos(tetX, zero, tetZ).color(base.red, base.green, base.blue, alpha).endVertex();
        }
    }
    tess.draw();
    OpenGlState.pop(glState);
}
Also used : OpenGlState(org.blockartistry.lib.gfx.OpenGlState) Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) Color(org.blockartistry.lib.Color)

Example 8 with Color

use of org.blockartistry.lib.Color in project DynamicSurroundings by OreCruncher.

the class BiomeInfo method update.

// Internal to the package
void update(@Nonnull final BiomeConfig entry) {
    addComment(entry.comment);
    if (entry.hasPrecipitation != null)
        setHasPrecipitation(entry.hasPrecipitation.booleanValue());
    if (entry.hasAurora != null)
        setHasAurora(entry.hasAurora.booleanValue());
    if (entry.hasDust != null)
        setHasDust(entry.hasDust.booleanValue());
    if (entry.hasFog != null)
        setHasFog(entry.hasFog.booleanValue());
    if (entry.fogDensity != null)
        setFogDensity(entry.fogDensity.floatValue());
    if (entry.fogColor != null) {
        final int[] rgb = MyUtils.splitToInts(entry.fogColor, ',');
        if (rgb.length == 3)
            setFogColor(new Color(rgb[0], rgb[1], rgb[2]));
    }
    if (entry.dustColor != null) {
        final int[] rgb = MyUtils.splitToInts(entry.dustColor, ',');
        if (rgb.length == 3)
            setDustColor(new Color(rgb[0], rgb[1], rgb[2]));
    }
    if (entry.soundReset != null && entry.soundReset.booleanValue()) {
        addComment("> Sound Reset");
        resetSounds();
    }
    if (entry.spotSoundChance != null)
        setSpotSoundChance(entry.spotSoundChance.intValue());
    for (final SoundConfig sr : entry.sounds) {
        if (ClientRegistry.SOUND.isSoundBlocked(sr.sound))
            continue;
        final SoundEffect.Builder b = new SoundEffect.Builder(sr);
        final SoundEffect s = b.build();
        if (s.getSoundType() == SoundType.SPOT)
            addSpotSound(s);
        else
            addSound(s);
    }
}
Also used : SoundEffect(org.blockartistry.DynSurround.client.sound.SoundEffect) Color(org.blockartistry.lib.Color) SoundConfig(org.blockartistry.DynSurround.data.xface.SoundConfig)

Aggregations

Color (org.blockartistry.lib.Color)8 World (net.minecraft.world.World)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)2 BlockPos (net.minecraft.util.math.BlockPos)2 BiomeInfo (org.blockartistry.DynSurround.registry.BiomeInfo)2 IBlockAccessEx (org.blockartistry.lib.chunk.IBlockAccessEx)2 Nonnull (javax.annotation.Nonnull)1 Material (net.minecraft.block.material.Material)1 IBlockState (net.minecraft.block.state.IBlockState)1 Minecraft (net.minecraft.client.Minecraft)1 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)1 Tessellator (net.minecraft.client.renderer.Tessellator)1 GameSettings (net.minecraft.client.settings.GameSettings)1 Entity (net.minecraft.entity.Entity)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vec3d (net.minecraft.util.math.Vec3d)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 ParticleTextPopOff (org.blockartistry.DynSurround.client.fx.particle.ParticleTextPopOff)1