Search in sources :

Example 6 with PacketGetDimensionEnergy

use of mcjty.rftoolsdim.network.PacketGetDimensionEnergy in project RFToolsDimensions by McJty.

the class GenericWorldProvider method getSkyColor.

@Override
@SideOnly(Side.CLIENT)
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) {
    int dim = worldObj.provider.getDimensionId();
    if (System.currentTimeMillis() - lastTime > 1000) {
        lastTime = System.currentTimeMillis();
        RFToolsDimMessages.INSTANCE.sendToServer(new PacketGetDimensionEnergy(dim));
    }
    float factor = calculatePowerBlackout(dim);
    getDimensionInformation();
    float r;
    float g;
    float b;
    if (dimensionInformation == null) {
        r = g = b = 1.0f;
    } else {
        r = dimensionInformation.getSkyDescriptor().getSkyColorFactorR() * factor;
        g = dimensionInformation.getSkyDescriptor().getSkyColorFactorG() * factor;
        b = dimensionInformation.getSkyDescriptor().getSkyColorFactorB() * factor;
    }
    Vec3 skyColor = super.getSkyColor(cameraEntity, partialTicks);
    return new Vec3(skyColor.xCoord * r, skyColor.yCoord * g, skyColor.zCoord * b);
}
Also used : Vec3(net.minecraft.util.Vec3) PacketGetDimensionEnergy(mcjty.rftoolsdim.network.PacketGetDimensionEnergy) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 7 with PacketGetDimensionEnergy

use of mcjty.rftoolsdim.network.PacketGetDimensionEnergy in project RFToolsDimensions by McJty.

the class GenericWorldProvider method getFogColor.

@Override
@SideOnly(Side.CLIENT)
public Vec3 getFogColor(float angle, float dt) {
    int dim = worldObj.provider.getDimensionId();
    if (System.currentTimeMillis() - lastFogTime > 1000) {
        lastFogTime = System.currentTimeMillis();
        RFToolsDimMessages.INSTANCE.sendToServer(new PacketGetDimensionEnergy(dim));
    }
    float factor = calculatePowerBlackout(dim);
    getDimensionInformation();
    float r;
    float g;
    float b;
    if (dimensionInformation == null) {
        r = g = b = 1.0f;
    } else {
        r = dimensionInformation.getSkyDescriptor().getFogColorFactorR() * factor;
        g = dimensionInformation.getSkyDescriptor().getFogColorFactorG() * factor;
        b = dimensionInformation.getSkyDescriptor().getFogColorFactorB() * factor;
    }
    Vec3 color = super.getFogColor(angle, dt);
    return new Vec3(color.xCoord * r, color.yCoord * g, color.zCoord * b);
}
Also used : Vec3(net.minecraft.util.Vec3) PacketGetDimensionEnergy(mcjty.rftoolsdim.network.PacketGetDimensionEnergy) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

PacketGetDimensionEnergy (mcjty.rftoolsdim.network.PacketGetDimensionEnergy)7 DimensionInformation (mcjty.rftoolsdim.dimensions.DimensionInformation)5 DimensionStorage (mcjty.rftoolsdim.dimensions.DimensionStorage)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 RfToolsDimensionManager (mcjty.rftoolsdim.dimensions.RfToolsDimensionManager)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 Vec3 (net.minecraft.util.Vec3)2