Search in sources :

Example 1 with InfinityParticle

use of crazypants.enderio.base.render.ranged.InfinityParticle in project EnderIO by SleepyTrousers.

the class BlockInfinity method randomDisplayTick.

@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rnd) {
    int count = world.canBlockSeeSky(pos) ? 1 : 3;
    for (int i = 0; i < count; i++) {
        float offsetX = (.25f + .5f * rnd.nextFloat());
        float offsetY = (.25f + .5f * rnd.nextFloat());
        float offsetZ = (.25f + .5f * rnd.nextFloat());
        float maxSize = Math.min(Math.min(Math.min(1f - offsetX, offsetX), Math.min(1f - offsetY, offsetY)), Math.min(1f - offsetZ, offsetZ)) * (.5f + .5f * rnd.nextFloat()) * 2;
        float color = (i == 0 && !bs.getValue(HARMLESS) && count > 1) ? 0 : rnd.nextFloat();
        Minecraft.getMinecraft().effectRenderer.addEffect(new InfinityParticle(world, pos, new Vector4f(color, color, color, 0.4f), new Vector4f(offsetX, offsetY, offsetZ, maxSize)));
    }
}
Also used : Vector4f(com.enderio.core.common.vecmath.Vector4f) InfinityParticle(crazypants.enderio.base.render.ranged.InfinityParticle) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

Vector4f (com.enderio.core.common.vecmath.Vector4f)1 InfinityParticle (crazypants.enderio.base.render.ranged.InfinityParticle)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1